|
@@ -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
|