瀏覽代碼

Merge branch 'dev'

lrf 2 年之前
父節點
當前提交
012042ee90
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 1 1
      app/service/trade/coupon.js
  2. 3 0
      app/service/trade/order.js

+ 1 - 1
app/service/trade/coupon.js

@@ -16,7 +16,7 @@ class CouponService extends CrudService {
   async userView(filter, { skip = 0, limit, sort, desc, projection } = {}) {
     const customer = _.get(this.ctx, 'user._id');
     if (!customer) throw new BusinessError(ErrorCode.NOT_LOGIN, '未找到用户登陆信息');
-    let list = await this.query(filter, { skip, limit, sort, desc, projection });
+    let list = await this.query({ ...filter, status: '0' }, { skip, limit, sort, desc, projection });
     list = await this.makeShowData(list);
     // 还需要判断用户是否领取过了
     for (const coupon of list) {

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

@@ -132,6 +132,9 @@ class OrderService extends CrudService {
       if (_.get(order, 'pay.result')) {
         throw new BusinessError(ErrorCode.DATA_INVALID, '该订单已支付完成,无法使用此接口');
       }
+      if (_.get(order, 'status') !== '0') {
+        throw new BusinessError(ErrorCode.DATA_INVALID, '该订单不处于可以退单的状态');
+      }
       // 退单分为 2 部分, 涉及价格不需要管.因为这是交钱之前的的操作,不涉及退款
       // 1.货物的库存
       const { goods: shopGoods, total_detail } = order;