CRM: 完善销售漏斗

This commit is contained in:
puhui999 2024-04-15 15:37:37 +08:00
parent 2512253020
commit 6acfc77d08
3 changed files with 27 additions and 10 deletions

View File

@ -3,13 +3,13 @@ import request from '@/config/axios'
export interface CrmStatisticFunnelRespVO {
customerCount: number // 客户数
businessCount: number // 商机数
winCount: number // 赢单数
businessWinCount: number // 赢单数
}
export interface CrmStatisticsBusinessSummaryByDateRespVO {
time: string // 时间
businessCreateCount: number // 商机数
businessDealCount: number // 商机金额
totalPrice: number | string // 商机金额
}
// 客户分析 API
@ -22,9 +22,9 @@ export const StatisticFunnelApi = {
})
},
// 2. 获取商机结束状态统计
getBusinessEndStatusSummary: (params: any) => {
getBusinessSummaryByEndStatus: (params: any) => {
return request.get({
url: '/crm/statistics-funnel/get-business-end-status-summary',
url: '/crm/statistics-funnel/get-business-summary-by-end-status',
params
})
},

View File

@ -118,7 +118,7 @@ const queryParams0 = reactive({
const loading = ref(false) //
const list = ref([]) //
const total = ref(0)
/** 将传进来的值赋值给 formData */
/** 将传进来的值赋值给 queryParams0 */
watch(
() => props.queryParams,
(data) => {
@ -216,7 +216,7 @@ const fetchAndFill = async () => {
}
if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
echartsOption.series[1]['data'] = businessSummaryByDate.map(
(s: CrmStatisticsBusinessSummaryByDateRespVO) => s.businessDealCount
(s: CrmStatisticsBusinessSummaryByDateRespVO) => s.totalPrice
)
}

View File

@ -4,6 +4,10 @@
<el-card shadow="never">
<el-row>
<el-col :span="24">
<el-button-group class="mb-10px">
<el-button type="primary" @click="handleActive(true)">客户视角</el-button>
<el-button type="primary" @click="handleActive(false)">动态视角</el-button>
</el-button-group>
<el-skeleton :loading="loading" animated>
<Echart :height="500" :options="echartsOption" />
</el-skeleton>
@ -35,6 +39,7 @@ import { FunnelChart } from 'echarts/charts'
defineOptions({ name: 'FunnelBusiness' })
const props = defineProps<{ queryParams: any }>() //
const active = ref(true)
const loading = ref(false) //
const list = ref<CrmStatisticFunnelRespVO[]>([]) //
@ -101,6 +106,11 @@ const echartsOption = reactive<EChartsOption>({
]
}) as EChartsOption
const handleActive = async (val: boolean) => {
active.value = val
await loadData()
}
/** 获取统计数据 */
const loadData = async () => {
loading.value = true
@ -117,13 +127,20 @@ const loadData = async () => {
) {
// tips value
const list: { value: number; name: string }[] = []
if (active.value) {
list.push({ value: 60, name: `客户-${data.customerCount || 0}` })
list.push({ value: 40, name: `商机-${data.businessCount || 0}` })
list.push({ value: 20, name: `赢单-${data.winCount || 0}` })
list.push({ value: 20, name: `赢单-${data.businessWinCount || 0}` })
} else {
list.push({ value: data.customerCount || 0, name: `客户-${data.customerCount || 0}` })
list.push({ value: data.businessCount || 0, name: `商机-${data.businessCount || 0}` })
list.push({ value: data.businessWinCount || 0, name: `赢单-${data.businessWinCount || 0}` })
}
echartsOption.series[0]['data'] = list
}
// 2.2
list.value = await StatisticFunnelApi.getBusinessEndStatusSummary(props.queryParams)
list.value = await StatisticFunnelApi.getBusinessSummaryByEndStatus(props.queryParams)
loading.value = false
}
defineExpose({ loadData })