YY před 2 roky
rodič
revize
c8577854e5
1 změnil soubory, kde provedl 37 přidání a 2 odebrání
  1. 37 2
      src/views/selfShop/goods/spec.vue

+ 37 - 2
src/views/selfShop/goods/spec.vue

@@ -28,6 +28,9 @@
             <template #status>
               <el-option v-for="i in statusList" :key="i.model" :label="i.label" :value="i.value"></el-option>
             </template>
+            <template #can_group>
+              <el-option v-for="i in tfList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </template>
           </data-form>
         </el-col>
       </el-row>
@@ -56,6 +59,17 @@ export default {
         { label: '划掉销售价格', model: 'flow_money' },
         { label: '运费', model: 'freight' },
         { label: '状态', model: 'status', format: (i) => (i === '0' ? '使用中' : '已禁用') },
+        {
+          label: '是否可以团购',
+          model: 'can_group',
+          format: (i) => {
+            let data = this.tfList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        { label: '团购金额', model: 'group_config.money' },
+        { label: '团购金额', model: 'group_config.need_person' },
       ],
       opera: [
         { label: '修改', method: 'edit' },
@@ -78,11 +92,16 @@ export default {
         { label: '划掉销售价格', model: 'flow_money', type: 'number' },
         { label: '运费', model: 'freight', type: 'number' },
         { label: '状态', model: 'status', type: 'select' },
+        { label: '是否可以团购', model: 'can_group', type: 'select' },
+        { label: '团购金额', model: 'money', type: 'number' },
+        { label: '团购金额', model: 'need_person', type: 'number' },
       ],
       rules: {},
       form: {},
 
       statusList: [],
+      // 是否可以团购
+      tfList: [],
     };
   },
   computed: {
@@ -104,13 +123,29 @@ export default {
       const obj = { goods: this.goods, status: '0' };
       this.$set(this, 'form', obj);
     },
-
+    async toSave({ data }) {
+      let group_config = {};
+      group_config.money = data.money;
+      group_config.need_person = data.need_person;
+      data.group_config = group_config;
+      let res;
+      if (data.id) res = await this.update(data);
+      else res = await this.create(data);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `维护信息成功` });
+        this.toBack();
+      }
+    },
     toBack() {
-      this.$router.push('/selfShop/goods');
+      window.history.go('-1');
     },
     async searchOthers() {
+      // 状态
       let res = await this.getDict({ code: 'status' });
       if (this.$checkRes(res)) this.$set(this, 'statusList', res.data);
+      // 是否可以团购
+      res = await this.getDict({ code: 'tf' });
+      if (this.$checkRes(res)) this.$set(this, 'tfList', res.data);
     },
   },
   metaInfo() {