import request from '@/utils/request'

export function getCompanyList(query) {
  return request({
    url: '/crm/company/',
    method: 'get',
    params: query
  })
}
export function createCompany(data) {
  return request({
    url: '/crm/company/',
    method: 'post',
    data
  })
}
export function updateCompany(id, data) {
  return request({
    url: `/crm/company/${id}/`,
    method: 'put',
    data
  })
}

export function transferCompany(id, data) {
  return request({
    url: `/crm/company/${id}/transfer/`,
    method: 'put',
    data
  })
}

export function transferCompanys(data) {
  return request({
    url: `/crm/company/transfers/`,
    method: 'put',
    data
  })
}
export function deleteCompany(id) {
  return request({
    url: `/crm/company/${id}/`,
    method: 'delete',
  })
}

export function getConsumerList(query) {
  return request({
    url: '/crm/consumer/',
    method: 'get',
    params: query
  })
}
export function createConsumer(data) {
  return request({
    url: '/crm/consumer/',
    method: 'post',
    data
  })
}
export function updateConsumer(id, data) {
  return request({
    url: `/crm/consumer/${id}/`,
    method: 'put',
    data
  })
}
export function deleteConsumer(id) {
  return request({
    url: `/crm/consumer/${id}/`,
    method: 'delete',
  })
}

export function deleteConsumers(data) {
  return request({
    url: `/crm/consumer/deletes/`,
    method: 'post',
    data
  })
}


export function importConsumer(data) {
  return request({
    url: `/crm/consumer/import/`,
    method: 'post',
    data
  })
}
export function exportConsumer(query) {
  return request({
    url: '/crm/consumer/export',
    method: 'get',
    params: query
  })
}
export function unbindConsumer(id) {
  return request({
    url: `/crm/consumer/${id}/unbind`,
    method: 'get',
  })
}

export function claimConsumer(id) {
  return request({
    url: `/crm/consumer/${id}/claim/`,
    method: 'put',
  })
}

export function getConsumerRoleAll(query) {
  return request({
    url: '/crm/consumerrole/',
    method: 'get',
    params: query
  })
}
export function createConsumerRole(data) {
  return request({
    url: '/crm/consumerrole/',
    method: 'post',
    data
  })
}
export function updateConsumerRole(id, data) {
  return request({
    url: `/crm/consumerrole/${id}/`,
    method: 'put',
    data
  })
}
export function deleteConsumerRole(id) {
  return request({
    url: `/crm/consumerrole/${id}/`,
    method: 'delete',
})
}
export function getConsumerPermAll(query) {
  return request({
    url: '/crm/consumerperm/',
    method: 'get',
    params: query
  })
}
export function updateendConsumers(data) {
  return request({
    url: `/crm/consumer/exceeddates/`,
    method: 'put',
    data
  })
}