浏览代码

fix:销售政策添加货品缺rebateWalletIds:[]

zh 2 年之前
父节点
当前提交
a084e72c5a
共有 2 个文件被更改,包括 29 次插入9 次删除
  1. 10 3
      src/views/sales_policy/components/AddPolicy.vue
  2. 19 6
      src/views/sales_policy/components/editPolicy.vue

+ 10 - 3
src/views/sales_policy/components/AddPolicy.vue

@@ -118,7 +118,7 @@
           <pl-table
             v-loading="listLoading"
             :data="dataList"
-            row-key="id"
+            row-key="index"
             use-virtual
             fixedColumnsRoll
             :dataChangesScrollTop="false"
@@ -485,6 +485,7 @@ import TabelTransfer from './TabelTransfer'
 import AddCondition from './AddCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
 import { PlTable, PlTableColumn } from 'pl-table'
+import { nextTick } from 'process'
 
 export default {
   directives: {
@@ -928,7 +929,7 @@ export default {
     },
     handleNewInfo() {
       // 物料列表
-
+    this.$nextTick(()=>{
       this.dataList.push({
         id: '',
         discAmount: 0,
@@ -944,9 +945,12 @@ export default {
         specification: '',
         rebateWalletIds: [],
         walletIds: [this.NoRebateWalletList[0].id],
-        walletRelaList: []
+        walletRelaList: [],
+        
       })
       this.sleectBox.currentPage = 1
+    })
+     
       // this.listTotal += 1;
       // this.dataList.push(this.addList[this.addList.length-1])
     },
@@ -985,6 +989,9 @@ export default {
         this.$successMsg('保存成功')
 
         this.handletwoList()
+      }).finally(()=>{
+        this.fullscreenLoading = false
+
       })
     },
     handleK3List(e, row, index, name) {

+ 19 - 6
src/views/sales_policy/components/editPolicy.vue

@@ -121,7 +121,7 @@
             <pl-table
               v-loading="listLoading"
               :data="dataList"
-              row-key="id"
+              row-key="index"
               use-virtual
               fixedColumnsRoll
               :dataChangesScrollTop="false"
@@ -201,7 +201,7 @@
                     filterable
                     @change="handleSalesType($event, scope.row, scope.$index, 'saleTypeId')"
                   >
-                    <el-option v-for="item in typeList" :key="item.id" :label="item.saleName" :value="item.id" />
+                    <el-option v-for="(item,index) in typeList" :key="index" :label="item.saleName" :value="item.id" />
                   </el-select>
                 </template>
               </pl-table-column>
@@ -708,10 +708,13 @@ export default {
 
       this.typeList = typeData.data.records
     },
-    handleSalesType(e, row, index, name) {
-      const item = this.typeList.filter(k => {
+    handleSalesType(e, row, index, name) { 
+      let item
+      try {
+        item= this.typeList.filter(k => {
         return k.id === e
       })[0]
+  
       const linshi = []
       const rebateList = []
       this.rebateList.forEach(k => {
@@ -722,10 +725,14 @@ export default {
           }
         })
       })
+
       if (rebateList.length) {
         this.dataList[index].rebateWalletIds = [...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId])]
         this.$set(row, 'rebateWalletIds', [...new Set([...row.rebateWalletIds, rebateList[0].walletRebateId])])
       }
+      } catch (error) {
+        console.log(error);
+      }
       this.dataList[index][name] = row[name]
       this.dataList[index].saleTypeCode = item.saleCode
       this.dataList[index].saleTypeName = item.saleName
@@ -977,7 +984,8 @@ export default {
     handleNewInfo() {
       // 物料列表
 
-      this.dataList.push({
+      this.$nextTick(()=>{
+        this.dataList.push({
         id: '',
         discAmount: '',
         materialId: '',
@@ -991,9 +999,11 @@ export default {
         saleTypeName: '',
         specification: '',
         walletIds: [this.NoRebateWalletList[0].id],
-        walletRelaList: []
+        walletRelaList: [],
+        rebateWalletIds:[]
       })
       this.sleectBox.currentPage = 1
+      })
       // this.listTotal += 1;
       // this.dataList.push(this.addList[this.addList.length-1])
     },
@@ -1031,6 +1041,9 @@ export default {
 
         this.$successMsg('保存成功')
         this.handletwoList()
+      }).finally(()=>{
+        this.fullscreenLoading = false
+
       })
     },
     handleK3List(e, row, index, name) {