|
@@ -217,23 +217,26 @@ class OrderDetailService extends CrudService {
|
|
const total = _.get(_.head(t), 'id');
|
|
const total = _.get(_.head(t), 'id');
|
|
const list = [];
|
|
const list = [];
|
|
for (const i of rs) {
|
|
for (const i of rs) {
|
|
- const { goods } = i;
|
|
|
|
|
|
+ const { goods, _id: orderDetail } = i;
|
|
const obj = _.cloneDeep(i);
|
|
const obj = _.cloneDeep(i);
|
|
const real_pay = this.ctx.service.util.orderDetail.computedRealPay(obj);
|
|
const real_pay = this.ctx.service.util.orderDetail.computedRealPay(obj);
|
|
obj.real_pay = real_pay;
|
|
obj.real_pay = real_pay;
|
|
obj.buy_num_total = goods.reduce((p, n) => this.ctx.plus(p, n.buy_num), 0);
|
|
obj.buy_num_total = goods.reduce((p, n) => this.ctx.plus(p, n.buy_num), 0);
|
|
for (const og of obj.goods) {
|
|
for (const og of obj.goods) {
|
|
- const { file = [] } = og;
|
|
|
|
|
|
+ const { file = [], _id: goodSpec } = og;
|
|
const gfile = _.get(og, 'goods.file', []);
|
|
const gfile = _.get(og, 'goods.file', []);
|
|
const nf = [ ...file, ...gfile ];
|
|
const nf = [ ...file, ...gfile ];
|
|
const url = _.get(_.head(nf), 'url');
|
|
const url = _.get(_.head(nf), 'url');
|
|
og.url = url;
|
|
og.url = url;
|
|
delete og.file;
|
|
delete og.file;
|
|
delete og.goods.file;
|
|
delete og.goods.file;
|
|
|
|
+ // 评价
|
|
|
|
+ const q = { orderDetail, goodSpec };
|
|
|
|
+ const rate = await this.goodsRateModel.findOne(q, { _id: 1 });
|
|
|
|
+ obj.rate = _.get(rate, '_id');
|
|
|
|
+
|
|
}
|
|
}
|
|
- // 评价与售后
|
|
|
|
- const rate = await this.goodsRateModel.findOne({ orderDetail: obj._id }, { _id: 1 });
|
|
|
|
- obj.rate = _.get(rate, '_id');
|
|
|
|
|
|
+ // 售后
|
|
const asum = await this.afterSaleModel.count({ order_detail: obj._id, status: { $nin: [ '0', '!1', '!2', '!3', '!4', '!5' ] } });
|
|
const asum = await this.afterSaleModel.count({ order_detail: obj._id, status: { $nin: [ '0', '!1', '!2', '!3', '!4', '!5' ] } });
|
|
obj.is_afterSale = asum > 0;
|
|
obj.is_afterSale = asum > 0;
|
|
list.push(obj);
|
|
list.push(obj);
|