Commit 4e4a145b authored by dragondean@qq.com's avatar dragondean@qq.com

完善海运价格编辑和批量设置

parent 161770b9
This diff is collapsed.
...@@ -371,12 +371,14 @@ export default { ...@@ -371,12 +371,14 @@ export default {
if(this.form.stepPrice === 1){ if(this.form.stepPrice === 1){
this.initStepPrice() this.initStepPrice()
} }
this.syncMinWeightUnit()
}, },
'form.stepPrice'(stepPrice){ 'form.stepPrice'(stepPrice){
if(this.form.stepPrice === 1){ if(this.form.stepPrice === 1){
this.initStepPrice() this.initStepPrice()
} }
this.stepPrice = !!stepPrice this.stepPrice = !!stepPrice
this.syncMinWeightUnit()
}, },
needPay(val){ needPay(val){
this.$set(this.form, 'needPay', val ? 1 : 0) this.$set(this.form, 'needPay', val ? 1 : 0)
...@@ -521,6 +523,21 @@ export default { ...@@ -521,6 +523,21 @@ export default {
}) })
}, },
methods: { methods: {
// 设置最小起计量单位
syncMinWeightUnit(){
// 如果是阶梯价
if(this.form.stepPrice){
const field = this.form.priceType === 1 ? "fullPriceStepList" : "freightPriceStepList"
const stepPriceList = this.form[field]
if(stepPriceList?.length){
this.form.minWeightUnit = stepPriceList[0]?.weightUnit || DEFAULT_WEIGHT_UNIT
}else {
this.form.minWeightUnit = DEFAULT_WEIGHT_UNIT
}
}else{
this.form.minWeightUnit = this.form[this.form.priceType === 1 ? 'allVolumeUnit' : 'transportVolumeUnit'] || DEFAULT_WEIGHT_UNIT
}
},
handleAddPrice(field, fieldPrefix){ handleAddPrice(field, fieldPrefix){
if(!this.form[field]){ if(!this.form[field]){
this.$set(this.form, field, []) this.$set(this.form, field, [])
...@@ -593,11 +610,18 @@ export default { ...@@ -593,11 +610,18 @@ export default {
}, },
// 非阶梯价格更新单位 // 非阶梯价格更新单位
handleFormUnitChange(data){ handleFormUnitChange(data){
// 海运非阶梯价没有重量单位,所以按照体积单位同步最小起计量单位
if(data.field === 'transportVolumeUnit' || data.field == 'allVolumeUnit'){
this.form.minWeightUnit = data.value
}
if(this.form.specialList?.length){ if(this.form.specialList?.length){
this.form.specialList.forEach(p => { this.form.specialList.forEach(p => {
p[data.field] = data.value p[data.field] = data.value
}) })
} }
// TODO 等加了包装之后还需要同步包装的单位
}, },
initStepPrice(){ initStepPrice(){
if(this.form.priceType == 1 && !this.form.fullPriceStepList?.length){ if(this.form.priceType == 1 && !this.form.fullPriceStepList?.length){
......
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