import { axios } from '@/utils/request'
// 保存抽奖设置
export const saveLuckyDrawConfig = (params) => {
  return axios({
    url: 'luckyDraw/save',
    data: params,
    method: 'post'
  })
}
// 抽奖活动列表
export const getLuckyDrawList = (params) => {
  const url = `luckyDraw/query/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 查询抽奖明细
export const getLuckyDrawDetail = (params) => {
  return axios({
    url: `luckyDraw/findById/${params.id}`,
    data: {},
    method: 'get'
  })
}
// 启用禁用
export const enableLuckyDraw = (params) => {
  return axios({
    url: 'luckyDraw/updateState',
    data: params,
    method: 'post'
  })
}
// 删除
export const deleteLuckyDraw = (params) => {
  return axios({
    url: `luckyDraw/delete/${params.id}`,
    data: {},
    method: 'get'
  })
}
// 查询中奖记录
export const getLuckyWinList = (params) => {
  const url = `luckyDrawWin/query/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 发送快递
export const sendExpress = (params) => {
  return axios({
    url: 'luckyDrawWin/sendExpress',
    data: params,
    method: 'post'
  })
}
// 查获奖用户明细
export const getLuckyDrawWinDetail = (params) => {
  return axios({
    url: `luckyDrawWin/findById/${params.id}`,
    data: {},
    method: 'get'
  })
}

// 中奖纪录导出
export const exportLuckyDrawWin = (params) => {
  return axios.request({
    url: 'luckyDrawWin/exportLuckyDrawWin',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
