Browse Source

修改bug

chenrui 7 months ago
parent
commit
894c00d8e2
1 changed files with 48 additions and 43 deletions
  1. 48 43
      src/views/easyPassManagement/promotionalActivities/edit.vue

+ 48 - 43
src/views/easyPassManagement/promotionalActivities/edit.vue

@@ -417,30 +417,31 @@ export default {
     // 参与经销商 change
     changeDealerScope (val) {
       const _this = this
-      const hasProduct = this.$refs.chooseProductList.getChooseProductNum()
-      if (hasProduct > 0) {
-        this.$confirm({
-          title: '提示',
-          content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
-          centered: true,
-          onOk () {
-            _this.form.allDealerFlag = val
-            if (val == '1') {
-              _this.chooseDealerList = []
+      if (_this.pageType === 'edit') {
+        const hasProduct = this.$refs.chooseProductList.getChooseProductNum()
+        if (hasProduct > 0) {
+          this.$confirm({
+            title: '提示',
+            content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
+            centered: true,
+            onOk () {
+              _this.form.allDealerFlag = val
+              if (val == '1') {
+                _this.chooseDealerList = []
+              }
+              // 情况产品列表
+              _this.$refs.chooseProductList.clearTable()
+            },
+            onCancel () {
+              _this.form.allDealerFlag = val == '1' ? '0' : '1'
             }
-            // 情况产品列表
-            _this.$refs.chooseProductList.clearTable()
-          },
-          onCancel () {
-            _this.form.allDealerFlag = val == '1' ? '0' : '1'
-          }
-        })
-      } else {
-        _this.form.allDealerFlag = val
-        if (val == '1') {
-          _this.chooseDealerList = []
+          })
         }
       }
+      _this.form.allDealerFlag = val
+      if (val == '1') {
+        _this.chooseDealerList = []
+      }
     },
     // 部分 打开选择经销商弹窗
     handleDealerModal () {
@@ -455,28 +456,29 @@ export default {
     // 部分经销商  选择经销商成功
     addDealerOk (list) {
       const _this = this
-      const hasProduct = this.$refs.chooseProductList.getChooseProductNum()
-      const hasEq = list.filter(item => !this.chooseDealerList.map(k => k.dealerSn).includes(item.dealerSn))
-      if (hasEq.length > 0 && hasProduct > 0) {
-        this.$confirm({
-          title: '提示',
-          content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
-          centered: true,
-          onOk () {
-            _this.chooseDealerList = list
-            _this.openDealerModal = false
-            // 清空产品列表
-            _this.$refs.chooseProductList.clearTable()
-          },
-          onCancel () {
-            _this.$refs.chooseDearler.pageFlag = false
-            _this.$refs.chooseDearler.searchForm()
-          }
-        })
-      } else {
-        _this.chooseDealerList = list
-        _this.openDealerModal = false
+      if (_this.pageType === 'edit') {
+        const hasProduct = this.$refs.chooseProductList.getChooseProductNum()
+        const hasEq = list.filter(item => !this.chooseDealerList.map(k => k.dealerSn).includes(item.dealerSn))
+        if (hasEq.length > 0 && hasProduct > 0) {
+          this.$confirm({
+            title: '提示',
+            content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
+            centered: true,
+            onOk () {
+              _this.chooseDealerList = list
+              _this.openDealerModal = false
+              // 清空产品列表
+              _this.$refs.chooseProductList.clearTable()
+            },
+            onCancel () {
+              _this.$refs.chooseDearler.pageFlag = false
+              _this.$refs.chooseDearler.searchForm()
+            }
+          })
+        }
       }
+      _this.chooseDealerList = list
+      _this.openDealerModal = false
     },
     // 禁用日期时间
     disabledDate (current) {
@@ -574,6 +576,7 @@ export default {
           const endTime = res.data.promoEndDate.split(' ')[0]
           res.data.time = [startTime, endTime]
         }
+        console.log('111111111:', res.data.imageUrl, _this.$refs)
         if (res.data.imageUrl) {
           _this.$refs.imageSet.setFileList(res.data.imageUrl)
         }
@@ -718,7 +721,9 @@ export default {
         validInfo: '', // 使用说明
         productNum: 0
       }
-      this.$refs.imageSet.setFileList('')
+      if (this.$refs.imageSet) {
+        this.$refs.imageSet.setFileList('')
+      }
       this.isShowNextStep = false
       if (this.$refs.ruleForm) {
         this.$refs.ruleForm.resetFields()