gaoluyang
2026-06-24 bfdc0e0e6d5e47aa501f9b6fadd143d9c97cf00a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import type { PageResult } from '../../../packages/effects/request/src';
 
import { requestClient } from '#/api/request';
 
export namespace CrmStatisticsFunnelApi {
  /** 销售漏斗统计数据响应 */
  export interface FunnelSummaryRespVO {
    customerCount: number; // 客户数
    businessCount: number; // 商机数
    businessWinCount: number; // 赢单数
  }
 
  /** 商机分析(按日期)响应 */
  export interface BusinessSummaryByDateRespVO {
    time: string; // 时间
    businessCreateCount: number; // 商机数
    totalPrice: number | string; // 商机金额
  }
 
  /** 商机转化率分析(按日期)响应 */
  export interface BusinessInversionRateSummaryByDateRespVO {
    time: string; // 时间
    businessCount: number; // 商机数量
    businessWinCount: number; // 赢单商机数
  }
}
 
export function getDatas(activeTabName: any, params: any) {
  switch (activeTabName) {
    case 'businessInversionRateSummary': {
      return getBusinessPageByDate(params);
    }
    case 'businessSummary': {
      return getBusinessPageByDate(params);
    }
    case 'funnel': {
      return getBusinessSummaryByEndStatus(params);
    }
    default: {
      return [];
    }
  }
}
 
export function getChartDatas(activeTabName: any, params: any) {
  switch (activeTabName) {
    case 'businessInversionRateSummary': {
      return getBusinessInversionRateSummaryByDate(params);
    }
    case 'businessSummary': {
      return getBusinessSummaryByDate(params);
    }
    case 'funnel': {
      return getFunnelSummary(params);
    }
    default: {
      return [];
    }
  }
}
 
/** 获取销售漏斗统计数据 */
export function getFunnelSummary(params: any) {
  return requestClient.get<CrmStatisticsFunnelApi.FunnelSummaryRespVO>(
    '/crm/statistics-funnel/get-funnel-summary',
    { params },
  );
}
 
/** 获取商机结束状态统计 */
export function getBusinessSummaryByEndStatus(params: any) {
  return requestClient.get<Record<string, number>>(
    '/crm/statistics-funnel/get-business-summary-by-end-status',
    { params },
  );
}
 
/** 获取新增商机分析(按日期) */
export function getBusinessSummaryByDate(params: any) {
  return requestClient.get<
    CrmStatisticsFunnelApi.BusinessSummaryByDateRespVO[]
  >('/crm/statistics-funnel/get-business-summary-by-date', { params });
}
 
/** 获取商机转化率分析(按日期) */
export function getBusinessInversionRateSummaryByDate(params: any) {
  return requestClient.get<
    CrmStatisticsFunnelApi.BusinessInversionRateSummaryByDateRespVO[]
  >('/crm/statistics-funnel/get-business-inversion-rate-summary-by-date', {
    params,
  });
}
 
/** 获取商机列表(按日期) */
export function getBusinessPageByDate(params: any) {
  return requestClient.get<PageResult<any>>(
    '/crm/statistics-funnel/get-business-page-by-date',
    { params },
  );
}