import request from '@/utils/request'

// 查询客户管理列表
export function listAccount(query) {
  return request({
    url: '/business/account/list',
    method: 'get',
    params: query
  })
}



// 查询客户管理列表(不分页)
export function listAll(query) {
  return request({
    url: '/business/account/listAll',
    method: 'get',
    params: query
  })
}

export function listRemote(query) {
  return request({
    url: '/business/account/listRemote/' + query,
    method: 'get',
  })
}
export function listRemotePage(query) {
  return request({
    url: '/business/account/listRemote',
    method: 'get',
    params: query
  })
}
// 查询关联客户
export function getRelatedAccount() {
  return request({
    url: '/business/account/accountlist',
    method: 'get'
  })
}
// 查询关联客户
export function getRelatedAccountByAccountId(query) {
  return request({
    url: '/business/account/accountData',
    method: 'get',
    params: query
  })
}
// 查询关联客户
export function getRelatedAccountByQuery(query) {
  return request({
    url: '/business/account/accountDataQuery',
    method: 'get',
    params: query
  })
}
export function getRelatedAccountByQueryPage(query) {
  return request({
    url: '/business/account/accountDataQueryPage',
    method: 'get',
    params: query
  })
}


// 查询客户管理详细
export function getAccount(accountId) {
  return request({
    url: '/business/account/' + accountId,
    method: 'get'
  })
}

export function getAccountByAgent(ownerAgent) {
  return request({
    url: '/business/account/getAccountByAgent/' + ownerAgent,
    method: 'get'
  })
}

// 新增客户管理
export function addAccount(data) {
  return request({
    url: '/business/account',
    method: 'post',
    data: data
  })
}

// 修改客户管理
export function updateAccount(data) {
  return request({
    url: '/business/account',
    method: 'put',
    data: data
  })
}

// 删除客户管理
export function delAccount(accountId) {
  return request({
    url: '/business/account/' + accountId,
    method: 'delete'
  })
}

// 合并客户
export function mergeAccount(data) {
  return request({
    url: '/business/account/merge',
    method: 'post',
    data: data
  })
}

// 取消合并
export function cancelMergeAccount(data) {
  return request({
    url: '/business/account/cancelMerge',
    method: 'post',
    data: data
  })
}

// 查询当前用户可见国家下拉
export function getCountryList() {
  return request({
    url: '/business/account/countries',
    method: 'get'
  })
}
// 查询当前用户可见区域下拉
export function getAreaList() {
  return request({
    url: '/business/account/areas',
    method: 'get'
  })
}

// 变更负责人
export function changeOwner(data) {
  return request({
    url: '/business/account/changeOwner',
    method: 'put',
    data: data
  })
}
