lrf 2 năm trước cách đây
mục cha
commit
21a024853e
2 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 1 0
      app/middleware/errorEmail.js
  2. 5 3
      app/service/statistics/bill.js

+ 1 - 0
app/middleware/errorEmail.js

@@ -19,6 +19,7 @@ module.exports = options => {
         emailData.errmsg = e.stack;
       }
       emailData.errcode = errcode;
+      console.log(emailData.errmsg);
       // 未定义的错误需要发邮件,定义的错误不需要
       if (!_.isNumber(e.errcode)) {
         // 非开发模式发送邮件

+ 5 - 3
app/service/statistics/bill.js

@@ -66,7 +66,7 @@ class BillService extends CrudService {
         from: 'orderDetail',
         localField: 'orderDetail_id',
         foreignField: '_id',
-        pipeline: [{ $project: { no: 1 } }],
+        pipeline: [{ $project: { no: 1, _id: 1 } }],
         as: 'orderDetailInfo',
       },
     });
@@ -79,6 +79,7 @@ class BillService extends CrudService {
         spec: '$goods.name',
         end_time: 1,
         money: { $toString: '$money' },
+        rowKey: { $concat: [{ $toString: '$_id' }, '_', '$goods.goods._id', '_', '$goods._id', '_', '$apply_time' ] },
       },
     });
     const afterSaleList = await this.afterSaleModel.aggregate(pipline);
@@ -110,7 +111,7 @@ class BillService extends CrudService {
         freight: 1,
         group_config: { money: 1 },
         name: 1,
-        goods: { name: 1 },
+        goods: { name: 1, _id: 1 },
       },
     };
     pipline.push({ $project });
@@ -129,7 +130,7 @@ class BillService extends CrudService {
         no: _.get(o, 'no'),
         type: _.get(type, 'label'),
         pay_time: _.get(o, 'pay_time'),
-        goods_id: _.get(o, 'goods.goods._id'),
+        goods_id: _.get(o, 'goods._id'),
         goods: _.get(o, 'goods.goods.name'),
         spec: _.get(o, 'goods.name'),
         spec_id: _.get(o, 'goods._id'),
@@ -137,6 +138,7 @@ class BillService extends CrudService {
         price: o.type === '1' ? _.get(o, 'goods.group_config.money') : _.get(o, 'goods.sell_money'),
         discount: _.get(moneyDetail, 'dt'),
         total: o.type === '1' ? _.get(moneyDetail, 'ggrp') : _.get(moneyDetail, 'grp'),
+        rowKey: `${_.get(o, '_id')}_${_.get(o, 'goods.goods._id')}_${_.get(o, 'goods._id')}`,
       };
       list.push(obj);
     }