Commit 324cd867 authored by dragondean@qq.com's avatar dragondean@qq.com

修复添加区间价没给默认值

parent 34a84154
......@@ -101,7 +101,7 @@
<div style="font-size:14px; margin:10px 0">
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="index == form.priceStepList.length - 1 && !readonly">
<el-link type="primary" @click.native="form.priceStepList.push({})">{{$t('添加区间')}}</el-link>
<el-link type="primary" @click.native="addStepPrice">{{$t('添加区间')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="form.priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
</template>
......@@ -956,6 +956,25 @@ export default {
// 加上对应的价格,但是不能小于0
this.$set(item, field, Math.max(0, Decimal(item[field] || 0).plus(amount).toNumber()))
})
},
// 添加区间价
addStepPrice(){
let fields = {}
const obj = this.form.priceStepList[0] || {}
if(this.form.priceType == 1){
fields = {
allPriceUnit: obj['allPriceUnit'],
allVolumeUnit: obj['allVolumeUnit']
}
}else{
fields = {
transportPriceUnit: obj.transportPriceUnit,
transportVolumeUnit: obj.transportVolumeUnit,
clearancePriceUnit: obj.clearancePriceUnit,
clearanceVolumeUnit: obj.transportVolumeUnit,
}
}
this.form.priceStepList.push(fields)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment