From 0e15d6c9d2856f3298821fef224d477608c7d1eb Mon Sep 17 00:00:00 2001 From: dhb52 Date: Tue, 9 Apr 2024 00:21:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E6=88=90?= =?UTF-8?q?=E4=BA=A4=E5=91=A8=E6=9C=9F=E5=88=86=E6=9E=90(=E6=8C=89?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E3=80=81=E6=8C=89=E4=BA=A7=E5=93=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/crm/statistics/customer.ts | 26 +++ .../components/CustomerDealCycleByArea.vue | 153 ++++++++++++++++++ .../components/CustomerDealCycleByProduct.vue | 153 ++++++++++++++++++ ...lCycle.vue => CustomerDealCycleByUser.vue} | 2 +- src/views/crm/statistics/customer/index.vue | 28 +++- 5 files changed, 355 insertions(+), 7 deletions(-) create mode 100644 src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue create mode 100644 src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue rename src/views/crm/statistics/customer/components/{CustomerDealCycle.vue => CustomerDealCycleByUser.vue} (98%) diff --git a/src/api/crm/statistics/customer.ts b/src/api/crm/statistics/customer.ts index 815fe653..c2092e48 100644 --- a/src/api/crm/statistics/customer.ts +++ b/src/api/crm/statistics/customer.ts @@ -67,6 +67,18 @@ export interface CrmStatisticsCustomerDealCycleByUserRespVO { customerDealCount: number } +export interface CrmStatisticsCustomerDealCycleByAreaRespVO { + areaName: string + customerDealCycle: number + customerDealCount: number +} + +export interface CrmStatisticsCustomerDealCycleByProductRespVO { + productName: string + customerDealCycle: number + customerDealCount: number +} + // 客户分析 API export const StatisticsCustomerApi = { // 1.1 客户总量分析(按日期) @@ -138,5 +150,19 @@ export const StatisticsCustomerApi = { url: '/crm/statistics-customer/get-customer-deal-cycle-by-user', params }) + }, + // 6.2 获取客户成交周期(按用户) + getCustomerDealCycleByArea: (params: any) => { + return request.get({ + url: '/crm/statistics-customer/get-customer-deal-cycle-by-area', + params + }) + }, + // 6.2 获取客户成交周期(按用户) + getCustomerDealCycleByProduct: (params: any) => { + return request.get({ + url: '/crm/statistics-customer/get-customer-deal-cycle-by-product', + params + }) } } diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue new file mode 100644 index 00000000..e168b773 --- /dev/null +++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue @@ -0,0 +1,153 @@ + + + diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue new file mode 100644 index 00000000..3dff3645 --- /dev/null +++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue @@ -0,0 +1,153 @@ + + + diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycle.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue similarity index 98% rename from src/views/crm/statistics/customer/components/CustomerDealCycle.vue rename to src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue index 23ce1448..e3d877e5 100644 --- a/src/views/crm/statistics/customer/components/CustomerDealCycle.vue +++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue @@ -30,7 +30,7 @@ import { } from '@/api/crm/statistics/customer' import { EChartsOption } from 'echarts' -defineOptions({ name: 'CustomerDealCycle' }) +defineOptions({ name: 'CustomerDealCycleByUser' }) const props = defineProps<{ queryParams: any }>() // 搜索参数 diff --git a/src/views/crm/statistics/customer/index.vue b/src/views/crm/statistics/customer/index.vue index 88a324e5..207dc350 100644 --- a/src/views/crm/statistics/customer/index.vue +++ b/src/views/crm/statistics/customer/index.vue @@ -102,8 +102,14 @@ - - + + + + + + + + @@ -117,7 +123,9 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime' import { defaultProps, handleTree } from '@/utils/tree' import CustomerConversionStat from './components/CustomerConversionStat.vue' -import CustomerDealCycle from './components/CustomerDealCycle.vue' +import CustomerDealCycleByUser from './components/CustomerDealCycleByUser.vue' +import CustomerDealCycleByArea from './components/CustomerDealCycleByArea.vue' +import CustomerDealCycleByProduct from './components/CustomerDealCycleByProduct.vue' import CustomerFollowUpSummary from './components/CustomerFollowUpSummary.vue' import CustomerFollowUpType from './components/CustomerFollowUpType.vue' import CustomerSummary from './components/CustomerSummary.vue' @@ -153,7 +161,9 @@ const followUpSummaryRef = ref() // 2. 客户跟进次数分析 const followUpTypeRef = ref() // 3. 客户跟进方式分析 const conversionStatRef = ref() // 4. 客户转化率分析 const customerPoolSummaryRef = ref() // 5. 客户公海分析 -const dealCycleRef = ref() // 6. 成交周期分析 +const dealCycleByUserRef = ref() // 6. 成交周期分析(按员工) +const dealCycleByAreaRef = ref() // 7. 成交周期分析(按地区) +const dealCycleByProductRef = ref() // 8. 成交周期分析(按产品) /** 搜索按钮操作 */ const handleQuery = () => { @@ -173,8 +183,14 @@ const handleQuery = () => { case 'poolSummary': // 公海客户分析 customerPoolSummaryRef.value?.loadData?.() break - case 'dealCycle': // 成交周期分析 - dealCycleRef.value?.loadData?.() + case 'dealCycleByUser': // 成交周期分析 + dealCycleByUserRef.value?.loadData?.() + break + case 'dealCycleByArea': // 成交周期分析 + dealCycleByAreaRef.value?.loadData?.() + break + case 'dealCycleByProduct': // 成交周期分析 + dealCycleByProductRef.value?.loadData?.() break } } From 5358863fc6430419deaf0cb6afa48e99106574d7 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Tue, 9 Apr 2024 18:47:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E5=A4=84?= =?UTF-8?q?=E7=90=86null=E6=95=B0=E6=8D=AE=E4=B8=BA'=E6=9C=AA=E7=9F=A5'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CustomerDealCycleByArea.vue | 22 +++++++++---------- .../components/CustomerDealCycleByProduct.vue | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue index e168b773..9aa6d5e2 100644 --- a/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue +++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByArea.vue @@ -11,13 +11,7 @@ - + ({ /** 获取数据并填充图表 */ const fetchAndFill = async () => { // 1. 加载统计数据 - const customerDealCycleByArea = await StatisticsCustomerApi.getCustomerDealCycleByArea( - props.queryParams - ) + const customerDealCycleByArea = ( + await StatisticsCustomerApi.getCustomerDealCycleByArea(props.queryParams) + ).map((s: CrmStatisticsCustomerDealCycleByAreaRespVO) => { + return { + areaName: s.areaName, + customerDealCycle: s.customerDealCycle, + customerDealCount: s.customerDealCount + } + }) // 2.1 更新 Echarts 数据 if (echartsOption.xAxis && echartsOption.xAxis['data']) { echartsOption.xAxis['data'] = customerDealCycleByArea.map( - (s: CrmStatisticsCustomerDealCycleByAreaRespVO) => s.areaName ?? '未知' + (s: CrmStatisticsCustomerDealCycleByAreaRespVO) => s.areaName ) } if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) { diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue index 3dff3645..74558d15 100644 --- a/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue +++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByProduct.vue @@ -11,13 +11,7 @@ - + ({ /** 获取数据并填充图表 */ const fetchAndFill = async () => { // 1. 加载统计数据 - const customerDealCycleByProduct = await StatisticsCustomerApi.getCustomerDealCycleByProduct( - props.queryParams - ) + const customerDealCycleByProduct = ( + await StatisticsCustomerApi.getCustomerDealCycleByProduct(props.queryParams) + ).map((s: CrmStatisticsCustomerDealCycleByProductRespVO) => { + return { + productName: s.productName ?? '未知', + customerDealCycle: s.customerDealCount, + customerDealCount: s.customerDealCount + } + }) // 2.1 更新 Echarts 数据 if (echartsOption.xAxis && echartsOption.xAxis['data']) { echartsOption.xAxis['data'] = customerDealCycleByProduct.map( - (s: CrmStatisticsCustomerDealCycleByProductRespVO) => s.productName ?? '未知' + (s: CrmStatisticsCustomerDealCycleByProductRespVO) => s.productName ) } if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {