chenrui 1 год назад
Родитель
Сommit
78d84524d4

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

@@ -21,8 +21,8 @@
           <a-descriptions-item label="费用所属部门">{{ detailData.expenseDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="参与客户" v-if="detailData.dealerScope!='ALL_DEALER'"><div @click="handleSee">共<span class="link-bule">{{ detailData.dealerQty }}</span>个</div></a-descriptions-item>
           <a-descriptions-item label="参与客户" v-else>全部客户</a-descriptions-item>
-          <a-descriptions-item label="活动订单起订金额(元)">{{ detailData.minOrderFlag ==='0'?'不限':detailData.minOrderAmount?detailData.minOrderAmount:'--' }}</a-descriptions-item>
-          <a-descriptions-item label="活动经费上限(元)" :span="2">{{ detailData.upperLimitFlag ==='0'?'不限':detailData.upperLimitAmount? detailData.upperLimitAmount:'--' }}</a-descriptions-item>
+          <a-descriptions-item label="活动订单起订金额(元)">{{ detailData.minOrderFlag ==='0'?'不限':detailData.minOrderAmount?toThousands(detailData.minOrderAmount):'--' }}</a-descriptions-item>
+          <a-descriptions-item label="活动经费上限(元)" :span="2">{{ detailData.upperLimitFlag ==='0'?'不限':detailData.upperLimitAmount? toThousands(detailData.upperLimitAmount):'--' }}</a-descriptions-item>
           <a-descriptions-item label="促销描述" :span="3">
             <div class="descItem">{{ detailData.content || '' }}</div>
           </a-descriptions-item>

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/importGuideModal.vue

@@ -150,7 +150,7 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
-        this.filePath = location.protocol + '//' + location.host + (this.goodFlag === '1' ? '/templ/促销规则导入产品.xlsx' : '/templ/促销规则导入特价产品.xlsx')
+        this.filePath = location.protocol + '//' + location.host + ((this.goodFlag === '1' ||(this.goodFlag === '0'&&this.rulesType!=0)) ? '/templ/促销规则导入产品.xlsx' : '/templ/促销规则导入特价产品.xlsx')
       }
     }
   }

+ 31 - 11
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入规则简称(最多20个字符)"
+            :maxLength="20"></a-input>
+        </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <div class="fixWidthBox">
             <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
@@ -55,17 +64,8 @@
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="规则简称" prop="description">
-          <a-input
-            size="small"
-            id="promotionList-description"
-            v-model.trim="form.description"
-            allowClear
-            placeholder="请输入规则简称(最多20个字符)"
-            :maxLength="20"></a-input>
-        </a-form-model-item>
         <a-form-model-item label="满赠规则" prop="giveRuleType">
-          <a-select default-value="SUM_MONEY" v-model="form.giveRuleType" style="width: 160px" size="small" allowClear>
+          <a-select default-value="SUM_MONEY" v-model="form.giveRuleType" style="width: 160px" size="small" @change="handleRuleType">
             <a-select-option value="SUM_MONEY">
               金额叠加
             </a-select-option>
@@ -143,7 +143,7 @@
                 v-model="con.promotionValue"
                 :min="0"
                 :step="1"
-                :precision="0"
+                :precision="2"
                 :max="999999"
                 size="small"/>
               %为促销品采购额
@@ -260,6 +260,14 @@ export default {
     }
   },
   methods: {
+    // 满赠规则叠加
+    handleRuleType (val) {
+      this.form.giveRuleType = val
+      this.fullGiftRuleList = [{
+        regularValue: undefined,
+        promotionValue: undefined
+      }]
+    },
     // 单位切换时,满赠规则数据清空
     handleUnit (val) {
       this.form.regularUnit = val
@@ -337,6 +345,18 @@ export default {
               return
             }
           }
+          if (_this.form.giveRuleType == 'SUM_MONEY') {
+            if (_this.fullGiftRuleList[0].regularValue <= 0 || _this.fullGiftRuleList[0].promotionValue <= 0) {
+              _this.$message.warning('满赠规则条件不能为空!')
+              return
+            }
+          } else {
+            const hasNullVal = _this.fullGiftRuleList.some(itemVal => (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0))
+            if (hasNullVal) {
+              _this.$message.warning('满赠规则条件不能为空!')
+              return
+            }
+          }
           const form = JSON.parse(JSON.stringify(_this.form))
           let rowFlag1, rowFlag2, rowFlag3
           if (form.gateFlag == '1') {

+ 37 - 19
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入规则简称(最多20个字符)"
+            :maxLength="20"></a-input>
+        </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <div class="fixWidthBox">
             <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
@@ -55,19 +64,10 @@
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="规则简称" prop="description">
-          <a-input
-            size="small"
-            id="promotionList-description"
-            v-model.trim="form.description"
-            allowClear
-            placeholder="请输入规则简称(最多20个字符)"
-            :maxLength="20"></a-input>
-        </a-form-model-item>
         <a-form-model-item label="满赠规则" prop="regularSameFlag">
           <div class="fullGiftRuleBox">
             <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
-              <span>{{ i*1+1 }}、</span>
+              <span v-if="fullGiftRuleList.length>1">{{ i*1+1 }}、</span>
               <a-select
                 default-value="1"
                 :disabled="i!=0"
@@ -98,12 +98,12 @@
                 style="width: 50px;margin-left:5px;"
                 size="small"
                 @change="handleChangeUnit">
-                <a-select-option value="YUAN">
-                  元
-                </a-select-option>
                 <a-select-option value="GE">
                 </a-select-option>
+                <a-select-option value="YUAN">
+                  元
+                </a-select-option>
               </a-select>
               正价产品,送
               <a-input-number
@@ -115,7 +115,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(i)">删除</a-button>
+              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(con.id)">删除</a-button>
             </div>
           </div>
           <div class="ruleDescList">
@@ -170,7 +170,7 @@
               正价产品
             </a-radio-button>
             <a-radio-button :value="'c'+i" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.regularPromotionSameFlag==='0'">
-              {{ i==0?'促销产品':'阶梯'+i+'促销产品' }}
+              {{ fullGiftRuleList.length>1?'促销产品('+'阶梯'+(i*1+1)+')':'促销产品' }}
             </a-radio-button>
           </a-radio-group>
           <a-button
@@ -182,7 +182,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'+i)" v-for="(item,i) in fullGiftRuleList" :key="i"><tableType1 :ref="'offerProduct'+i"></tableType1></div>
+        <div v-show="chooseVal==('c'+i)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :ref="'offerProduct'+i"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -227,6 +227,7 @@ export default {
         wrapperCol: { span: 17 }
       },
       fullGiftRuleList: [{
+        id: this.generateRandomString(),
         scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
@@ -259,10 +260,15 @@ export default {
       },
       chooseVal: 'a',
       openGuideModal: false, // 导入弹窗
-      id: 1
+      id: ''
     }
   },
   methods: {
+    // 生成随机id
+    generateRandomString () {
+      const result = new Date().getTime() + 'IDNUM'
+      return result
+    },
     // 单位切换时,满赠规则数据清空
     handleChangeUnit (e) {
       this.form.regularUnit = e
@@ -275,16 +281,21 @@ export default {
     },
     // 新增  满减规则  最多能添加五个
     addFullGiftRule () {
+      this.id = this.generateRandomString()
       const obj = {
+        id: this.id,
         scopeLevel: undefined,
         regularValue: undefined,
         promotionValue: undefined
       }
       this.fullGiftRuleList.push(obj)
+      debugger
     },
     // 删除满减规则
-    delFullGiftRule (pos) {
+    delFullGiftRule (id) {
+      const pos = this.fullGiftRuleList.findIndex(con => { return con.id == id })
       this.fullGiftRuleList.splice(pos, 1)
+      this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
     },
     // 满赠  同款    促销品与正品一致  默认是 可修改
     //     不同款                   默认否 不可修改
@@ -346,6 +357,11 @@ export default {
               return
             }
           }
+          const hasNullVal = _this.fullGiftRuleList.some(itemVal => (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0))
+          if (hasNullVal) {
+            _this.$message.warning('满赠规则条件不能为空!')
+            return
+          }
           if (_this.form.restrictFlag === '1' && !_this.form.restrictCategory) {
             _this.$message.warning('请输入限制正价产品款数个数!')
             return
@@ -499,7 +515,7 @@ export default {
         gateValue: undefined,
         quotaAmount: undefined,
         regularSameFlag: '1', // 满赠规则  同款不同款商品
-        regularUnit: 'YUAN',
+        regularUnit: 'GE',
         restrictFlag: '0', // 限制正价产品款数
         convertExpenseFlag: '0', // 转费用报销标记
         restrictCategory: '',
@@ -520,9 +536,11 @@ export default {
         this.$refs['offerProduct' + i][0].reSetTableData()
       })
       this.fullGiftRuleList = [{
+        id: this.generateRandomString(),
         regularValue: undefined,
         promotionValue: undefined
       }]
+      this.id = ''
     },
     // 获取编辑详情
     getDetail () {

+ 31 - 20
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -16,6 +16,15 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="规则简称" prop="description">
+          <a-input
+            size="small"
+            id="promotionList-description"
+            v-model.trim="form.description"
+            allowClear
+            placeholder="请输入规则简称(最多20个字符)"
+            :maxLength="20"></a-input>
+        </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="handleChange">
             <a-radio-button value="1">
@@ -61,15 +70,6 @@
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="规则简称" prop="description">
-          <a-input
-            size="small"
-            id="promotionList-description"
-            v-model.trim="form.description"
-            allowClear
-            placeholder="请输入规则简称(最多20个字符)"
-            :maxLength="20"></a-input>
-        </a-form-model-item>
         <a-form-model-item label="特价规则" prop="discountType">
           <a-select
             default-value="0"
@@ -133,22 +133,24 @@
             <template slot="provincePrice" slot-scope="text, record">
               <a-input-number
                 size="small"
-                v-model="record.provinceValue"
+                :value="record.provinceValue"
                 :min="0"
                 :step="1"
                 :precision="2"
                 :max="999999"
-                placeholder="请输入"/>
+                placeholder="请输入"
+                @blur="handleProvincePrice"/>
             </template>
             <template slot="cityPrice" slot-scope="text, record">
               <a-input-number
                 size="small"
-                v-model="record.cityValue"
+                :value="record.cityValue"
                 :min="0"
                 :step="1"
                 :precision="2"
                 :max="record.provinceValue||999999"
-                placeholder="请输入"/>
+                placeholder="请输入"
+                @blur="handleCityPrice"/>
             </template>
             <template slot="specialPrice" slot-scope="text, record">
               <a-input-number
@@ -296,6 +298,15 @@ export default {
     }
   },
   methods: {
+    handleProvincePrice (e) {
+      this.setTableData[0].provinceValue = e.target.value
+      if (this.setTableData[0].cityValue) {
+        this.setTableData[0].cityValue = e.target.value
+      }
+    },
+    handleCityPrice (e) {
+      this.setTableData[0].cityValue = e.target.value
+    },
     // 特价规则切换时清空数据
     handleDiscountType (val) {
       this.form.discountType = val
@@ -389,13 +400,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
-              }
-            }
+            // 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

+ 3 - 3
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -124,7 +124,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?setData[0].provinceValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].provinceValue || setData[0].provinceValue==0)?'-'+setData[0].provinceValue:'--' }}</span>
+          <span v-else>{{ (setData[0].provinceValue || setData[0].provinceValue==0)?'-'+(setData[0].provinceValue).toFixed(2):'--' }}</span>
         </div>
       </template>
       <!-- 市价特价 -->
@@ -171,7 +171,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?setData[0].cityValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].cityValue || setData[0].cityValue==0)?'-'+setData[0].cityValue:'--' }}</span>
+          <span v-else>{{ (setData[0].cityValue || setData[0].cityValue==0)?'-'+(setData[0].cityValue).toFixed(2):'--' }}</span>
         </div>
       </template>
       <!-- 特约特价 -->
@@ -218,7 +218,7 @@
         </div>
         <div v-else>
           <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?setData[0].specialValue+'%':'--' }}</span>
-          <span v-else>{{ (setData[0].specialValue || setData[0].specialValue==0)?'-'+setData[0].specialValue:'--' }}</span>
+          <span v-else>{{ (setData[0].specialValue || setData[0].specialValue==0)?'-'+(setData[0].specialValue).toFixed(2):'--' }}</span>
         </div>
       </template>
       <!-- 设置起订量 -->