Selaa lähdekoodia

解决打印时部分数字精度异常问题

lph 1 vuosi sitten
vanhempi
säilyke
7978a8552b

+ 2 - 1
zkqy-ui/src/utils/print/deliverOrderPrint.js

@@ -43,7 +43,7 @@ function receiptDocuments(data, domId) {
     if (item.weight) {
       totalWeight += Number(item.weight);
     }
-    totalWeight = totalWeight.toFixed(2);
+
     printContent += `<tr align="center">
       <td>${item.productCode}</td>
       <td>${item.productName}</td>
@@ -55,6 +55,7 @@ function receiptDocuments(data, domId) {
       <td>${item.weight}</td>
       </tr>`
   }
+  totalWeight = totalWeight.toFixed(2);
   printContent += `<tr align="center">
             <td colspan="6" align="left">合计</td>
             <td>${totalBoxNum}</td>

+ 2 - 0
zkqy-ui/src/utils/print/outBoundPrint.js

@@ -57,6 +57,8 @@ function outBoundPrint(data, domId) {
       <td>${productAmounts}</td>
       </tr>`
   }
+  totalPrice = totalPrice.toFixed(2);
+  totalWeight = totalWeight.toFixed(2);
   printContent += `<tr style="text-align: center;border: none;">
         <td style="width: 100px;">合计</td>
         <td style="width: 100px;"></td>

+ 3 - 1
zkqy-ui/src/utils/print/sendOrderPrint.js

@@ -61,7 +61,7 @@ function receiptDocuments(data, domId) {
       totalPrice += price
     }
     price = price.toFixed(2);
-    totalPrice = totalPrice.toFixed(2);
+
     printContent += `<tr align="center">
       <td>${item.productName}</td>
       <td>${item.productSpecifications}</td>
@@ -74,6 +74,8 @@ function receiptDocuments(data, domId) {
       <td>${price}</td>
       </tr>`
   }
+  totalWeight = totalWeight.toFixed(2);
+  totalPrice = totalPrice.toFixed(2);
   printContent += `<tr align="center">
               <td colspan="5">合计</td>
               <td>${totalBoxNum}</td>

+ 9 - 9
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -1067,14 +1067,14 @@ export default {
       });
       this.changeGrossWeight(this.printTableData[0]);
       // 前端打印
-      codeListPrint(this.printTableData, "printDom");
+      // codeListPrint(this.printTableData, "printDom");
 
-      if (this.excuteType == 1) {
-        this.tableData.push(this.printTableData[0]);
-      }
+      // if (this.excuteType == 1) {
+      //   this.tableData.push(this.printTableData[0]);
+      // }
       // 后端打印
       console.log("newPrintHandler");
-      // this.newPrintHandler();
+      this.newPrintHandler();
     },
     // 获取机台选项数据
     async getLineOptionLsit() {
@@ -1319,10 +1319,10 @@ export default {
         this.tableData = [];
         // this.$refs.form.resetFields();
         this.nowWeight = 0;
-        if (!this.printAuto) {
-          // 手动打印  获取码单号
-          this.getQrCodeHandle();
-        }
+        // if (!this.printAuto) {
+        // 手动打印  获取码单号
+        this.getQrCodeHandle();
+        // }
       }
       this.currentRow = val;
     },

+ 3 - 1
zkqy-ui/src/views/orderMange/index.vue

@@ -1853,7 +1853,9 @@ export default {
         productNumber,
         productUnitPrice
       );
-      row.productAmounts = Number(productNumber) * Number(productUnitPrice);
+      row.productAmounts = (
+        Number(productNumber) * Number(productUnitPrice)
+      ).toFixed(2);
     },
     isUpperCase(char) {
       return char === char.toUpperCase();