Parcourir la source

fix:山东养护接口取费问题

vian il y a 1 an
Parent
commit
7d84e2b06e
1 fichiers modifiés avec 21 ajouts et 5 suppressions
  1. 21 5
      web/building_saas/standard_interface/import/shandong_common.js

+ 21 - 5
web/building_saas/standard_interface/import/shandong_common.js

@@ -145,6 +145,19 @@ INTERFACE_IMPORT = (() => {
         return tender;
       }
 
+      function handleBillPrice(bill, formula, totalFee, quantity) {
+        if (formula) {
+          bill.calcFlag = 1;
+          bill.exCalcStr = formula;
+        } else if (!formula && !quantity && totalFee) {
+          // 没有基数、没有工程量时,有金额时,金额作为基数
+          bill.exCalcStr = String(totalFee);
+          bill.calcFlag = 1;
+        } else {
+          bill.calcFlag = 2;
+        }
+      }
+
       function setupBills(item, needClac = false) { 
         const regBlank = new RegExp(' ', 'g');
         let bill = {
@@ -159,6 +172,7 @@ INTERFACE_IMPORT = (() => {
           qtyFormula: item._QtyFormula,
           children: []
         }
+        const formula = getValue(item, ['CostComposition', 'Formula', '_Formulas']);
         // if ((needClac || bill.name == "暂列金额(不含计日工总额)") && bill.qtyFormula && bill.qtyFormula !== '') {
         if ((needClac || bill.name == "暂列金额(不含计日工总额)") && bill.hasOwnProperty('qtyFormula')) {
           let formula = getValue(item, ['CostComposition', 'Formula', '_Formulas']);
@@ -180,16 +194,18 @@ INTERFACE_IMPORT = (() => {
         if (item._ProvisionalType == '2') {
           let sumVal = getValue(item, ['_Sum']);
           bill.fees = [{ fieldName: "common",tenderTotalFee:sumVal, tenderUnitFee: "0", totalFee: sumVal, unitFee: "0" }];
-          bill.calcBase = sumVal;
-          bill.calcFlag = 1;
+          // bill.calcBase = sumVal;
+          // bill.calcFlag = 2;
+          handleBillPrice(bill, formula, +sumVal, +bill.quantity);
         }
         if (item._ProvisionalType == '3') {
           let sumVal = getValue(item, ['_Sum']);
           let priceVal = getValue(item, ['_Price']);
-          if ((+sumVal) < (+priceVal)) sumVal = priceVal;
+          // if ((+sumVal) < (+priceVal)) sumVal = priceVal;
           bill.fees = [{ fieldName: "common",tenderTotalFee:sumVal, tenderUnitFee: priceVal, totalFee: sumVal, unitFee: priceVal }];
-          bill.calcBase = sumVal;
-          bill.calcFlag = 1;
+          // bill.calcBase = sumVal;
+          // bill.calcFlag = 2;
+          handleBillPrice(bill, formula, +sumVal, +bill.quantity);
         }
 
         let subItems = arrayValue(item, ['Item']);