Commit 98880691 authored by dragondean@qq.com's avatar dragondean@qq.com

创建报价单支持路线设置的保费币种

parent c1f871c8
......@@ -310,7 +310,7 @@
<el-descriptions :column="5" border>
<el-descriptions-item :label="$t('保价费')">
{{fee.insuranceFee || 0}} {{$t('美元')}}
{{fee.insuranceFee || 0}} {{ selectedRouter ? currencyMap[selectedRouter.currencyUnit || 1] : '' }}
</el-descriptions-item>
<el-descriptions-item :label="$t('总运费')">
<template v-for="item in freightFeeList">
......@@ -730,8 +730,6 @@ export default {
// 预计费用(原价 - 优惠金额 + 其他费用 + 保价费)
estimatedCosts(){
let arr = []
let withInsuranceFee = false
let withOtherFee = false
this.originalFeeList.forEach(item => {
let it = {
currencyId: item.currencyId,
......@@ -741,50 +739,31 @@ export default {
if(coupon){
it.amount = it.amount.minus(coupon.reduceTotalAmount)
}
if(this.form.otherFee && this.form.otherFeeCurrencyId == item.currencyId){
it.amount = it.amount.plus(this.form.otherFee)
withOtherFee = true
}
// 保价费(美元)
if(item.currencyId == 1 && this.fee && this.fee.insuranceFee){
it.amount = it.amount.plus(this.fee.insuranceFee)
withInsuranceFee = true
}
arr.push(it)
})
// 没有累加保价费(没有美元计价)但是有保价费则需要加上去
if(!withInsuranceFee && this.fee && this.fee.insuranceFee){
let fee = Decimal(this.fee.insuranceFee)
// 如果没有美元费用,且保价费和其他费用币种相同(都是美元)
if(this.form.otherFeeCurrencyId == 1 && this.form.otherFee){
withOtherFee = true
fee = fee.plus(new Decimal(this.form.otherFee || 0))
}
// 累加保价费
const insuranceFeeIndex = arr.findIndex(item => item.currencyId == this.insuranceFeeCurrency)
if(insuranceFeeIndex > -1){
arr[insuranceFeeIndex].amount = arr[insuranceFeeIndex].amount.plus(this.fee.insuranceFee || 0)
}else{
arr.push({
currencyId: 1,
amount: fee
currencyId: this.insuranceFeeCurrency,
amount: Decimal(this.fee.insuranceFee || 0)
})
}
// 如果没有累加其他费用,则另外增加货币
if(!withOtherFee && this.form.otherFee){
let fee = {
// 累加其他费用
const otherFeeIndex = arr.findIndex(item => item.currencyId == this.form.otherFeeCurrencyId)
if(otherFeeIndex > -1){
arr[otherFeeIndex].amount = arr[otherFeeIndex].amount.plus(this.form.otherFee || 0)
}else{
arr.push({
currencyId: this.form.otherFeeCurrencyId,
amount: Decimal(this.form.otherFee)
}
// 如果保价费跟其他费用是同一种货币(都是美元)
if(!withInsuranceFee && this.fee && this.fee.insuranceFee && this.form.otherFeeCurrencyId == 1){
fee.amount = fee.amount.plus(this.fee.insuranceFee)
}
arr.push(fee)
amount: Decimal(this.form.otherFee || 0)
})
}
return arr
},
// 路线开通的服务
......@@ -792,6 +771,10 @@ export default {
if(!this.selectedRouter || !this.selectedRouter.otherService) return []
return this.selectedRouter.otherService.split(',')
},
// 保价费单位(路线里设置,默认美元)
insuranceFeeCurrency() {
return this.selectedRouter?.currencyUnit || 1;
},
// 是否可以添加商品
canAddProduct(){
if(!this.form.lineId){
......
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