| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671 |
- /**
- * 客户管理API接口
- * @module api/crm/customer
- */
- import request from '@/utils/request';
- import type {
- CustomerQuery,
- CustomerForm,
- CustomerVO,
- ContactQuery,
- ContactForm,
- ContactVO,
- CustomerFollowQuery,
- CustomerFollowForm,
- CustomerFollowVO,
- CustomerPoolQuery,
- CustomerPoolForm,
- CustomerPoolVO,
- CustomerTransferParams,
- CustomerIntoPoolParams,
- CustomerClaimParams,
- CustomerStatisticsOverview
- } from './types';
- // ==================== 客户管理接口 ====================
- /**
- * 查询客户列表(分页)
- * @param query 查询参数
- */
- export function listCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询客户详情
- * @param id 客户ID(兼容字符串和数字类型)
- */
- export function getCustomer(id: number | string) {
- return request({
- url: `/crm/customer/${id}`,
- method: 'get'
- });
- }
- /**
- * 新增客户
- * @param data 客户表单数据
- * @returns 成功时 data 为新客户主键 id(用于关联开票信息等)
- */
- export function addCustomer(data: CustomerForm) {
- return request({
- url: '/crm/customer',
- method: 'post',
- data: data
- });
- }
- /**
- * 修改客户
- * @param data 客户表单数据
- */
- export function updateCustomer(data: CustomerForm) {
- return request({
- url: '/crm/customer',
- method: 'put',
- data: data
- });
- }
- /**
- * 删除客户
- * @param ids 客户ID数组(兼容字符串和数字类型)
- */
- export function delCustomer(ids: number | string | (number | string)[]) {
- return request({
- url: `/crm/customer/${ids}`,
- method: 'delete'
- });
- }
- /**
- * 批量转移客户
- * @param data 转移参数
- */
- export function transferCustomer(data: CustomerTransferParams) {
- return request({
- url: '/crm/customer/transfer',
- method: 'put',
- data: data
- });
- }
- /**
- * 批量放入公海池
- * @param data 放入公海参数
- */
- export function intoPool(data: CustomerIntoPoolParams) {
- return request({
- url: '/crm/customer/intoPool',
- method: 'put',
- data: data
- });
- }
- /**
- * 导出客户
- * @param query 查询参数
- */
- export function exportCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/export',
- method: 'post',
- data: query,
- responseType: 'blob'
- });
- }
- /**
- * 下载导入模板
- */
- export function importTemplate() {
- return request({
- url: '/crm/customer/importTemplate',
- method: 'post',
- responseType: 'blob'
- });
- }
- /**
- * 查询公海池客户列表
- * @param query 查询参数
- */
- export function listPoolCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/pool/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 领取公海客户
- * @param data 领取参数
- */
- export function claimCustomer(data: CustomerClaimParams) {
- return request({
- url: '/crm/customer/claim',
- method: 'put',
- data: data
- });
- }
- /**
- * 查询待跟进客户
- * @param query 查询参数
- */
- export function listToFollowCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/toFollow',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询我的客户
- * @param query 查询参数
- */
- export function listMyCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/mine',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询重点客户
- * @param query 查询参数
- */
- export function listKeyCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/key',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询成交客户
- * @param query 查询参数
- */
- export function listDealedCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/dealed',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询本周新增客户
- * @param query 查询参数
- */
- export function listWeekNewCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/weekNew',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询长期未跟进客户
- * @param query 查询参数
- */
- export function listLongTimeNoFollowCustomer(query: CustomerQuery) {
- return request({
- url: '/crm/customer/longTimeNoFollow',
- method: 'get',
- params: query
- });
- }
- // ==================== 联系人管理接口 ====================
- /**
- * 查询联系人列表(分页)
- * @param query 查询参数
- */
- export function listContact(query: ContactQuery) {
- return request({
- url: '/crm/contact/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询联系人详情
- * @param id 联系人ID
- */
- export function getContact(id: number) {
- return request({
- url: `/crm/contact/${id}`,
- method: 'get'
- });
- }
- /**
- * 根据客户ID查询联系人列表
- * @param customerId 客户ID
- */
- export function getContactByCustomerId(customerId: number | string) {
- return request({
- url: `/crm/contact/customer/${customerId}`,
- method: 'get'
- });
- }
- /**
- * 新增联系人
- * @param data 联系人表单数据
- */
- export function addContact(data: ContactForm) {
- return request({
- url: '/crm/contact',
- method: 'post',
- data: data
- });
- }
- /**
- * 修改联系人
- * @param data 联系人表单数据
- */
- export function updateContact(data: ContactForm) {
- return request({
- url: '/crm/contact',
- method: 'put',
- data: data
- });
- }
- /**
- * 删除联系人
- * @param ids 联系人ID数组
- */
- export function delContact(ids: number | number[]) {
- return request({
- url: `/crm/contact/${ids}`,
- method: 'delete'
- });
- }
- /**
- * 设置主要联系人
- * @param id 联系人ID
- */
- export function setPrimaryContact(id: number) {
- return request({
- url: `/crm/contact/setPrimary/${id}`,
- method: 'put'
- });
- }
- /**
- * 导出联系人
- * @param query 查询参数
- */
- export function exportContact(query: ContactQuery) {
- return request({
- url: '/crm/contact/export',
- method: 'post',
- data: query,
- responseType: 'blob'
- });
- }
- /**
- * 查询决策人联系人列表(分页)
- * @param query 查询参数
- */
- export function listDecisionContact(query: ContactQuery) {
- return request({
- url: '/crm/contact/decision',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询主联系人列表(分页)
- * @param query 查询参数
- */
- export function listPrimaryContact(query: ContactQuery) {
- return request({
- url: '/crm/contact/primary',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询本月生日联系人列表(分页)
- * @param query 查询参数
- */
- export function listBirthdayContact(query: ContactQuery) {
- return request({
- url: '/crm/contact/birthday',
- method: 'get',
- params: query
- });
- }
- // ==================== 客户跟进记录接口 ====================
- /**
- * 查询跟进记录列表(分页)
- * @param query 查询参数
- */
- export function listCustomerFollow(query: CustomerFollowQuery) {
- return request({
- url: '/crm/customer/follow/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询跟进记录详情
- * @param id 跟进记录ID
- */
- export function getCustomerFollow(id: number) {
- return request({
- url: `/crm/customer/follow/${id}`,
- method: 'get'
- });
- }
- /**
- * 根据客户ID查询跟进记录列表
- * @param customerId 客户ID
- */
- export function getFollowByCustomerId(customerId: number) {
- return request({
- url: `/crm/customer/follow/customer/${customerId}`,
- method: 'get'
- });
- }
- /**
- * 新增跟进记录
- * @param data 跟进记录表单数据
- */
- export function addCustomerFollow(data: CustomerFollowForm) {
- return request({
- url: '/crm/customer/follow',
- method: 'post',
- data: data
- });
- }
- /**
- * 修改跟进记录
- * @param data 跟进记录表单数据
- */
- export function updateCustomerFollow(data: CustomerFollowForm) {
- return request({
- url: '/crm/customer/follow',
- method: 'put',
- data: data
- });
- }
- /**
- * 删除跟进记录
- * @param ids 跟进记录ID数组
- */
- export function delCustomerFollow(ids: number | number[]) {
- return request({
- url: `/crm/customer/follow/${ids}`,
- method: 'delete'
- });
- }
- /**
- * 导出跟进记录
- * @param query 查询参数
- */
- export function exportCustomerFollow(query: CustomerFollowQuery) {
- return request({
- url: '/crm/customer/follow/export',
- method: 'post',
- data: query,
- responseType: 'blob'
- });
- }
- // ==================== 客户公海池规则接口 ====================
- /**
- * 查询公海池规则列表(分页)
- * @param query 查询参数
- */
- export function listCustomerPool(query: CustomerPoolQuery) {
- return request({
- url: '/crm/customer/pool/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询公海池规则详情
- * @param id 规则ID
- */
- export function getCustomerPool(id: number) {
- return request({
- url: `/crm/customer/pool/${id}`,
- method: 'get'
- });
- }
- /**
- * 新增公海池规则
- * @param data 规则表单数据
- */
- export function addCustomerPool(data: CustomerPoolForm) {
- return request({
- url: '/crm/customer/pool',
- method: 'post',
- data: data
- });
- }
- /**
- * 修改公海池规则
- * @param data 规则表单数据
- */
- export function updateCustomerPool(data: CustomerPoolForm) {
- return request({
- url: '/crm/customer/pool',
- method: 'put',
- data: data
- });
- }
- /**
- * 删除公海池规则
- * @param ids 规则ID数组
- */
- export function delCustomerPool(ids: number | number[]) {
- return request({
- url: `/crm/customer/pool/${ids}`,
- method: 'delete'
- });
- }
- /**
- * 启用/禁用公海规则
- * @param id 规则ID
- * @param status 状态
- */
- export function updatePoolStatus(id: number, status: string) {
- return request({
- url: `/crm/customer/pool/rule/status/${id}/${status}`,
- method: 'put'
- });
- }
- /**
- * 手动执行公海池规则
- */
- export function executePoolRules() {
- return request({
- url: '/crm/customer/pool/rule/execute',
- method: 'post'
- });
- }
- /**
- * 导出公海池规则
- * @param query 查询参数
- */
- export function exportCustomerPool(query: CustomerPoolQuery) {
- return request({
- url: '/crm/customer/pool/export',
- method: 'post',
- data: query,
- responseType: 'blob'
- });
- }
- // ==================== 统计分析接口 ====================
- /**
- * 客户统计概览
- * @param params 查询参数
- */
- export function getStatisticsOverview(params?: any) {
- return request({
- url: '/crm/customer/statistics/overview',
- method: 'get',
- params: params
- });
- }
- /**
- * 客户来源统计
- * @param params 查询参数
- */
- export function getStatisticsBySource(params?: any) {
- return request({
- url: '/crm/customer/statistics/source',
- method: 'get',
- params: params
- });
- }
- /**
- * 客户级别分布
- */
- export function getStatisticsByLevel() {
- return request({
- url: '/crm/customer/statistics/level',
- method: 'get'
- });
- }
- /**
- * 客户行业分布
- */
- export function getStatisticsByIndustry() {
- return request({
- url: '/crm/customer/statistics/industry',
- method: 'get'
- });
- }
- /**
- * 客户成交趋势
- * @param params 查询参数
- */
- export function getStatisticsTrend(params?: any) {
- return request({
- url: '/crm/customer/statistics/trend',
- method: 'get',
- params: params
- });
- }
- /**
- * 负责人客户统计
- * @param params 查询参数
- */
- export function getStatisticsByOwner(params?: any) {
- return request({
- url: '/crm/customer/statistics/owner',
- method: 'get',
- params: params
- });
- }
- /**
- * 客户跟进统计
- * @param params 查询参数
- */
- export function getStatisticsFollow(params?: any) {
- return request({
- url: '/crm/customer/statistics/follow',
- method: 'get',
- params: params
- });
- }
- // ==================== 客户成交与重复检测 ====================
- /**
- * 客户成交
- * @param data 成交数据
- */
- export function dealCustomer(data: { id: number; dealAmount: number; dealTime?: string; remark?: string }) {
- return request({
- url: `/crm/customer/deal/${data.id}`,
- method: 'put',
- data: data
- });
- }
- /**
- * 客户重复检测
- * @param data 检测参数
- */
- export function checkDuplicateCustomer(data: { mobile?: string; customerName?: string; excludeId?: number }) {
- return request({
- url: '/crm/customer/checkDuplicate',
- method: 'post',
- data: data
- });
- }
- // ==================== 公海池管理 ====================
- /**
- * 分配公海池客户(管理员功能)
- * @param data 分配参数
- */
- export function assignPoolCustomers(data: { ids: number[]; ownerUserId: number; remark?: string }) {
- return request({
- url: '/crm/customer/pool/assign',
- method: 'put',
- data: data
- });
- }
- /**
- * 获取所在园区列表(去重)
- */
- export function getParkAreaList() {
- return request({
- url: '/crm/customer/parkAreaList',
- method: 'get'
- });
- }
|