import { request } from '@/service/request';

/**
 * 售后快递订单
 * @param data
 * @returns
 */
export function fetchGetAfterSalesOrderList(data: any) {
  return request<Api.Common.PaginatingQueryRecord<Api.delivery.OrderRefund>>({
    url: '/platform/orderRefund/orderRefundPage',
    method: 'get',
    params: data
  });
}

/**
 * 导出正常快递订单
 * @param data
 * @returns
 */
export function fetchExportRefundOrderList(data: any) {
  return request({
    url: '/platform/orderRefund/export',
    method: 'get',
    params: data
  });
}

/**
 * 导出售后快递订单
 * @param data
 */
export function fetchExportAfterSalesOrderList(data: any) {
  return request<any>({
    url: '/platform/orderRefund/export',
    method: 'get',
    params: data
  });
}

/**
 *  获取售后快递订单状态数量
 * @returns
 */
export function fetchGetAfterSalesStatusNum(data: any) {
  return request<Api.delivery.OrderRefundCountParam>({
    url: '/platform/orderRefund/orderRefundCount',
    method: 'get',
    params: data
  });
}

/**
 * 获取快递订单详情
 * @param orderNumber
 * @returns
 */
export function fetchGetNomalOrderInfo(orderNumber: string) {
  return request<Api.delivery.deliveryOrder>({
    url: `/platform/order/orderInfo/${orderNumber}`,
    method: 'get'
  });
}

/**
 *
 * 快递公司列表
 *  */
export function fetchGetDevList(data: any) {
  return request<Api.delivery.devList>({
    url: '/platform/delivery/list',
    method: 'get',
    params: data
  });
}

/**
 * 发货
 */
export function fetchDeliveryOrder(data: any) {
  return request({
    url: '/platform/order/delivery',
    method: 'PUT',
    data
  });
}

/**
 * 查看退款订单详情
 * @param refundId
 * @returns
 */
export function fetchGetAfterSalesOrderDetail(refundId: number) {
  return request<Api.delivery.OrderRefund>({
    url: `/platform/orderRefund/orderRefundInfo/${refundId}`,
    method: 'get'
  });
}
