|
@@ -36,7 +36,7 @@ class OrderService extends CrudService {
|
|
|
const user = this.ctx.user;
|
|
|
const customer = _.get(user, '_id');
|
|
|
if (!customer) throw new BusinessError(ErrorCode.NOT_LOGIN, '未找到用户信息');
|
|
|
- const { address, goods, total_detail, coupon = [], type = '0', group, inviter } = body;
|
|
|
+ const { address, goods, total_detail, coupon = [], type = '0', inviter } = body;
|
|
|
if (coupon.length > 1) throw new BusinessError(ErrorCode.DATA_INVALID, '目前只允许使用1张优惠券');
|
|
|
// 检测商品是否可以下单
|
|
|
for (const i of goods) {
|
|
@@ -93,15 +93,8 @@ class OrderService extends CrudService {
|
|
|
orderData.no = `${moment().format('YYYYMMDDHHmmss')}-${str}`;
|
|
|
// 4.状态
|
|
|
orderData.status = '0';
|
|
|
- // #region 是否是团购
|
|
|
- orderData.type = type;
|
|
|
- if (type === '1' || group) {
|
|
|
- orderData.group = group;
|
|
|
- }
|
|
|
- // #endregion
|
|
|
// 5.返现部分:邀请人: 自己发链接自己买不行
|
|
|
if (customer !== inviter && ObjectId.isValid(inviter)) orderData.inviter = inviter;
|
|
|
-
|
|
|
// 生成数据
|
|
|
const order_id = this.tran.insert('Order', orderData);
|
|
|
// 处理库存,删除购物车
|