|
@@ -1080,7 +1080,7 @@ module.exports = app => {
|
|
|
await this.ctx.service.tender.checkTender(tid);
|
|
|
await this.ctx.service.stage.checkStage(sid);
|
|
|
this.changeInfo = await this.ctx.service.change.getChangeAndUsedInfo(tid);
|
|
|
- const usedChangesId = await ctx.service.stageChange.getStageUsedChangeId(sid);
|
|
|
+ const usedChangesId = await this.ctx.service.stageChange.getStageUsedChangeId(sid);
|
|
|
for (const c of this.changeInfo) {
|
|
|
c.cur_used = usedChangesId.indexOf(c.cid) >= 0;
|
|
|
}
|
|
@@ -1092,17 +1092,17 @@ module.exports = app => {
|
|
|
this.changeInfoBills = [];
|
|
|
for (const c of this.changeInfo) {
|
|
|
const cb = await this.ctx.service.stageChange.getUsedData(tid, c.cid);
|
|
|
- const curUsedBills = await this.ctx.service.stageChange.getStageUsedData(sid, cid);
|
|
|
+ const curUsedBills = await this.ctx.service.stageChange.getStageUsedData(sid, c.cid);
|
|
|
for (const b of cb) {
|
|
|
b.qty = this.ctx.helper._.toNumber(b.samount);
|
|
|
- b.valid_qty = ZhCalc.sub(b.qty, b.used_qty);
|
|
|
+ b.valid_qty = this.ctx.helper.sub(b.qty, b.used_qty);
|
|
|
b.tp = this.ctx.helper.round(this.ctx.helper.mul(b.qty, b.unit_price), this.ctx.tender.info.decimal.tp);
|
|
|
const pos = this.ctx.helper._.filter(curUsedBills, { cbid: b.id });
|
|
|
b.cur_qty = 0;
|
|
|
for (const p of pos) {
|
|
|
- b.cur_qty = ZhCalc.add(b.cur_qty, p.qty);
|
|
|
+ b.cur_qty = this.ctx.helper.add(b.cur_qty, p.qty);
|
|
|
}
|
|
|
- b.cur_used = !!data.cur_qty;
|
|
|
+ b.cur_used = !!b.cur_qty;
|
|
|
this.changeInfoBills.push(b);
|
|
|
}
|
|
|
}
|