Ver Fonte

修改bug

chenrui há 1 ano atrás
pai
commit
c60855f814

+ 26 - 13
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -336,7 +336,7 @@ export default {
           var form = JSON.parse(JSON.stringify(_this.form))
           let rowFlag1 = null
           let rowFlag2 = null
-          const rowFlag3 = null
+          let rowFlag3 = null
           if (form.gateFlag == '1') { // 门槛产品
             form.gateProductList = this.$refs.cillProduct.getResultVal()
             form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
@@ -371,32 +371,45 @@ export default {
           }
           if (form.regularPromotionSameFlag === '0') { // 促销产品   阶梯促销产品
             const allGiftObj = {}
-            // _this.fullGiftRuleList.forEach((val, i) => {
-            //   allGiftObj['GIFT' + i] = []
-            // })
-            console.log('222222:', _this.fullGiftRuleList)
-            // console.log('333333:', allGiftObj)
             _this.fullGiftRuleList.forEach((val, i) => {
               allGiftObj['GIFT' + i] = _this.$refs['offerProduct' + i][0].getResultVal()
-              // _this.$set(allGiftObj, ('GIFT' + i), _this.$refs['offerProduct' + i].getResultVal())
             })
-            // _this.$forceUpdate()
-            console.log('111111111:', allGiftObj)
-            debugger
-            if (form.giftProductList.length == 0) {
+            var lengthFlag = null
+            for (const con in allGiftObj) {
+              if (allGiftObj[con].length === 0) {
+                lengthFlag = true
+              }
+            }
+            if (lengthFlag) {
               _this.$message.warning('请添加促销产品!')
               return
             }
-            rowFlag2 = _this.isJudge(form.giftProductList)
+            const arrFlag = []
+            for (const con in allGiftObj) {
+              if (con.length > 0) {
+                arrFlag.push(_this.isJudge(allGiftObj[con]))
+              }
+            }
+            rowFlag3 = arrFlag.some(val => { return val })
+            form.giftProductMap = allGiftObj
           } else {
-            form.giftProductList = []
+            form.giftProductMap = {}
           }
 
           if (rowFlag1 || rowFlag2 || rowFlag3) {
             _this.$message.warning('请选择产品分类、品牌或产品!')
             return
           }
+          // 组数据
+          _this.fullGiftRuleList.map((val, i) => {
+            val.scopeLevel = i * 1 + 1
+            val.regularSameFlag = form.regularSameFlag
+            val.regularUnit = form.regularUnit
+          })
+          console.log('111111111111:', _this.fullGiftRuleList)
           form.promotionSn = _this.promotionSn
+          form.giveRuleList = _this.fullGiftRuleList
+          console.log('222222222222:', form)
           _this.spinning = true
           promotionSave(form).then(res => {
             if (res.status == 200) {