import request from '@/utils/request'

// 查询企业微信客户列表
export function listExternalContact(query) {
  return request({
    url: '/qw/externalContact/list',
    method: 'get',
    params: query
  })
}
export function myList(query) {
  return request({
    url: '/qw/externalContact/myList',
    method: 'get',
    params: query
  })
}
/** 查询 预计发送客户的总数 */
export function selectCountCustomer(param) {
  return request({
    url: '/qw/externalContact/expectQwGroupMsgCountCustomer',
    method: 'post',
    data:param,
  })
}
// 查询企业微信客户详细
export function getExternalContact(id) {
  return request({
    url: '/qw/externalContact/' + id,
    method: 'get'
  })
}

// 新增企业微信客户
export function addExternalContact(data) {
  return request({
    url: '/qw/externalContact',
    method: 'post',
    data: data
  })
}

//同步我的企微客户
export function syncMyExternalContact(id) {
  return request({
    url: '/qw/externalContact/syncMyExternalContact/'+id,
    method: 'get',
  })
}

export function syncMyAddExternalContact(id) {
  return request({
    url: '/qw/externalContact/syncAddMyExternalContact/'+id,
    method: 'get',
  })
}
export function getUserInfo(id) {
  return request({
    url: '/qw/externalContact/getUserInfo/'+id,
    method: 'get',
  })
}

export function addUnassigned(data) {
  return request({
    url: '/qw/externalContact/addUnassigned',
    method: 'post',
    data: data
  })
}
export function addTag(data) {
  return request({
    url: '/qw/externalContact/addTag',
    method: 'post',
    data: data
  })
}
export function delTag(data) {
  return request({
    url: '/qw/externalContact/delTag',
    method: 'post',
    data: data
  })
}
export function resignedTransfer(data) {
  return request({
    url: '/qw/externalContact/resignedTransfer',
    method: 'put',
    data: data
  })
}
export function transfer(data) {
  return request({
    url: '/qw/externalContact/transfer',
    method: 'put',
    data: data
  })
}
// 修改企业微信客户
export function updateExternalContact(data) {
  return request({
    url: '/qw/externalContact',
    method: 'put',
    data: data
  })
}

// 修改企业微信客户称呼
export function updateExternalContactCall(data) {
  return request({
    url: '/qw/externalContact/call',
    method: 'put',
    data: data
  })
}
// 修改企业微信客户
export function editStatus(data) {
  return request({
    url: '/qw/externalContact/editStatus',
    method: 'put',
    data: data
  })
}

export function editbindCustomer(data) {
  return request({
    url: '/qw/externalContact/editbindCustomer',
    method: 'put',
    data: data
  })
}
export function bindUserId(data) {
  return request({
    url: '/qw/externalContact/bindUserId',
    method: 'put',
    data: data
  })
}

export function unBindUserId(id) {
  return request({
    url: '/qw/externalContact/unBindUserId/'+id,
    method: 'get',
  })
}
// 删除企业微信客户
export function delExternalContact(id) {
  return request({
    url: '/qw/externalContact/' + id,
    method: 'delete'
  })
}

// 导出企业微信客户
export function exportExternalContact(query) {
  return request({
    url: '/qw/externalContact/export',
    method: 'get',
    params: query
  })
}

/**
* 获取CRM客户列表
*/
export function getMyCustomerList(query) {
  return request({
    url: '/qw/externalContact/getMyCustomerList',
    method: 'get',
    params: query
  })
}

/**
 * 获取小程序的客户
 */
export function getMiniProgramCustomer(query) {
  return request({
    url: '/qw/externalContact/getMiniCustomer',
    method: 'get',
    params: query
  })
}

/**
 * 获取课程列表
 */
export function getCourseStudyList(query) {
  return request({
    url: '/qw/externalContact/getCourseStudyList',
    method: 'get',
    params: query
  })
}

/**
 * 设置客户-课节SOP
 */
export function setCustomerCourseSop(data) {
  return request({
    url: '/qw/externalContact/setCustomerCourseSop',
    method: 'post',
    data: data
  })
}


/**
 * 批量设置客户-课节SOP
 */
export function setCustomerCourseSopList(data) {
  return request({
    url: '/qw/externalContact/setCustomerCourseSopList',
    method: 'post',
    data: data
  })
}

/**
 * 查询是否已经设置过客户-某个课节的SOP
 */
export function getCustomerCourseSop(query) {
  return request({
    url: '/qw/externalContact/getCustomerCourseSop',
    method: 'get',
    params: query
  })
}
