// 导出客户 Excel
import request from '@/utils/request'
import query from "@/views/ecw/customer/query";
import * as url from "url";

export function exportCustomerExcel(query) {
  return request({
    url: '/ecw/indirect-customer/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获得客户
export function getCustomer(id) {
  return request({
    url: '/ecw/indirect-customer/get?id=' + id,
    method: 'get'
  })
}

// 获得客户分页
export function getCustomerPage(query) {
  return request({
    url: '/ecw/indirect-customer/page',
    method: 'get',
    params: query
  })
}

// 更新客户
export function updateCustomer(data) {
  return request({
    url: '/ecw/indirect-customer/update',
    method: 'put',
    data: data
  })
}

// 根据客户ID获得联系人列表
export function getCustomerContactsListByCustomer(query) {
  return request({
    url: '/ecw/indirect-customer-contacts/list-by-customer',
    method: 'get',
    params: query
  })
}

// 删除间接客户
export function deleteIndirectCustomer(id) {
  return request({
    url: '/ecw/indirect-customer/delete?id=' + id,
    method: 'delete'
  })
}