lilei 7 months ago
parent
commit
c52a9fc114

+ 5 - 4
src/views/salesManagement/salesQueryNew/comps/chooseProduct.vue

@@ -8,7 +8,6 @@
     :get-container="false"
     :wrap-style="{ position: 'absolute' }"
     :headerStyle="{ padding: '10px' }"
-    @close="onClose"
     wrapClassName="chooseProducts-modal">
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="products-con">
@@ -60,18 +59,20 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       orderData: null, // 订单数据
       promoData: null, //  促销活动数据
-      title: '选择产品'
+      title: '选择产品',
+      hasRefash: false // 是否刷新
     }
   },
 
   methods: {
     // 关闭弹框
     onClose () {
-      this.$emit('close')
+      this.$emit('close', this.hasRefash)
     },
     // 添加产品,
     // row 产品信息, promoProductClz 促销产品类型, 0 正常产品
     insterProduct (row, promoProductClz) {
+      this.hasRefash = true // 添加时不刷新,关闭弹框再刷新
       this.$emit('addProduct', row, this.promoData, promoProductClz, this.cptype)
     },
     // 初始化数据,
@@ -94,7 +95,7 @@ export default {
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
       if (!newValue) {
-        this.$emit('close', this.cptype)
+        this.onClose()
         this.cptype = 3
       }
     }

+ 22 - 13
src/views/salesManagement/salesQueryNew/edit.vue

@@ -59,7 +59,7 @@
         <div slot="title">
           <div style="display: flex;justify-content: space-between;">
             <span>活动产品</span>
-            <a-button size="small" @click="getActiveList" type="link" class="button-info"><a-icon type="reload"/> 刷新</a-button>
+            <a-button size="small" @click="getActiveList(true)" type="link" class="button-info"><a-icon type="reload"/> 刷新</a-button>
           </div>
         </div>
         <activeStatisticsList
@@ -298,7 +298,7 @@ export default {
       })
     },
     // 获取销售单参与的活动列表
-    async getActiveList () {
+    async getActiveList (flag) {
       // 已参与活动列表
       const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
@@ -306,12 +306,14 @@ export default {
       this.$nextTick(() => {
         if (this.activeList.length) this.$refs.activeTjList.hasInit = false
       })
-      setTimeout(() => {
-        // 刷新正常产品列表
-        this.$refs.productNormalList.resetSearchForm()
-        // 刷新活动产品列表
-        if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
-      }, 500)
+      if (!flag) {
+        setTimeout(() => {
+          // 刷新正常产品列表
+          this.$refs.productNormalList.resetSearchForm()
+          // 刷新活动产品列表
+          if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
+        }, 500)
+      }
     },
     // 获取是否有新活动,
     async getNewActive () {
@@ -361,8 +363,11 @@ export default {
       this.showCpModal = true
     },
     // 添加产品后,关闭弹框
-    closeProductModal (type) {
+    closeProductModal (hasRefash) {
       this.showCpModal = false
+      if (hasRefash) {
+        this.getActiveList()
+      }
     },
     // 获取指定活动的产品列表
     getActiveProduct (active) {
@@ -375,18 +380,22 @@ export default {
       // 如果是活动产品
       if (type == 'promo') {
         // 刷新正常产品列表
-        this.$refs.productNormalList.resetSearchForm()
+        if (action != 'add') this.$refs.productNormalList.resetSearchForm()
       } else if (type == 'normal') { // 如果是正常产品
         // 刷新活动产品列表
-        if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
+        if (this.activeList.length && action != 'add') this.$refs.productActiveList.resetSearchForm()
       } else {
         // 刷新正常产品列表
         this.$refs.productNormalList.resetSearchForm()
         // 刷新活动产品列表
         if (this.activeList.length) this.$refs.productActiveList.resetSearchForm()
       }
-      // 重新获取详情信息和活动统计列表
-      this.getOrderDetail(true)
+      // 重新获取详情信息
+      this.getOrderDetail(false)
+      if (action != 'add') {
+        // 重新获取参与活动列表
+        this.getActiveList(true)
+      }
     },
     // 确定新增产品到列表,
     // row 产品信息,promo 活动规则信息,promoProductClz 规则类型,cptype 1 添加活动产品,2 累计产品