|
@@ -31,9 +31,9 @@ class CashBackService extends CrudService {
|
|
|
// 上面总价包含了提现金额
|
|
|
// 下面计算的金额是可以提现的金额 提现总金额 - 提现金额
|
|
|
let canGet = 0;
|
|
|
- const inBill = res.filter((f) => parseInt(f.source) >= 0);
|
|
|
- const outBill = res.filter((f) => parseInt(f.source) < 0);
|
|
|
- const getOutBill = res.filter((f) => f.source === '-1');
|
|
|
+ const inBill = res.filter(f => parseInt(f.source) >= 0);
|
|
|
+ const outBill = res.filter(f => parseInt(f.source) < 0);
|
|
|
+ const getOutBill = res.filter(f => f.source === '-1');
|
|
|
const outBillMoney = getOutBill.reduce((p, n) => this.ctx.plus(p, n.money), 0);
|
|
|
for (const i of inBill) {
|
|
|
const cAt = _.get(i, 'time');
|
|
@@ -42,7 +42,7 @@ class CashBackService extends CrudService {
|
|
|
// 已经过了提款时间,那就再找下,是否有该记录相应的退款
|
|
|
const { money, source_id } = i;
|
|
|
let cg = money;
|
|
|
- const os = outBill.filter((f) => f.source_id === source_id);
|
|
|
+ const os = outBill.filter(f => f.source_id === source_id);
|
|
|
for (const o of os) {
|
|
|
cg = this.ctx.minus(cg, o.money);
|
|
|
}
|
|
@@ -105,10 +105,10 @@ class CashBackService extends CrudService {
|
|
|
const source_id = _.get(afterSale, 'order_detail');
|
|
|
const inBill = await this.model.findOne({ source_id }).lean();
|
|
|
if (!inBill) return;
|
|
|
- const outBill = _.pick(inBill, ['inviter', 'money', 'source', 'source_id']);
|
|
|
+ const outBill = _.pick(inBill, [ 'inviter', 'money', 'source', 'source_id' ]);
|
|
|
outBill.time = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
outBill.status = '-1';
|
|
|
- tran.insert('OutBill', outBill);
|
|
|
+ tran.insert('CashBack', outBill);
|
|
|
}
|
|
|
}
|
|
|
|