lrf 2 years ago
parent
commit
4b1d46a70f
1 changed files with 12 additions and 0 deletions
  1. 12 0
      app/service/trade/orderDetail.js

+ 12 - 0
app/service/trade/orderDetail.js

@@ -159,6 +159,18 @@ class OrderDetailService extends CrudService {
       const obj = { key: platform_act, zh: title, money: this.ctx.minus(0, discount) };
       tarr.push(obj);
     }
+    const discount_detail = _.get(total_detail, 'discount_detail', {});
+    const userCoupons = Object.keys(discount_detail);
+    if (userCoupons.length > 0) {
+      let dm = 0;
+      for (const uc_id of userCoupons) {
+        const detail = _.get(discount_detail, uc_id, {});
+        const values = Object.values(detail);
+        dm = values.reduce((p, n) => this.ctx.minus(p, n), dm);
+      }
+      tarr.push({ key: 'coupons', zh: '优惠券优惠', money: dm });
+    }
+
     return tarr;
   }