import request from '@/config/axios'

export interface PayOrderVO {
  id: number
  merchantId: number
  channelId: number
  channelCode: string
  merchantOrderId: string
  subject: string
  body: string
  notifyUrl: string
  notifyStatus: number
  amount: number
  channelFeeRate: object
  channelFeeAmount: number
  status: number
  userIp: string
  expireTime: Date
  successTime: Date
  notifyTime: Date
  successExtensionId: number
  refundStatus: number
  refundTimes: number
  refundAmount: number
  channelUserId: string
  channelOrderNo: string
}

// 查询支付订单列表
export const getPayOrderPage = async (params) => {
  return await request.get({ url: `/member/pay-order/page`, params })
}

// 查询支付订单详情
export const getPayOrder = async (id: number) => {
  return await request.get({ url: `/member/pay-order/get?id=` + id })
}

// 新增支付订单

export const createPayOrder = async (data: PayOrderVO) => {
  return await request.post({ url: `/member/pay-order/create`, data })
}

// 修改支付订单

export const updatePayOrder = async (data: PayOrderVO) => {
  return await request.put({ url: `/member/pay-order/update`, data })
}

// 删除支付订单

export const deletePayOrder = async (id: number) => {
  return await request.delete({ url: `/member/pay-order/delete?id=` + id })
}

// 导出支付订单Excel
export const exportPayOrder = async (params) => {
  return await request.download({ url: `/member/pay-order/export-excel`, params })
}

// 审批支付订单
export const approvePayOrder = async (data: any) => {
  return await request.post({ url: `/member/pay-order/approve`, data })
}
