import request from '@/helpers/request';

export const type_OrderTypes: { [_: string]: string } = {
  VIP: '数字化器乐学练工具',
  SCHOOL_REGISTER: '学生报名'
};
export const type_OrderStatus: { [_: string]: string } = {
  WAIT_PAY: '待支付',
  PAYING: '支付中',
  PAID: '已付款',
  TIMEOUT: '订单超时',
  FAIL: '支付失败',
  CLOSED: '已关闭',
  REFUNDED: '已退款'
};
export interface IApiUserPaymentOrderPage {
  /** 订单状态,可用值:WAIT_PAY,PAYING,PAID,TIMEOUT,FAIL,CLOSED,REFUNDED */
  orderStatus:
    | 'WAIT_PAY'
    | 'PAYING'
    | 'PAID'
    | 'TIMEOUT'
    | 'FAIL'
    | 'CLOSED'
    | 'REFUNDED';
  /** 分页行数 */
  rows: number;
  /** 当前页 */
  page: number;
  /** 订单年份, 类似: 2023-06 */
  payMonth: string;
}
/** 获取领取列表 */
export const api_userPaymentOrderPage = (
  params: IApiUserPaymentOrderPage
): Promise<any> => {
  return request.post('/edu-app/userPaymentOrder/studentOrderPage', {
    data: params
  });
};
/** 获取退回列表 */
export const api_userPaymentOrderStudentRefundOrderPage = (
  params: any
): Promise<any> => {
  return request.post('/edu-app/userPaymentOrder/studentRefundOrderPage', {
    data: params
  });
};

/** 获取订单详情 */
export const api_userPaymentOrderDetail = (params: any): Promise<any> => {
  return request.get(`/edu-app/userPaymentOrder/detail/${params}`);
};
/** 获取退回订单详情 */
export const api_userPaymentOrderRefundDetail = (params: any): Promise<any> => {
  return request.get(`/edu-app/userPaymentOrder/refundDetail/${params}`);
};
/** 取消订单退款 */
export const api_userPaymentOrderCancelRefund = (params: any): Promise<any> => {
  return request.post(`/edu-app/userPaymentOrder/cancelRefund/${params}`);
};
/** 申请退款 */
export const api_userPaymentOrderRefundPayment = (
  params: any
): Promise<any> => {
  return request.post('/edu-app/userPaymentOrder/refundPayment', {
    data: params
  });
};

/** 继续支付订单 */
export const api_userPaymentOrderUnpaid = (params: any): Promise<any> => {
  return request.get('/edu-app/userPaymentOrder/unpaid', {
    params
  });
};
/** 取消订单 */
export const api_userPaymentOrderCancelPayment = (
  params: any
): Promise<any> => {
  return request.post('/edu-app/userPaymentOrder/cancelPayment/' + params);
};
