|
@@ -26,18 +26,26 @@ class OrderService extends CrudService {
|
|
let goods_total = 0,
|
|
let goods_total = 0,
|
|
freight_total = 0,
|
|
freight_total = 0,
|
|
discount = 0;
|
|
discount = 0;
|
|
- for (const g of i.goods) {
|
|
|
|
- // 如果有特价,那就使用特价,没有特价就是用正常销售价
|
|
|
|
- goods_total = this.ctx.plus(goods_total, this.ctx.multiply(_.get(g, 'price'), _.get(g, 'num')));
|
|
|
|
- freight_total = this.ctx.plus(freight_total, this.ctx.multiply(_.get(g, 'freight'), _.get(g, 'num')));
|
|
|
|
- if (_.isArray(g.act)) {
|
|
|
|
- const actDiscount = g.act.reduce((p, n) => this.ctx.plus(p, n.discount), 0);
|
|
|
|
- discount = this.ctx.plus(discount, actDiscount);
|
|
|
|
|
|
+ const { is_set = '1' } = i;
|
|
|
|
+ if (is_set === '1') {
|
|
|
|
+ for (const g of i.goods) {
|
|
|
|
+ // 如果有特价,那就使用特价,没有特价就是用正常销售价
|
|
|
|
+ goods_total = this.ctx.plus(goods_total, this.ctx.multiply(_.get(g, 'price'), _.get(g, 'num')));
|
|
|
|
+ freight_total = this.ctx.plus(freight_total, this.ctx.multiply(_.get(g, 'freight'), _.get(g, 'num')));
|
|
|
|
+ if (_.isArray(g.act)) {
|
|
|
|
+ const actDiscount = g.act.reduce((p, n) => this.ctx.plus(p, n.discount), 0);
|
|
|
|
+ discount = this.ctx.plus(discount, actDiscount);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ i.goods_total = goods_total;
|
|
|
|
+ i.freight_total = freight_total;
|
|
|
|
+ i.discount = this.ctx.minus(0, discount);
|
|
|
|
+ } else {
|
|
|
|
+ const { sell_money, num, freight } = i;
|
|
|
|
+ goods_total = this.ctx.multiply(num, sell_money);
|
|
|
|
+ freight_total = this.ctx.multiply(num, freight);
|
|
}
|
|
}
|
|
- i.goods_total = goods_total;
|
|
|
|
- i.freight_total = freight_total;
|
|
|
|
- i.discount = this.ctx.minus(0, discount);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|