import request from '@/utils/request'

// 分页查询代理商经纪列表
export function pageListBroker(query) {
  return request({
    url: '/broker/broker/pageList',
    method: 'get',
    params: query
  })
}

// 查询代理商经纪列表
export function listBroker(query) {
  return request({
    url: '/broker/broker/list',
    method: 'get',
    params: query
  })
}

// 查询代理商经纪树
export function listBrokerByTree(query) {
  return request({
    url: '/broker/broker/listByTree',
    method: 'get',
    params: query
  })
}

// 查询代理商经纪详细
export function getBroker(id) {
  return request({
    url: '/broker/broker/' + id,
    method: 'get'
  })
}


// 修改代理商经纪状态
export function changeBrokerStatus(id, staus) {
  const data = {
    id,
    staus
  }
  return request({
    url: '/broker/broker/changeStatus',
    method: 'put',
    data: data
  })
}


// 新增代理商经纪
export function addBroker(data) {
  return request({
    url: '/broker/broker',
    method: 'post',
    data: data
  })
}

// 修改代理商经纪
export function updateBroker(data) {
  return request({
    url: '/broker/broker',
    method: 'put',
    data: data
  })
}

// 删除代理商经纪
export function delBroker(id) {
  return request({
    url: '/broker/broker/' + id,
    method: 'delete'
  })
}

// 导出代理商经纪
export function exportBroker(query) {
  return request({
    url: '/broker/broker/' + 'export',
    method: 'post',
    params: query
  })
}
