zhangwencui
2 天以前 a2002ba0e8aa2a0e4eee61b5205748d8f6e454fc
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import { requestClient } from '#/api/request';
 
export namespace CrmStatisticsCustomerApi {
  /** 客户统计请求 */
  export interface CustomerSummaryReqVO {
    times: string[];
    interval: number;
    deptId: number;
    userId: number;
    userIds: number[];
  }
 
  /** 客户总量分析(按日期)响应 */
  export interface CustomerSummaryByDateRespVO {
    time: string;
    customerCreateCount: number;
    customerDealCount: number;
  }
 
  /** 客户总量分析(按用户)响应 */
  export interface CustomerSummaryByUserRespVO {
    ownerUserName: string;
    customerCreateCount: number;
    customerDealCount: number;
    contractPrice: number;
    receivablePrice: number;
  }
 
  /** 客户跟进次数分析(按日期)响应 */
  export interface FollowUpSummaryByDateRespVO {
    time: string;
    followUpRecordCount: number;
    followUpCustomerCount: number;
  }
 
  /** 客户跟进次数分析(按用户)响应 */
  export interface FollowUpSummaryByUserRespVO {
    ownerUserName: string;
    followupRecordCount: number;
    followupCustomerCount: number;
  }
 
  /** 客户跟进方式统计响应 */
  export interface FollowUpSummaryByTypeRespVO {
    followUpType: string;
    followUpRecordCount: number;
  }
 
  /** 合同摘要信息响应 */
  export interface CustomerContractSummaryRespVO {
    customerName: string;
    contractName: string;
    totalPrice: number;
    receivablePrice: number;
    customerType: string;
    customerSource: string;
    ownerUserName: string;
    creatorUserName: string;
    createTime: Date;
    orderDate: Date;
  }
 
  /** 客户公海分析(按日期)响应 */
  export interface PoolSummaryByDateRespVO {
    time: string;
    customerPutCount: number;
    customerTakeCount: number;
  }
 
  /** 客户公海分析(按用户)响应 */
  export interface PoolSummaryByUserRespVO {
    ownerUserName: string;
    customerPutCount: number;
    customerTakeCount: number;
  }
 
  /** 客户成交周期(按日期)响应 */
  export interface CustomerDealCycleByDateRespVO {
    time: string;
    customerDealCycle: number;
  }
 
  /** 客户成交周期(按用户)响应 */
  export interface CustomerDealCycleByUserRespVO {
    ownerUserName: string;
    customerDealCycle: number;
    customerDealCount: number;
  }
 
  /** 客户成交周期(按地区)响应 */
  export interface CustomerDealCycleByAreaRespVO {
    areaName: string;
    customerDealCycle: number;
    customerDealCount: number;
  }
 
  /** 客户成交周期(按产品)响应 */
  export interface CustomerDealCycleByProductRespVO {
    productName: string;
    customerDealCycle: number;
    customerDealCount: number;
  }
}
 
export function getDatas(activeTabName: any, params: any) {
  switch (activeTabName) {
    case 'conversionStat': {
      return getContractSummary(params);
    }
    case 'customerSummary': {
      return getCustomerSummaryByUser(params);
    }
    case 'dealCycleByArea': {
      return getCustomerDealCycleByArea(params);
    }
    case 'dealCycleByProduct': {
      return getCustomerDealCycleByProduct(params);
    }
    case 'dealCycleByUser': {
      return getCustomerDealCycleByUser(params);
    }
    case 'followUpSummary': {
      return getFollowUpSummaryByUser(params);
    }
    case 'followUpType': {
      return getFollowUpSummaryByType(params);
    }
    case 'poolSummary': {
      return getPoolSummaryByUser(params);
    }
    default: {
      return [];
    }
  }
}
 
export function getChartDatas(activeTabName: any, params: any) {
  switch (activeTabName) {
    case 'conversionStat': {
      return getCustomerSummaryByDate(params);
    }
    case 'customerSummary': {
      return getCustomerSummaryByDate(params);
    }
    case 'dealCycleByArea': {
      return getCustomerDealCycleByArea(params);
    }
    case 'dealCycleByProduct': {
      return getCustomerDealCycleByProduct(params);
    }
    case 'dealCycleByUser': {
      return getCustomerDealCycleByUser(params);
    }
    case 'followUpSummary': {
      return getFollowUpSummaryByDate(params);
    }
    case 'followUpType': {
      return getFollowUpSummaryByType(params);
    }
    case 'poolSummary': {
      return getPoolSummaryByDate(params);
    }
    default: {
      return [];
    }
  }
}
 
/** 客户总量分析(按日期) */
export function getCustomerSummaryByDate(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerSummaryByDateRespVO[]
  >('/crm/statistics-customer/get-customer-summary-by-date', { params });
}
 
/** 客户总量分析(按用户) */
export function getCustomerSummaryByUser(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerSummaryByUserRespVO[]
  >('/crm/statistics-customer/get-customer-summary-by-user', { params });
}
 
/** 客户跟进次数分析(按日期) */
export function getFollowUpSummaryByDate(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.FollowUpSummaryByDateRespVO[]
  >('/crm/statistics-customer/get-follow-up-summary-by-date', { params });
}
 
/** 客户跟进次数分析(按用户) */
export function getFollowUpSummaryByUser(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.FollowUpSummaryByUserRespVO[]
  >('/crm/statistics-customer/get-follow-up-summary-by-user', { params });
}
 
/** 获取客户跟进方式统计数 */
export function getFollowUpSummaryByType(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.FollowUpSummaryByTypeRespVO[]
  >('/crm/statistics-customer/get-follow-up-summary-by-type', { params });
}
 
/** 合同摘要信息(客户转化率页面) */
export function getContractSummary(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerContractSummaryRespVO[]
  >('/crm/statistics-customer/get-contract-summary', { params });
}
 
/** 获取客户公海分析(按日期) */
export function getPoolSummaryByDate(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByDateRespVO[]>(
    '/crm/statistics-customer/get-pool-summary-by-date',
    { params },
  );
}
 
/** 获取客户公海分析(按用户) */
export function getPoolSummaryByUser(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<CrmStatisticsCustomerApi.PoolSummaryByUserRespVO[]>(
    '/crm/statistics-customer/get-pool-summary-by-user',
    { params },
  );
}
 
/** 获取客户成交周期(按日期) */
export function getCustomerDealCycleByDate(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerDealCycleByDateRespVO[]
  >('/crm/statistics-customer/get-customer-deal-cycle-by-date', { params });
}
 
/** 获取客户成交周期(按用户) */
export function getCustomerDealCycleByUser(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerDealCycleByUserRespVO[]
  >('/crm/statistics-customer/get-customer-deal-cycle-by-user', { params });
}
 
/** 获取客户成交周期(按地区) */
export function getCustomerDealCycleByArea(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerDealCycleByAreaRespVO[]
  >('/crm/statistics-customer/get-customer-deal-cycle-by-area', { params });
}
 
/** 获取客户成交周期(按产品) */
export function getCustomerDealCycleByProduct(
  params: CrmStatisticsCustomerApi.CustomerSummaryReqVO,
) {
  return requestClient.get<
    CrmStatisticsCustomerApi.CustomerDealCycleByProductRespVO[]
  >('/crm/statistics-customer/get-customer-deal-cycle-by-product', { params });
}