|
@@ -19,7 +19,6 @@
|
|
|
@puton="toPuton"
|
|
|
@lower="toLower"
|
|
|
@delete="toDelete"
|
|
|
- @copy="toCopy"
|
|
|
></data-table>
|
|
|
</template>
|
|
|
<template v-else>
|
|
@@ -60,13 +59,13 @@ export default {
|
|
|
{ label: '排序', model: 'sort' },
|
|
|
{ label: '商品名称', model: 'name' },
|
|
|
{ label: '店铺名称', model: 'shop.name' },
|
|
|
+ { label: '商品库存', model: 'num' },
|
|
|
{ label: '商品状态', model: 'status', format: (i) => this.getStatus(i) },
|
|
|
],
|
|
|
opera: [
|
|
|
{ label: '修改', method: 'edit' },
|
|
|
{ label: '上架', method: 'puton', display: (i) => i.status == '0' },
|
|
|
{ label: '下架', method: 'lower', display: (i) => i.status == '1' },
|
|
|
- { label: '复制', method: 'copy' },
|
|
|
{ label: '删除', method: 'delete', confirm: true, type: 'danger' },
|
|
|
],
|
|
|
btnList: [{ label: '添加', method: 'add' }],
|
|
@@ -84,8 +83,7 @@ export default {
|
|
|
{ label: '简短简介', model: 'shot_brief', maxLength: 50 },
|
|
|
{ label: '预计发货时间', model: 'send_time' },
|
|
|
{ label: '商品状态', model: 'status', type: 'select' },
|
|
|
- { label: '商品来源', model: 'source' },
|
|
|
- { label: '网址', model: 'url' },
|
|
|
+ { label: '商品库存', model: 'num', type: 'number' },
|
|
|
{ label: '排序', model: 'sort', type: 'number' },
|
|
|
{ label: '消耗尊荣', model: 'cost', type: 'number' },
|
|
|
{ label: '商品图片', model: 'file', type: 'upload', url: '/files/point/zrGoods/upload' },
|
|
@@ -107,13 +105,18 @@ export default {
|
|
|
...methodsUtil,
|
|
|
// 查询
|
|
|
async search({ skip = 0, limit = this.limit, ...others } = {}) {
|
|
|
- // let query = { skip, limit, ...others, shop: this.user.shop.id };
|
|
|
- // if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
|
|
|
- // const res = await this.query(query);
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- // this.$set(this, `list`, res.data);
|
|
|
- // this.$set(this, `total`, res.total);
|
|
|
- // }
|
|
|
+ if (this.user.role.code == 'sadmin') {
|
|
|
+ others.shop = '';
|
|
|
+ } else {
|
|
|
+ others.shop = this.user.shop.id;
|
|
|
+ }
|
|
|
+ let query = { skip, limit, ...others };
|
|
|
+ if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
|
|
|
+ const res = await this.query(query);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
},
|
|
|
// 添加自定义
|
|
|
initAddData() {
|
|
@@ -123,22 +126,6 @@ export default {
|
|
|
};
|
|
|
this.$set(this, 'form', obj);
|
|
|
},
|
|
|
- // 复制
|
|
|
- async toCopy({ data }) {
|
|
|
- this.$confirm('是否确认复制该商品?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(async () => {
|
|
|
- let res;
|
|
|
- res = await this.copy(data.id);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message({ type: `success`, message: `复制成功` });
|
|
|
- this.toBack();
|
|
|
- this.search();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
// 查询其他信息
|
|
|
async searchOthers() {
|
|
|
let res;
|