ソースを参照

Merge branch 'develop_yh49_1' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh50

lilei 7 ヶ月 前
コミット
2490320ead

+ 9 - 8
src/views/easyPassManagement/promotionalActivities/addPromotionModal.vue

@@ -185,7 +185,7 @@ export default {
       chooseDealerList: [], // 已选择的经销商列表
       chooseSnList: [], // 已选经销商sn集合
       openDealerModal: false, // 经销商弹窗
-      hasEq: null,
+      isAllDealerFlag: null, // 是否是全部经销商
       form: {
         promoType: undefined, // 促销类型
         promoName: '', // '促销名称'
@@ -237,7 +237,6 @@ export default {
     // 部分经销商  选择经销商成功
     addDealerOk (list) {
       const _this = this
-      _this.hasEq = list.filter(item => !this.chooseDealerList.map(k => k.dealerSn).includes(item.dealerSn))
       _this.chooseDealerList = list
       _this.openDealerModal = false
     },
@@ -278,19 +277,18 @@ export default {
             }
             formData.dealerSnList = _this.chooseDealerList.map(con => con.dealerSn)
           }
-          delete formData.time
-          delete formData.shopPromoDealerList
           if (_this.itemSn && _this.itemSn.length > 0) {
-            if (_this.chooseProductNum > 0 && _this.hasEq && _this.hasEq.length > 0) {
+            const hasEq = _this.chooseDealerList.filter(item => !formData.shopPromoDealerList.map(k => k.dealerSn).includes(item.dealerSn)) // 经销商是否变更
+            const hasEq1 = _this.isAllDealerFlag == 0 && formData.allDealerFlag == 1 // 部分变全部
+            const hasChange = _this.isAllDealerFlag == 0 && _this.isAllDealerFlag == formData.allDealerFlag // 是否部分经销商未变更
+            console.log(hasEq, hasEq1)
+            if (_this.chooseProductNum > 0 && (hasChange && hasEq && hasEq.length > 0 || hasEq1)) {
               _this.$confirm({
                 title: '提示',
                 content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
                 centered: true,
                 onOk () {
                   _this.saveSuccess(formData, '1')
-                },
-                onCancel () {
-                  console.log('取消变更经销商')
                 }
               })
             } else {
@@ -305,6 +303,8 @@ export default {
     saveSuccess (ajaxData, type) {
       const _this = this
       _this.spinning = true
+      delete ajaxData.time
+      delete ajaxData.shopPromoDealerList
       ajaxData.saveType = 'alone'
       saveShopPromo(ajaxData).then(res => {
         if (res.status == 200) {
@@ -379,6 +379,7 @@ export default {
           _this.pageType = res.data.promoType
           _this.promotionName = res.data.promoName
         }
+        _this.isAllDealerFlag = _this.form.allDealerFlag // 存储是否是全部经销商
         // 部分经销商
         if (_this.form.allDealerFlag == 0) {
           _this.chooseDealerList = _this.form.shopPromoDealerList