|
@@ -79,14 +79,18 @@ class AfterSaleService extends CrudService {
|
|
if (type === '1') {
|
|
if (type === '1') {
|
|
// 仅退款,退优惠券,退款
|
|
// 仅退款,退优惠券,退款
|
|
// 如果不是处理中,则不进行退款
|
|
// 如果不是处理中,则不进行退款
|
|
- if (_.get(update, 'status') !== '1') throw new BusinessError(ErrorCode.DATA_INVALID, '订单状态错误');
|
|
|
|
- // 1.检验并组织退款信息
|
|
|
|
- refundInfo = await this.toReturnMoney(entity, update, this.tran);
|
|
|
|
- // 2.检查是否退优惠券,该退就退
|
|
|
|
- await this.toReturnCoupons(entity, update, this.tran);
|
|
|
|
- // 3.修改数据, 直接修改成退完款的状态.如果后面退款失败了.直接回滚了
|
|
|
|
- update.status = '-1';
|
|
|
|
- update.end_time = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
|
+ if (_.get(update, 'status') === '1') {
|
|
|
|
+ // 1.检验并组织退款信息
|
|
|
|
+ refundInfo = await this.toReturnMoney(entity, update, this.tran);
|
|
|
|
+ // 2.检查是否退优惠券,该退就退
|
|
|
|
+ await this.toReturnCoupons(entity, update, this.tran);
|
|
|
|
+ // 3.修改数据, 直接修改成退完款的状态.如果后面退款失败了.直接回滚了
|
|
|
|
+ update.status = '-1';
|
|
|
|
+ update.end_time = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
+ } else if (_.get(update, 'status') === '!1') {
|
|
|
|
+ update.end_time = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
+ }
|
|
|
|
+
|
|
// 4.修改订单状态
|
|
// 4.修改订单状态
|
|
await this.refundOrder(entity, this.tran);
|
|
await this.refundOrder(entity, this.tran);
|
|
} else if (type === '2') {
|
|
} else if (type === '2') {
|