index.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import request from '@/config/axios'
  2. export interface CustomerVO {
  3. id?: number
  4. name: string
  5. industryId: number
  6. level: number
  7. source: number
  8. followUpStatus?: boolean
  9. lockStatus?: boolean
  10. dealStatus?: boolean
  11. mobile: string
  12. telephone: string
  13. website: string
  14. qq: string
  15. wechat: string
  16. email: string
  17. description: string
  18. remark: string
  19. ownerUserId?: number
  20. ownerUserName?: string
  21. ownerUserDept?: string
  22. roUserIds?: string
  23. rwUserIds?: string
  24. areaId?: number
  25. areaName?: string
  26. detailAddress: string
  27. contactLastTime?: Date
  28. contactNextTime: Date
  29. createTime?: Date
  30. updateTime?: Date
  31. creator?: string
  32. creatorName?: string
  33. }
  34. // 查询客户列表
  35. export const getCustomerPage = async (params) => {
  36. return await request.get({ url: `/crm/customer/page`, params })
  37. }
  38. // 查询客户详情
  39. export const getCustomer = async (id: number) => {
  40. return await request.get({ url: `/crm/customer/get?id=` + id })
  41. }
  42. // 新增客户
  43. export const createCustomer = async (data: CustomerVO) => {
  44. return await request.post({ url: `/crm/customer/create`, data })
  45. }
  46. // 修改客户
  47. export const updateCustomer = async (data: CustomerVO) => {
  48. return await request.put({ url: `/crm/customer/update`, data })
  49. }
  50. // 删除客户
  51. export const deleteCustomer = async (id: number) => {
  52. return await request.delete({ url: `/crm/customer/delete?id=` + id })
  53. }
  54. // 导出客户 Excel
  55. export const exportCustomer = async (params: any) => {
  56. return await request.download({ url: `/crm/customer/export-excel`, params })
  57. }
  58. // 下载客户导入模板
  59. export const importCustomerTemplate = () => {
  60. return request.download({ url: '/crm/customer/get-import-template' })
  61. }
  62. // 客户列表
  63. export const getSimpleCustomerList = async () => {
  64. return await request.get({ url: `/crm/customer/list-all-simple` })
  65. }
  66. // ======================= 业务操作 =======================
  67. export interface TransferReqVO {
  68. id: number | undefined // 客户编号
  69. newOwnerUserId: number | undefined // 新负责人的用户编号
  70. oldOwnerPermissionLevel: number | undefined // 老负责人加入团队后的权限级别
  71. }
  72. // 客户转移
  73. export const transferCustomer = async (data: TransferReqVO) => {
  74. return await request.put({ url: '/crm/customer/transfer', data })
  75. }
  76. // 锁定/解锁客户
  77. export const lockCustomer = async (id: number, lockStatus: boolean) => {
  78. return await request.put({ url: `/crm/customer/lock`, data: { id, lockStatus } })
  79. }
  80. // 领取公海客户
  81. export const receiveCustomer = async (ids: any[]) => {
  82. return await request.put({ url: '/crm/customer/receive', params: { ids: ids.join(',') } })
  83. }
  84. // 客户放入公海
  85. export const putCustomerPool = async (id: number) => {
  86. return await request.put({ url: `/crm/customer/put-pool?id=${id}` })
  87. }
  88. // 进入公海客户提醒
  89. export const getPutInPoolRemindCustomerPage = async (params) => {
  90. return await request.get({ url: `/crm/customer/put-in-pool-remind-page`, params })
  91. }