Browse Source

1、红包抵扣使用;

Lawsun_M 1 year ago
parent
commit
bf7cbe298c
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/service/order.js

+ 3 - 3
app/service/order.js

@@ -37,9 +37,9 @@ class OrderService extends ShopService {
     const selectBean = await that.app.comoBean.instance({}, {
       where: { order_id }, include: { model: that.app.model.AdminUser, as: 'admin_user', attributes: [] },
       attributes: {
-        include: [[ seq.col('admin_user.username'), 'username' ]],
+        include: [ [ seq.col('admin_user.username'), 'username' ] ],
         exclude: [ 'admin_id', 'order_id' ],
-      }, order: [[ 'action_id', 'asc' ]],
+      }, order: [ [ 'action_id', 'asc' ] ],
     });
     const result = await that.service.base.select(selectBean, that.app.model.OrdersAction, '操作记录查询失败,请稍候重试', false, true);
     return result;
@@ -81,7 +81,7 @@ class OrderService extends ShopService {
       userMoney = 0;
     }
     let payment_money = 0;
-    const surplus_amout = userMoney >= orderAmount.orderPriceCanDiscount ? orderAmount.orderPriceCanDiscount : userMoney;
+    const surplus_amout = userMoney >= (orderAmount.orderPriceCanDiscount * 0.1) ? (orderAmount.orderPriceCanDiscount * 0.1) : userMoney;
     const totalAmount = orderAmount.orderPriceCanDiscount + orderAmount.orderPriceNotDiscount;
     if (surplus_amout < totalAmount) payment_money = (totalAmount - surplus_amout);
     return { surplus_amout, payment_money };