|
@@ -23,21 +23,6 @@ class AfterSaleService extends CrudService {
|
|
// 查看该商品是否已经申请售后
|
|
// 查看该商品是否已经申请售后
|
|
const hasData = await this.model.count({ order_detail, 'goods._id': goods_id, type: [ '0', '1', '2', '3' ] });
|
|
const hasData = await this.model.count({ order_detail, 'goods._id': goods_id, type: [ '0', '1', '2', '3' ] });
|
|
if (hasData > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已有正在处理中的售后申请.请勿重复申请');
|
|
if (hasData > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已有正在处理中的售后申请.请勿重复申请');
|
|
-
|
|
|
|
- // 查询该商品是不是申请退款,如果是申请退款,查看是否有记录,如果有记录,是否已经退款
|
|
|
|
- // const type = _.get(others, 'type');
|
|
|
|
- // if (type === '0') {
|
|
|
|
- // const record = await this.model.find({ order_detail, 'goods._id': goods_id, type: '0' });
|
|
|
|
- // if (record) {
|
|
|
|
- // const rs = _.get(record, 'status');
|
|
|
|
- // if (rs === '0' || rs === '1') throw new BusinessError(ErrorCode.DATA_EXISTED, '已申请退款,正在等待处理');
|
|
|
|
- // else if (rs === '-1') throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已退款');
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // // 如果是换货/维修,那么可以重复多次,也就是需要查当前该货物是否有未结束的售后,如果有,则不能添加
|
|
|
|
- // const num = await this.model.count({ order_detail, 'goods._id': goods_id, type, status: [ '2', '3' ] });
|
|
|
|
- // if (num) throw new BusinessError(ErrorCode.DATA_INVALID, '商品正在售后中');
|
|
|
|
- // }
|
|
|
|
const { goods: goodsList } = orderDetail;
|
|
const { goods: goodsList } = orderDetail;
|
|
const goods = goodsList.find(f => ObjectId(f._id).equals(goods_id));
|
|
const goods = goodsList.find(f => ObjectId(f._id).equals(goods_id));
|
|
if (!goods) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未在当前订单中搜索到要售后的商品');
|
|
if (!goods) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未在当前订单中搜索到要售后的商品');
|