Bläddra i källkod

销售订单-子表计算公式修改

jingbb 1 månad sedan
förälder
incheckning
2486796a98
1 ändrade filer med 7 tillägg och 13 borttagningar
  1. 7 13
      src/views/saleCode/quotation/components/quotationFormForm.vue

+ 7 - 13
src/views/saleCode/quotation/components/quotationFormForm.vue

@@ -942,7 +942,8 @@
         prop.row.intermediatorCommission =prop.row.intermediatorCommission == '' || prop.row.intermediatorCommission === null || !prop.row.intermediatorCommission? 0: prop.row.intermediatorCommission;
         //计算销售单价
         if (prop.col.key == 'purchasePrice' || prop.col.key == 'taxRate' || prop.col.key == 'tariff' || prop.col.key == 'discount' || prop.col.key == 'grossMargin' || prop.col.key == 'customerCommision' || prop.col.key == 'intermediatorCommission') {
-          var num =((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100);
+          // var num =((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100);
+          var num=(prop.row.purchasePrice * Number(formData.exchangeRate)*(1 + prop.row.tariff / 100))/(1 - prop.row.grossMargin / 100 - prop.row.customerCommision / 100)*(1 + prop.row.taxRate / 100)/(1 - prop.row.discount / 100)
           prop.row.salePrice = !isNaN(num) ? num.toFixed(2) : '';
           if (prop.row.quantity) {
             prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2); //计算金额
@@ -959,7 +960,8 @@
         }
         //计算毛利率/金额
         if (prop.col.key == 'salePrice') {
-          var num =1 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100-((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /prop.row.salePrice;
+          // var num =1 - prop.row.customerCommision / 100 - prop.row.intermediatorCommission / 100-((prop.row.purchasePrice / Number(formData.exchangeRate)) *(1 + prop.row.taxRate / 100) *(1 + prop.row.tariff / 100) *(1 - prop.row.discount / 100)) /prop.row.salePrice;
+          var num = 1-(prop.row.customerCommision / 100)-(prop.row.purchasePrice*Number(formData.exchangeRate)*(1 + prop.row.tariff / 100))/(prop.row.salePrice/((1 + prop.row.taxRate / 100)/(1 - prop.row.discount / 100)))
           num = (Number(num) * 100).toFixed(2);
           prop.row.grossMargin = !isNaN(num) ? num : '';
           if (prop.row.quantity) {
@@ -977,17 +979,9 @@
             item.discount = formData.custumerDiscount == '' || formData.custumerDiscount === null || !formData.custumerDiscount ? 0 : formData.custumerDiscount;
             item.tariff = item.tariff == '' || item.tariff === null || !item.tariff ? 0 : item.tariff;
             item.customerCommision = item.customerCommision == '' || item.customerCommision === null || !item.customerCommision ? 0 : item.customerCommision;
-            item.intermediatorCommission =
-              item.intermediatorCommission == '' || item.intermediatorCommission === null || !item.intermediatorCommission
-                ? 0
-                : item.intermediatorCommission;
+            item.intermediatorCommission =item.intermediatorCommission == '' || item.intermediatorCommission === null || !item.intermediatorCommission? 0: item.intermediatorCommission;
             //汇率默认为1
-            var num =
-              ((item.purchasePrice / Number(formData.exchangeRate)) *
-                (1 + item.taxRate / 100) *
-                (1 + item.tariff / 100) *
-                (1 - item.discount / 100)) /
-              (1 - item.grossMargin / 100 - item.customerCommision / 100 - item.intermediatorCommission / 100);
+            var num =(item.purchasePrice * Number(formData.exchangeRate)*(1 + item.tariff / 100))/(1 - item.grossMargin / 100 - item.customerCommision / 100)*(1 + item.taxRate / 100)/(1 -item.discount / 100)
             item.salePrice = !isNaN(num) ? num.toFixed(2) : '';
             if (item.quantity) {
               item.taxAmount = (item.salePrice * item.quantity).toFixed(2);
@@ -1029,7 +1023,7 @@
       async function getLinkOptionsArr(customerId){
         var obj = await LinkOption({id:customerId})
         linkOption.value = obj
-        if(obj.lenght!==0){
+        if(obj.lenght!==0&&typeof obj === 'undefined'){
            formData.liaisonId = obj[0].id
           formData.liaisonInfo = obj[0].name
         }