ellisran 12 часов назад
Родитель
Сommit
4e2605d643
1 измененных файлов с 13 добавлено и 7 удалено
  1. 13 7
      app/public/js/contract_detail.js

+ 13 - 7
app/public/js/contract_detail.js

@@ -149,24 +149,30 @@ $(document).ready(function() {
         markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
         markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
         markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
         markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
     };
     };
-    const calcField = ['total_price', 'yf_price'];
-    const calcFieldColor = {'total_price': '#bbb', 'yf_price': '#28a745'};
-    const calcFieldCaption = {'total_price': '合同金额', 'yf_price': contract_type === contractConst.type.expenses ? '累计应付' : '累计应回'};
     treeSetting.calcFun = function (node) {
     treeSetting.calcFun = function (node) {
         if (node && node.c_code) {
         if (node && node.c_code) {
-            const base = node.total_price;
+            const contractPayLimit = getContractPayLimit(node);
+            const base = contractPayLimit.price;
+            const baseField = contractPayLimit.name === '结算金额' ? 'settle_price' : 'total_price';
+            const calcFields = [baseField, 'yf_price'];
+            const calcFieldColor = { total_price: '#bbb', settle_price: '#bbb', yf_price: '#28a745' };
+            const calcFieldCaption = {
+                total_price: '合同金额',
+                settle_price: '结算金额',
+                yf_price: contract_type === contractConst.type.expenses ? '累计应付' : '累计应回',
+            };
             node.stackedBar = [];
             node.stackedBar = [];
             node.stackedBarTips = [];
             node.stackedBarTips = [];
-            for (const cf of calcField) {
+            for (const cf of calcFields) {
                 node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf, hintNum: cf === 'yf_price' });
                 node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf, hintNum: cf === 'yf_price' });
                 node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
                 node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
             }
             }
             // 计算实付进度(单独的 stackedBarSf)
             // 计算实付进度(单独的 stackedBarSf)
             node.stackedBarSf = [];
             node.stackedBarSf = [];
             node.stackedBarSfTips = [];
             node.stackedBarSfTips = [];
-            node.stackedBarSf.push({ color: '#bbb', percent: ZhCalc.div(node.total_price, base), field: 'total_price', hintNum: false });
+            node.stackedBarSf.push({ color: '#bbb', percent: ZhCalc.div(node[baseField], base), field: baseField, hintNum: false });
             node.stackedBarSf.push({ color: '#28a745', percent: ZhCalc.div(node.sf_price, base), field: 'sf_price', hintNum: true });
             node.stackedBarSf.push({ color: '#28a745', percent: ZhCalc.div(node.sf_price, base), field: 'sf_price', hintNum: true });
-            node.stackedBarSfTips.push(`合同金额: ${node.total_price || 0}`);
+            node.stackedBarSfTips.push(`${contractPayLimit.name}: ${base || 0}`);
             node.stackedBarSfTips.push(`累计${contract_type === contractConst.type.expenses ? '实付' : '实回'}: ${node.sf_price || 0}`);
             node.stackedBarSfTips.push(`累计${contract_type === contractConst.type.expenses ? '实付' : '实回'}: ${node.sf_price || 0}`);
         }
         }
     };
     };