index.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import request from '@/config/axios'
  2. import { TransferReqVO } from '@/api/crm/permission'
  3. export interface CustomerVO {
  4. id: number // 编号
  5. name: string // 客户名称
  6. followUpStatus: boolean // 跟进状态
  7. contactLastTime: Date // 最后跟进时间
  8. contactLastContent: string // 最后跟进内容
  9. contactNextTime: Date // 下次联系时间
  10. ownerUserId: number // 负责人的用户编号
  11. ownerUserName?: string // 负责人的用户名称
  12. ownerUserDept?: string // 负责人的部门名称
  13. lockStatus?: boolean
  14. dealStatus?: boolean
  15. mobile: string // 手机号
  16. telephone: string // 电话
  17. qq: string // QQ
  18. wechat: string // wechat
  19. email: string // email
  20. areaId: number // 所在地
  21. areaName?: string // 所在地名称
  22. detailAddress: string // 详细地址
  23. industryId: number // 所属行业
  24. level: number // 客户等级
  25. source: number // 客户来源
  26. remark: string // 备注
  27. creator: string // 创建人
  28. creatorName?: string // 创建人名称
  29. createTime: Date // 创建时间
  30. updateTime: Date // 更新时间
  31. }
  32. // 查询客户列表
  33. export const getCustomerPage = async (params) => {
  34. return await request.get({ url: `/crm/customer/page`, params })
  35. }
  36. // 进入公海客户提醒的客户列表
  37. export const getPutPoolRemindCustomerPage = async (params) => {
  38. return await request.get({ url: `/crm/customer/put-pool-remind-page`, params })
  39. }
  40. // 获得待进入公海客户数量
  41. export const getPutPoolRemindCustomerCount = async () => {
  42. return await request.get({ url: `/crm/customer/put-pool-remind-count` })
  43. }
  44. // 获得今日需联系客户数量
  45. export const getTodayContactCustomerCount = async () => {
  46. return await request.get({ url: `/crm/customer/today-contact-count` })
  47. }
  48. // 获得分配给我、待跟进的线索数量的客户数量
  49. export const getFollowCustomerCount = async () => {
  50. return await request.get({ url: `/crm/customer/follow-count` })
  51. }
  52. // 查询客户详情
  53. export const getCustomer = async (id: number) => {
  54. return await request.get({ url: `/crm/customer/get?id=` + id })
  55. }
  56. // 新增客户
  57. export const createCustomer = async (data: CustomerVO) => {
  58. return await request.post({ url: `/crm/customer/create`, data })
  59. }
  60. // 修改客户
  61. export const updateCustomer = async (data: CustomerVO) => {
  62. return await request.put({ url: `/crm/customer/update`, data })
  63. }
  64. // 更新客户的成交状态
  65. export const updateCustomerDealStatus = async (id: number, dealStatus: boolean) => {
  66. return await request.put({ url: `/crm/customer/update-deal-status`, params: { id, dealStatus } })
  67. }
  68. // 删除客户
  69. export const deleteCustomer = async (id: number) => {
  70. return await request.delete({ url: `/crm/customer/delete?id=` + id })
  71. }
  72. // 导出客户 Excel
  73. export const exportCustomer = async (params: any) => {
  74. return await request.download({ url: `/crm/customer/export-excel`, params })
  75. }
  76. // 下载客户导入模板
  77. export const importCustomerTemplate = () => {
  78. return request.download({ url: '/crm/customer/get-import-template' })
  79. }
  80. // 导入客户
  81. export const handleImport = async (formData) => {
  82. return await request.upload({ url: `/crm/customer/import`, data: formData })
  83. }
  84. // 客户列表
  85. export const getCustomerSimpleList = async () => {
  86. return await request.get({ url: `/crm/customer/simple-list` })
  87. }
  88. // ======================= 业务操作 =======================
  89. // 客户转移
  90. export const transferCustomer = async (data: TransferReqVO) => {
  91. return await request.put({ url: '/crm/customer/transfer', data })
  92. }
  93. // 锁定/解锁客户
  94. export const lockCustomer = async (id: number, lockStatus: boolean) => {
  95. return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
  96. }
  97. // 领取公海客户
  98. export const receiveCustomer = async (ids: any[]) => {
  99. return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
  100. }
  101. // 分配公海给对应负责人
  102. export const distributeCustomer = async (ids: any[], ownerUserId: number) => {
  103. return await request.put({
  104. url: '/crm/customer/distribute',
  105. data: { ids: ids, ownerUserId }
  106. })
  107. }
  108. // 客户放入公海
  109. export const putCustomerPool = async (id: number) => {
  110. return await request.put({ url: `/crm/customer/put-pool?id=${id}` })
  111. }