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

//  人员 列表  分页
export const queryUserList = (params) => {
  const url = `/bizuser/queryUserList/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('人员列表查询')
    }
  })
}
// 业务负责人配置列表  分页
export const queryPage = (params) => {
  const url = `/bizuser/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('列表查询')
    }
  })
}

// 业务负责人配置列表   新增/编辑
export const bizuserSave = params => {
  return axios({
    url: '/bizuser/save',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('新增/编辑')
    }
  })
}

// 业务负责人配置列表 删除
export const bizuserDelete = params => {
  return axios({
    url: `/bizuser/delete/${params.id}`,
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('删除')
    }
  })
}

/*
****  设置管辖范围
*/

// 设置管辖品类  新增（生成sn)
export const getNewScopeSn = params => {
  return axios({
    url: '/bizuser/scope/getNewScopeSn',
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('新增管辖品类')
    }
  })
}

// 设置管辖品类
export const saveProductBrandList = params => {
  return axios({
    url: '/bizuser/scope/saveProductBrandList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('新增品牌标签')
    }
  })
}

// 设置管辖品类
export const saveProductTypeList = params => {
  return axios({
    url: '/bizuser/scope/saveProductTypeList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('新增分类标签')
    }
  })
}
// 设置管辖区域
export const queryDealerScopePage = params => {
  const url = `/bizuser/scope/queryDealerScopePage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('管辖区域明细列表')
    }
  })
}
// 设置管辖品类
export const queryProductScopePage = params => {
  const url = `/bizuser/scope/queryProductScopePage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('管辖品类列表')
    }
  })
}

// 设置管辖品类  删除整列
export const bizuserScopeDelete = params => {
  return axios({
    url: `/bizuser/scope/delete/${params.id}`,
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('删除')
    }
  })
}
// 设置管辖品类  删除产品品牌
export const deleteProductBrand = params => {
  return axios({
    url: `/bizuser/scope/detail/deleteProductBrand/${params.id}`,
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('删除产品品牌标签')
    }
  })
}
// 设置管辖品类  删除产品分类
export const deleteProductType = params => {
  return axios({
    url: `/bizuser/scope/detail/deleteProductType/${params.id}`,
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('删除分类标签')
    }
  })
}

// 查询用户信息
export const findById = params => {
  return axios({
    url: `/bizuser/findById/${params.id}`,
    data: {},
    method: 'get',
    headers:{
      'module': encodeURIComponent('查询用户信息')
    }
  })
}

// 查询区域回显列表
export const queryAreaScope = params => {
  return axios({
    url: '/bizuser/scope/queryAreaScopeList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('查询区域列表')
    }
  })
}

// 保存区域
export const saveAreaScope = params => {
  return axios({
    url: '/bizuser/scope/saveAreaScope',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('添加区域')
    }
  })
}

// 查询经销商回显列表
export const queryDealerScope = params => {
  return axios({
    url: '/bizuser/scope/queryDealerScopeList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('经销商查询')
    }
  })
}
// 保存经销商
export const saveDealerScope = params => {
  return axios({
    url: '/bizuser/scope/saveDealerScope',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('添加经销商')
    }
  })
}

// 经销商列表  (选择过的优先显示)
export const bizuserScopeQueryDealer = (params) => {
  const url = `/bizuser/scope/queryDealerPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('经销商列表(选择过的优先显示)')
    }
  })
}

/* 供应商 */
// 供应商显示列表
export const querySupplierScopePage = (params) => {
  const url = `/bizuser/scope/querySupplierScopePage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('已选供应商列表')
    }
  })
}
// 供应商列表  (选择过的优先显示)
export const querySupplierPage = (params) => {
  const url = `/bizuser/scope/querySupplierPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('供应商列表(选择过的优先显示)')
    }
  })
}
// 保存供应商
export const saveSupplierList = params => {
  return axios({
    url: '/bizuser/scope/saveSupplierList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('添加供应商')
    }
  })
}

export const querySupplierScope = params => {
  return axios({
    url: '/bizuser/scope/querySupplierScopeList',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('供应商列表查询')
    }
  })
}

// 已启用状态下的客服列表查询
export const queryUnderlingKf = params => {
  return axios({
    url: '/bizuser/queryUnderlingKf',
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('客服列表查询')
    }
  })
}
