/* eslint-disable arrow-parens */
import request from '../../service/request';
import { urlConfig } from '../../utils/mock';
/*
 * 查询订单详情
 * @param orderId
 * */

const queryForOrderDetail = params => {
  const url = `${urlConfig}/api/v1/mall/order/detail`;
  return request.post(url, params);
};
/*
 * 查询退款单详情
 * @param id
 * */


const queryForRefundDetail = params => {
  const url = `${urlConfig}/api/v1/mall/order/refund/detail`;
  return request.post(url, params);
};
/*
 * 单独创建支付订单
 * @param orderId
 * */


const orderPayCreate = params => {
  const url = `${urlConfig}/api/v1/mall/order/payCreate`;
  return request.post(url, params);
};
/*
 * 取消订单
 * @param id
 * */


const cancelOrder = params => {
  const url = `${urlConfig}/api/v1/mall/order/cancel`;
  return request.post(url, params);
};
/*
 * 订单状态查询
 * @param orderId
 * */


const queryOrderStatus = params => {
  const url = `${urlConfig}/api/v1/mall/order/payStatus`;
  return request.post(url, params);
};
/*
 * 确认提货
 * @param code
 * */


const confirmTakeDelivery = params => {
  const url = `${urlConfig}/api/v1/mall/order/takeDelivery`;
  return request.post(url, params);
};
/*
 * 确认收货
 * @param orderId
 * */


const confirmReceiveDelivery = params => {
  const url = `${urlConfig}/api/v1/mall/order/userReceiving`;
  return request.post(url, params);
};
/*
 * 再来一单
 * @param orderId
 * */


const orderBuyAgain = params => {
  const url = `${urlConfig}/api/v1/mall/cart/buyAgain`;
  return request.post(url, params);
};

export default {
  cancelOrder,
  orderBuyAgain,
  orderPayCreate,
  confirmTakeDelivery,
  queryOrderStatus,
  confirmReceiveDelivery,
  queryForOrderDetail,
  queryForRefundDetail
};