소스 검색

经销商促销,详情显示

chenrui 1 년 전
부모
커밋
ffea5fb063

+ 12 - 2
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -78,11 +78,21 @@
           <template slot="ruleProduct" slot-scope="text, record">
             <div v-if="record.promotionRuleType == 'BUY_PROD_GIVE_PROD'">
               <div>{{ record.accrualFlag==='1'?'数量叠加;':'' }}{{ record.convertExpenseFlag==='1'?'可转费用报销单;':'' }}</div>
+              <div v-if="record.giveRuleList && record.giveRuleList.length>0">
+                <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
+                  {{ item.scopeLevel }}、{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品,购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ item.promotionValue }}个促销产品;
+                </div>
+              </div>
               <div v-if="record.restrictFlag==='1'">限制正价产品{{ record.restrictCategory }}款</div>
-              <!-- {{ record.regularSameFlag==1?'同款':'不同款' }}产品,购买满{{ record.regularQty }}个正价产品,送{{ record.promotionQty }}个促销产品{{ (record.accrualFlag&&record.accrualFlag==1)?',数量叠加':',数量不叠加' }} -->
             </div>
             <div v-else-if="record.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
-              购买满{{ record.regularAmount }}元正价产品,送{{ record.giveAmount }}元促销品采购额{{ record.promotionRuleType ==='BUY_PROD_GIVE_MONEY'?(record.accrualFlag&&record.accrualFlag==1)?',金额叠加':',金额不叠加':'' }}
+              <div v-if="record.giveRuleType==='SUM_MONEY'">金额叠加;购买满{{ record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ record.giveRuleList[0].promotionValue }}元<span v-if="record.giveRuleList[0].regularUnit==='YUAN'">({{ record.giveRuleList[0].regularValue!=0?(record.giveRuleList[0].promotionValue/record.giveRuleList[0].regularValue).toFixed(2)*100:0 }}%促销品采购额)</span></div>
+              <div v-if="record.giveRuleType==='RATIO' &&record.giveRuleList && record.giveRuleList.length>0 ">
+                <span>按比例;</span>
+                <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
+                  {{ item.scopeLevel }}、产品购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送该规则订单金额的{{ item.promotionValue }}%为促销品采购额
+                </div>
+              </div>
             </div>
             <div v-else>
               <span v-if="record.discountType ==='0'">手动输入特价</span>

+ 39 - 49
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -83,10 +83,16 @@
               @blur="calculatePrice"
               :max="999999"
               :step="1"
-              :precision="2"
+              :precision="form.regularUnit==='YUAN'?2:0"
               :min="0"
               size="small"/>
-            <a-select default-value="YUAN" v-model="form.regularUnit" style="width: 50px;margin-left:5px;" size="small" allowClear>
+            <a-select
+              default-value="YUAN"
+              v-model="form.regularUnit"
+              style="width: 50px;margin-left:5px;"
+              size="small"
+              @change="handleUnit"
+              allowClear>
               <a-select-option value="YUAN">
               </a-select-option>
@@ -111,12 +117,19 @@
               购买满
               <a-input-number
                 v-model="con.regularValue"
-                :min="0"
+                :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
                 :step="1"
                 :max="999999"
-                :precision="0"
+                :precision="form.regularUnit==='YUAN'?2:0"
                 size="small"/>
-              <a-select default-value="YUAN" v-model="form.regularUnit" style="width: 50px;margin-left:5px;" size="small" allowClear>
+              <a-select
+                default-value="YUAN"
+                v-model="form.regularUnit"
+                @change="handleChangeUnit"
+                style="width: 50px;margin-left:5px;"
+                size="small"
+                :disabled="i!=0"
+                allowClear>
                 <a-select-option value="YUAN">
                 </a-select-option>
@@ -160,12 +173,9 @@
             <a-radio-button value="b">
               正价产品
             </a-radio-button>
-            <a-radio-button value="c" v-show="form.scopeFlag==='0'&&form.giveRuleType==='SUM_MONEY'">
+            <a-radio-button value="c" v-show="form.scopeFlag==='0'">
               促销产品
             </a-radio-button>
-            <a-radio-button :value="'c'+i" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.scopeFlag==='0'&&form.giveRuleType==='RATIO'">
-              {{ i==0?'促销产品':'阶梯'+i+'促销产品' }}
-            </a-radio-button>
           </a-radio-group>
           <a-button
             size="small"
@@ -176,10 +186,7 @@
         </div>
         <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
         <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
