Commit 6a840832 authored by dragondean@qq.com's avatar dragondean@qq.com

批量设置价格优化

parent c6fad928
......@@ -39,10 +39,14 @@
{{$t('第{index}阶梯定价方案', {index: index+1})}}
<template v-if="index == form.priceStepList.length - 1">
<el-link type="primary" @click.native="form.priceStepList.push({})">{{$t('添加区间')}}</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click.native="form.priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
<el-divider v-if="index" direction="vertical"></el-divider>
<el-link v-if="index" type="danger" @click.native="form.priceStepList.splice(index, 1)">{{$t('删除')}}</el-link>
</template>
</div>
<div v-if="willBeIgnore(item)" style="color:red">{{$t('此阶梯未设置阶梯和价格,将会被忽略')}}</div>
<div v-else-if="!isStepPriceOk(item)" style="color:red">{{$t('此阶梯价信息设置不完整')}}</div>
<el-form-item :label="$t(`第{index}阶梯`, {index: index+1})">
<el-input v-model="item.startNum" type="number" placeholder="" class="w100"></el-input>
-
......@@ -255,7 +259,33 @@ export default {
}
return {currency, unit}
}
},
// 判断是否空值
isEmpty(){
return (content) => {
return !content && content !== 0 && content !== '0'
}
},
// 判断某个阶梯价是否会被忽略
willBeIgnore(){
return (stepPrice) => {
if(!this.isEmpty(stepPrice.startNum) || !this.isEmpty(stepPrice.endNum)) return false
if(this.form.priceType == 1 && !this.isEmpty(stepPrice.allPrice)) return false
if(this.form.priceType != 1 && !this.isEmpty(stepPrice.transportPrice) && !this.isEmpty(stepPrice.clearancePrice)) return false
return true
}
},
// 判断阶梯价是否设置不完整
isStepPriceOk(){
return (stepPrice) => {
if(this.isEmpty(stepPrice.startNum) || this.isEmpty(stepPrice.endNum)) return false
if(this.form.priceType == 1 && (this.isEmpty(stepPrice.allPrice) || this.isEmpty(stepPrice.allPriceUnit) || this.isEmpty(stepPrice.allVolumeUnit))) return false
else if(this.isEmpty(stepPrice.transportPrice) || this.isEmpty(stepPrice.transportPriceUnit)){ // 清关费可能为0或者空
return false
}
return true
}
},
},
watch: {
checkList() { //选择路线
......@@ -504,6 +534,27 @@ export default {
// 没有设置阶梯价格则不提交priceStepList
if(data.stepPrice != 1){
delete data.priceStepList
}else{
// 根据23-11-23 21点左右的群讨论,阶梯价如果留空则不提交,如果全部为空则不提交此字段
// 相关工单 https://zentao.test.jdshangmen.com/bug-view-5460.html
// 填写不完整的给提示
let notOk = []
data.priceStepList.forEach((item, index) => {
if(!this.willBeIgnore(item) && !this.isStepPriceOk(item)){
notOk.push(index + 1)
}
})
if(notOk.length){
return this.$confirm(this.$t("第{steps}阶梯设置不完整", {steps: notOk.join(",")}))
}
// 删除未填写的阶梯价
data.priceStepList = data.priceStepList.filter(item => {
return !this.willBeIgnore(item)
})
if(!data.priceStepList.length){
delete data.priceStepList
}
}
data.lineChannelList = this.selectedRoutes
......
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