Browse Source

修改bug

chenrui 1 year ago
parent
commit
54b87b3d1b

+ 29 - 41
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -233,12 +233,7 @@ export default {
         labelCol: { span: 4 },
         wrapperCol: { span: 17 }
       },
-      fullGiftRuleList: [{
-        id: undefined,
-        scopeLevel: undefined,
-        regularValue: undefined,
-        promotionValue: undefined
-      }],
+      fullGiftRuleList: [],
       form: {
         giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
@@ -546,7 +541,7 @@ export default {
       return flag
     },
     // 重置表格
-    async resetSearchForm () {
+    resetSearchForm () {
       this.form = {
         giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
@@ -578,12 +573,7 @@ export default {
       this.fullGiftRuleList.forEach((val, i) => {
         this.$refs['offerProduct' + i][0].reSetTableData()
       })
-      const result = await getNewScopeSn({})
-      this.fullGiftRuleList = [{
-        id: result.data,
-        regularValue: undefined,
-        promotionValue: undefined
-      }]
+      this.fullGiftRuleList = []
       this.id = null
     },
     // 获取编辑详情
@@ -712,7 +702,6 @@ export default {
     handlePreview () {
       const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : 'giftGroup'
       const titName = this.chooseVal === 'a' ? '门槛产品' : this.chooseVal === 'b' ? '正价产品' : '促销产品'
-      console.log('1111111111111111:', dataName)
       if (dataName != 'giftGroup') {
         if (!this.itemSn) {
           if (this.chooseVal === 'a') {
@@ -721,20 +710,19 @@ export default {
             this.form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
           }
         }
-        console.log('33333333:', this.form)
-        this.$nextTick(() => {
-          const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
-          if (newPreviewList && newPreviewList.length > 0) {
-            this.previewList = newPreviewList
-            const resuleObj = {
-              tit: titName
-            }
-            this.$refs.previewModal.pageInit(resuleObj)
-            this.openProductModal = true
-          } else {
-            this.$message.warning('暂时没有可预览的产品')
+        const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
+        if (newPreviewList && newPreviewList.length > 0) {
+          this.previewList = newPreviewList
+          const resuleObj = {
+            tit: titName
           }
-        })
+          this.$nextTick(() => {
+            this.$refs.previewModal.pageInit(resuleObj)
+          })
+          this.openProductModal = true
+        } else {
+          this.$message.warning('暂时没有可预览的产品')
+        }
       } else {
         // 阶梯数据处理
         const idInfo = this.chooseVal.split('c')[1]
@@ -742,22 +730,21 @@ export default {
         if (stepIndex > -1 && !this.itemSn) {
           this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)] = this.$refs['offerProduct' + stepIndex][0].getResultVal()
         }
-        console.log('222222:', this.form)
-        this.$nextTick(() => {
-          if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
-            const stepPreviewList = this.getPreviewList(this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)])
-            if (stepPreviewList && stepPreviewList.length > 0) {
-              this.previewList = stepPreviewList
-              const resuleObj = {
-                tit: '促销产品(阶梯' + (stepIndex * 1 + 1) + ')'
-              }
-              this.$refs.previewModal.pageInit(resuleObj)
-              this.openProductModal = true
-            } else {
-              this.$message.warning('暂时没有可预览的产品')
+        if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
+          const stepPreviewList = this.getPreviewList(this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)])
+          if (stepPreviewList && stepPreviewList.length > 0) {
+            this.previewList = stepPreviewList
+            const resuleObj = {
+              tit: '促销产品(阶梯' + (stepIndex * 1 + 1) + ')'
             }
+            this.$nextTick(() => {
+              this.$refs.previewModal.pageInit(resuleObj)
+            })
+            this.openProductModal = true
+          } else {
+            this.$message.warning('暂时没有可预览的产品')
           }
-        })
+        }
       }
     },
     closeProductModal () {
@@ -781,6 +768,7 @@ export default {
       } else {
         // 获取起订类型数据字典
         this.getUnitTypeList()
+        this.addFullGiftRule()
         if (this.itemSn) {
           this.getDetail()
         } else {