feat(api): 新增销售漏斗和黄金联络时段API接口
feat(views): 添加销售漏斗和黄金联络时段数据展示功能 refactor(views): 优化客户详情组件的数据处理逻辑 fix(views): 修复业绩数据显示字段不一致问题 style(views): 调整路由导航顶栏样式
This commit is contained in:
@@ -99,7 +99,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onBeforeUnmount, computed } from 'vue';
|
||||
import { ref, reactive, onMounted, onBeforeUnmount, computed, watch } from 'vue';
|
||||
import StatisticData from './StatisticData.vue';
|
||||
import * as echarts from 'echarts';
|
||||
import Chart from 'chart.js/auto';
|
||||
@@ -130,10 +130,7 @@ const props = defineProps({
|
||||
},
|
||||
contactTimeData: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
labels: ['9-10点', '10-11点', '11-12点', '14-15点', '15-16点', '16-17点'],
|
||||
data: [65, 85, 80, 92, 75, 60]
|
||||
})
|
||||
default: () => ({})
|
||||
},
|
||||
statisticsData: {
|
||||
type: Object,
|
||||
@@ -176,12 +173,6 @@ const totalProblemCount = computed(() => {
|
||||
return props.urgentProblemData.reduce((sum, item) => sum + item.value, 0);
|
||||
});
|
||||
|
||||
// --- 方法 ---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Chart.js: 创建或更新图表
|
||||
const createOrUpdateChart = (chartId, canvasRef, config) => {
|
||||
if (chartInstances[chartId]) {
|
||||
@@ -198,10 +189,10 @@ const renderPersonalFunnelChart = () => {
|
||||
const config = {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: funnelData.labels,
|
||||
labels: funnelData.value.labels,
|
||||
datasets: [{
|
||||
label: '数量', data: funnelData.data,
|
||||
backgroundColor: ['rgba(59, 130, 246, 0.8)', 'rgba(16, 185, 129, 0.8)', 'rgba(245, 158, 11, 0.8)', 'rgba(239, 68, 68, 0.8)'],
|
||||
label: '数量', data: funnelData.value.data,
|
||||
backgroundColor: ['rgba(59, 130, 246, 0.8)', 'rgba(16, 185, 129, 0.8)', 'rgba(245, 158, 11, 0.8)', 'rgba(239, 68, 68, 0.8)', 'rgba(168, 85, 247, 0.8)'],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
@@ -219,12 +210,19 @@ const renderPersonalFunnelChart = () => {
|
||||
|
||||
// Chart.js: 渲染黄金联络时段图
|
||||
const renderContactTimeChart = () => {
|
||||
if (!props.contactTimeData || !props.contactTimeData.gold_contact_success_rate) {
|
||||
return;
|
||||
}
|
||||
|
||||
const labels = Object.keys(props.contactTimeData.gold_contact_success_rate);
|
||||
const data = Object.values(props.contactTimeData.gold_contact_success_rate).map(rate => parseFloat(rate));
|
||||
|
||||
const config = {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: contactTimeData.labels,
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: '成功率', data: contactTimeData.data,
|
||||
label: '成功率', data: data,
|
||||
borderColor: '#10b981', backgroundColor: 'rgba(16, 185, 129, 0.1)',
|
||||
borderWidth: 3, tension: 0.4, fill: true, pointRadius: 4,
|
||||
pointBackgroundColor: '#10b981', pointBorderColor: '#ffffff', pointBorderWidth: 2
|
||||
@@ -254,6 +252,10 @@ const getRankBadgeClass = (index) => ({ 'badge-gold': index === 0, 'badge-silver
|
||||
|
||||
|
||||
|
||||
watch(() => props.contactTimeData, () => {
|
||||
renderContactTimeChart();
|
||||
}, { deep: true });
|
||||
|
||||
// --- 生命周期钩子 ---
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user