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

//  修理厂促销  列表  有分页
export const promoActiveList = (params) => {
  const url = `/promoActive/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
//  修理厂促销 新增
export const promoActiveCreate = (params) => {
  return axios({
    url: '/promoActive/create',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('新增')
    }
  })
}

//  修理厂促销 详情
export const promoActiveDetail = (params) => {
  const url = `/promoActive/findBySn/${params.sn}`
  return axios({
    url: url,
    method: 'get'
  })
}
//  修理厂促销 编辑
export const promoActiveUpdate = (params) => {
  return axios({
    url: '/promoActive/update',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('编辑')
    }
  })
}

//  修理厂促销 删除
export const promoActiveDel = (params) => {
  const url = `/promoActive/delete/${params.sn}`
  return axios({
    url: url,
    method: 'get',
    headers: {
      'module': encodeURIComponent('删除')
    }
  })
}
// 修理厂促销 促销发布
export const promoActivePublish = (params) => {
  return axios({
    url: '/promoActive/updatePublish',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('促销发布')
    }
  })
}
// 修理厂促销 选择产品列表
export const queryWaitingProductPage = (params) => {
  const url = `/promoRuleProduct/queryWaitingProductPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

// 修理厂促销   保存产品范围
export const saveBatchEntity = (params) => {
  return axios({
    url: '/promoRuleProductRange/saveBatchEntity',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('保存产品范围')
    }
  })
}
// 批量创建产品
export const promoCreateBatch = (params) => {
  return axios({
    url: '/promoRuleProduct/createBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量创建产品')
    }
  })
}
export const promoUpdateBatch = (params) => {
  return axios({
    url: '/promoRuleProduct/updateBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量创建产品')
    }
  })
}
// 获取已选产品列表数据  有分页
export const promoRuleProductList = (params) => {
  const url = `/promoRuleProduct/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

// 批量删除
export const deleteBatch = (params) => {
  return axios({
    url: '/promoRuleProduct/deleteBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量删除')
    }
  })
}
// 删除产品范围  数据变化 promoActiveSn  productTypeSnList
export const deleteByProductType = (params) => {
  return axios({
    url: '/promoRuleProduct/deleteByProductType',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量删除')
    }
  })
}
