lrf 2 lat temu
rodzic
commit
494ebb398c
1 zmienionych plików z 4 dodań i 6 usunięć
  1. 4 6
      app/service/trade/order.js

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

@@ -380,6 +380,7 @@ class OrderService extends CrudService {
             goodsSpec_name: '$name',
             freight: { $toString: '$freight' },
             sell_money: { $toString: '$sell_money' },
+            leader_price: { $toString: '$leader_price' },
             num: { $toDouble: num },
             file: '$goods.file',
             tags: '$goods.tags',
@@ -399,15 +400,12 @@ class OrderService extends CrudService {
     const is_leader = _.get(user, 'is_leader', '1');
     if (is_leader === '0') {
       for (const i of arr) {
-        const { goods_id: goods, goodsSpec_id: spec } = i;
-        const r = await this.goodsConfigModel.findOne({ goods, spec });
-        if (r) {
-          i.leader_price = r.leader_price;
-          i.price = r.leader_price;
+        if (i.leader_price) {
+          i.leader_price = this.ctx.toNumber(i.leader_price);
+          i.price = i.leader_price;
         }
       }
     }
-
     // 平铺数据后,需要处理活动相关部分
     // 经过处理后的数据,会添加act字段,表明与活动有关的信息
     await this.dealAct(arr, actList);