lilei 1 jaar geleden
bovenliggende
commit
0c4b125318

+ 0 - 2
src/api/salesDetailNew.js

@@ -172,8 +172,6 @@ export const insertBatchOfWaitDispatch = (params) => {
     })
     })
   }
   }
 
 
-
-
 // 缺货明细
 // 缺货明细
 export const salesStockoutDetail = (params) => {
 export const salesStockoutDetail = (params) => {
   const url = `/oos/detail/queryBySales`
   const url = `/oos/detail/queryBySales`

+ 1 - 1
src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue

@@ -89,7 +89,7 @@
             </template>
             </template>
             <span class="ellipsisText">{{ text }}</span>
             <span class="ellipsisText">{{ text }}</span>
           </a-tooltip>
           </a-tooltip>
-          <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.isJoinActivityProduct == 1"></a-badge>
+          <!-- <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.isJoinActivityProduct == 1"></a-badge> -->
         </div>
         </div>
       </template>
       </template>
       <!-- 操作 -->
       <!-- 操作 -->

+ 1 - 1
src/views/salesManagement/salesQueryNew/comps/chooseProduct.vue

@@ -82,8 +82,8 @@ export default {
     //  重定义的弹框状态
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
     isShow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
+        this.$emit('close',this.cptype)
         this.cptype = 3
         this.cptype = 3
-        this.$emit('close')
       }
       }
     }
     }
   }
   }

+ 4 - 3
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -157,6 +157,7 @@
       :data="loadData"
       :data="loadData"
       :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.promotionFlag == 'GIFT'&&!!record.salesPromoDetailParentSn } }) }"
       :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.promotionFlag == 'GIFT'&&!!record.salesPromoDetailParentSn } }) }"
       @rowSelection="rowSelectionFun"
       @rowSelection="rowSelectionFun"
+      :defaultLoadData="false"
       :pageSize="10"
       :pageSize="10"
       bordered>
       bordered>
       <!-- 产品编码 -->
       <!-- 产品编码 -->
@@ -378,9 +379,9 @@
                   data.list[i].unitQtyV = data.list[i].packQty&&data.list[i].unitQty ? ((data.list[i].packQty*data.list[i].unitQty) + data.list[i].productUnit) : '--'
                   data.list[i].unitQtyV = data.list[i].packQty&&data.list[i].unitQty ? ((data.list[i].packQty*data.list[i].unitQty) + data.list[i].productUnit) : '--'
                 }
                 }
               }
               }
-              this.disabled = false
               this.dataSource = data.list
               this.dataSource = data.list
             }
             }
+            this.disabled = false
             return data
             return data
           })
           })
         },
         },
@@ -477,7 +478,7 @@
       },
       },
       // 禁用活动
       // 禁用活动
       disableActive(flag){
       disableActive(flag){
-        this.resetSearchForm()
+        console.log(flag,'------')
         this.disablePromo = flag
         this.disablePromo = flag
       },
       },
       // 统计
       // 统计
@@ -727,7 +728,7 @@
           if (res.status == 200) {
           if (res.status == 200) {
             this.$message.success('产品添加成功', 2.5)
             this.$message.success('产品添加成功', 2.5)
             this.resetSearchForm()
             this.resetSearchForm()
-            this.$emit('insterOk','promo')
+            // this.$emit('insterOk','promo')
           }
           }
           this.spinning = false
           this.spinning = false
           this.isInster = false
           this.isInster = false

+ 2 - 2
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -244,9 +244,9 @@
                 data.list[i].qtyBackups = data.list[i].qty
                 data.list[i].qtyBackups = data.list[i].qty
                 data.list[i].warehouseBackups = data.list[i].warehouseSn
                 data.list[i].warehouseBackups = data.list[i].warehouseSn
               }
               }
-              this.disabled = false
               this.dataSource = data.list
               this.dataSource = data.list
             }
             }
+            this.disabled = false
             return data
             return data
           })
           })
         },
         },
@@ -524,7 +524,7 @@
           if (res.status == 200) {
           if (res.status == 200) {
             this.$message.success('产品添加成功', 2.5)
             this.$message.success('产品添加成功', 2.5)
             this.resetSearchForm()
             this.resetSearchForm()
-            this.$emit('insterOk','normal')
+            // this.$emit('insterOk','normal')
           }
           }
           this.spinning = false
           this.spinning = false
           this.isInster = false
           this.isInster = false

