YY hace 2 años
padre
commit
3d19fa78c3
Se han modificado 2 ficheros con 26 adiciones y 9 borrados
  1. 6 6
      src/views/platActivi/coupon/detail.vue
  2. 20 3
      src/views/platmanag/goods/index.vue

+ 6 - 6
src/views/platActivi/coupon/detail.vue

@@ -213,12 +213,12 @@ export default {
           data.tags = _.get(data, 'use_limit_config.tags');
           data.time = _.get(data, 'expire_config.fixed[0]');
           data.days = _.get(data, 'expire_config.days');
-          // if (data.shop) {
-          //   let res = await this.shopFetch(data.shop);
-          //   if (this.$checkRes(res)) {
-          //     data.shop = res.data.name;
-          //   }
-          // }
+          if (data.shop) {
+            let res = await this.shopFetch(data.shop);
+            if (this.$checkRes(res)) {
+              this.shopList.push(res.data);
+            }
+          }
           this.$set(this, `form`, data);
         }
       } else {

+ 20 - 3
src/views/platmanag/goods/index.vue

@@ -99,7 +99,7 @@ export default {
       limit: 10,
       // info部分
       infoFields: [
-        { label: '铺名称', model: 'shop', custom: true },
+        { label: '铺名称', model: 'shop', custom: true },
         { label: '商品名称', model: 'name' },
         { label: '商品分类', model: 'tags', custom: true },
         { label: '活动标签', model: 'act_tags', type: 'selectMany' },
@@ -113,7 +113,9 @@ export default {
         { label: '商品介绍', model: 'brief', custom: true },
       ],
 
-      rules: {},
+      rules: {
+        shop: [{ required: true, message: '请选择商铺名称', trigger: 'change' }],
+      },
       form: {},
       // 商品分类
       tagsList: [],
@@ -149,6 +151,22 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    // 去编辑
+    async toEdit({ data }) {
+      const res = await this.fetch(data._id);
+      if (this.$checkRes(res)) {
+        if (data.shop) {
+          let res = await this.shopFetch(data.shop._id);
+          if (this.$checkRes(res)) {
+            this.shopList.push(res.data);
+          }
+        }
+        this.$set(this, `form`, res.data);
+        this.view = 'info';
+      } else {
+        this.$message.error('未找到指定数据');
+      }
+    },
     // 多选
     handleSelect(data) {
       this.$emit('handleSelect');
@@ -177,7 +195,6 @@ export default {
     initAddData() {
       const obj = {
         status: '1',
-        shop: _.get(this.shop, '_id'),
       };
       this.$set(this, 'form', obj);
     },