lrf 2 năm trước cách đây
mục cha
commit
bf48381807
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      app/service/trade/afterSale.js

+ 5 - 2
app/service/trade/afterSale.js

@@ -28,7 +28,7 @@ class AfterSaleService extends CrudService {
    * @param {Object} 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, '未找到订单信息');
     const orderDetail = await this.orderDetailModel.findById(order_detail);
     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 (type !== '4' && type !== '5') {
       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, '未在当前订单中搜索到要售后的商品');
     } else {
       const realPay = await this.ctx.service.util.orderDetail.computedRealPay(orderDetail);