From d2aacd439e4eda6a37e56a8dfbc07b09c6973a38 Mon Sep 17 00:00:00 2001 From: linfso Date: Sat, 31 Aug 2024 17:10:34 +0800 Subject: [PATCH] md --- src/views/emis/emisWaybill/waybillModify.vue | 12 ++++- src/views/emis/emisWaybill/waybillRecord.vue | 12 ++++- .../emisWaybillAjustApply/adjustPanel.vue | 46 +++++++++++++++---- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/views/emis/emisWaybill/waybillModify.vue b/src/views/emis/emisWaybill/waybillModify.vue index 277f164e..7d1e4b1c 100644 --- a/src/views/emis/emisWaybill/waybillModify.vue +++ b/src/views/emis/emisWaybill/waybillModify.vue @@ -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){ diff --git a/src/views/emis/emisWaybill/waybillRecord.vue b/src/views/emis/emisWaybill/waybillRecord.vue index 5dfa0054..75698468 100644 --- a/src/views/emis/emisWaybill/waybillRecord.vue +++ b/src/views/emis/emisWaybill/waybillRecord.vue @@ -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){ diff --git a/src/views/emis/emisWaybillAjustApply/adjustPanel.vue b/src/views/emis/emisWaybillAjustApply/adjustPanel.vue index c380bffd..da672c49 100644 --- a/src/views/emis/emisWaybillAjustApply/adjustPanel.vue +++ b/src/views/emis/emisWaybillAjustApply/adjustPanel.vue @@ -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);