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

//  经销权 列表 有分页
export const dealerScopeList = (params) => {
  const url = `/dealerScope/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
//  经销权 列表 无分页
export const dealerScopeQueryList = (params) => {
  const mid = { 'PRODUCT': '选择产品', 'BRAND': '选择品牌', 'CATEGORY': '选择产品分类' }
  return axios({
    url: '/dealerScope/queryList',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent(mid[params.goodsType])
    }
  })
}
//  经销权  添加
export const dealerScopeSave = (params) => {
  return axios({
    url: '/dealerScope/addDealerScope',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('新增')
    }
  })
}
// 经销权 删除
export const dealerScopeDel = (params) => {
  return axios({
    url: `/dealerScope/deleteBySn/${params.sn}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('删除')
    }
  })
}
//  经销权  校验产品是否被包含在品牌分类中
export const dealerScopeValidProduct = (params) => {
  return axios({
    url: '/dealerScope/validProductIsIncloude',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('校验产品是否在品牌分类中')
    }
  })
}

// 获取选择品类列表数据   (所有产品的品牌+分类)
export const queryWaitingData = (params) => {
  return axios({
    url: '/dealerScope/queryWaitingData',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('选择品类列表查询')
    }
  })
}
//  经销权  添加品类
export const dealerScopeCreate = (params) => {
  return axios({
    url: '/dealerScope/create',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('新增品类')
    }
  })
}
//  经销权  修改价格级别
export const dealerScopeModifyPriceLevel = (params) => {
  return axios({
    url: '/dealerScope/modifyPriceLevelBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('修改价格级别')
    }
  })
}
// 经销权  删除选择品类
export const dealerScopeDelete = (params) => {
  return axios({
    url: '/dealerScope/deleteBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('删除')
    }
  })
}
