laiguoran 2 anni fa
parent
commit
d4363116cf
2 ha cambiato i file con 13 aggiunte e 9 eliminazioni
  1. 11 7
      app/controller/wap_controller.js
  2. 2 2
      app/view/wap/tender.ejs

+ 11 - 7
app/controller/wap_controller.js

@@ -125,8 +125,8 @@ module.exports = app => {
                     if (isLastage) await this.ctx.service.stage.checkStageGatherData(audit);
                 }
                 audit.gather_tp = ctx.helper.sum([audit.contract_tp, audit.qc_tp, audit.pc_tp]);
-                // audit.end_contract_tp = ctx.helper.add(audit.contract_tp, audit.pre_contract_tp);
-                // audit.end_qc_tp = ctx.helper.add(audit.qc_tp, audit.pre_qc_tp);
+                audit.end_contract_tp = ctx.helper.sum([audit.contract_tp, audit.pre_contract_tp, audit.contract_pc_tp]);
+                audit.end_qc_tp = ctx.helper.sum([audit.qc_tp, audit.pre_qc_tp, audit.qc_pc_tp]);
                 audit.pre_gather_tp = ctx.helper.add(audit.pre_contract_tp, audit.pre_qc_tp);
                 audit.end_gather_tp = ctx.helper.add(audit.gather_tp, audit.pre_gather_tp);
             }
@@ -223,18 +223,22 @@ module.exports = app => {
                     tender.total_price = sum.total_price;
                     tender.deal_tp = sum.deal_tp;
                 }
+                const [change_tp, change_p_tp, change_n_tp] = await ctx.service.change.getChangeTp(ctx.tender.id);
+                tender.change_tp = change_tp;
+                tender.change_p_tp = change_p_tp;
+                tender.change_n_tp = change_n_tp;
                 const stages = await ctx.service.stage.getValidStages(ctx.tender.id);
                 const lastStage = stages.length > 0 ? stages[0] : null; //await ctx.service.stage.getLastestStage(ctx.tender.id);
                 if (lastStage) {
                     await this.ctx.service.stage.checkStageGatherData(lastStage);
-                    tender.gather_tp = ctx.helper.add(lastStage.contract_tp, lastStage.qc_tp);
-                    tender.end_contract_tp = ctx.helper.add(lastStage.contract_tp, lastStage.pre_contract_tp);
-                    tender.end_qc_tp = ctx.helper.add(lastStage.qc_tp, lastStage.pre_qc_tp);
-                    tender.end_gather_tp = ctx.helper.add(tender.end_contract_tp, tender.end_qc_tp);
+                    tender.gather_tp = ctx.helper.sum([lastStage.contract_tp, lastStage.qc_tp, lastStage.pc_tp]);
+                    tender.end_contract_tp = ctx.helper.sum([lastStage.contract_tp, lastStage.pre_contract_tp, lastStage.contract_pc_tp]);
+                    tender.end_qc_tp = ctx.helper.sum([lastStage.qc_tp, lastStage.pre_qc_tp, lastStage.qc_pc_tp]);
                     tender.pre_gather_tp = ctx.helper.add(lastStage.pre_contract_tp, lastStage.pre_qc_tp);
+                    tender.end_gather_tp = ctx.helper.add(tender.gather_tp, tender.pre_gather_tp);
                     tender.yf_tp = lastStage.yf_tp;
                     tender.qc_ratio = ctx.helper.mul(ctx.helper.div(tender.end_qc_tp, ctx.tender.info.deal_param.contractPrice, 2), 100);
-                    tender.sum = ctx.helper.add(tender.total_price, tender.end_qc_tp);
+                    tender.sum = ctx.helper.add(tender.total_price, tender.change_tp);
                     tender.pre_ratio = ctx.helper.mul(ctx.helper.div(tender.pre_gather_tp, tender.sum, 2), 100);
                     tender.cur_ratio = ctx.helper.mul(ctx.helper.div(tender.gather_tp, tender.sum, 2), 100);
                     tender.other_tp = ctx.helper.sub(ctx.helper.sub(tender.sum, tender.pre_gather_tp), tender.gather_tp);

+ 2 - 2
app/view/wap/tender.ejs

@@ -397,7 +397,7 @@
                 stack: '完成',
                 data:[
                     <% for (const s of stagesEcharts) {%>
-                    <%- ctx.helper.add(s.contract_tp, s.qc_tp) %>,
+                    <%- ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]) %>,
                     <% } %>
                 ]
             },
@@ -408,7 +408,7 @@
                 yAxisIndex: 1,
                 data:[
                     <% for (const s of stagesEcharts) {%>
-                    <%- ctx.helper.mul(ctx.helper.div(ctx.helper.add(s.contract_tp, s.qc_tp), tender.sum, 2), 100) %>,
+                    <%- ctx.helper.mul(ctx.helper.div(ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]), tender.sum, 2), 100) %>,
                     <% } %>
                 ]
             },