-        <div v-show="chooseVal=='c'&&form.giveRuleType==='SUM_MONEY'"><tableType1 ref="offerProduct"></tableType1></div>
-        <div v-if="form.giveRuleType==='RATIO'">
-          <div v-show="chooseVal==('c'+i)" v-for="(item,i) in fullGiftRuleList" :key="i" ><tableType1 :ref="'offerProduct'+i"></tableType1></div>
-        </div>
+        <div v-show="chooseVal=='c'"><tableType1 ref="offerProduct"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -231,9 +238,8 @@ export default {
         gateValue: undefined,
         quotaAmount: undefined,
         giveRuleType: 'SUM_MONEY',
-        regularUnit:'YUAN',
-        scopeFlag: '1',
-        giftProductMap: {}
+        regularUnit: 'YUAN',
+        scopeFlag: '1'
       },
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
@@ -251,6 +257,17 @@ export default {
     }
   },
   methods: {
+    // 单位切换时,满赠规则数据清空
+    handleUnit (val) {
+      this.form.regularUnit = val
+      this.fullGiftRuleList[0].regularValue = undefined
+    },
+    handleChangeUnit (e) {
+      this.form.regularUnit = e
+      this.fullGiftRuleList.forEach(item => {
+        item.regularValue = undefined
+      })
+    },
     // 新增  满减规则  最多能添加五个
     addFullGiftRule () {
       const obj = {
@@ -275,7 +292,7 @@ export default {
     // 计算百分比
     calculatePrice () {
       const _this = this
-      if (_this.form.giveRuleType === 'SUM_MONEY' && _this.fullGiftRuleList[0].promotionValue && _this.fullGiftRuleList[0].regularValue) {
+      if (_this.form.giveRuleType === 'SUM_MONEY' && _this.form.regularUnit === 'YUAN' && _this.fullGiftRuleList[0].promotionValue && _this.fullGiftRuleList[0].regularValue) {
         _this.scaleNum = ((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)
       } else {
         _this.scaleNum = 0
@@ -354,40 +371,14 @@ export default {
           }
           // 促销产品
           if (form.scopeFlag == '0') {
-            if (form.giveRuleType === 'SUM_MONEY') {
-              form.giftProductList = this.$refs.offerProduct.getResultVal()
-              if (form.giftProductList.length == 0) {
-                _this.$message.warning('请添加促销产品!')
-                return
-              }
-              rowFlag3 = _this.isJudge(form.giftProductList)
-            } else {
-              const allGiftObj = {}
-              _this.fullGiftRuleList.forEach((val, i) => {
-                allGiftObj['GIFT' + i] = _this.$refs['offerProduct' + i][0].getResultVal()
-              })
-              var lengthFlag = null
-              for (const con in allGiftObj) {
-                if (allGiftObj[con].length === 0) {
-                  lengthFlag = true
-                }
-              }
-              if (lengthFlag) {
-                _this.$message.warning('请添加促销产品!')
-                return
-              }
-              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
+            form.giftProductList = this.$refs.offerProduct.getResultVal()
+            if (form.giftProductList.length == 0) {
+              _this.$message.warning('请添加促销产品!')
+              return
             }
+            rowFlag3 = _this.isJudge(form.giftProductList)
           } else {
             form.giftProductList = []
-            form.giftProductMap = {}
           }
 
           if (rowFlag1 || rowFlag2 || rowFlag3) {
@@ -456,7 +447,6 @@ export default {
         giveRuleType: 'SUM_MONEY',
         regularUnit: 'YUAN',
         scopeFlag: '1',
-        giftProductMap: {},
         gateProductList: undefined,
         giftProductList: undefined,
         regularProductList: undefined

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

@@ -86,10 +86,10 @@
               产品购买满
               <a-input-number
                 v-model="con.regularValue"
-                :min="0"
+                :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
                 :step="1"
                 :max="999999"
-                :precision="0"
+                :precision="form.regularUnit==='YUAN'?2:0"
                 size="small"/>
               <a-select
                 default-value="YUAN"
@@ -97,6 +97,7 @@
                 v-model="form.regularUnit"
                 style="width: 50px;margin-left:5px;"
                 size="small"
+                @change="handleChangeUnit"
                 allowClear>
                 <a-select-option value="YUAN">
@@ -115,7 +116,7 @@
                 size="small"/>
               个促销产品
               <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
-              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(con)">删除</a-button>
+              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(i)">删除</a-button>
             </div>
           </div>
           <div class="ruleDescList">
@@ -255,10 +256,18 @@ export default {
         regularPromotionSameFlag: [{ required: true, message: '请选择促销品与正品是否一致', trigger: 'change' }]
       },
       chooseVal: 'a',
-      openGuideModal: false// 导入弹窗
+      openGuideModal: false, // 导入弹窗
+      id: 1
     }
   },
   methods: {
+    // 单位切换时,满赠规则数据清空
+    handleChangeUnit (e) {
+      this.form.regularUnit = e
+      this.fullGiftRuleList.forEach(item => {
+        item.regularValue = undefined
+      })
+    },
     onChooseVal (e) {
       this.chooseVal = e.target.value
     },

+ 39 - 24
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -77,6 +77,7 @@
             placeholder="请选择"
             style="width:60%;"
             size="small"
+            @change="handleDiscountType"
             allowClear>
             <a-select-option value="0">
               手动输入特价
@@ -100,34 +101,34 @@
             style="width:60%;"
             bordered>
             <template slot="provinceDiscount" slot-scope="text, record">
-              <a-input
+              <a-input-number
+                size="small"
                 v-model="record.provinceValue"
-                style="width:80%;"
-                type="number"
-                @input="record.provinceValue=record.provinceValue.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.provinceValue.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
                 :min="0"
-                placeholder="请输入"
-                size="small"/>%
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
             </template>
             <template slot="cityDiscount" slot-scope="text, record">
-              <a-input
+              <a-input-number
+                size="small"
                 v-model="record.cityValue"
-                style="width:80%;"
-                type="number"
-                @input="record.cityValue=record.cityValue.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.cityValue.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
-                :min="0"
-                placeholder="请输入"
-                size="small"/>%
+                :min="record.provinceValue||0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
             </template>
             <template slot="specialDiscount" slot-scope="text, record">
-              <a-input
+              <a-input-number
+                size="small"
                 v-model="record.specialValue"
-                style="width:80%;"
-                type="number"
-                @input="record.specialValue=record.specialValue.match(/^\d{1,4}(\.?\d{0,2})/g) ? record.specialValue.match(/^\d{1,4}(\.?\d{0,2})/g)[0] : ''"
-                :min="0"
-                placeholder="请输入"
-                size="small"/>%
+                :min="record.cityValue ||0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
             </template>
             <template slot="provincePrice" slot-scope="text, record">
               <a-input-number
@@ -146,7 +147,7 @@
                 :min="0"
                 :step="1"
                 :precision="2"
-                :max="999999"
+                :max="record.provinceValue||999999"
                 placeholder="请输入"/>
             </template>
             <template slot="specialPrice" slot-scope="text, record">
@@ -156,7 +157,7 @@
                 :min="0"
                 :step="1"
                 :precision="2"
-                :max="999999"
+                :max="record.cityValue||999999"
                 placeholder="请输入"/>
             </template>
           </a-table>
@@ -293,6 +294,11 @@ export default {
     }
   },
   methods: {
+    // 特价规则切换时清空数据
+    handleDiscountType (val) {
+      this.form.discountType = val
+      this.$refs.specialProduct.reSetTableData()
+    },
     // 导入
     closeGuideModel () {
       this.openGuideModal = false
@@ -370,7 +376,7 @@ export default {
             _this.$message.warning('订单起订量设置不能为空!')
             return
           }
-          if (form.discountType === '0') {
+          if (form.discountType === '0') { // 手动输入
             const isCountEmpty = _this.isNumEmpty(form.specialProductList)
             if (isCountEmpty.flag) {
               _this.$message.warning('折扣不能为空!')
@@ -381,6 +387,13 @@ export default {
               return
             }
           } else {
+            if (form.discountType === '2') { // 直降价格为负判断
+              const hasNegativePrice = form.specialProductList.some((item) => (item.provinceDiscountPrice < 0 || item.cityDiscountPrice < 0 || item.specialDiscountPrice < 0))
+              if (hasNegativePrice) {
+                _this.$message.warning('直降后价格不能为负值!')
+                return
+              }
+            }
             form.provinceValue = _this.setTableData[0].provinceValue
             form.cityValue = _this.setTableData[0].cityValue
             form.specialValue = _this.setTableData[0].specialValue
@@ -461,8 +474,10 @@ export default {
         this.$refs.ruleForm.resetFields()
         this.$refs.cillProduct.reSetTableData()
         this.$refs.specialProduct.reSetTableData()
-        this.$refs[0].setTable.clearTable()
       })
+      if (this.form.discountType != '0') {
+        this.$refs[0].setTable.clearTable()
+      }
       this.setTableData = []
     },
     // 获取编辑详情