Преглед изворни кода

fix: 采购订单计算总重保留4位小数

liujt пре 7 месеци
родитељ
комит
a5a07e739a

+ 4 - 1
src/BIZComponents/setProduct.js

@@ -1,7 +1,9 @@
 import Vue from 'vue';
+import _ from 'lodash';
 
 //改变数量
 export function changeCount(row, countObj, noDiscountSingle) {
+  console.log('改变数量~~~~', row, countObj, noDiscountSingle);
   let total = row[countObj.countKey] || 0;
   let data = row;
   if (row.packageDispositionList) {
@@ -42,7 +44,8 @@ function setWeight(row) {
   if (row.weightUnit == row.measuringUnit) {
     row['totalWeight'] = row.totalCount;
   } else if (row.totalCount && row.singleWeight) {
-    row['totalWeight'] = row.totalCount * row.singleWeight;
+    // 使用lodash的round函数保留4位小数并向上舍入
+    row['totalWeight'] = _.round(row.totalCount * row.singleWeight, 4, Math.ceil);
   } else {
     row['totalWeight'] = 0;
   }

+ 1 - 0
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -1067,6 +1067,7 @@
         // if (this.detailType) {
         //   return;
         // }
+        console.log('changeCount~~', row);
         let countObj = {
           countKey: 'purchaseCount',
           unitKey: 'purchaseUnit',