Browse Source

修改销售报价单毛利率

yh 1 week ago
parent
commit
73e917739b
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/views/saleCode/quotation/components/quotationFormForm.vue

+ 6 - 6
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -1008,7 +1008,7 @@
             prop.row.intermediatorCommission / 100 -
             (prop.row.purchasePrice * Number(formData.exchangeRate) * (1 + prop.row.tariff / 100) * (1 + prop.row.tariff / 100)) / prop.row.salePrice;
           num = (Number(num) * 100).toFixed(2);
-          prop.row.grossMargin = !isNaN(num) ? num : '';
+          prop.row.grossMargin = !isNaN(num) && isFinite(num) ? num : '';
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
           }
@@ -1074,13 +1074,13 @@
           purchasePriceAll = 0;
         var xTable = saleQuotationFormProductTableRef.value!.getXTable().data;
         xTable.map((item) => {
-          customerCommisionAll += (Number(item.customerCommision) / 100) * Number(item.taxAmount);
-          platformCommisionAll += (Number(item.intermediatorCommission) / 100) * Number(item.taxAmount);
-          salePriceAll += Number(item.taxAmount);
-          purchasePriceAll += Number(item.purchaseAmount);
+          customerCommisionAll += (Number(item.customerCommision || 0) / 100) * Number(item.taxAmount || 0);
+          platformCommisionAll += (Number(item.intermediatorCommission || 0) / 100) * Number(item.taxAmount || 0);
+          salePriceAll += Number(item.taxAmount || 0);
+          purchasePriceAll += Number(item.purchaseAmount || 0);
         });
         formData.grossMarginHead =
-          (salePriceAll - customerCommisionAll - platformCommisionAll - purchasePriceAll / Number(formData.exchangeRate)) / salePriceAll;
+          (salePriceAll - customerCommisionAll - platformCommisionAll - purchasePriceAll / Number(formData.exchangeRate)) / salePriceAll || 0;
         formData.grossMarginHead = (Number(formData.grossMarginHead) * 100).toFixed(2);
       }
       async function getLinkOptionsArr(customerId) {