chenrui hace 9 meses
padre
commit
8600196a51
Se han modificado 1 ficheros con 22 adiciones y 21 borrados
  1. 22 21
      src/views/easyPassManagement/promotionalActivities/edit.vue

+ 22 - 21
src/views/easyPassManagement/promotionalActivities/edit.vue

@@ -505,26 +505,6 @@ export default {
       // 验证组件必填项
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          _this.form.promoType = _this.pageType
-          _this.form.productNum = _this.$refs.chooseProductList.getChooseProductNum()
-
-          if (!_this.form.productNum) {
-            _this.$message.warning('请选择返券产品!')
-            return
-          }
-          if (_this.form.promoType === 'BUY_PROD_GIVE_VALID') {
-            if (_this.form.validType === 'FIXED') {
-              if (!_this.form.validStartDate || !_this.form.validEndDate) {
-                _this.$message.warning('请输入券有效期!')
-                return false
-              }
-            } else {
-              if (!_this.form.validDays) {
-                _this.$message.warning('请输入券有效期!')
-                return false
-              }
-            }
-          }
           _this.savePartInfo(type)
         }
       })
@@ -532,9 +512,30 @@ export default {
     // 保存
     savePartInfo (type) {
       const _this = this
+      _this.form.promoType = _this.pageType
       var formData = JSON.parse(JSON.stringify(_this.form))
+      if (type === 'all') {
+        formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
+        if (!formData.productNum) {
+          _this.$message.warning('请选择返券产品!')
+          return
+        }
+        if (formData.promoType === 'BUY_PROD_GIVE_VALID') {
+          if (formData.validType === 'FIXED') {
+            if (!formData.validStartDate || !formData.validEndDate) {
+              _this.$message.warning('请输入券有效期!')
+              return false
+            }
+          } else {
+            if (!formData.validDays) {
+              _this.$message.warning('请输入券有效期!')
+              return false
+            }
+          }
+        }
+        delete formData.productNum
+      }
       delete formData.time
-      delete formData.productNum
       _this.spinning = true
       saveShopPromo(formData).then(res => {
         if (res.status == 200) {