import request from '@/config/axios'

export interface BalanceAccountVO {
  userId: number
  balance: number
  freezeBalance: number
  password: string
  status: number
}

// 查询会员账户列表
export const getBalanceAccountPage = async (params) => {
  return await request.get({ url: `/member/balance-account/page`, params })
}

// 查询会员账户详情
export const getBalanceAccount = async (id: number) => {
  return await request.get({ url: `/member/balance-account/get?id=` + id })
}

// 新增会员账户
export const createBalanceAccount = async (data: BalanceAccountVO) => {
  return await request.post({ url: `/member/balance-account/create`, data })
}

// 修改会员账户
export const updateBalanceAccount = async (data: BalanceAccountVO) => {
  return await request.put({ url: `/member/balance-account/update`, data })
}

// 删除会员账户
export const deleteBalanceAccount = async (id: number) => {
  return await request.delete({ url: `/member/balance-account/delete?id=` + id })
}

// 导出会员账户 Excel
export const exportBalanceAccount = async (params) => {
  return await request.download({ url: `/member/balance-account/export-excel`, params })
}

// 查询会员账户by userId
export const getBalanceAccountByUseId = async (params) => {
  return await request.get({ url: `/member/balance-account/get/${params.userId}` })
}

// 修改账户余额
export const updateBalanceAccountByUser = async (data: any) => {
  return await request.post({ url: `/member/balance-account/update-balance`, data })
}

// 修改取款密码
export const updateBalanceAccountPassword = async (data: any) => {
  return await request.put({ url: `/member/balance-account/update-password`, data })
}
