This commit is contained in:
linfso 2024-08-31 17:10:34 +08:00
parent e3a60c6245
commit d2aacd439e
3 changed files with 58 additions and 12 deletions

View File

@ -1369,6 +1369,16 @@ methods: {
this.form.feeItems=[];
}
let expr="s+w*d";
if((newItem.initialWeightFee>0||newItem.addWeightPrice>0) && this.form.settlementWeight!=null){
expr=expr.replace("s",newItem.initialWeightFee);
expr=expr.replace("d",newItem.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
newItem.realFee=parseFloat(eval(expr)).toFixed(2);
newItem.fee=newItem.realFee;
}
this.form.feeItems.push(newItem);
this.form.blSpecialQuote='1';
@ -1903,7 +1913,7 @@ methods: {
}
}
newFee=newFee.toFixed(2);
newFee=Number(newFee).toFixed(2);
totalFee=Number(totalFee)+Number(newFee);
if(item.blAutoGen==0){

View File

@ -1369,6 +1369,16 @@ methods: {
this.form.feeItems=[];
}
let expr="s+w*d";
if((newItem.initialWeightFee>0||newItem.addWeightPrice>0) && this.form.settlementWeight!=null){
expr=expr.replace("s",newItem.initialWeightFee);
expr=expr.replace("d",newItem.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
newItem.realFee=parseFloat(eval(expr)).toFixed(2);
newItem.fee=newItem.realFee;
}
this.form.feeItems.push(newItem);
this.form.blSpecialQuote='1';
@ -1903,7 +1913,7 @@ methods: {
}
}
newFee=newFee.toFixed(2);
newFee=Number(newFee).toFixed(2);
totalFee=Number(totalFee)+Number(newFee);
if(item.blAutoGen==0){

View File

@ -1361,6 +1361,16 @@ export default {
if(!this.form.feeItems){
this.form.feeItems=[];
}
let expr="s+w*d";
if((newItem.initialWeightFee>0||newItem.addWeightPrice>0) && this.form.settlementWeight!=null){
expr=expr.replace("s",newItem.initialWeightFee);
expr=expr.replace("d",newItem.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
newItem.realFee=parseFloat(eval(expr)).toFixed(2);
newItem.fee=newItem.realFee;
}
this.form.feeItems.push(newItem);
this.handleCalcFeeItem();
}
@ -1789,14 +1799,31 @@ export default {
},
async handleCalcFeeItem(row){
if(row!=null && this.form.settlementWeight!=null){
let expr="s+w*d";
if(row.initialWeightFee>0||row.addWeightPrice>0){
expr=expr.replace("s",row.initialWeightFee);
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
row.realFee=parseFloat(eval(expr));
row.realFee=realFee.toFixed(2);
if(row.calcExp&&row.calcExp!='undefined'){
let expr=row.calcExp;
// 如果公式包含变量,使用变量进行计算
if(expr.indexOf('s')!=-1 || expr.indexOf('d')!=-1){
expr=expr.replace("s",row.initialWeightFee);
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
row.realFee=parseFloat(eval(expr)).toFixed(2);
}else{
//
}
}else{
let expr="s+w*d";
if(row.initialWeightFee>0||row.addWeightPrice>0){
expr=expr.replace("s",row.initialWeightFee);
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
row.realFee=parseFloat(eval(expr)).toFixed(2);
// console.log("===>calcExp222==expr==>",expr);
// console.log("===>calcExp222==row==>",row);
}
}
}
let totalFee=Number(0);
@ -1814,13 +1841,12 @@ export default {
}
}
newFee=Number(newFee).toFixed(2);
totalFee=Number(totalFee)+Number(newFee);
if(item.blAutoGen==0){
item.fee=item.realFee;
}
newFee=newFee.toFixed(2);
totalFee=Number(totalFee)+Number(newFee);
}
}
this.form.freight = totalFee.toFixed(2);