+ 2 - 6
src/views/salesManagement/salesQueryNew/comps/queryPart.vue

@@ -200,12 +200,8 @@ export default {
       return {
       return {
         on: {
         on: {
           dblclick: (event) => {
           dblclick: (event) => {
-            if (!record.productPrice || record.productPrice <= 0) {
-              _this.$message.info('该产品暂时不能添加')
-            } else {
-              event.stopPropagation()
-              _this.$emit('add', record, 0)
-            }
+            event.stopPropagation()
+            this.$emit('add', record, 0, 0)
           }
           }
         }
         }
       }
       }

+ 89 - 18
src/views/salesManagement/salesQueryNew/edit.vue

@@ -218,6 +218,11 @@ export default {
     tooglePanel(item){
     tooglePanel(item){
       item.isActive=!item.isActive
       item.isActive=!item.isActive
       this.activeList.splice()
       this.activeList.splice()
+      // 刷新当前表格
+      if(item.isActive){
+        const row = this.$refs['productList-'+item.promoRuleSn][0]
+        row&&row.resetSearchForm()
+      }
     },
     },
     //  销售单详情
     //  销售单详情
     getOrderDetail (flag) {
     getOrderDetail (flag) {
@@ -239,6 +244,45 @@ export default {
         }
         }
       })
       })
     },
     },
+    // 判断是否全部调用完
+    isAllLoadFinish(mlist){
+      const nid = setInterval(()=>{
+        const ret = []
+        mlist.map(item => {
+          const da = item.disabled
+          ret.push(da)
+        })
+        // 加载完了
+        if(!ret.includes(true)){
+          clearInterval(nid)
+          this.spinning = false
+        }
+        console.log(ret)
+      }, 50)
+    },
+    // 刷新所有表格数据
+    updateAllTable(flag){
+      const activeList = this.activeList.filter(item=>item.isActive)
+      const mlist = []
+      this.spinning = true
+      // 加载正常产品列表
+      this.$refs.productNormalList.resetSearchForm()
+      mlist.push(this.$refs.productNormalList)
+      // 刷新所有活动产品列表
+      activeList.map(item => {
+        const row = this.$refs['productList-' + item.promoRuleSn][0]
+        row&&row.resetSearchForm()
+        mlist.push(row)
+      })
+
+      // 判断是否全部调用完
+      this.isAllLoadFinish(mlist)
+
+      // 是否刷新详情
+      if(flag){
+        this.getOrderDetail()
+      }
+    },
     // 获取销售单参与的活动列表
     // 获取销售单参与的活动列表
     async getActiveList(){
     async getActiveList(){
       // 已参与活动列表
       // 已参与活动列表
@@ -249,9 +293,9 @@ export default {
         item.disabled = item.enabledFlag == 0
         item.disabled = item.enabledFlag == 0
         this.activeDesKey['search-'+item.promoRuleSn] = false
         this.activeDesKey['search-'+item.promoRuleSn] = false
       })
       })
-      // 加载正常产品列表
+      
       setTimeout(()=> {
       setTimeout(()=> {
-        this.$refs.productNormalList.resetSearchForm()
+        this.updateAllTable()
       }, 500)
       }, 500)
     },
     },
     // 获取是否有新活动
     // 获取是否有新活动
@@ -267,9 +311,11 @@ export default {
       this.getOrderDetail(true)
       this.getOrderDetail(true)
     },
     },
     // 添加产品,包括正常和活动的产品
     // 添加产品,包括正常和活动的产品
