import request from '@/config/axios'

export interface WithdrawalVO {
  id: number
  userId: number
  withdrawalType: number
  amount: number
  currency: string
  status: string
  requestDate: Date
  processedDate: Date
  remark: string
  fee: number
  netAmount: number
}

// 查询提现记录列表
export const getWithdrawalPage = async (params) => {
  return await request.get({ url: `/member/withdrawal/page`, params })
}

// 查询提现记录详情
export const getWithdrawal = async (id: number) => {
  return await request.get({ url: `/member/withdrawal/get?id=` + id })
}

// 新增提现记录
export const createWithdrawal = async (data: WithdrawalVO) => {
  return await request.post({ url: `/member/withdrawal/create`, data })
}

// 修改提现记录
export const updateWithdrawal = async (data: WithdrawalVO) => {
  return await request.put({ url: `/member/withdrawal/update`, data })
}

// 修改提现记录
export const approveWithdrawal = async (data: WithdrawalVO) => {
  return await request.put({ url: `/member/withdrawal/approve`, data })
}

// 删除提现记录
export const deleteWithdrawal = async (id: number) => {
  return await request.delete({ url: `/member/withdrawal/delete?id=` + id })
}

// 导出提现记录 Excel
export const exportWithdrawal = async (params) => {
  return await request.download({ url: `/member/withdrawal/export-excel`, params })
}
