|
|
|
@ -364,6 +364,7 @@ |
|
|
|
<el-form-item label=" "> |
|
|
|
<div class="tier-action-buttons"> |
|
|
|
<el-button type="primary" class="customer-bun-min" @click="addTierRow">新增梯度</el-button> |
|
|
|
<el-button type="primary" class="customer-bun-min" @click="setNoTier">无梯度</el-button> |
|
|
|
<el-upload |
|
|
|
ref="tierUpload" |
|
|
|
action="#" |
|
|
|
@ -1085,7 +1086,30 @@ export default { |
|
|
|
this.tierDialogVisible = true |
|
|
|
}, |
|
|
|
addTierRow () { |
|
|
|
this.tierForm.tierPriceList.push(this.buildEmptyTierRow()) |
|
|
|
const rows = this.tierForm.tierPriceList |
|
|
|
// 新增梯度前需判断上一条结束数量不等于 0:未填写有效结束数量时阻止新增 |
|
|
|
if (rows.length) { |
|
|
|
const lastQtyEnd = this.normalizeNumberValue(rows[rows.length - 1].qtyEnd, 0) |
|
|
|
if (lastQtyEnd === 0) { |
|
|
|
this.$message.warning('请先填写上一条梯度的结束数量') |
|
|
|
return |
|
|
|
} |
|
|
|
// 新梯度的开始数量 = 上一条结束数量 + 1 |
|
|
|
const newRow = this.buildEmptyTierRow() |
|
|
|
newRow.qtyStart = lastQtyEnd + 1 |
|
|
|
rows.push(newRow) |
|
|
|
} else { |
|
|
|
rows.push(this.buildEmptyTierRow()) |
|
|
|
} |
|
|
|
}, |
|
|
|
setNoTier () { |
|
|
|
const rows = this.tierForm.tierPriceList || [] |
|
|
|
// 无梯度:仅允许存在一条价格梯度,将其结束数量置为上不封顶(1000000) |
|
|
|
if (rows.length !== 1) { |
|
|
|
this.$message.warning('当前产品有价格梯度,请删除多余价格信息') |
|
|
|
return |
|
|
|
} |
|
|
|
rows[0].qtyEnd = 1000000 |
|
|
|
}, |
|
|
|
removeTierRow (index) { |
|
|
|
this.tierForm.tierPriceList.splice(index, 1) |
|
|
|
|