Explorar el Código

feat: 选择活动类型判断

Damon hace 11 meses
padre
commit
bb747b1090
Se han modificado 2 ficheros con 51 adiciones y 27 borrados
  1. 38 21
      src/views/operation/activity/detail.vue
  2. 13 6
      src/views/operation/activity/index.vue

+ 38 - 21
src/views/operation/activity/detail.vue

@@ -12,8 +12,6 @@
         <el-input v-model="form.name" placeholder="请输入活动名称" />
       </el-form-item>
 
-      <!-- :prop="`deviceRespList.${scope.$index}.indate`"
-      :rules="{ required: true, trigger: 'change' }" -->
       <el-form-item label="活动类型:">
         <el-select
           v-model="form.platformName"
@@ -85,14 +83,16 @@
               </el-form-item>
             </template>
           </el-table-column>
+
+          {{ this.form }}
           <el-table-column label="活动权益" align="center">
             <template slot-scope="scope">
               <el-form-item
-                :prop="`deviceRespList.${scope.$index}.indate`"
+                :prop="`deviceRespList.${scope.$index}.goodId`"
                 :rules="{ required: true, trigger: 'change' }"
               >
                 <el-select
-                  v-model="scope.row.indate"
+                  v-model="scope.row.goodId"
                   placeholder="请选择活动权益"
                   :disabled="disabledActivity"
                 >
@@ -161,6 +161,8 @@ export default {
   mixins: [serviceTimeMixin, devMixin],
   data() {
     return {
+      ///赠送流量权益列表
+      deviceEquities: [],
       // 表单
       form: {
         deviceRespList: [],
@@ -219,6 +221,27 @@ export default {
       },
       deep: true,
     },
+
+    "form.platformName": {
+      handler(val) {
+        console.log("gasdfasdfasdfaf==00==" + this.form.platformName);
+      },
+      deep: true,
+    },
+
+    "form.platformName": {
+      handler(val) {
+        console.log("gasdfasdfasdfaf==00==" + this.form.platformName);
+      },
+      deep: true,
+    },
+
+    "form.platformName": {
+      handler(val) {
+        console.log("gasdfasdfasdfaf==00==" + this.form.platformName);
+      },
+      deep: true,
+    },
   },
   mounted() {
     this.getDevList();
@@ -226,32 +249,26 @@ export default {
       this.getDetail();
     }
   },
+
   methods: {
     // 超级详情
     getGoodList() {
+      this.deviceEquities = [];
       var param = {
         deviceId: this.$route.query.id,
-        platformId: 0,
+        platformId: 1,
       };
       goodList(param).then((res) => {
-        
-        console.log("操作结果dasd发==aaa=" + JSON.stringify(res));
         if (res.code === 0) {
-          res.data.platformName =
-            res.data.platformId === 1
-              ? this.platformNames[1]
-              : this.platformNames[0];
-          this.form = res.data;
-          res.data.deviceRespList.map((i) => {
-            this.num.push(i.totalNum);
-          });
+          this.deviceEquities = res.data;
+          ///goodId  goodName
         }
       });
     },
+
     // 详情
     getDetail() {
       detail(this.$route.query.id).then((res) => {
-        console.log("操作结果dasd发==111=" + JSON.stringify(res));
         if (res.code === 0) {
           res.data.platformName =
             res.data.platformId === 1
@@ -272,7 +289,11 @@ export default {
 
     // 添加
     handlePush() {
-      this.form.deviceRespList.push({});
+      if (this.form.platformName != null) {
+        this.form.deviceRespList.push({});
+      } else {
+        this.$message.success("请先选择活动类型");
+      }
     },
 
     // 已生效的活动 设备数量不能修改的比之前小
@@ -312,10 +333,6 @@ export default {
         }
       });
     },
-
-    getPlatformIdName(platformId) {
-      return platformId === 1 ? "流量赠送" : "会员赠送";
-    },
   },
 };
 </script>

+ 13 - 6
src/views/operation/activity/index.vue

@@ -208,10 +208,10 @@
 
 <script>
 import {
-allNoDeleteList,
-change,
-doExchange,
-list,
+  allNoDeleteList,
+  change,
+  doExchange,
+  list,
 } from "@/api/operation/activity";
 import { currentMixin, devMixin, disabledMixin } from "@/mixin/index";
 export default {
@@ -236,6 +236,15 @@ export default {
       tableData: [],
     };
   },
+
+  watch: {
+    "form.deviceRespList": {
+      handler(val) {
+        console.log();
+      },
+      deep: true,
+    },
+  },
   mounted() {
     this.getList();
     this.getAllNoDeleteList();
@@ -266,7 +275,6 @@ export default {
         deviceId: deviceId,
       };
 
-      console.log("操作参数==" + JSON.stringify(param));
       doExchange(param).then((res) => {
         // 89860624650085884202
         console.log("操作结果=" + JSON.stringify(param));
@@ -300,7 +308,6 @@ export default {
     getList() {
       this.loading = true;
       list(this.form).then((res) => {
-        console.log("操作结果dasd发==00=" + JSON.stringify(res));
         if (res.code === 0) {
           this.tableData = res.data.records;
           this.total = res.data.total;