import request from '@/utils/request'

// 查询提现申请列表
export function listWithdrawals(query) {
  return request({
    url: '/admin/withdrawal/list',
    method: 'get',
    params: query
  })
}

// 获取提现申请详情
export function getWithdrawal(id) {
  return request({
    url: '/admin/withdrawal/' + id,
    method: 'get'
  })
}

// 审核通过
export function approveWithdrawal(id) {
  return request({
    url: '/admin/withdrawal/' + id + '/approve',
    method: 'put'
  })
}

// 审核拒绝
export function rejectWithdrawal(id, reason) {
  return request({
    url: '/admin/withdrawal/' + id + '/reject',
    method: 'put',
    params: { reason }
  })
}

// 确认打款
export function confirmPaid(id) {
  return request({
    url: '/admin/withdrawal/' + id + '/paid',
    method: 'put'
  })
}

// 导出提现申请
export function exportWithdrawal(query) {
  return request({
    url: '/admin/withdrawal/export',
    method: 'get',
    params: query
  })
}
