|
@@ -60,11 +60,15 @@ class OrderService extends CrudService {
|
|
|
if (pay) {
|
|
|
// 这个是order表的数据,需要用order的计算方式
|
|
|
const buy_num_total = goods.reduce(
|
|
|
- (p, n) =>
|
|
|
- this.ctx.plus(
|
|
|
- p,
|
|
|
- n.goods.reduce((np, ng) => this.ctx.plus(np, ng.buy_num), 0)
|
|
|
- ),
|
|
|
+ (p, n) => {
|
|
|
+ let num = 0;
|
|
|
+ if (_.get(n, 'is_set') === '0') num = _.get(n, 'buy_num');
|
|
|
+ else {
|
|
|
+ const goods = _.get(n, 'goods', []);
|
|
|
+ num = goods.reduce((np, nn) => this.ctx.plus(np, nn.buy_num), 0);
|
|
|
+ }
|
|
|
+ return this.ctx.plus(p, num);
|
|
|
+ },
|
|
|
0
|
|
|
);
|
|
|
obj.buy_num_total = buy_num_total;
|