|
@@ -299,7 +299,7 @@ module.exports = app => {
|
|
|
return user;
|
|
return user;
|
|
|
}
|
|
}
|
|
|
async copyPaySafeData(payTenderId) {
|
|
async copyPaySafeData(payTenderId) {
|
|
|
- const details = await this.ctx.service.paymentDetail.getAllDataByCondition({ where: { tender_id: payTenderId, type: 1 } });
|
|
|
|
|
|
|
+ const details = await this.ctx.service.paymentDetail.getAllDataByCondition({ where: { tender_id: payTenderId, type: 1 }, orders: [['order', 'asc']] });
|
|
|
const tid = this.ctx.tender.id;
|
|
const tid = this.ctx.tender.id;
|
|
|
const conn = await this.db.beginTransaction();
|
|
const conn = await this.db.beginTransaction();
|
|
|
try {
|
|
try {
|
|
@@ -314,6 +314,7 @@ module.exports = app => {
|
|
|
};
|
|
};
|
|
|
insertStage.push(stage);
|
|
insertStage.push(stage);
|
|
|
const safeBills = await this.ctx.service.paymentSafeBills.getAllDataByCondition({ where: { detail_id: detail.id } });
|
|
const safeBills = await this.ctx.service.paymentSafeBills.getAllDataByCondition({ where: { detail_id: detail.id } });
|
|
|
|
|
+ let tp = 0, pre_tp = 0;
|
|
|
for (const sb of safeBills) {
|
|
for (const sb of safeBills) {
|
|
|
sb.tender_id = tid;
|
|
sb.tender_id = tid;
|
|
|
delete sb.detail_id;
|
|
delete sb.detail_id;
|
|
@@ -326,8 +327,14 @@ module.exports = app => {
|
|
|
delete h.order;
|
|
delete h.order;
|
|
|
}
|
|
}
|
|
|
sb.cur_his = JSON.stringify(his);
|
|
sb.cur_his = JSON.stringify(his);
|
|
|
|
|
+ if (sb.tree_is_leaf) {
|
|
|
|
|
+ pre_tp = this.ctx.helper.add(pre_tp, sb.pre_tp);
|
|
|
|
|
+ tp = this.ctx.helper.add(tp, sb.cur_tp);
|
|
|
|
|
+ }
|
|
|
insertBills.push(sb);
|
|
insertBills.push(sb);
|
|
|
}
|
|
}
|
|
|
|
|
+ stage.pre_bills_tp = pre_tp;
|
|
|
|
|
+ stage.bills_tp = tp;
|
|
|
const user = await this._getUserInfo(detail.uid);
|
|
const user = await this._getUserInfo(detail.uid);
|
|
|
const audits = await this.ctx.service.paymentDetailAudit.getAllDataByCondition({ where: { td_id: detail.id }, orders: [['times', 'asc'], ['order', 'asc']]});
|
|
const audits = await this.ctx.service.paymentDetailAudit.getAllDataByCondition({ where: { td_id: detail.id }, orders: [['times', 'asc'], ['order', 'asc']]});
|
|
|
if (detail.status === audit.status.checked) {
|
|
if (detail.status === audit.status.checked) {
|