-    closeProductModal(){
+    closeProductModal(type){
         this.cpCurRefId = ''
         this.cpCurRefId = ''
         this.showCpModal = false
         this.showCpModal = false
+        // 刷新表格
+        this.insterActiveOk(['normal','promo'][type])
     },
     },
     // 打开选择产品弹框
     // 打开选择产品弹框
     openProductModal(type, refId){
     openProductModal(type, refId){
@@ -281,16 +327,25 @@ export default {
     },
     },
     // 添加活动产品成功的回调
     // 添加活动产品成功的回调
     insterActiveOk(type){
     insterActiveOk(type){
+      console.log(type)
+      const mlist = []
+      this.spinning = true
       if(type == 'promo'){
       if(type == 'promo'){
         // 刷新正常产品列表
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
         this.$refs.productNormalList.resetSearchForm()
+        mlist.push(this.$refs.productNormalList)
       }
       }
       if(type == 'normal'){
       if(type == 'normal'){
         // 刷新活动产品列表
         // 刷新活动产品列表
-        this.activeList.map(item => {
-          this.$refs['productList-' + item.promoRuleSn][0].resetSearchForm()
+        const activeList = this.activeList.filter(item=>item.isActive)
+        activeList.map(item => {
+          const row = this.$refs['productList-' + item.promoRuleSn][0]
+          row&&row.resetSearchForm()
+          mlist.push(row)
         })
         })
       }
       }
+      // 判断是否全部调用完
+      this.isAllLoadFinish(mlist)
       this.getOrderDetail()
       this.getOrderDetail()
     },
     },
     // 新增产品
     // 新增产品
@@ -315,14 +370,26 @@ export default {
         ...params
         ...params
       }).then(res => {
       }).then(res => {
         if(res.status == 200){
         if(res.status == 200){
+          const mlist = []
+          const nt = this.$refs['productList-'+promo[1]][0]
+          const ot = this.$refs['productList-'+oldPromo.promoRuleSn][0]
+          const pnt = this.$refs.productNormalList
+          this.spinning = true
           // 刷新新参与活动
           // 刷新新参与活动
           if(data != 0){
           if(data != 0){
-            this.$refs['productList-'+promo[1]][0].resetSearchForm()
+            nt&&nt.resetSearchForm()
+            mlist.push(nt)
           }
           }
           // 刷新正常活动
           // 刷新正常活动
-          this.$refs.productNormalList.resetSearchForm()
+          pnt&&pnt.resetSearchForm()
+          mlist.push(pnt)
           // 刷新当前活动
           // 刷新当前活动
-          this.$refs['productList-'+oldPromo.promoRuleSn][0].upAcitveSuccess()
+          ot&&ot.upAcitveSuccess()
+          mlist.push(ot)
+
+          // 判断是否全部调用完
+          this.isAllLoadFinish(mlist)
+
           // 刷新详情统计
           // 刷新详情统计
           this.getOrderDetail()
           this.getOrderDetail()
         }
         }
@@ -449,14 +516,16 @@ export default {
         salesPromoSn: item.salesPromoSn
         salesPromoSn: item.salesPromoSn
       }).then(res => {
       }).then(res => {
         if(res.status == 200){
         if(res.status == 200){
-          _this.$refs['productList-'+item.promoRuleSn][0].disableActive(false)
           item.disabled = false
           item.disabled = false
           item.isActive = true
           item.isActive = true
           _this.activeList.splice()
           _this.activeList.splice()
+          // 禁用按钮
+          _this.$refs['productList-'+item.promoRuleSn][0].disableActive(false)
+
+          // 刷新所有表格
+          _this.updateAllTable(true)
+          
           _this.spinning = false
           _this.spinning = false
-          // 刷新正常活动
-          _this.$refs.productNormalList.resetSearchForm()
-          _this.insterActiveOk('normal')
           _this.$message.success("操作成功,请添加产品")
           _this.$message.success("操作成功,请添加产品")
         }
         }
       })
       })
@@ -472,15 +541,17 @@ export default {
         salesDisableType: _this.disabledActiveOption
         salesDisableType: _this.disabledActiveOption
       }).then(res => {
       }).then(res => {
         if(res.status == 200){
         if(res.status == 200){
-          _this.$refs['productList-'+item.promoRuleSn][0].disableActive(true)
-          // 刷新所有表格
-          _this.$refs.productNormalList.resetSearchForm()
-          _this.insterActiveOk('normal')
-          _this.spinning = false
-          _this.disabledActiveOption = null
           item.disabled = true
           item.disabled = true
           item.isActive = false
           item.isActive = false
           _this.activeList.splice()
           _this.activeList.splice()
+          // 启用按钮
+          _this.$refs['productList-'+item.promoRuleSn][0].disableActive(true)
+
+          // 刷新所有表格
+          _this.updateAllTable(true)
+
+          _this.disabledActiveOption = null
+          _this.spinning = false
           _this.$message.success("操作成功")
           _this.$message.success("操作成功")
         }
         }
       })
       })