Browse Source

政策订单

howie 3 năm trước cách đây
mục cha
commit
86fca0712d

+ 28 - 34
src/views/sales_policy/components/AddCondition.vue

@@ -451,6 +451,7 @@ export default {
       saleTypeCode: "",
       arrIndex: 0,
       popArr: {},
+      fang: false,
     };
   },
   created() {
@@ -566,46 +567,39 @@ export default {
           }
         }
       }
-      console.log(index, this.arrIndex);
     },
     getMaterialLists(index) {
-
       this.arrIndex = index;
-      getMaterialList({
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        saleTypeCode: this.saleTypeCode,
-        policyId: this.comCode,
-      }).then((res) => {
-        let arr = []
-        let datas = []
-
-                       for (let i = 0; i < res.data.records.length; i++) {
-                          for (let j = 0; j < this.conditionBox.length; j++) {
-
-                                datas = [...datas,...this.conditionBox[j]]
-                                if (datas.length) {
-                                   for (let k = 0; k < datas.length; k++) {
-                                    if (datas[k].id !== res.data.records[i].id) {
-                                        arr.push(res.data.records[i])
-                                    }
-
-                                }
-                                }else{
-                                  arr = res.data.records
-                                }
-
-
-                          }
-
-
-                       }
+      if (!this.fang) {
+        getMaterialList({
+          pageNum: this.currentPage,
+          pageSize: this.pageSize,
+          saleTypeCode: this.saleTypeCode,
+          policyId: this.comCode,
+        }).then((res) => {
+          this.conditList = res.data.records;
+          this.listTotal = res.data.total;
+          this.fang = true;
+        });
+      } else {
+        console.log('fang');
 
+        let datas = [];
 
+      for (let j = 0; j < this.conditionBox.length; j++) {
+            datas = [...datas, ...this.conditionBox[j]];
+        }
+        for (let i = 0; i < this.conditList.length; i++) {
+           if (datas.length) {
+              for (let k = 0; k < datas.length; k++) {
+                if (datas[k].id == this.conditList[i].id) {
+                  this.conditList.splice(i,1)
+                }
+              }
+          }
+        }
 
-        this.conditList = arr;
-        this.listTotal = res.data.total;
-      });
+      }
     },
     handleSelectionAllChange(e) {
       this.leftData = e;

+ 35 - 4
src/views/supply/policy/components/retail_form.vue

@@ -749,7 +749,6 @@ export default {
       currentPage: 1, // 当前页码
       pageSize: 10, // 每页数量
       listTotal: 0, // 列表总数
-
       cusIndex: 0,
       radio: "",
       pop: "",
@@ -879,13 +878,15 @@ export default {
     this.getDictList();
     this.getWalletList();
     this.getWarehouseList();
-    this.getPolicyList();
+
     this.getTypeList();
     if (this.listItem) {
       this.getDetail();
     }
   },
+  beforeUpdate() {
 
+  },
   methods: {
     // 返回列表
     goBack() {
@@ -973,6 +974,7 @@ export default {
     },
     handleShow() {
       this.isShowDialog = true;
+      this.getPolicyList()
     },
     // 获取钱包列表
     getWalletList() {
@@ -1160,12 +1162,15 @@ export default {
       this.getConditionList(params[3], this.step);
     },
     getConditionList(policyConditionId, popType) {
+      let arr = []
       getConditionList({
         pageNum: this.currentPage,
         pageSize: this.pageSize,
         policyConditionId,
         popType,
       }).then((res) => {
+        console.log(this.cusIndex);
+         const datas = res.data.records
         for (let i = 0; i < res.data.records.length; i++) {
           res.data.records[i].qty = 1;
         }
@@ -1175,8 +1180,34 @@ export default {
         if (this.cusIndex == 0) {
           this.popDataArr = [];
         }
-        this.popDataArr.push(res.data.records);
-        // console.log(this.popDataArr, "[]", this.radioObj);
+
+        if (this.cusIndex == 1) {
+          for (let l = 0; l < this.dataList.length; l++) {
+
+              for (let k = 0; k < datas.length; k++) {
+                            console.log(this.dataList[l].id == datas[k].id,'hahah',datas,this.dataList);
+                      if (this.dataList[l].id == datas[k].id) {
+                          datas.splice(k,1)
+                      }
+              }
+          }
+           this.popDataArr.push(datas);
+        }else{
+
+          for (let j = 0; j <  this.popDataArr[this.cusIndex-1].length; j++) {
+             for (let k = 0; k < datas.length; k++) {
+
+                      if (this.dataList[l].id == datas[k].id) {
+                            datas.splice(k,1)
+                      }
+              }
+
+          }
+          this.popDataArr.push(datas);
+        }
+
+        // this.popDataArr.push(res.data.records);
+
       });
     },
     hanlePopData() {