import { axios } from '@/utils/request'
// 修理厂促销列表  有分页
export const promoTerminalList = (params) => {
  const url = `/promoTerminal/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('列表查询')
    }
  })
}
//  保存促销
export const promoTerminalSave = (params) => {
  return axios({
    url: '/promoTerminal/save',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('新增/编辑')
    }
  })
}

//  获取促销详情
export const promoTerminalDetail = (params) => {
  const url = `/promoTerminal/findBySn/${params.sn}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('详情')
    }
  })
}

//  促销活动 删除
export const promoTerminalDel = (params) => {
  const url = `/promoTerminal/delete/${params.sn}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('删除')
    }
  })
}
//  促销活动 修改显示状态
export const updateShowFlag = (params) => {
  const url = `/promoTerminal/updateShowFlag/${params.sn}/${params.showFlag}`
  return axios({
    url: url,
    method: 'get',
    headers:{
        'module': encodeURIComponent('显示状态修改')
    }
  })
}
//  促销活动发布
export const saveActive = (params) => {
  return axios({
    url: '/promoTerminal/saveActive',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('发布')
    }
  })
}

// 导出活动经销商列表
export const dealerExport = (params) => {
  return axios({
    url: '/dealer/exportListForPromo',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers:{
        'module': encodeURIComponent('导出')
    }
  })
}
