|
@@ -148,6 +148,7 @@ class UserCouponService extends CrudService {
|
|
|
}
|
|
|
uc.canUse = true;
|
|
|
}
|
|
|
+ couponList = couponList.filter(f => f.canUse);
|
|
|
if (couponList.length <= 0) return [];
|
|
|
couponList = await this.makeShowData(couponList);
|
|
|
return couponList;
|
|
@@ -229,14 +230,8 @@ class UserCouponService extends CrudService {
|
|
|
const { discount_config = {} } = coupon;
|
|
|
const limit = _.get(discount_config, 'limit');
|
|
|
if (limit === 'nolimit') return true;
|
|
|
- const goods_total = shopGoods.reduce((p, n) =>
|
|
|
- this.ctx.plus(
|
|
|
- p,
|
|
|
- n.goods.reduce((gp, gn) =>
|
|
|
- this.ctx.plus(gp, this.ctx.multiply(gn.sell_money, gn.buy_num)), 0)
|
|
|
- )
|
|
|
- , 0);
|
|
|
- if (this.ctx.minus(goods_total, limit) > 0) return true;
|
|
|
+ const goods_total = shopGoods.reduce((p, n) => this.ctx.plus(this.ctx.plus(p, n.goods_total), n.freight_total), 0);
|
|
|
+ if (this.ctx.minus(goods_total, limit) >= 0) return true;
|
|
|
return false;
|
|
|
|
|
|
}
|