lilei 3 weeks ago
parent
commit
f472d6d11a

+ 16 - 1
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -255,6 +255,10 @@ export default {
       type: Boolean,
       default: true
     },
+    activeList: {
+      type: Array,
+      default: () => []
+    },
     hasActive: { // 是否显示参与促销
       type: Boolean,
       default: false
@@ -554,7 +558,7 @@ export default {
         _this.warehouseTit = '全部仓库设置'
         _this.openWarehouseModal = true
       } else if (e.key == 4) { // 批量匹配活动
-
+        _this.handleBatchAddPromo()
       } else {
         this.handleBatchDelAll()
       }
@@ -601,6 +605,17 @@ export default {
       this.rowSelectionInfo = null
       this.$refs.table.refresh(false)
     },
+    // 批量参与促销
+    handleBatchAddPromo () {
+      if (!this.selectTotal) {
+        this.$message.warning('请先选择要批量匹配促销的产品!')
+      } else {
+        const _this = this
+        const obj = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => item.salesBillDetailSn) || []
+        _this.$refs.updateActive.setBatchData(obj, _this.activeList)
+        _this.openUpActiveModal = true
+      }
+    },
     // 参与促销选择弹框
     handleAddPromo (record) {
       this.$refs.updateActive.getActiveList({

+ 27 - 2
src/views/salesManagement/salesQueryNew/comps/updateActiveModal.vue

@@ -9,6 +9,23 @@
     @cancel="cancel"
   >
     <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 批量操作 -->
+      <div v-if="salesBillDetailSnList.length">
+        <div>
+          <span>产品范围</span>
+          <aRadioGroup v-model="productType">
+            <aRadio value="0">选中产品</aRadio>
+            <aRadio value="1">全部产品</aRadio>
+          </aRadioGroup>
+        </div>
+        <div>
+          <span>规则范围</span>
+          <aRadioGroup v-model="ruleType">
+            <aRadio value="0">选中规则</aRadio>
+            <aRadio value="1">全部规则</aRadio>
+          </aRadioGroup>
+        </div>
+      </div>
       <div style="padding: 0 30px;" v-if="total">
         <!-- 非叠加活动 -->
         <div>
@@ -77,7 +94,10 @@ export default {
       upActiveValArr: [],
       radioStyle: "display:block;height: '30px';lineHeight: '30px';padding:5px 0;margin:0;",
       activeList: [],
-      editRow: null
+      editRow: null,
+      salesBillDetailSnList: [],
+      productType: '0',
+      ruleType: '0'
     }
   },
   computed: {
@@ -106,7 +126,7 @@ export default {
       salesPromoMatchProduct(data).then(res => {
         this.activeList = res.data || []
         // 回显选中项
-        if (record.promoRuleSnList) {
+        if (record && record.promoRuleSnList) {
           if (record.stackFlag == 0) { // 非叠加
             const pos = res.data.findIndex(item => item.promoRuleSn == record.promoRuleSnList[0])
             this.upActiveVal = pos >= 0 ? res.data[pos].salesPromoSn : '-1'
@@ -121,6 +141,11 @@ export default {
         this.spinning = false
       })
     },
+    // 批量操作
+    setBatchData (productSn, activeList) {
+      this.activeList = activeList
+      this.salesBillDetailSnList = productSn
+    },
     //  保存
     handleSubmit (e) {
       e.preventDefault()

+ 2 - 2
src/views/salesManagement/salesQueryNew/detail.vue

@@ -546,7 +546,7 @@ export default {
       if (type == 'normal') {
         this.hideNormalTable = true
       } else {
-        this.hideActiveTable = true
+        // this.hideActiveTable = true
       }
     },
     // 编辑
@@ -632,6 +632,7 @@ export default {
           this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
         }
         this.getActiveList()
+        this.getColsOptions()
       })
     },
     // 获取销售单参与的活动列表
@@ -645,7 +646,6 @@ export default {
         if (!this.hideActiveTable) {
           this.$refs.activeTjList.hasInit = false
         }
-        this.getColsOptions()
       })
       this.spinning = false
       setTimeout(() => {

+ 2 - 1
src/views/salesManagement/salesQueryNew/edit.vue

@@ -48,6 +48,7 @@
             @addActive="upActive"
             @error="tableErrorData"
             :showTotal="showTotal"
+            :activeList="activeList"
             :hasActive="activeList.length>0"
             :detailData="detailData"
             :warehouseSn="warehouseSn"
@@ -521,7 +522,6 @@ export default {
       if (this.$refs.activeTjList) {
         this.$refs.activeTjList.hasInit = false
       }
-      this.getColsOptions()
       // 已参与活动列表
       const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
       this.activeList = list.filter(item => item.promotion && item.promotionRule)
@@ -595,6 +595,7 @@ export default {
       this.warehouseSn = this.$route.params.sn ? this.$route.params.wSn : ''
       // 是否有新活动
       this.getNewActive()
+      this.getColsOptions()
     }
   },
   mounted () {