浏览代码

fix: 政策货品信息调整

zh 2 年之前
父节点
当前提交
41b726fb0b
共有 2 个文件被更改,包括 46 次插入2 次删除
  1. 23 1
      src/views/sales_policy/components/AddPolicy.vue
  2. 23 1
      src/views/sales_policy/components/editPolicy.vue

+ 23 - 1
src/views/sales_policy/components/AddPolicy.vue

@@ -614,7 +614,9 @@ export default {
       dcurrentPage: 1,
       fullscreenLoading: false,
       priceList: [],
-      priceList2: []
+      priceList2: [],
+      importRebate: {},
+      importWallet: {}
     }
   },
   computed: {
@@ -653,6 +655,8 @@ export default {
         if (name === 'priceType') {
           this.NoRebateWalletList2 = []
           this.rebateList2 = []
+          const rebateListId = []
+          const NoRebateWalletListId = []
           this.priceList.forEach(k => {
             if (k.priceTypeId === e) {
               this.NoRebateWalletList2.push(
@@ -665,8 +669,16 @@ export default {
                 walletRebateId: k.walletId2,
                 name: k.walletName2
               })
+              NoRebateWalletListId.push(k.walletId)
+              rebateListId.push(k.walletId2)
             }
           })
+          if (NoRebateWalletListId.length && !~NoRebateWalletListId.indexOf(this.importWallet.walletId)) {
+            this.importWallet.walletId && this.NoRebateWalletList2.push(this.importWallet)
+          }
+          if (rebateListId.length && !~rebateListId.indexOf(this.importRebate.walletRebateId)) {
+            this.importRebate.walletRebateId && this.rebateList2.push(this.importRebate)
+          }
           const item = this.priceList.find(k => k.priceTypeId === e)
           this.dataList[index][name] = item.priceTypeName
           this.$set(row, 'walletIds', [])
@@ -1183,16 +1195,26 @@ export default {
             row.walletIds.forEach(k => {
               if (!~NoRebateWalletListId.indexOf(k)) {
                 const item = this.NoRebateWalletList.find(e => e.id === k)
+                this.importWallet = item
                 this.NoRebateWalletList2.push(item)
               }
+              if (~NoRebateWalletListId.indexOf(k)) {
+                const item = this.NoRebateWalletList.find(e => e.id === k)
+                this.importWallet = item
+              }
             })
           }
           if (row.rebateWalletIds && row.rebateWalletIds.length) {
             row.rebateWalletIds.forEach(k => {
               if (!~rebateListId.indexOf(k)) {
                 const item = this.rebateList.find(e => e.walletRebateId === k)
+                this.importRebate = item
                 this.rebateList2.push(item)
               }
+              if (~rebateListId.indexOf(k)) {
+                const item = this.rebateList.find(e => e.walletRebateId === k)
+                this.importRebate = item
+              }
             })
           }
         })

+ 23 - 1
src/views/sales_policy/components/editPolicy.vue

@@ -673,7 +673,9 @@ export default {
       fullscreenLoading: false,
       srcList: [],
       priceList: [],
-      priceList2: []
+      priceList2: [],
+      importRebate: {},
+      importWallet: {}
     }
   },
   computed: {
@@ -701,6 +703,8 @@ export default {
           const item = this.priceList.find(k => k.priceTypeId === e)
           this.NoRebateWalletList2 = []
           this.rebateList2 = []
+          const rebateListId = []
+          const NoRebateWalletListId = []
           this.priceList.forEach(k => {
             if (k.priceTypeId === e) {
               this.NoRebateWalletList2.push(
@@ -713,8 +717,16 @@ export default {
                 walletRebateId: k.walletId2,
                 name: k.walletName2
               })
+              NoRebateWalletListId.push(k.walletId)
+              rebateListId.push(k.walletId2)
             }
           })
+          if (NoRebateWalletListId.length && !~NoRebateWalletListId.indexOf(this.importWallet.walletId)) {
+            this.importWallet.walletId && this.NoRebateWalletList2.push(this.importWallet)
+          }
+          if (rebateListId.length && !~rebateListId.indexOf(this.importRebate.walletRebateId)) {
+            this.importRebate.walletRebateId && this.rebateList2.push(this.importRebate)
+          }
           this.dataList[index][name] = item.priceTypeName
           this.$set(row, 'walletIds', [])
           if (item.walletId) {
@@ -1277,16 +1289,26 @@ export default {
             row.walletIds.forEach(k => {
               if (!~NoRebateWalletListId.indexOf(k)) {
                 const item = this.NoRebateWalletList.find(e => e.id === k)
+                this.importWallet = item
                 this.NoRebateWalletList2.push(item)
               }
+              if (~NoRebateWalletListId.indexOf(k)) {
+                const item = this.NoRebateWalletList.find(e => e.id === k)
+                this.importWallet = item
+              }
             })
           }
           if (row.rebateWalletIds && row.rebateWalletIds.length) {
             row.rebateWalletIds.forEach(k => {
               if (!~rebateListId.indexOf(k)) {
                 const item = this.rebateList.find(e => e.walletRebateId === k)
+                this.importRebate = item
                 this.rebateList2.push(item)
               }
+              if (~rebateListId.indexOf(k)) {
+                const item = this.rebateList.find(e => e.walletRebateId === k)
+                this.importRebate = item
+              }
             })
           }
         })