|
@@ -123,7 +123,7 @@ module.exports = app => {
|
|
|
} else {
|
|
|
latestOrder.order = latestOrder.order + 1;
|
|
|
}
|
|
|
- const record = await this.db.insert(this.tableName, { type, uid, tid, status: auditConst.status.uncheck, order: latestOrder.order, prev_amount: latestOrder.prev_total_amount, prev_total_amount: latestOrder.prev_total_amount });
|
|
|
+ const record = await this.db.insert(this.tableName, { type, uid, tid, status: auditConst.status.uncheck, order: latestOrder.order, prev_amount: latestOrder.prev_total_amount, prev_total_amount: latestOrder.prev_total_amount, pay_time: new Date() });
|
|
|
const auditors = await ctx.service.advanceAudit.getAuditGroupByList(latestOrder.id, latestOrder.times);
|
|
|
for (let idx = 0; idx < auditors.length; idx++) {
|
|
|
const { audit_id } = auditors[idx];
|
|
@@ -196,9 +196,13 @@ module.exports = app => {
|
|
|
*/
|
|
|
async updateAdvance(payload, id) {
|
|
|
const { ctx } = this;
|
|
|
- const prevRecord = await this.getPreviousRecord(ctx.tender.id, ctx.advance.type) || { prev_total_amount: 0 };
|
|
|
- const { cur_amount } = payload;
|
|
|
- payload.prev_total_amount = ctx.helper.add(cur_amount, prevRecord.prev_total_amount);
|
|
|
+ if (!payload.pay_time) {
|
|
|
+ const prevRecord = await this.getPreviousRecord(ctx.tender.id, ctx.advance.type) || { prev_total_amount: 0 };
|
|
|
+ const { cur_amount } = payload;
|
|
|
+ payload.prev_total_amount = ctx.helper.add(cur_amount, prevRecord.prev_total_amount);
|
|
|
+ } else {
|
|
|
+ payload.pay_time = new Date(payload.pay_time);
|
|
|
+ }
|
|
|
return await this.update(payload, {
|
|
|
id,
|
|
|
});
|