|
@@ -128,6 +128,8 @@ class AfterSaleService extends CrudService {
|
|
|
if (uStatus === '4') {
|
|
|
refundInfo = await this.returnOrder(entity, this.tran);
|
|
|
update.status = '-4';
|
|
|
+ // 检查是否是团购
|
|
|
+ await this.exitGroup(entity, this.tran);
|
|
|
}
|
|
|
update.end_time = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
} else if (type === '5') {
|
|
@@ -250,14 +252,6 @@ class AfterSaleService extends CrudService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 售后退库存
|
|
|
- * @param {Object} data 售后修改前的数据
|
|
|
- * @param {Transaction} tran 数据库事务
|
|
|
- */
|
|
|
- async toReturnStock(data, tran) {}
|
|
|
-
|
|
|
/**
|
|
|
* 售后:修改拆分订单
|
|
|
* @param {Object} data 售后修改前的数据
|
|
@@ -360,6 +354,19 @@ class AfterSaleService extends CrudService {
|
|
|
|
|
|
return refundInfo;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 售后 取消订单 & 拒收处理完成
|
|
|
+ * @param {Object} data 售后修改前的数据
|
|
|
+ * @param {Transaction} tran 数据库事务
|
|
|
+ */
|
|
|
+ async exitGroup(data, tran) {
|
|
|
+ const { order_detail } = data;
|
|
|
+ const orderDetail = await this.orderDetailModel.findById(order_detail);
|
|
|
+ if (!orderDetail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单数据');
|
|
|
+ const { type, group, customer } = orderDetail;
|
|
|
+ if (type !== '1' || !group) return;
|
|
|
+ await this.ctx.service.group.group.refund({ group, customer }, tran);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 判断是否全额退的商品
|