amoebaUtils.js 3.1 KB
import * as fetch from './fetch';
import qs from 'querystring';

const prefix = '/api';

// 客户列表
export const selectCustomerListApi = (params) => {
  return fetch.get(`${prefix}/crm/customers?${params}`)
}

/**
 * 
 * 查看详情
 */
export const customerDetailApi = (key_no) => {
  return fetch.get(prefix + `/crm/companys/${key_no}`)
}
//  /crm/companys/:key_no
//  /crm/view-customers/:id

/**
 * 查看详情的 基本信息
 */

export const baseInfoApi = (id) => {
  return fetch.get(prefix + `/crm/view-customers/${id}?`)
}

/**
 * 编辑基本信息
 */
export const editBaseInfoApi = (customer_id, params) => {
  return fetch.put(prefix + `/crm/view-customers/${customer_id}`, params)
}

// 放弃
// export const customerOperateApi = (id, data) => {
//   // '/crm/customer/' + id
//   return fetch.post(prefix + `/crm/customer/${id}/operate`, data)
// }

// 申领
export const applyOperateApi = (id, data) => {
  return fetch.post(prefix + `/crm/customer-owners/${id}/apply`, data)
}
// 终止
export const terminateOperateApi = (id, data) => {
  return fetch.post(prefix + `/crm/customer-owners/${id}/terminate`, data)
}
// 放弃
export const abandonOperateApi = (id, data) => {
  console.log('djjjj', id)
  return fetch.post(prefix + `/crm/customer-owners/${id}/abandon`, data)
}
// 白名单
export const whitelistOperateApi = (id, data) => {
  return fetch.post(prefix + `/crm/customer-owners/${id}/whitelist`, data)
}
// 黑名单
export const blacklistOperateApi = (id, data) => {
  return fetch.post(prefix + `/crm/customer-owners/${id}/blacklist`, data)
}


// 新增客户
export const addNewCustomerApi = (data) => {
  return fetch.post(prefix + '/crm/customers', data)
}

// 归属公司
export const selectCompanyApi = () => {
  return fetch.get(prefix + '/uaa/myorgs')
}

/**
 * 查看详情 --- 联系人
 */

export const getContactsListApi = (id) => {
  // get           /crm/customers/${id}/contacts
  return fetch.get(prefix + `/crm/customers/${id}/contacts`)
}

/**
 * 编辑联系人
 */
export const editContactsApi = (customer_id, contact_id, params) => {
  //     put           /crm/customers/${id}/contacts/${customer_id}
  return fetch.put(prefix + `/crm/customers/${customer_id}/contacts/${contact_id}`, params)
}

/**
 * 新增联系人
 */
export const addContactsApi = (id, params) => {
  //           post           /crm/customers/${id}/contacts
  return fetch.post(prefix + `/crm/customers/${id}/contacts`, params)
}

/**
 * 企查查
 */
export const searchCompanyApi = (params) => {
  return fetch.get(prefix + '/crm/companys?' + qs.stringify(params))
}

/**
 * 添加拜访记录
 */
export const addVisitHistoryApi = (data) => {
  // crm/v1/customer-comment
  return fetch.post(prefix + `/crm/customer-comment`, data)
}

/**
 * 请求共享客户
 */
export const shareCustomerApi = (data) => {
  return fetch.post(prefix + `/crm/customer-share`, data)
}

/**
 * 重新申请
 */

export const reApplicationApi = (id, params) => {
  return fetch.pist(prefix + `/crm/v1/customer-owners/${id}/reapply`, params)
}

/**
 * 查看详情中的负责人
 */

export const chargePersonApi = (id) => {
  return fetch.get(prefix + `/crm/customers/${id}/owners`)
}