فهرست منبع

处理优惠费用的精度丢失问题

祁鹏飞 1 ماه پیش
والد
کامیت
1302e4e151
1فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 5 4
      src/views/insurancePolicy/index.vue

+ 5 - 4
src/views/insurancePolicy/index.vue

@@ -1541,6 +1541,7 @@ import QRCode from 'qrcode'
 import dayjs from "dayjs"
 // 导入日期格式化函数
 import { gainFocus } from "@/utils/dataformat"
+import Decimal from 'decimal.js'
 
 // 下拉选项接口定义
 interface OptionItem {
@@ -3794,7 +3795,7 @@ const quoteInsurance = async (companyId: any, companyIndex: any, val: any) => {
             commissionPremium: feeOrders.jqCommissionPremium ?? 0,
             commissionRatio: feeOrders.jqCommissionRatio ?? 0,
             exportPremium: feeOrders.jqExportPremium ?? 0,
-            exportRatio: (feeOrders.jqExportRatio ?? 0) * 100 + '%',
+            exportRatio: new Decimal(feeOrders.jqExportRatio ?? 0).times(100) + '%',
           }, {
             name: '商业',  // 商业险费用明细
             additionalPremium: feeOrders.syAdditionalPremium ?? 0,
@@ -3802,7 +3803,7 @@ const quoteInsurance = async (companyId: any, companyIndex: any, val: any) => {
             commissionPremium: feeOrders.syCommissionPremium ?? 0,
             commissionRatio: feeOrders.syCommissionRatio ?? 0,
             exportPremium: feeOrders.syExportPremium ?? 0,
-            exportRatio: (feeOrders.syExportRatio ?? 0) * 100 + '%',
+            exportRatio: new Decimal(feeOrders.syExportRatio ?? 0).times(100) + '%',
           }, {
             name: '驾意险',  // 驾意险费用明细
             additionalPremium: feeOrders.jyAdditionalPremium ?? 0,
@@ -3810,10 +3811,10 @@ const quoteInsurance = async (companyId: any, companyIndex: any, val: any) => {
             commissionPremium: feeOrders.jyCommissionPremium ?? 0,
             commissionRatio: feeOrders.jyCommissionRatio ?? 0,
             exportPremium: feeOrders.jyExportPremium ?? 0,
-            exportRatio: (feeOrders.jyExportRatio ?? 0) * 100 + '%',
+            exportRatio: new Decimal(feeOrders.jyExportRatio ?? 0).times(100) + '%',
           }, {
             name: '总计',  // 总计
-            exportPremium: (feeOrders.jyExportPremium ?? 0) + (feeOrders.syExportPremium ?? 0) + (feeOrders.jqExportPremium ?? 0),
+            exportPremium: new Decimal(feeOrders.jyExportPremium ?? 0).plus(feeOrders.syExportPremium ?? 0).plus(feeOrders.jqExportPremium ?? 0),
             exportRatio: '--',
           },
         ]