Browse Source

变更令计价及不计价统计功能

ellisran 1 year ago
parent
commit
8ee00ab3bf

+ 17 - 0
app/public/js/change_information.js

@@ -637,6 +637,8 @@ $(document).ready(() => {
 function calcChangePrice() {
     let positive_tp = 0;
     let negative_tp = 0;
+    let valuation_tp = 0;
+    let unvaluation_tp = 0;
     let new_tp = 0;
     for (const c of changeList) {
         if (c.spamount) {
@@ -647,6 +649,11 @@ function calcChangePrice() {
             } else {
                 negative_tp = ZhCalc.add(negative_tp, price);
             }
+            if (c.is_valuation) {
+                valuation_tp = ZhCalc.add(valuation_tp, price);
+            } else {
+                unvaluation_tp = ZhCalc.add(unvaluation_tp, price);
+            }
         }
     }
     const updateTpList = {};
@@ -663,11 +670,21 @@ function calcChangePrice() {
         updateTpList.negative_tp = negative_tp;
         updateFlag = true;
     }
+    if (valuation_tp !== changeVp) {
+        updateTpList.valuation_tp = valuation_tp;
+        updateFlag = true;
+    }
+    if (unvaluation_tp !== changeUp) {
+        updateTpList.unvaluation_tp = unvaluation_tp;
+        updateFlag = true;
+    }
     if (updateFlag) {
         console.log(updateTpList);
         postData(window.location.pathname + '/save', { type:'update_tp', updateData: updateTpList }, function () {
             changePp = positive_tp;
             changeNp = negative_tp;
+            changeVp = valuation_tp;
+            changeUp = unvaluation_tp;
             changeTp = new_tp;
         });
     }

+ 9 - 0
app/service/change_audit_list.js

@@ -408,6 +408,8 @@ module.exports = app => {
             let total_price = 0;
             let positive_tp = 0;
             let negative_tp = 0;
+            let valuation_tp = 0;
+            let unvaluation_tp = 0;
             const tp_decimal = this.ctx.change.tp_decimal ? this.ctx.change.tp_decimal : this.ctx.tender.info.decimal.tp;
             for (const cl of changeList) {
                 const price = this.ctx.helper.mul(cl.unit_price, cl.spamount, tp_decimal);
@@ -417,11 +419,18 @@ module.exports = app => {
                 } else {
                     negative_tp = this.ctx.helper.accAdd(negative_tp, price);
                 }
+                if (cl.is_valuation) {
+                    valuation_tp = this.ctx.helper.accAdd(valuation_tp, price);
+                } else {
+                    unvaluation_tp = this.ctx.helper.accAdd(unvaluation_tp, price);
+                }
             }
             const updateData = {
                 total_price,
                 positive_tp,
                 negative_tp,
+                valuation_tp,
+                unvaluation_tp,
             };
             if (updateTpDecimal) {
                 updateData.tp_decimal = tp_decimal;

+ 2 - 0
app/view/change/information.ejs

@@ -485,6 +485,8 @@
     let changeTp = parseFloat('<%- change.total_price ? change.total_price : 0 %>');
     let changePp = parseFloat('<%- change.positive_tp ? change.positive_tp : 0 %>');
     let changeNp = parseFloat('<%- change.negative_tp ? change.negative_tp : 0 %>');
+    let changeVp = parseFloat('<%- change.valuation_tp ? change.valuation_tp : 0 %>');
+    let changeUp = parseFloat('<%- change.unvaluation_tp ? change.unvaluation_tp : 0 %>');
     const changeStatus = parseFloat('<%- change.status %>');
     const touristPermission = parseInt('<%- ctx.tender.touristPermission.file %>');
     const precision = JSON.parse('<%- JSON.stringify(precision) %>');