lilei 6 月之前
父節點
當前提交
cc131cef19

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

@@ -863,16 +863,16 @@ export default {
       })
     },
     // 确定更换促销活动
-    async upActiveOk (data, editRow) {
+    async upActiveOk (salesPromoSnList, editRow) {
       this.spinning = true
       const params = {
         salesBillDetailSn: editRow.salesBillDetailSn,
         salesBillSn: this.salesBillSn,
-        oldSalesPromoSn: '',
-        priceLevel: editRow.priceLevel
+        priceLevel: editRow.priceLevel,
+        salesPromoSnList: salesPromoSnList
       }
       // 更换活动
-      this.$emit('upActive', data, params)
+      this.$emit('upActive', params)
     },
     // 更换活动成功
     upAcitveSuccess () {

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

@@ -550,15 +550,16 @@ export default {
       this.openUpActiveModal = true
     },
     // 确定参与促销
-    upActiveOk (data, editRow) {
+    upActiveOk (salesPromoSnList, editRow) {
       this.spinning = true
       const params = {
         salesBillDetailSn: editRow.salesBillDetailSn,
         salesBillSn: this.salesBillSn,
-        priceLevel: editRow.priceLevel
+        priceLevel: editRow.priceLevel,
+        salesPromoSnList: salesPromoSnList
       }
       // 参与促销活动
-      this.$emit('addActive', data, params)
+      this.$emit('addActive', params)
     },
     // 参与促销活动成功
     addAcitveSuccess () {

+ 42 - 19
src/views/salesManagement/salesQueryNew/comps/updateActiveModal.vue

@@ -10,22 +10,36 @@
   >
     <a-spin :spinning="spinning" tip="Loading...">
       <div style="padding: 0 30px;" v-if="total">
-        <aRadio :style="radioStyle" value="0" v-if="pageType">
-          不参加促销
-        </aRadio>
-        <!-- 非叠加 -->
-        <div v-for="(item,idx) in activeList" :key="idx">
-          <div>
-            <strong >{{ item.title }}</strong>
-          </div>
-          <aRadioGroup v-model="upActiveVal" v-if="!pageType">
-            <aRadio :style="radioStyle" v-for="(sitem,sindex) in item.promotionRule" :key="sindex" :value="item.promotionSn+'-'+sitem.promotionRuleSn+'-'+sitem.promotionProductType">
-              {{ sindex+1 }}、{{ sitem.description }}
+        <!-- 非叠加活动 -->
+        <div>
+          <aRadioGroup v-model="upActiveVal" @change="(e)=>{upActiveValArr=[]}">
+            <aRadio :style="radioStyle" value="-1" v-if="pageType">
+              不参加促销
+            </aRadio>
+            <div>
+              <strong >非叠加活动</strong>
+            </div>
+            <aRadio
+              :style="radioStyle"
+              v-for="(item,sindex) in noStackActiveList"
+              :key="item.id"
+              :value="item.salesPromoSn">
+              {{ sindex+1 }}、{{ item.description }}
             </aRadio>
           </aRadioGroup>
-          <a-checkbox-group @change="onChange" v-else>
-            <a-checkbox value="A" v-for="(sitem,sindex) in item.promotionRule" :key="sindex">
-              {{ sindex+1 }}、{{ sitem.description }}
+        </div>
+        <!-- 叠加活动 -->
+        <div>
+          <div>
+            <strong >叠加活动</strong>
+          </div>
+          <a-checkbox-group v-model="upActiveValArr" @change="(e)=>{upActiveVal=null}">
+            <a-checkbox
+              :style="radioStyle"
+              v-for="(item,sindex) in stackActiveList"
+              :value="item.salesPromoSn"
+              :key="item.id">
+              {{ sindex+1 }}、{{ item.description }}
             </a-checkbox>
           </a-checkbox-group>
         </div>
@@ -60,7 +74,8 @@ export default {
       spinning: false,
       confirmLoading: false,
       upActiveVal: null,
-      radioStyle: "display:block;height: '30px';lineHeight: '30px';padding:5px 0;",
+      upActiveValArr: [],
+      radioStyle: "display:block;height: '30px';lineHeight: '30px';padding:5px 0;margin:0;",
       activeList: [],
       editRow: null
     }
@@ -77,11 +92,11 @@ export default {
     },
     // 叠加活动
     stackActiveList () {
-      return this.activeList.filter(item => item.promotion.stackFlag == 1)
+      return this.activeList.filter(item => item.stackFlag == 1)
     },
     // 非叠加活动
     noStackActiveList () {
-      return this.activeList.filter(item => item.promotion.stackFlag !== 1)
+      return this.activeList.filter(item => item.stackFlag == 0)
     }
   },
   methods: {
@@ -97,9 +112,16 @@ export default {
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
-      if (_this.upActiveVal) {
+      if (_this.upActiveVal || this.upActiveValArr.length) {
+        let salesPromoSnList = []
+        // 不参与
+        if (this.upActiveVal == '-1') {
+          salesPromoSnList = []
+        } else {
+          salesPromoSnList = this.upActiveVal ? [this.upActiveVal] : this.upActiveValArr
+        }
         _this.confirmLoading = true
-        _this.$emit('ok', _this.upActiveVal, _this.editRow)
+        _this.$emit('ok', salesPromoSnList, _this.editRow)
       } else {
         _this.$message.info('请选择活动规则!')
       }
@@ -108,6 +130,7 @@ export default {
       if (!this.confirmLoading) {
         this.opened = false
         this.upActiveVal = null
+        this.upActiveValArr = []
         this.$emit('cancel')
       } else {
         this.$message.info('正在更换促销,请勿关闭!')

+ 3 - 12
src/views/salesManagement/salesQueryNew/edit.vue

@@ -397,7 +397,6 @@ export default {
       salesChangePromo({
         salesPromoSn: newSalesPromoSn,
         promoRuleSn: promo[1],
-        promotionFlag: promo[2] || '',
         ...params
       }).then(res => {
         if (res.status == 200) {
@@ -411,21 +410,13 @@ export default {
       })
     },
     // 更换活动
-    upActive (data, params) {
-      const promo = data.split('-')
-      const newSn = this.activeList.find(item => item.promoRuleSn == promo[1])
-      const newSalesPromoSn = newSn && newSn.salesPromoSn || ''
-      salesChangePromo({
-        salesPromoSn: data != 0 ? newSalesPromoSn : '',
-        promoRuleSn: promo[1],
-        promotionFlag: promo[2] || '',
-        ...params
-      }).then(res => {
+    upActive (params) {
+      salesChangePromo(params).then(res => {
         if (res.status == 200) {
           // 刷新活动产品
           this.$refs.productActiveList.upAcitveSuccess()
           // 刷新活动统计
-          this.$refs.activeTjList.refashRow(newSn, 1)
+          this.$refs.activeTjList.refashRow('', 1)
           // 刷新详情统计
           this.refashTableData('promo')
         }