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

//  根据sn查找经销商详情
export const dealerDetailBySn = (params) => {
  return axios({
    url: `/dealer/findBySn/${params.sn}`,
    data: params,
    method: 'get'
  })
}
// 根据sn查找修改过后的经销商信息
export const dealerFindUpdateInfoBySn = (params) => {
  return axios({
    url: `/dealer/findUpdateInfoBySn/${params.sn}`,
    data: params,
    method: 'get'
  })
}
//  经销商列表有分页
export const dealerQueryList = (params) => {
  const url = `/dealer/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  经销商 列表 有分页
export const dealerSubareaScopeList = (params) => {
  const url = `/dealer/queryBySubareaScope/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  经销商保存
export const dealerSave = (params) => {
  return axios({
    url: '/dealer/save',
    data: params,
    method: 'post'
  })
}
//  经销商 导出
export const dealerExport = (params) => {
  return axios({
    url: '/dealer/exportList',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
// 审核经销商资料
export const dealerAudit = (params) => {
  return axios({
    url: `/dealer/audit/${params.dealerAuditSn}/${params.auditState}`,
    method: 'get'
  })
}

// 更新经销级别
export const updateDealerLevel = (params) => {
  return axios({
    url: `/dealer/updateDealerLevel/${params.dealerSn}/${params.dealerLevel}`,
    method: 'get'
  })
}

// 更新合作状态
export const updateCooperate = (params) => {
  return axios({
    url: '/dealer/updateCooperate',
    data: params,
    method: 'post'
  })
}

//  经销商账号  列表  有分页
export const dealerUserList = (params) => {
  const url = `/dealer/user/queryLike/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 经销商账号  详情
export const dealerUserDetail = (params) => {
  return axios({
    url: `/dealer/user/findById/${params.id}`,
    method: 'get'
  })
}
// 经销商账号  删除
export const dealerUserDel = (params) => {
  return axios({
    url: `/dealer/user/delete/${params.id}`,
    method: 'get'
  })
}
// 经销商账号  启禁用
export const dealerUserEnable = (params) => {
  return axios({
    url: `/dealer/user/enable/${params.id}/${params.flag}`,
    method: 'get'
  })
}
// 经销商账号  修改密码
export const dealerUserChangeP = (params) => {
  return axios({
    url: `/dealer/user/changePWD`,
    data: params,
    method: 'post'
  })
}
// 经销商账号  重置密码
export const dealerUserResetP = (params) => {
  return axios({
    url: `/dealer/user/resetPwd`,
    data: params,
    method: 'post'
  })
}
// 经销商账号  保存
export const dealerUserSave = (params) => {
  return axios({
    url: `/dealer/user/save`,
    data: params,
    method: 'post'
  })
}
