Prechádzať zdrojové kódy

fix:打印合计问题

liujt 3 týždňov pred
rodič
commit
264e0f5b0c

+ 3 - 3
src/BIZComponents/inventoryTable.vue

@@ -2283,7 +2283,7 @@
             item['customerMark'] = item.customerMark || this.customerMark;
             item['arrivalWay'] = item.arrivalWay || 1;
             item.discountRatio = Number(item.discountRatio) || 100; 
-            item.taxRate = item.taxRate ? item.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined;
+            item.taxRate = (item.taxRate !== undefined && item.taxRate !== null) ? item.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined;
             item.quoteWay = item.quoteWay || 1;
           });
           this.form.datasource = productList;
@@ -2384,7 +2384,7 @@
           this.$set(parasm, 'modelKey', item.modelKey || '');
           this.$set(parasm, 'colorKey', item.colorKey || '');
           if (this.defTaxRate) {
-            this.$set(parasm, 'taxRate', parasm.taxRate ? parasm.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined);
+            this.$set(parasm, 'taxRate', parasm.taxRate !== undefined && parasm.taxRate !== null ? parasm.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined);
           }
           this.$set(
             parasm,
@@ -2514,7 +2514,7 @@
           this.$set(parasm, 'batchNo', item.batchNo);
           this.$set(parasm, 'imgCode', '');
           this.$set(parasm, 'produceType', item.componentAttribute);
-          this.$set(parasm, 'taxRate', item.taxRate ? item.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined);
+          this.$set(parasm, 'taxRate', item.taxRate !== undefined && item.taxRate !== null? item.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined);
           let goodsData = await getGoodsByCategoryId(item.productId);
           goodsData = goodsData.filter((item) => item.approvalStatus == 2);
           if (goodsData?.length) {

+ 5 - 4
src/views/saleManage/saleOrder/components/printTemplateHt.vue

@@ -90,7 +90,7 @@
               <td style="padding: 2px"> {{ item.saleUnit }}</td>
               <td style="padding: 2px"> {{ item.saleCount }}</td>
               <td style="padding: 2px"> {{ item.singlePrice }}</td>
-              <td style="padding: 2px"> {{ item.taxRate }}{{ item.taxRate ? '%' : '0%' }}</td>
+              <td style="padding: 2px"> {{ item.taxRate }}{{ item.taxRate !== undefined && item.taxRate !== null ? '%' : '' }}</td>
               <td style="padding: 2px"> {{ item.totalPrice }}</td>
               <td style="padding: 2px"> {{ item.colorKey }}</td>
               <!-- <td style="padding: 5px"> {{ item.modelKey }}</td> -->
@@ -98,11 +98,11 @@
             </tr>
             <tr align="center">
               <td style="padding: 2px"> 合计 </td>
-              <td style="padding: 2px" colspan="2">{{ numberToChinese(getTotalValue(item, 'totalPrice', 2)) }}</td>
-              <td style="padding: 2px">{{ getTotalValue(item, 'saleCount', 2) }} </td>
+              <td style="padding: 2px" colspan="2">{{ numberToChinese(getTotalValue(wrapperItem, 'totalPrice', 2)) }}</td>
+              <td style="padding: 2px">{{ getTotalValue(wrapperItem, 'saleCount', 2) }} </td>
               <td style="padding: 2px"> </td>
               <td style="padding: 2px"> </td>
-              <td style="padding: 2px">{{ getTotalValue(item, 'totalPrice', 2) }}</td>
+              <td style="padding: 2px">{{ getTotalValue(wrapperItem, 'totalPrice', 2) }}</td>
               <td style="padding: 2px"> </td>
               <td style="padding: 2px"> </td>
               <!-- <td style="padding: 2px"> </td> -->
@@ -209,6 +209,7 @@
         this.QRvisible = false;
       },
       getTotalValue(itemI,key, num) {
+        console.log('itemI:', itemI, 'key:', key);
         let val = itemI?.productList?.reduce((total, item) => {
           return (total += Number(item[key]));
         }, 0);