import request from '@/utils/request'
import query from "@/views/ecw/customer/query";
import * as url from "url";

// 创建客户
export function createCustomer(data) {
  return request({
    url: '/ecw/customer/create',
    method: 'post',
    data: data
  })
}

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

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

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

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

// 获得客户下拉
export function getCustomerSelect(query) {
  return request({
    url: '/ecw/customer/select',
    method: 'get',
    params: query
  })
}

// 根据客户id集合获得客户详情列表
export function getCustomerList(query) {
  return request({
    url: '/ecw/customer/list',
    method: 'get',
    params: query
  })
}

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

// 待接收客户列表
export function getWaitForConfirmList(query) {
  return request({
    url: '/ecw/customer/get-wait-for-confirm',
    method: 'get',
    params: query
  })
}

// 确认
export function confirm(data) {
  return request({
    url: '/ecw/customer/confirm',
    method: 'put',
    data: data
  })
}

// 待分配客户
export function getWaitForDistributionList(query) {
  return request({
    url: '/ecw/customer/get-wait-for-distribution',
    method: 'get',
    params: query
  })
}

// 移交
export function handOverCustomer(data) {
  return request({
    url: '/ecw/customer/handOver',
    method: 'put',
    data: data,
    })
}

// 公海池客户
export function getPublicList(query) {
  return request({
    url: '/ecw/customer/get-public',
    method: 'get',
    params: query
  })
}

//捞取
export function setFishing(query){
  return request({
    url:'/ecw/customer/catch-open-sea-customer',
    method:'put',
    params:query,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    }
  })
}
//待分配 客户列表
export function getCustomerToBeAssigned(query){
  return request(
    {
      url:'ecw/customer/get-wait-for-distribution',
      method: 'get',
      params: query

    }
  )
}
//我的客户列表
export function getMyCustomerService(query){
  return request({
    url:'/ecw/customer/get-mine',
    method:'get',
    params:query,
  })
}
//获取会员列表
export  function userMemberUserList(){
  return request({
    url:'/member/user/member-user-list',
    method:'get'
  })
}
//查看某客户授权的品牌
export function getBrankByCustomer(data){
  return request({
    url:'/ecw/product-brank/getBrankByCustomer',
    method:'post',
    data,
  })
}
