feat: crm api
parent
5d02400053
commit
380eaed159
|
@ -0,0 +1,118 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessApi {
|
||||
/** 商机产品信息 */
|
||||
export interface BusinessProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
businessPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
followUpStatus: boolean;
|
||||
contactLastTime: Date;
|
||||
contactNextTime: Date;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
statusTypeId: number;
|
||||
statusTypeName?: string;
|
||||
statusId: number;
|
||||
statusName?: string;
|
||||
endStatus: number;
|
||||
endRemark: string;
|
||||
dealTime: Date;
|
||||
totalProductPrice: number;
|
||||
totalPrice: number;
|
||||
discountPercent: number;
|
||||
remark: string;
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
products?: BusinessProduct[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询商机列表 */
|
||||
export function getBusinessPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商机列表,基于指定客户 */
|
||||
export function getBusinessPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商机详情 */
|
||||
export function getBusiness(id: number) {
|
||||
return requestClient.get<CrmBusinessApi.Business>(
|
||||
`/crm/business/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商机列表(精简) */
|
||||
export function getSimpleBusinessList() {
|
||||
return requestClient.get<CrmBusinessApi.Business[]>(
|
||||
'/crm/business/simple-all-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增商机 */
|
||||
export function createBusiness(data: CrmBusinessApi.Business) {
|
||||
return requestClient.post('/crm/business/create', data);
|
||||
}
|
||||
|
||||
/** 修改商机 */
|
||||
export function updateBusiness(data: CrmBusinessApi.Business) {
|
||||
return requestClient.put('/crm/business/update', data);
|
||||
}
|
||||
|
||||
/** 修改商机状态 */
|
||||
export function updateBusinessStatus(data: CrmBusinessApi.Business) {
|
||||
return requestClient.put('/crm/business/update-status', data);
|
||||
}
|
||||
|
||||
/** 删除商机 */
|
||||
export function deleteBusiness(id: number) {
|
||||
return requestClient.delete(`/crm/business/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出商机 */
|
||||
export function exportBusiness(params: any) {
|
||||
return requestClient.download('/crm/business/export-excel', params);
|
||||
}
|
||||
|
||||
/** 联系人关联商机列表 */
|
||||
export function getBusinessPageByContact(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessApi.Business>>(
|
||||
'/crm/business/page-by-contact',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 商机转移 */
|
||||
export function transferBusiness(data: CrmPermissionApi.TransferReq) {
|
||||
return requestClient.put('/crm/business/transfer', data);
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmBusinessStatusApi {
|
||||
/** 商机状态信息 */
|
||||
export interface BusinessStatus {
|
||||
id: number;
|
||||
name: string;
|
||||
percent: number;
|
||||
}
|
||||
|
||||
/** 商机状态组信息 */
|
||||
export interface BusinessStatusType {
|
||||
id: number;
|
||||
name: string;
|
||||
deptIds: number[];
|
||||
statuses?: BusinessStatus[];
|
||||
}
|
||||
|
||||
/** 默认商机状态 */
|
||||
export const DEFAULT_STATUSES = [
|
||||
{
|
||||
endStatus: 1,
|
||||
key: '结束',
|
||||
name: '赢单',
|
||||
percent: 100,
|
||||
},
|
||||
{
|
||||
endStatus: 2,
|
||||
key: '结束',
|
||||
name: '输单',
|
||||
percent: 0,
|
||||
},
|
||||
{
|
||||
endStatus: 3,
|
||||
key: '结束',
|
||||
name: '无效',
|
||||
percent: 0,
|
||||
},
|
||||
] as const;
|
||||
}
|
||||
|
||||
/** 查询商机状态组列表 */
|
||||
export function getBusinessStatusPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmBusinessStatusApi.BusinessStatusType>>(
|
||||
'/crm/business-status/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增商机状态组 */
|
||||
export function createBusinessStatus(
|
||||
data: CrmBusinessStatusApi.BusinessStatusType,
|
||||
) {
|
||||
return requestClient.post('/crm/business-status/create', data);
|
||||
}
|
||||
|
||||
/** 修改商机状态组 */
|
||||
export function updateBusinessStatus(
|
||||
data: CrmBusinessStatusApi.BusinessStatusType,
|
||||
) {
|
||||
return requestClient.put('/crm/business-status/update', data);
|
||||
}
|
||||
|
||||
/** 查询商机状态类型详情 */
|
||||
export function getBusinessStatus(id: number) {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatusType>(
|
||||
`/crm/business-status/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 删除商机状态 */
|
||||
export function deleteBusinessStatus(id: number) {
|
||||
return requestClient.delete(`/crm/business-status/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商机状态组列表 */
|
||||
export function getBusinessStatusTypeSimpleList() {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatusType[]>(
|
||||
'/crm/business-status/type-simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得商机阶段列表 */
|
||||
export function getBusinessStatusSimpleList(typeId: number) {
|
||||
return requestClient.get<CrmBusinessStatusApi.BusinessStatus[]>(
|
||||
'/crm/business-status/status-simple-list',
|
||||
{ params: { typeId } },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmClueApi {
|
||||
/** 线索信息 */
|
||||
export interface Clue {
|
||||
id: number; // 编号
|
||||
name: string; // 线索名称
|
||||
followUpStatus: boolean; // 跟进状态
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
transformStatus: boolean; // 转化状态
|
||||
customerId: number; // 客户编号
|
||||
customerName?: string; // 客户名称
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
industryId: number; // 所属行业
|
||||
level: number; // 客户等级
|
||||
source: number; // 客户来源
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询线索列表 */
|
||||
export function getCluePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmClueApi.Clue>>('/crm/clue/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询线索详情 */
|
||||
export function getClue(id: number) {
|
||||
return requestClient.get<CrmClueApi.Clue>(`/crm/clue/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增线索 */
|
||||
export function createClue(data: CrmClueApi.Clue) {
|
||||
return requestClient.post('/crm/clue/create', data);
|
||||
}
|
||||
|
||||
/** 修改线索 */
|
||||
export function updateClue(data: CrmClueApi.Clue) {
|
||||
return requestClient.put('/crm/clue/update', data);
|
||||
}
|
||||
|
||||
/** 删除线索 */
|
||||
export function deleteClue(id: number) {
|
||||
return requestClient.delete(`/crm/clue/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出线索 */
|
||||
export function exportClue(params: any) {
|
||||
return requestClient.download('/crm/clue/export-excel', params);
|
||||
}
|
||||
|
||||
/** 线索转移 */
|
||||
export function transferClue(data: CrmPermissionApi.TransferReq) {
|
||||
return requestClient.put('/crm/clue/transfer', data);
|
||||
}
|
||||
|
||||
/** 线索转化为客户 */
|
||||
export function transformClue(id: number) {
|
||||
return requestClient.put('/crm/clue/transform', { id });
|
||||
}
|
||||
|
||||
/** 获得分配给我的、待跟进的线索数量 */
|
||||
export function getFollowClueCount() {
|
||||
return requestClient.get<number>('/crm/clue/follow-count');
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContactApi {
|
||||
/** 联系人信息 */
|
||||
export interface Contact {
|
||||
id: number; // 编号
|
||||
name: string; // 联系人名称
|
||||
customerId: number; // 客户编号
|
||||
customerName?: string; // 客户名称
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
sex: number; // 性别
|
||||
master: boolean; // 是否主联系人
|
||||
post: string; // 职务
|
||||
parentId: number; // 上级联系人编号
|
||||
parentName?: string; // 上级联系人名称
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
|
||||
/** 联系人商机关联请求 */
|
||||
export interface ContactBusinessReq {
|
||||
contactId: number;
|
||||
businessIds: number[];
|
||||
}
|
||||
|
||||
/** 商机联系人关联请求 */
|
||||
export interface BusinessContactReq {
|
||||
businessId: number;
|
||||
contactIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询联系人列表 */
|
||||
export function getContactPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人列表,基于指定客户 */
|
||||
export function getContactPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人列表,基于指定商机 */
|
||||
export function getContactPageByBusiness(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContactApi.Contact>>(
|
||||
'/crm/contact/page-by-business',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询联系人详情 */
|
||||
export function getContact(id: number) {
|
||||
return requestClient.get<CrmContactApi.Contact>(`/crm/contact/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增联系人 */
|
||||
export function createContact(data: CrmContactApi.Contact) {
|
||||
return requestClient.post('/crm/contact/create', data);
|
||||
}
|
||||
|
||||
/** 修改联系人 */
|
||||
export function updateContact(data: CrmContactApi.Contact) {
|
||||
return requestClient.put('/crm/contact/update', data);
|
||||
}
|
||||
|
||||
/** 删除联系人 */
|
||||
export function deleteContact(id: number) {
|
||||
return requestClient.delete(`/crm/contact/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出联系人 */
|
||||
export function exportContact(params: any) {
|
||||
return requestClient.download('/crm/contact/export-excel', params);
|
||||
}
|
||||
|
||||
/** 获得联系人列表(精简) */
|
||||
export function getSimpleContactList() {
|
||||
return requestClient.get<CrmContactApi.Contact[]>(
|
||||
'/crm/contact/simple-all-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 批量新增联系人商机关联 */
|
||||
export function createContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReq,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list', data);
|
||||
}
|
||||
|
||||
/** 批量新增商机联系人关联 */
|
||||
export function createBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReq,
|
||||
) {
|
||||
return requestClient.post('/crm/contact/create-business-list2', data);
|
||||
}
|
||||
|
||||
/** 解除联系人商机关联 */
|
||||
export function deleteContactBusinessList(
|
||||
data: CrmContactApi.ContactBusinessReq,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list', { data });
|
||||
}
|
||||
|
||||
/** 解除商机联系人关联 */
|
||||
export function deleteBusinessContactList(
|
||||
data: CrmContactApi.BusinessContactReq,
|
||||
) {
|
||||
return requestClient.delete('/crm/contact/delete-business-list2', { data });
|
||||
}
|
||||
|
||||
/** 联系人转移 */
|
||||
export function transferContact(data: CrmPermissionApi.TransferReq) {
|
||||
return requestClient.put('/crm/contact/transfer', data);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContractConfigApi {
|
||||
/** 合同配置信息 */
|
||||
export interface Config {
|
||||
notifyEnabled?: boolean;
|
||||
notifyDays?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取合同配置 */
|
||||
export function getContractConfig() {
|
||||
return requestClient.get<CrmContractConfigApi.Config>(
|
||||
'/crm/contract-config/get',
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新合同配置 */
|
||||
export function saveContractConfig(data: CrmContractConfigApi.Config) {
|
||||
return requestClient.put('/crm/contract-config/save', data);
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmContractApi {
|
||||
/** 合同产品信息 */
|
||||
export interface ContractProduct {
|
||||
id: number;
|
||||
productId: number;
|
||||
productName: string;
|
||||
productNo: string;
|
||||
productUnit: number;
|
||||
productPrice: number;
|
||||
contractPrice: number;
|
||||
count: number;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id: number;
|
||||
name: string;
|
||||
no: string;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
businessId: number;
|
||||
businessName: string;
|
||||
contactLastTime: Date;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
ownerUserDeptName?: string;
|
||||
processInstanceId: number;
|
||||
auditStatus: number;
|
||||
orderDate: Date;
|
||||
startTime: Date;
|
||||
endTime: Date;
|
||||
totalProductPrice: number;
|
||||
discountPercent: number;
|
||||
totalPrice: number;
|
||||
totalReceivablePrice: number;
|
||||
signContactId: number;
|
||||
signContactName?: string;
|
||||
signUserId: number;
|
||||
signUserName: string;
|
||||
remark: string;
|
||||
createTime?: Date;
|
||||
creator: string;
|
||||
creatorName: string;
|
||||
updateTime?: Date;
|
||||
products?: ContractProduct[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询合同列表 */
|
||||
export function getContractPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同列表,基于指定客户 */
|
||||
export function getContractPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同列表,基于指定商机 */
|
||||
export function getContractPageByBusiness(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmContractApi.Contract>>(
|
||||
'/crm/contract/page-by-business',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同详情 */
|
||||
export function getContract(id: number) {
|
||||
return requestClient.get<CrmContractApi.Contract>(
|
||||
`/crm/contract/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询合同下拉列表 */
|
||||
export function getContractSimpleList(customerId: number) {
|
||||
return requestClient.get<CrmContractApi.Contract[]>(
|
||||
`/crm/contract/simple-list?customerId=${customerId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增合同 */
|
||||
export function createContract(data: CrmContractApi.Contract) {
|
||||
return requestClient.post('/crm/contract/create', data);
|
||||
}
|
||||
|
||||
/** 修改合同 */
|
||||
export function updateContract(data: CrmContractApi.Contract) {
|
||||
return requestClient.put('/crm/contract/update', data);
|
||||
}
|
||||
|
||||
/** 删除合同 */
|
||||
export function deleteContract(id: number) {
|
||||
return requestClient.delete(`/crm/contract/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出合同 */
|
||||
export function exportContract(params: any) {
|
||||
return requestClient.download('/crm/contract/export-excel', params);
|
||||
}
|
||||
|
||||
/** 提交审核 */
|
||||
export function submitContract(id: number) {
|
||||
return requestClient.put(`/crm/contract/submit?id=${id}`);
|
||||
}
|
||||
|
||||
/** 合同转移 */
|
||||
export function transferContract(data: CrmPermissionApi.TransferReq) {
|
||||
return requestClient.put('/crm/contract/transfer', data);
|
||||
}
|
||||
|
||||
/** 获得待审核合同数量 */
|
||||
export function getAuditContractCount() {
|
||||
return requestClient.get<number>('/crm/contract/audit-count');
|
||||
}
|
||||
|
||||
/** 获得即将到期(提醒)的合同数量 */
|
||||
export function getRemindContractCount() {
|
||||
return requestClient.get<number>('/crm/contract/remind-count');
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmCustomerApi {
|
||||
/** 客户信息 */
|
||||
export interface Customer {
|
||||
id: number; // 编号
|
||||
name: string; // 客户名称
|
||||
followUpStatus: boolean; // 跟进状态
|
||||
contactLastTime: Date; // 最后跟进时间
|
||||
contactLastContent: string; // 最后跟进内容
|
||||
contactNextTime: Date; // 下次联系时间
|
||||
ownerUserId: number; // 负责人的用户编号
|
||||
ownerUserName?: string; // 负责人的用户名称
|
||||
ownerUserDept?: string; // 负责人的部门名称
|
||||
lockStatus?: boolean;
|
||||
dealStatus?: boolean;
|
||||
mobile: string; // 手机号
|
||||
telephone: string; // 电话
|
||||
qq: string; // QQ
|
||||
wechat: string; // wechat
|
||||
email: string; // email
|
||||
areaId: number; // 所在地
|
||||
areaName?: string; // 所在地名称
|
||||
detailAddress: string; // 详细地址
|
||||
industryId: number; // 所属行业
|
||||
level: number; // 客户等级
|
||||
source: number; // 客户来源
|
||||
remark: string; // 备注
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询客户列表 */
|
||||
export function getCustomerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmCustomerApi.Customer>>(
|
||||
'/crm/customer/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询客户详情 */
|
||||
export function getCustomer(id: number) {
|
||||
return requestClient.get<CrmCustomerApi.Customer>(
|
||||
`/crm/customer/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户 */
|
||||
export function createCustomer(data: CrmCustomerApi.Customer) {
|
||||
return requestClient.post('/crm/customer/create', data);
|
||||
}
|
||||
|
||||
/** 修改客户 */
|
||||
export function updateCustomer(data: CrmCustomerApi.Customer) {
|
||||
return requestClient.put('/crm/customer/update', data);
|
||||
}
|
||||
|
||||
/** 删除客户 */
|
||||
export function deleteCustomer(id: number) {
|
||||
return requestClient.delete(`/crm/customer/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出客户 */
|
||||
export function exportCustomer(params: any) {
|
||||
return requestClient.download('/crm/customer/export-excel', params);
|
||||
}
|
||||
|
||||
/** 下载客户导入模板 */
|
||||
export function importCustomerTemplate() {
|
||||
return requestClient.download('/crm/customer/get-import-template');
|
||||
}
|
||||
|
||||
/** 导入客户 */
|
||||
export function importCustomer(file: File) {
|
||||
return requestClient.upload('/crm/customer/import', { file });
|
||||
}
|
||||
|
||||
/** 获取客户精简信息列表 */
|
||||
export function getCustomerSimpleList() {
|
||||
return requestClient.get<CrmCustomerApi.Customer[]>(
|
||||
'/crm/customer/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 客户转移 */
|
||||
export function transferCustomer(data: CrmPermissionApi.TransferReq) {
|
||||
return requestClient.put('/crm/customer/transfer', data);
|
||||
}
|
||||
|
||||
/** 锁定/解锁客户 */
|
||||
export function lockCustomer(id: number, lockStatus: boolean) {
|
||||
return requestClient.put('/crm/customer/lock', { id, lockStatus });
|
||||
}
|
||||
|
||||
/** 领取公海客户 */
|
||||
export function receiveCustomer(ids: number[]) {
|
||||
return requestClient.put('/crm/customer/receive', { ids: ids.join(',') });
|
||||
}
|
||||
|
||||
/** 分配公海给对应负责人 */
|
||||
export function distributeCustomer(ids: number[], ownerUserId: number) {
|
||||
return requestClient.put('/crm/customer/distribute', { ids, ownerUserId });
|
||||
}
|
||||
|
||||
/** 客户放入公海 */
|
||||
export function putCustomerPool(id: number) {
|
||||
return requestClient.put(`/crm/customer/put-pool?id=${id}`);
|
||||
}
|
||||
|
||||
/** 更新客户的成交状态 */
|
||||
export function updateCustomerDealStatus(id: number, dealStatus: boolean) {
|
||||
return requestClient.put('/crm/customer/update-deal-status', {
|
||||
id,
|
||||
dealStatus,
|
||||
});
|
||||
}
|
||||
|
||||
/** 进入公海客户提醒的客户列表 */
|
||||
export function getPutPoolRemindCustomerPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmCustomerApi.Customer>>(
|
||||
'/crm/customer/put-pool-remind-page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得待进入公海客户数量 */
|
||||
export function getPutPoolRemindCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/put-pool-remind-count');
|
||||
}
|
||||
|
||||
/** 获得今日需联系客户数量 */
|
||||
export function getTodayContactCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/today-contact-count');
|
||||
}
|
||||
|
||||
/** 获得分配给我、待跟进的线索数量的客户数量 */
|
||||
export function getFollowCustomerCount() {
|
||||
return requestClient.get<number>('/crm/customer/follow-count');
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmCustomerLimitConfigApi {
|
||||
/** 客户限制配置 */
|
||||
export interface CustomerLimitConfig {
|
||||
id?: number;
|
||||
type?: number;
|
||||
userIds?: string;
|
||||
deptIds?: string;
|
||||
maxCount?: number;
|
||||
dealCountEnabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户限制配置类型
|
||||
*/
|
||||
export enum LimitConfType {
|
||||
/** 锁定客户数限制 */
|
||||
CUSTOMER_LOCK_LIMIT = 2,
|
||||
/** 拥有客户数限制 */
|
||||
CUSTOMER_QUANTITY_LIMIT = 1,
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询客户限制配置列表 */
|
||||
export function getCustomerLimitConfigPage(params: PageParam) {
|
||||
return requestClient.get<
|
||||
PageResult<CrmCustomerLimitConfigApi.CustomerLimitConfig>
|
||||
>('/crm/customer-limit-config/page', { params });
|
||||
}
|
||||
|
||||
/** 查询客户限制配置详情 */
|
||||
export function getCustomerLimitConfig(id: number) {
|
||||
return requestClient.get<CrmCustomerLimitConfigApi.CustomerLimitConfig>(
|
||||
`/crm/customer-limit-config/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户限制配置 */
|
||||
export function createCustomerLimitConfig(
|
||||
data: CrmCustomerLimitConfigApi.CustomerLimitConfig,
|
||||
) {
|
||||
return requestClient.post('/crm/customer-limit-config/create', data);
|
||||
}
|
||||
|
||||
/** 修改客户限制配置 */
|
||||
export function updateCustomerLimitConfig(
|
||||
data: CrmCustomerLimitConfigApi.CustomerLimitConfig,
|
||||
) {
|
||||
return requestClient.put('/crm/customer-limit-config/update', data);
|
||||
}
|
||||
|
||||
/** 删除客户限制配置 */
|
||||
export function deleteCustomerLimitConfig(id: number) {
|
||||
return requestClient.delete(`/crm/customer-limit-config/delete?id=${id}`);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmCustomerPoolConfigApi {
|
||||
/** 客户公海规则设置 */
|
||||
export interface CustomerPoolConfig {
|
||||
enabled?: boolean;
|
||||
contactExpireDays?: number;
|
||||
dealExpireDays?: number;
|
||||
notifyEnabled?: boolean;
|
||||
notifyDays?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取客户公海规则设置 */
|
||||
export function getCustomerPoolConfig() {
|
||||
return requestClient.get<CrmCustomerPoolConfigApi.CustomerPoolConfig>(
|
||||
'/crm/customer-pool-config/get',
|
||||
);
|
||||
}
|
||||
|
||||
/** 更新客户公海规则设置 */
|
||||
export function saveCustomerPoolConfig(
|
||||
data: CrmCustomerPoolConfigApi.CustomerPoolConfig,
|
||||
) {
|
||||
return requestClient.put('/crm/customer-pool-config/save', data);
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmFollowUpApi {
|
||||
/** 关联商机信息 */
|
||||
export interface Business {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 关联联系人信息 */
|
||||
export interface Contact {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 跟进记录信息 */
|
||||
export interface FollowUpRecord {
|
||||
id: number; // 编号
|
||||
bizType: number; // 数据类型
|
||||
bizId: number; // 数据编号
|
||||
type: number; // 跟进类型
|
||||
content: string; // 跟进内容
|
||||
picUrls: string[]; // 图片
|
||||
fileUrls: string[]; // 附件
|
||||
nextTime: Date; // 下次联系时间
|
||||
businessIds: number[]; // 关联的商机编号数组
|
||||
businesses: Business[]; // 关联的商机数组
|
||||
contactIds: number[]; // 关联的联系人编号数组
|
||||
contacts: Contact[]; // 关联的联系人数组
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询跟进记录分页 */
|
||||
export function getFollowUpRecordPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmFollowUpApi.FollowUpRecord>>(
|
||||
'/crm/follow-up-record/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增跟进记录 */
|
||||
export function createFollowUpRecord(data: CrmFollowUpApi.FollowUpRecord) {
|
||||
return requestClient.post('/crm/follow-up-record/create', data);
|
||||
}
|
||||
|
||||
/** 删除跟进记录 */
|
||||
export function deleteFollowUpRecord(id: number) {
|
||||
return requestClient.delete(`/crm/follow-up-record/delete?id=${id}`);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmOperateLogApi {
|
||||
/** 操作日志查询参数 */
|
||||
export interface OperateLogQuery extends PageParam {
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
}
|
||||
|
||||
/** 操作日志信息 */
|
||||
export interface OperateLog {
|
||||
id: number;
|
||||
bizType: number;
|
||||
bizId: number;
|
||||
type: number;
|
||||
content: string;
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
createTime: Date;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得操作日志 */
|
||||
export function getOperateLogPage(params: CrmOperateLogApi.OperateLogQuery) {
|
||||
return requestClient.get<PageResult<CrmOperateLogApi.OperateLog>>(
|
||||
'/crm/operate-log/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmPermissionApi {
|
||||
/** 数据权限信息 */
|
||||
export interface Permission {
|
||||
id?: number; // 数据权限编号
|
||||
userId: number; // 用户编号
|
||||
bizType: number; // Crm 类型
|
||||
bizId: number; // Crm 类型数据编号
|
||||
level: number; // 权限级别
|
||||
toBizTypes?: number[]; // 同时添加至
|
||||
deptName?: string; // 部门名称
|
||||
nickname?: string; // 用户昵称
|
||||
postNames?: string[]; // 岗位名称数组
|
||||
createTime?: Date;
|
||||
ids?: number[];
|
||||
}
|
||||
|
||||
/** 数据权限转移请求 */
|
||||
export interface TransferReq {
|
||||
id: number; // 模块编号
|
||||
newOwnerUserId: number; // 新负责人的用户编号
|
||||
oldOwnerPermissionLevel?: number; // 老负责人加入团队后的权限级别
|
||||
toBizTypes?: number[]; // 转移客户时,需要额外有【联系人】【商机】【合同】的 checkbox 选择
|
||||
}
|
||||
|
||||
/**
|
||||
* CRM 业务类型枚举
|
||||
*/
|
||||
export enum BizType {
|
||||
CRM_BUSINESS = 4, // 商机
|
||||
CRM_CLUE = 1, // 线索
|
||||
CRM_CONTACT = 3, // 联系人
|
||||
CRM_CONTRACT = 5, // 合同
|
||||
CRM_CUSTOMER = 2, // 客户
|
||||
CRM_PRODUCT = 6, // 产品
|
||||
CRM_RECEIVABLE = 7, // 回款
|
||||
CRM_RECEIVABLE_PLAN = 8, // 回款计划
|
||||
}
|
||||
|
||||
/**
|
||||
* CRM 数据权限级别枚举
|
||||
*/
|
||||
export enum PermissionLevel {
|
||||
OWNER = 1, // 负责人
|
||||
READ = 2, // 只读
|
||||
WRITE = 3, // 读写
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得数据权限列表(查询团队成员列表) */
|
||||
export function getPermissionList(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmPermissionApi.Permission>>(
|
||||
'/crm/permission/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 创建数据权限(新增团队成员) */
|
||||
export function createPermission(data: CrmPermissionApi.Permission) {
|
||||
return requestClient.post('/crm/permission/create', data);
|
||||
}
|
||||
|
||||
/** 编辑数据权限(修改团队成员权限级别) */
|
||||
export function updatePermission(data: CrmPermissionApi.Permission) {
|
||||
return requestClient.put('/crm/permission/update', data);
|
||||
}
|
||||
|
||||
/** 删除数据权限(删除团队成员) */
|
||||
export function deletePermissionBatch(ids: number[]) {
|
||||
return requestClient.delete(`/crm/permission/delete?ids=${ids.join(',')}`);
|
||||
}
|
||||
|
||||
/** 删除自己的数据权限(退出团队) */
|
||||
export function deleteSelfPermission(id: number) {
|
||||
return requestClient.delete(`/crm/permission/delete-self?id=${id}`);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmProductCategoryApi {
|
||||
/** 产品分类信息 */
|
||||
export interface ProductCategory {
|
||||
id: number;
|
||||
name: string;
|
||||
parentId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品分类详情 */
|
||||
export function getProductCategory(id: number) {
|
||||
return requestClient.get<CrmProductCategoryApi.ProductCategory>(
|
||||
`/crm/product-category/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增产品分类 */
|
||||
export function createProductCategory(
|
||||
data: CrmProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.post('/crm/product-category/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品分类 */
|
||||
export function updateProductCategory(
|
||||
data: CrmProductCategoryApi.ProductCategory,
|
||||
) {
|
||||
return requestClient.put('/crm/product-category/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品分类 */
|
||||
export function deleteProductCategory(id: number) {
|
||||
return requestClient.delete(`/crm/product-category/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 产品分类列表 */
|
||||
export function getProductCategoryList(params?: PageParam) {
|
||||
return requestClient.get<CrmProductCategoryApi.ProductCategory[]>(
|
||||
'/crm/product-category/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmProductApi {
|
||||
/** 产品信息 */
|
||||
export interface Product {
|
||||
id: number;
|
||||
name: string;
|
||||
no: string;
|
||||
unit: number;
|
||||
price: number;
|
||||
status: number;
|
||||
categoryId: number;
|
||||
categoryName?: string;
|
||||
description: string;
|
||||
ownerUserId: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询产品列表 */
|
||||
export function getProductPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmProductApi.Product>>(
|
||||
'/crm/product/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得产品精简列表 */
|
||||
export function getProductSimpleList() {
|
||||
return requestClient.get<CrmProductApi.Product[]>('/crm/product/simple-list');
|
||||
}
|
||||
|
||||
/** 查询产品详情 */
|
||||
export function getProduct(id: number) {
|
||||
return requestClient.get<CrmProductApi.Product>(`/crm/product/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增产品 */
|
||||
export function createProduct(data: CrmProductApi.Product) {
|
||||
return requestClient.post('/crm/product/create', data);
|
||||
}
|
||||
|
||||
/** 修改产品 */
|
||||
export function updateProduct(data: CrmProductApi.Product) {
|
||||
return requestClient.put('/crm/product/update', data);
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
export function deleteProduct(id: number) {
|
||||
return requestClient.delete(`/crm/product/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出产品 */
|
||||
export function exportProduct(params: any) {
|
||||
return requestClient.download('/crm/product/export-excel', params);
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmReceivableApi {
|
||||
/** 合同信息 */
|
||||
export interface Contract {
|
||||
id?: number;
|
||||
name?: string;
|
||||
no: string;
|
||||
totalPrice: number;
|
||||
}
|
||||
|
||||
/** 回款信息 */
|
||||
export interface Receivable {
|
||||
id: number;
|
||||
no: string;
|
||||
planId?: number;
|
||||
customerId?: number;
|
||||
customerName?: string;
|
||||
contractId?: number;
|
||||
contract?: Contract;
|
||||
auditStatus: number;
|
||||
processInstanceId: number;
|
||||
returnTime: Date;
|
||||
returnType: number;
|
||||
price: number;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
remark: string;
|
||||
creator: string; // 创建人
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime: Date; // 创建时间
|
||||
updateTime: Date; // 更新时间
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款列表 */
|
||||
export function getReceivablePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款列表,基于指定客户 */
|
||||
export function getReceivablePageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivableApi.Receivable>>(
|
||||
'/crm/receivable/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款详情 */
|
||||
export function getReceivable(id: number) {
|
||||
return requestClient.get<CrmReceivableApi.Receivable>(
|
||||
`/crm/receivable/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增回款 */
|
||||
export function createReceivable(data: CrmReceivableApi.Receivable) {
|
||||
return requestClient.post('/crm/receivable/create', data);
|
||||
}
|
||||
|
||||
/** 修改回款 */
|
||||
export function updateReceivable(data: CrmReceivableApi.Receivable) {
|
||||
return requestClient.put('/crm/receivable/update', data);
|
||||
}
|
||||
|
||||
/** 删除回款 */
|
||||
export function deleteReceivable(id: number) {
|
||||
return requestClient.delete(`/crm/receivable/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出回款 */
|
||||
export function exportReceivable(params: any) {
|
||||
return requestClient.download('/crm/receivable/export-excel', params);
|
||||
}
|
||||
|
||||
/** 提交审核 */
|
||||
export function submitReceivable(id: number) {
|
||||
return requestClient.put(`/crm/receivable/submit?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得待审核回款数量 */
|
||||
export function getAuditReceivableCount() {
|
||||
return requestClient.get<number>('/crm/receivable/audit-count');
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmReceivablePlanApi {
|
||||
/** 回款计划信息 */
|
||||
export interface Plan {
|
||||
id: number;
|
||||
period: number;
|
||||
receivableId: number;
|
||||
price: number;
|
||||
returnTime: Date;
|
||||
remindDays: number;
|
||||
returnType: number;
|
||||
remindTime: Date;
|
||||
customerId: number;
|
||||
customerName?: string;
|
||||
contractId?: number;
|
||||
contractNo?: string;
|
||||
ownerUserId: number;
|
||||
ownerUserName?: string;
|
||||
remark: string;
|
||||
creator: string;
|
||||
creatorName?: string;
|
||||
createTime: Date;
|
||||
updateTime: Date;
|
||||
receivable?: {
|
||||
price: number;
|
||||
returnTime: Date;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询回款计划列表 */
|
||||
export function getReceivablePlanPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划列表(按客户) */
|
||||
export function getReceivablePlanPageByCustomer(params: PageParam) {
|
||||
return requestClient.get<PageResult<CrmReceivablePlanApi.Plan>>(
|
||||
'/crm/receivable-plan/page-by-customer',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划详情 */
|
||||
export function getReceivablePlan(id: number) {
|
||||
return requestClient.get<CrmReceivablePlanApi.Plan>(
|
||||
'/crm/receivable-plan/get',
|
||||
{ params: { id } },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询回款计划下拉数据 */
|
||||
export function getReceivablePlanSimpleList(
|
||||
customerId: number,
|
||||
contractId: number,
|
||||
) {
|
||||
return requestClient.get<CrmReceivablePlanApi.Plan[]>(
|
||||
'/crm/receivable-plan/simple-list',
|
||||
{
|
||||
params: { customerId, contractId },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增回款计划 */
|
||||
export function createReceivablePlan(data: CrmReceivablePlanApi.Plan) {
|
||||
return requestClient.post('/crm/receivable-plan/create', data);
|
||||
}
|
||||
|
||||
/** 修改回款计划 */
|
||||
export function updateReceivablePlan(data: CrmReceivablePlanApi.Plan) {
|
||||
return requestClient.put('/crm/receivable-plan/update', data);
|
||||
}
|
||||
|
||||
/** 删除回款计划 */
|
||||
export function deleteReceivablePlan(id: number) {
|
||||
return requestClient.delete('/crm/receivable-plan/delete', {
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出回款计划 Excel */
|
||||
export function exportReceivablePlan(params: PageParam) {
|
||||
return requestClient.download('/crm/receivable-plan/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获得待回款提醒数量 */
|
||||
export function getReceivablePlanRemindCount() {
|
||||
return requestClient.get<number>('/crm/receivable-plan/remind-count');
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsCustomerApi {
|
||||
/** 客户总量分析(按日期) */
|
||||
export interface CustomerSummaryByDate {
|
||||
time: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户) */
|
||||
export interface CustomerSummaryByUser {
|
||||
ownerUserName: string;
|
||||
customerCreateCount: number;
|
||||
customerDealCount: number;
|
||||
contractPrice: number;
|
||||
receivablePrice: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期) */
|
||||
export interface FollowUpSummaryByDate {
|
||||
time: string;
|
||||
followUpRecordCount: number;
|
||||
followUpCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户) */
|
||||
export interface FollowUpSummaryByUser {
|
||||
ownerUserName: string;
|
||||
followupRecordCount: number;
|
||||
followupCustomerCount: number;
|
||||
}
|
||||
|
||||
/** 客户跟进方式统计 */
|
||||
export interface FollowUpSummaryByType {
|
||||
followUpType: string;
|
||||
followUpRecordCount: number;
|
||||
}
|
||||
|
||||
/** 合同摘要信息 */
|
||||
export interface CustomerContractSummary {
|
||||
customerName: string;
|
||||
contractName: string;
|
||||
totalPrice: number;
|
||||
receivablePrice: number;
|
||||
customerType: string;
|
||||
customerSource: string;
|
||||
ownerUserName: string;
|
||||
creatorUserName: string;
|
||||
createTime: Date;
|
||||
orderDate: Date;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按日期) */
|
||||
export interface PoolSummaryByDate {
|
||||
time: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户公海分析(按用户) */
|
||||
export interface PoolSummaryByUser {
|
||||
ownerUserName: string;
|
||||
customerPutCount: number;
|
||||
customerTakeCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按日期) */
|
||||
export interface CustomerDealCycleByDate {
|
||||
time: string;
|
||||
customerDealCycle: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按用户) */
|
||||
export interface CustomerDealCycleByUser {
|
||||
ownerUserName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按地区) */
|
||||
export interface CustomerDealCycleByArea {
|
||||
areaName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
|
||||
/** 客户成交周期(按产品) */
|
||||
export interface CustomerDealCycleByProduct {
|
||||
productName: string;
|
||||
customerDealCycle: number;
|
||||
customerDealCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 客户总量分析(按日期) */
|
||||
export function getCustomerSummaryByDate(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerSummaryByDate[]>(
|
||||
'/crm/statistics-customer/get-customer-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 客户总量分析(按用户) */
|
||||
export function getCustomerSummaryByUser(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerSummaryByUser[]>(
|
||||
'/crm/statistics-customer/get-customer-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按日期) */
|
||||
export function getFollowUpSummaryByDate(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByDate[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 客户跟进次数分析(按用户) */
|
||||
export function getFollowUpSummaryByUser(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByUser[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户跟进方式统计数 */
|
||||
export function getFollowUpSummaryByType(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.FollowUpSummaryByType[]>(
|
||||
'/crm/statistics-customer/get-follow-up-summary-by-type',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 合同摘要信息(客户转化率页面) */
|
||||
export function getContractSummary(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerContractSummary[]>(
|
||||
'/crm/statistics-customer/get-contract-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户公海分析(按日期) */
|
||||
export function getPoolSummaryByDate(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByDate[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户公海分析(按用户) */
|
||||
export function getPoolSummaryByUser(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByUser[]>(
|
||||
'/crm/statistics-customer/get-pool-summary-by-user',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按日期) */
|
||||
export function getCustomerDealCycleByDate(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByDate[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按用户) */
|
||||
export function getCustomerDealCycleByUser(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByUser[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-user',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按地区) */
|
||||
export function getCustomerDealCycleByArea(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsCustomerApi.CustomerDealCycleByArea[]>(
|
||||
'/crm/statistics-customer/get-customer-deal-cycle-by-area',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户成交周期(按产品) */
|
||||
export function getCustomerDealCycleByProduct(params: PageParam) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsCustomerApi.CustomerDealCycleByProduct[]
|
||||
>('/crm/statistics-customer/get-customer-deal-cycle-by-product', { params });
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsFunnelApi {
|
||||
/** 销售漏斗统计数据 */
|
||||
export interface FunnelSummary {
|
||||
customerCount: number; // 客户数
|
||||
businessCount: number; // 商机数
|
||||
businessWinCount: number; // 赢单数
|
||||
}
|
||||
|
||||
/** 商机分析(按日期) */
|
||||
export interface BusinessSummaryByDate {
|
||||
time: string; // 时间
|
||||
businessCreateCount: number; // 商机数
|
||||
totalPrice: number | string; // 商机金额
|
||||
}
|
||||
|
||||
/** 商机转化率分析(按日期) */
|
||||
export interface BusinessInversionRateSummaryByDate {
|
||||
time: string; // 时间
|
||||
businessCount: number; // 商机数量
|
||||
businessWinCount: number; // 赢单商机数
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取销售漏斗统计数据 */
|
||||
export function getFunnelSummary(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsFunnelApi.FunnelSummary>(
|
||||
'/crm/statistics-funnel/get-funnel-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取商机结束状态统计 */
|
||||
export function getBusinessSummaryByEndStatus(params: PageParam) {
|
||||
return requestClient.get<Record<string, number>>(
|
||||
'/crm/statistics-funnel/get-business-summary-by-end-status',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取新增商机分析(按日期) */
|
||||
export function getBusinessSummaryByDate(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsFunnelApi.BusinessSummaryByDate[]>(
|
||||
'/crm/statistics-funnel/get-business-summary-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取商机转化率分析(按日期) */
|
||||
export function getBusinessInversionRateSummaryByDate(params: PageParam) {
|
||||
return requestClient.get<
|
||||
CrmStatisticsFunnelApi.BusinessInversionRateSummaryByDate[]
|
||||
>('/crm/statistics-funnel/get-business-inversion-rate-summary-by-date', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取商机列表(按日期) */
|
||||
export function getBusinessPageByDate(params: PageParam) {
|
||||
return requestClient.get<PageResult<any>>(
|
||||
'/crm/statistics-funnel/get-business-page-by-date',
|
||||
{ params },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPerformanceApi {
|
||||
/** 员工业绩统计 */
|
||||
export interface Performance {
|
||||
time: string;
|
||||
currentMonthCount: number;
|
||||
lastMonthCount: number;
|
||||
lastYearCount: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 员工获得合同金额统计 */
|
||||
export function getContractPricePerformance(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
'/crm/statistics-performance/get-contract-price-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 员工获得回款统计 */
|
||||
export function getReceivablePricePerformance(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
'/crm/statistics-performance/get-receivable-price-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 员工获得签约合同数量统计 */
|
||||
export function getContractCountPerformance(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPerformanceApi.Performance[]>(
|
||||
'/crm/statistics-performance/get-contract-count-performance',
|
||||
{ params },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsPortraitApi {
|
||||
/** 客户基础统计信息 */
|
||||
export interface CustomerBase {
|
||||
customerCount: number;
|
||||
dealCount: number;
|
||||
dealPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户行业统计信息 */
|
||||
export interface CustomerIndustry extends CustomerBase {
|
||||
industryId: number;
|
||||
industryPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户来源统计信息 */
|
||||
export interface CustomerSource extends CustomerBase {
|
||||
source: number;
|
||||
sourcePortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户级别统计信息 */
|
||||
export interface CustomerLevel extends CustomerBase {
|
||||
level: number;
|
||||
levelPortion: number | string;
|
||||
}
|
||||
|
||||
/** 客户地区统计信息 */
|
||||
export interface CustomerArea extends CustomerBase {
|
||||
areaId: number;
|
||||
areaName: string;
|
||||
areaPortion: number | string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取客户行业统计数据 */
|
||||
export function getCustomerIndustry(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerIndustry[]>(
|
||||
'/crm/statistics-portrait/get-customer-industry-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户来源统计数据 */
|
||||
export function getCustomerSource(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerSource[]>(
|
||||
'/crm/statistics-portrait/get-customer-source-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户级别统计数据 */
|
||||
export function getCustomerLevel(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerLevel[]>(
|
||||
'/crm/statistics-portrait/get-customer-level-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取客户地区统计数据 */
|
||||
export function getCustomerArea(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsPortraitApi.CustomerArea[]>(
|
||||
'/crm/statistics-portrait/get-customer-area-summary',
|
||||
{ params },
|
||||
);
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
import type { PageParam } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace CrmStatisticsRankApi {
|
||||
/** 排行统计数据 */
|
||||
export interface Rank {
|
||||
count: number;
|
||||
nickname: string;
|
||||
deptName: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** 获得合同排行榜 */
|
||||
export function getContractPriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-contract-price-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得回款排行榜 */
|
||||
export function getReceivablePriceRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-receivable-price-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 签约合同排行 */
|
||||
export function getContractCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-contract-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 产品销量排行 */
|
||||
export function getProductSalesRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-product-sales-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增客户数排行 */
|
||||
export function getCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增联系人数排行 */
|
||||
export function getContactsCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-contacts-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 跟进次数排行 */
|
||||
export function getFollowCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-follow-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 跟进客户数排行 */
|
||||
export function getFollowCustomerCountRank(params: PageParam) {
|
||||
return requestClient.get<CrmStatisticsRankApi.Rank[]>(
|
||||
'/crm/statistics-rank/get-follow-customer-count-rank',
|
||||
{ params },
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue