import request from '@/config/axios'

export interface BalanceRecordVO {
  id: number
  userId: number
  beforeAmount: number
  amount: number
  afterAmount: number
  type: string
  flow: string
  description: string
}

// 查询余额日志列表
export const getBalanceRecordPage = async (params) => {
  return await request.get({ url: `/member/balance-record/page`, params })
}

// 查询余额日志详情
export const getBalanceRecord = async (id: number) => {
  return await request.get({ url: `/member/balance-record/get?id=` + id })
}

// 新增余额日志
export const createBalanceRecord = async (data: BalanceRecordVO) => {
  return await request.post({ url: `/member/balance-record/create`, data })
}

// 修改余额日志
export const updateBalanceRecord = async (data: BalanceRecordVO) => {
  return await request.put({ url: `/member/balance-record/update`, data })
}

// 删除余额日志
export const deleteBalanceRecord = async (id: number) => {
  return await request.delete({ url: `/member/balance-record/delete?id=` + id })
}

// 导出余额日志 Excel
export const exportBalanceRecord = async (params) => {
  return await request.download({ url: `/member/balance-record/export-excel`, params })
}
