lrf 2 éve
szülő
commit
bb7947ba7f

+ 3 - 4
app/service/trade/order.js

@@ -220,6 +220,9 @@ class OrderService extends CrudService {
     const customer = _.get(user, '_id');
     if (!customer) throw new BusinessError(ErrorCode.NOT_LOGIN, '未找到用户信息');
     const pageData = {};
+    // 商品总价,各店铺的价格明细
+    specsData = this.ctx.service.util.order.makeOrder_computedShopTotal(specsData);
+    const shopTotalDetail = this.ctx.service.util.order.makerOrder_computedOrderTotal(specsData);
     // 找到默认地址
     const address = await this.addressModel.findOne({ customer, is_default: '1' });
     pageData.address = address;
@@ -230,10 +233,6 @@ class OrderService extends CrudService {
     // 返现部分:添加推荐人信息
     const inviter = data.find(f => ObjectId.isValid(f.inviter));
     pageData.inviter = inviter;
-
-    // 商品总价,各店铺的价格明细
-    specsData = this.ctx.service.util.order.makeOrder_computedShopTotal(specsData);
-    const shopTotalDetail = this.ctx.service.util.order.makerOrder_computedOrderTotal(specsData);
     // 活动部分
     // 将加价购拿出来,给前端,需要特殊处理
     pageData.actList = actList.filter(f => f.platform_act_type === '4');

+ 1 - 1
app/service/user/userCoupon.js

@@ -232,7 +232,7 @@ 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(this.ctx.plus(p, n.goods_total), n.freight_total), 0);
+    const goods_total = shopGoods.reduce((p, n) => this.ctx.plus(p, this.ctx.plus(n.discount, this.ctx.plus(n.goods_total, n.freight_total))), 0);
     if (this.ctx.minus(goods_total, limit) >= 0) return true;
     return false;
   }

+ 1 - 1
app/service/util/order.js

@@ -35,7 +35,7 @@ class OrderService extends CrudService {
       }
       i.goods_total = goods_total;
       i.freight_total = freight_total;
-      i.discount = discount;
+      i.discount = this.ctx.minus(0, discount);
     }
     return list;
   }