import { axios } from '@/utils/request'

//  首页轮播图列表  有分页
export const shopBannerList = (params) => {
  const url = `/shopBanner/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

//  首页轮播图  保存
export const saveShopBanner = (params) => {
  return axios({
    url: '/shopBanner/saveShopBanner',
    data: params,
    method: 'post'
  })
}

// 查看参与经销商
export const shopBannerSeeDealer = (params) => {
  const url = `/shopBanner/queryDealerPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

// 发布  关闭  删除
export const updateShopBanner = (params) => {
  return axios({
    url: '/shopBanner/updateShopBannerState',
    data: params,
    method: 'post'
  })
}

// 查看详情
export const shopBannerDetail = (params) => {
  return axios({
    url: '/shopBanner/view',
    data: params,
    method: 'post'
  })
}

// 查看经销商  导出
export const shopBannerExport = params => {
  return axios.request({
    url: '/shopBanner/exportList',
    method: 'post',
    data: params,
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('导出')
    }
  })
}

// 促销活动  设置轮播图
export const updateSetShopBanner = (params) => {
  return axios({
    url: '/shopBanner/queryByBizSn',
    data: params,
    method: 'post'
  })
}
