|
@@ -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 () {
|