Kaynağa Gözat

合同支付调整

MaiXinRong 4 yıl önce
ebeveyn
işleme
e2a8e722d5
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      app/lib/pay_calc.js

+ 5 - 2
app/lib/pay_calc.js

@@ -130,8 +130,9 @@ class PayCalculate {
      * 累计 计量等数据
      */
     async _getAddCalcRela() {
-        // todo 获取截止上期数据
-        this.pre = this.stage.order > 1 ? await this.ctx.service.stageBillsFinal.getSumTotalPrice(this.stage.tid, this.stage.order - 1) : null;
+        if (this.cur && this.add) return;
+
+        this.pre = this.stage.order > 1 ? await this.ctx.service.stageBillsFinal.getSumTotalPrice(this.stage.tid, this.stage.order - 1) : {};
         this.cur = await this.ctx.service.stageBills.getSumTotalPrice(this.stage);
         this.add = {};
         if (this.pre) {
@@ -231,6 +232,8 @@ class PayCalculate {
     }
 
     async calculateAll(pays) {
+        await this.getCalcBase();
+        await this._getAddCalcRela();
         await this.calculateStartRangePrice(pays);
         await this.calculate(pays);
     }