chenrui 7 månader sedan
förälder
incheckning
8a02386c9e

+ 50 - 64
src/views/easyPassManagement/promotionalActivities/addPromotionModal.vue

@@ -168,7 +168,7 @@ export default {
       default: ''
       default: ''
     },
     },
     chooseProductNum: {
     chooseProductNum: {
-      type: String,
+      type: [String, Number],
       default: null
       default: null
     }
     }
   },
   },
@@ -218,24 +218,6 @@ export default {
     // 参与经销商 change
     // 参与经销商 change
     changeDealerScope (val) {
     changeDealerScope (val) {
       const _this = this
       const _this = this
-      // if (_this.itemSn && _this.itemSn.length > 0) {
-      //   if (_this.chooseProductNum > 0) {
-      //     _this.$confirm({
-      //       title: '提示',
-      //       content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
-      //       centered: true,
-      //       onOk () {
-      //         _this.form.allDealerFlag = val
-      //         if (val == '1') {
-      //           _this.chooseDealerList = []
-      //         }
-      //       },
-      //       onCancel () {
-      //         _this.form.allDealerFlag = val == '1' ? '0' : '1'
-      //       }
-      //     })
-      //   }
-      // }
       _this.form.allDealerFlag = val
       _this.form.allDealerFlag = val
       if (val == '1' || !val) {
       if (val == '1' || !val) {
         _this.chooseDealerList = []
         _this.chooseDealerList = []
@@ -254,24 +236,6 @@ export default {
     // 部分经销商  选择经销商成功
     // 部分经销商  选择经销商成功
     addDealerOk (list) {
     addDealerOk (list) {
       const _this = this
       const _this = this
-      // if (_this.itemSn && _this.itemSn.length > 0) {
-      //   const hasEq = list.filter(item => !this.chooseDealerList.map(k => k.dealerSn).includes(item.dealerSn))
-      //   if (hasEq.length > 0 && _this.chooseProductNum > 0) {
-      //     _this.$confirm({
-      //       title: '提示',
-      //       content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
-      //       centered: true,
-      //       onOk () {
-      //         _this.chooseDealerList = list
-      //         _this.openDealerModal = false
-      //       },
-      //       onCancel () {
-      //         _this.$refs.chooseDearler.pageFlag = false
-      //         _this.$refs.chooseDearler.searchForm()
-      //       }
-      //     })
-      //   }
-      // }
       _this.chooseDealerList = list
       _this.chooseDealerList = list
       _this.openDealerModal = false
       _this.openDealerModal = false
     },
     },
@@ -314,37 +278,59 @@ export default {
           }
           }
           delete formData.time
           delete formData.time
           delete formData.shopPromoDealerList
           delete formData.shopPromoDealerList
-          _this.spinning = true
-          saveShopPromo(formData).then(res => {
-            if (res.status == 200) {
-              _this.spinning = false
-              if (res.data.errorMsg && res.data.errorMsg.length > 0) {
-                this.$confirm({
-                  title: '提示',
-                  content: res.data.errorMsg.map((item, i) => { return <p>{i * 1 + 1}、{item}</p> }),
-                  centered: true,
-                  okText: '知道了',
-                  cancelText: '取消', // 将cancelText设置为空字符串或去掉该属性可以隐藏取消按钮
-                  cancelButtonProps: {
-                    style: {
-                      display: 'none' // 通过设置样式隐藏取消按钮
-                    }
-                  },
-                  onOk () {
-                    console.log('知道了')
-                  }
-                })
-                return
-              }
-              _this.$message.success(res.message)
-              _this.$nextTick(() => {
-                _this.isShow = false
-                _this.$emit('ok')
+          if (_this.itemSn && _this.itemSn.length > 0) {
+            if (_this.chooseProductNum > 0) {
+              _this.$confirm({
+                title: '提示',
+                content: <div>变更【参与经销商】后将会【<span style="color:red">清空</span>】已选产品列表,确定变更吗?</div>,
+                centered: true,
+                onOk () {
+                  _this.saveSuccess(formData)
+                },
+                onCancel () {
+                  console.log('取消变更经销商')
+                }
               })
               })
             } else {
             } else {
-              _this.spinning = false
+              _this.saveSuccess(formData)
             }
             }
+          } else {
+            _this.saveSuccess(formData)
+          }
+        }
+      })
+    },
+    saveSuccess (ajaxData) {
+      const _this = this
+      _this.spinning = true
+      saveShopPromo(ajaxData).then(res => {
+        if (res.status == 200) {
+          _this.spinning = false
+          if (res.data.errorMsg && res.data.errorMsg.length > 0) {
+            this.$confirm({
+              title: '提示',
+              content: res.data.errorMsg.map((item, i) => { return <p>{i * 1 + 1}、{item}</p> }),
+              centered: true,
+              okText: '知道了',
+              cancelText: '取消', // 将cancelText设置为空字符串或去掉该属性可以隐藏取消按钮
+              cancelButtonProps: {
+                style: {
+                  display: 'none' // 通过设置样式隐藏取消按钮
+                }
+              },
+              onOk () {
+                console.log('知道了')
+              }
+            })
+            return
+          }
+          _this.$message.success(res.message)
+          _this.$nextTick(() => {
+            _this.isShow = false
+            _this.$emit('ok')
           })
           })
+        } else {
+          _this.spinning = false
         }
         }
       })
       })
     },
     },