|
@@ -28,7 +28,7 @@ class AfterSaleService extends CrudService {
|
|
* @param {Object} body 售后信息
|
|
* @param {Object} body 售后信息
|
|
*/
|
|
*/
|
|
async create(body) {
|
|
async create(body) {
|
|
- const { order_detail, goods_id, type, ...others } = body;
|
|
|
|
|
|
+ const { order_detail, goods: goods_id, type, ...others } = body;
|
|
if (!order_detail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单信息');
|
|
if (!order_detail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单信息');
|
|
const orderDetail = await this.orderDetailModel.findById(order_detail);
|
|
const orderDetail = await this.orderDetailModel.findById(order_detail);
|
|
if (!orderDetail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单信息');
|
|
if (!orderDetail) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到订单信息');
|
|
@@ -38,7 +38,10 @@ class AfterSaleService extends CrudService {
|
|
if (hasData > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已有正在处理中的售后申请.请勿重复申请');
|
|
if (hasData > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '该商品已有正在处理中的售后申请.请勿重复申请');
|
|
if (type !== '4' && type !== '5') {
|
|
if (type !== '4' && type !== '5') {
|
|
const { goods: goodsList } = orderDetail;
|
|
const { goods: goodsList } = orderDetail;
|
|
- goods = goodsList.find(f => ObjectId(f._id).equals(goods_id));
|
|
|
|
|
|
+ goods = goodsList.find(f => {
|
|
|
|
+ console.log(f._id, goods_id);
|
|
|
|
+ return ObjectId(f._id).equals(goods_id);
|
|
|
|
+ });
|
|
if (!goods) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未在当前订单中搜索到要售后的商品');
|
|
if (!goods) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未在当前订单中搜索到要售后的商品');
|
|
} else {
|
|
} else {
|
|
const realPay = await this.ctx.service.util.orderDetail.computedRealPay(orderDetail);
|
|
const realPay = await this.ctx.service.util.orderDetail.computedRealPay(orderDetail);
|