import request from '@/utils/request';

/**
 * 订单接口 - 获取用户的订单列表
 * @returns
 */
export function userOrdersApi(data) {
  return request({
    url: '/maintain/userorders',
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * 订单接口 - 获取用户的订单列表
 * @returns
 */
export function getUserOrderList(data) {
  return request({
    url: '/maintain/order/paging',
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * 订单接口 - 支付成功回调
 * @returns
 */

export function successfulPayment(id, data) {
  return request({
    url: `/maintain/paySuccess/${id}`,
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * 订单接口 - 获取订单明细
 * @returns
 */

export function orderDetailGoodApi(id, data) {
  return request({
    url: `/maintain/orderdetail/${id}`,
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}

/**
 * 订单接口 - 取消订单
 * @returns
 */

export function cancelOrder(id, data) {
  return request({
    url: `/maintain/cancelOrder/${id}`,
    method: 'get',
    data: data,
    headers: {
      'content-type': 'application/x-www-form-urlencoded',
    },
  });
}
