浏览代码

四舍五入问题

TonyKang 4 年之前
父节点
当前提交
db91de01b1
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      web/building_saas/main/js/views/std_bills_unit_price_feature.js

+ 3 - 2
web/building_saas/main/js/views/std_bills_unit_price_feature.js

@@ -25,9 +25,10 @@ function chkAndSetBillsUnitPrice(billsNodes) {
     if (billsUnitPriceFeature !== null) {
         for (const node of billsNodes) {
             if (node.updateType === 'create') {
-                // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
                 let unitFeeVal = _commonChkAndSetPrice(node.updateData, true);
                 if (unitFeeVal !== 0) {
+                    // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
+                    unitFeeVal = unitFeeVal + 0.0000001; //前端四舍五入补偿用
                     node.updateData.calcFlag = 2; //当用户输入单价
                     if (!node.updateData.hasOwnProperty('fees')) {
                         node.updateData.fees = [];
@@ -46,6 +47,7 @@ function chkAndResetBills() {
         let unitFeeVal = _commonChkAndSetPrice(node.data, true);
         if (unitFeeVal !== 0) {
             // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
+            unitFeeVal = unitFeeVal + 0.0000001; //前端四舍五入补偿用
             if (!node.data.hasOwnProperty('fees')) {
                 node.data.fees = [];
             }
@@ -78,7 +80,6 @@ function chkAndAddEstUnitPrice(orgBills) {
                 unitFeeVal = unitFeeVal.toFixed(2);
                 if (unitFeeVal === '0.00') unitFeeVal = '';
             }
-            // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
             node.baseEstUnitPrice = unitFeeVal;
         }
     }