|
@@ -138,15 +138,13 @@
|
|
|
</a-select>
|
|
|
<a-table
|
|
|
v-show="form.discountType!=0"
|
|
|
- class="sTable"
|
|
|
ref="setTable"
|
|
|
- size="small"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="setColumns"
|
|
|
:dataSource="setTableData"
|
|
|
:pagination="false"
|
|
|
style="width:60%;"
|
|
|
- bordered>
|
|
|
+ >
|
|
|
<template slot="provinceDiscount" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
size="small"
|
|
@@ -216,6 +214,20 @@
|
|
|
placeholder="请输入"
|
|
|
@blur="handleSpecialPrice"/>
|
|
|
</template>
|
|
|
+ <template slot="orginAmount" slot-scope="text, record">
|
|
|
+ <a-input-number
|
|
|
+ size="small"
|
|
|
+ :id="'promotionList-orginAmountValue'+record.id"
|
|
|
+ v-model="record.orginAmountValue"
|
|
|
+ :min="0"
|
|
|
+ :precision="2"
|
|
|
+ :max="99999999"
|
|
|
+ placeholder="请输入"/>
|
|
|
+ </template>
|
|
|
+ <template slot="actions" slot-scope="text, record, index">
|
|
|
+ <a-button v-if="index==0" size="small" type="link" class="button-info" @click="addTableData"><a-icon type="plus"/>新增</a-button>
|
|
|
+ <a-button v-else size="small" type="link" @click="delTableData(record,index)"><a-icon type="delete"/>删除</a-button>
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</a-form-model-item>
|
|
|
<a-form-model-item label="规则叠加" v-if="form.discountType!=0">
|
|
@@ -361,15 +373,17 @@ export default {
|
|
|
var arr = []
|
|
|
if (_this.form.discountType === '1') {
|
|
|
arr = [
|
|
|
- { title: '省价折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '33%', align: 'center' },
|
|
|
- { title: '市价折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '33%', align: 'center' },
|
|
|
- { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '33%', align: 'center' }
|
|
|
+ { title: '特价产品原价金额', scopedSlots: { customRender: 'orginAmount' }, width: '30%', align: 'left' },
|
|
|
+ { title: '省价折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '20%', align: 'left' },
|
|
|
+ { title: '市价折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '20%', align: 'left' },
|
|
|
+ { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '20%', align: 'left' },
|
|
|
+ { title: '', scopedSlots: { customRender: 'actions' }, width: '10%', align: 'center' }
|
|
|
]
|
|
|
} else if (_this.form.discountType === '2') {
|
|
|
arr = [
|
|
|
- { title: '省价直降', scopedSlots: { customRender: 'provincePrice' }, width: '33%', align: 'center' },
|
|
|
- { title: '市价直降', scopedSlots: { customRender: 'cityPrice' }, width: '33%', align: 'center' },
|
|
|
- { title: '特约直降', scopedSlots: { customRender: 'specialPrice' }, width: '33%', align: 'center' }
|
|
|
+ { title: '省价直降', scopedSlots: { customRender: 'provincePrice' }, width: '33%', align: 'left' },
|
|
|
+ { title: '市价直降', scopedSlots: { customRender: 'cityPrice' }, width: '33%', align: 'left' },
|
|
|
+ { title: '特约直降', scopedSlots: { customRender: 'specialPrice' }, width: '33%', align: 'left' }
|
|
|
]
|
|
|
}
|
|
|
return arr
|
|
@@ -398,6 +412,7 @@ export default {
|
|
|
this.form.discountType = val
|
|
|
this.$refs.specialProduct.reSetTableData()
|
|
|
this.setTableData = [{
|
|
|
+ orginAmountValue: 0,
|
|
|
provinceValue: undefined,
|
|
|
cityValue: undefined,
|
|
|
specialValue: undefined
|
|
@@ -435,6 +450,24 @@ export default {
|
|
|
this.form.gateValue = undefined
|
|
|
this.form.quotaAmount = undefined
|
|
|
},
|
|
|
+ // 新增特价规则阶梯
|
|
|
+ addTableData () {
|
|
|
+ const len = this.setTableData.length
|
|
|
+ if (len >= 5) {
|
|
|
+ this.$message.warning('最多只能添加5条!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.setTableData.push({
|
|
|
+ orginAmountValue: 0,
|
|
|
+ provinceValue: undefined,
|
|
|
+ cityValue: undefined,
|
|
|
+ specialValue: undefined
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除特价规则阶梯
|
|
|
+ delTableData (row, index) {
|
|
|
+ this.setTableData.splice(index, 1)
|
|
|
+ },
|
|
|
// 保存
|
|
|
handleSave () {
|
|
|
const _this = this
|
|
@@ -452,9 +485,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// 验证特价规则条件必填
|
|
|
+ console.log(_this.setTableData)
|
|
|
if (_this.form.discountType != '0' && _this.setTableData) {
|
|
|
- if (_this.setTableData[0].provinceValue == undefined || _this.setTableData[0].cityValue == undefined || _this.setTableData[0].specialValue == undefined) {
|
|
|
- _this.$message.warning('特价规则条件不能为空!')
|
|
|
+ const hasTemp = _this.setTableData.some(item => {
|
|
|
+ if (_this.form.discountType == '2' || _this.setTableData.length == 1) {
|
|
|
+ return item.provinceValue == undefined || item.cityValue == undefined || item.specialValue == undefined
|
|
|
+ }
|
|
|
+ return item.orginAmountValue == 0 || item.provinceValue == undefined || item.cityValue == undefined || item.specialValue == undefined
|
|
|
+ })
|
|
|
+ if (hasTemp) {
|
|
|
+ _this.$message.warning(_this.form.discountType == '2' || _this.setTableData.length == 1 ? '特价规则条件不能为空!' : '特价规则条件不能为空且原价金额必需大于0!')
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -484,7 +524,7 @@ export default {
|
|
|
if (_this.isJudge(form.specialProductList, '特价')) {
|
|
|
return
|
|
|
}
|
|
|
- // 手动输入必填项
|
|
|
+ // 校验产品折扣手动输入必填项
|
|
|
if (form.discountType === '0') {
|
|
|
const isCountEmpty = _this.isNumEmpty(form.specialProductList)
|
|
|
if (isCountEmpty.flag) {
|
|
@@ -502,6 +542,7 @@ export default {
|
|
|
}
|
|
|
// 组后端所需数据
|
|
|
form.promotionSn = _this.promotionSn
|
|
|
+ // 门槛描述
|
|
|
if (form.gateFlag == '1') {
|
|
|
if (form.gateType === 'RATIO_AMOUNT') {
|
|
|
form.gateInfo = '购买门槛产品金额' + (form.gateValue * 100).toFixed(2) + '%作为配额'
|
|
@@ -511,6 +552,7 @@ export default {
|
|
|
form.gateInfo = '购买每满' + (form.gateUnit == 'YUAN' ? (form.gateValue).toFixed(2) : form.gateValue) + (form.gateUnit == 'YUAN' ? '元' : '个') + '门槛产品,可采购' + form.quotaAmount + '个特价产品(配额算销售额)'
|
|
|
}
|
|
|
}
|
|
|
+ // 规则描述
|
|
|
let infoDetail = `<div>${form.stackFlag == '1' ? '规则叠加;' : ''}</div>`
|
|
|
if (form.discountType == '0') {
|
|
|
infoDetail += '手动输入特价'
|