import request from '@/config/axios'

// 兑换 VO
export interface RedeemVO {
  id: number // id
  name: string // 商品名
  url: string // url
  point: number // 兑换积分
  userId: number // 用户id
  contactName: string // 联系人姓名
  contactAddress: string // 联系地址
  contactPhone: string // 联系电话
  status: string // 状态
  remark: string // 备注
}

// 兑换 API
export const RedeemApi = {
  // 查询兑换分页
  getRedeemPage: async (params: any) => {
    return await request.get({ url: `/menduner/system/redeem/page`, params })
  },

  // 查询兑换详情
  getRedeem: async (id: number) => {
    return await request.get({ url: `/menduner/system/redeem/get?id=` + id })
  },

  // 新增兑换
  createRedeem: async (data: RedeemVO) => {
    return await request.post({ url: `/menduner/system/redeem/create`, data })
  },

  // 修改兑换
  updateRedeem: async (data: RedeemVO) => {
    return await request.put({ url: `/menduner/system/redeem/update`, data })
  },

  // 删除兑换
  deleteRedeem: async (id: number) => {
    return await request.delete({ url: `/menduner/system/redeem/delete?id=` + id })
  },

  // 导出兑换 Excel
  exportRedeem: async (params) => {
    return await request.download({ url: `/menduner/system/redeem/export-excel`, params })
  }
}