|
@@ -16,6 +16,8 @@
|
|
|
:limit="limit"
|
|
|
@query="search"
|
|
|
@edit="toEdit"
|
|
|
+ @puton="toPuton"
|
|
|
+ @lower="toLower"
|
|
|
@delete="toDelete"
|
|
|
@spec="toSpec"
|
|
|
></data-table>
|
|
@@ -70,6 +72,8 @@ export default {
|
|
|
],
|
|
|
opera: [
|
|
|
{ label: '修改', method: 'edit' },
|
|
|
+ { label: '上架', method: 'puton' },
|
|
|
+ { label: '下架', method: 'lower' },
|
|
|
{ label: '库存管理', method: 'spec' },
|
|
|
{ label: '删除', method: 'delete', confirm: true, type: 'danger' },
|
|
|
],
|
|
@@ -173,6 +177,39 @@ export default {
|
|
|
}
|
|
|
return arr.join(';');
|
|
|
},
|
|
|
+ // 上架
|
|
|
+ async toPuton({ data }) {
|
|
|
+ this.$confirm('是否确认上架该商品?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ data.status = '1';
|
|
|
+ let res;
|
|
|
+ if (data.id) res = await this.update(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({ type: `success`, message: `上架成功` });
|
|
|
+ }
|
|
|
+ this.search();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 下架
|
|
|
+ async toLower({ data }) {
|
|
|
+ this.$confirm('是否确认下架该商品?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ data.status = '0';
|
|
|
+ let res;
|
|
|
+ if (data._id) res = await this.update(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ console.log(res.data);
|
|
|
+ this.$message({ type: `success`, message: `下架成功` });
|
|
|
+ }
|
|
|
+ this.search();
|
|
|
+ });
|
|
|
+ },
|
|
|
toSpec({ data }) {
|
|
|
this.$router.push({ path: `/selfShop/spec/${data._id}` });
|
|
|
},
|