提交 74cb7949 authored 作者: haodaking's avatar haodaking

chore: 优化报表分析

上级 920e7405
......@@ -83,12 +83,13 @@ onMounted(fetchAge)
const ageOption = computed(() => {
return {
tooltip: {
trigger: 'item'
trigger: 'item',
formatter: '{b}: {c}<br />{d}%'
},
series: [
{
type: 'pie',
label: { formatter: '{b}\n{c}' },
label: { formatter: '{b}\n{d}%' },
itemStyle: {
borderRadius: 6
},
......@@ -129,6 +130,11 @@ const levelOption = computed(() => {
{
name: '数据',
type: 'bar',
label: {
show: true,
position: 'top'
},
itemStyle: { borderRadius: 2 },
data: cardLevel.value.map(item => item.total)
}
]
......@@ -148,7 +154,8 @@ onMounted(fetchMonthly)
const monthlyOption = computed(() => {
return {
tooltip: {
trigger: 'item'
trigger: 'item',
formatter: '{b}: {c}<br />{d}%'
},
series: [
{
......@@ -158,7 +165,7 @@ const monthlyOption = computed(() => {
borderRadius: 6
},
label: {
formatter: '{b}\n{c}'
formatter: '{b}\n{d}%'
},
data: monthly.value
}
......@@ -278,7 +285,7 @@ async function fetchCardOpen() {
if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2)
rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
}
return { ...item, rate }
})
......@@ -295,7 +302,7 @@ async function fetchCardIntegral() {
if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2)
rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
}
return { ...item, rate }
})
......@@ -312,7 +319,7 @@ async function fetchCardInstallment() {
if (index === 0) {
rate = ((items[items.length - 1]?.total / item.total) * 100).toFixed(2)
} else {
rate = (((items[index + 1]?.total || 0) / item.total) * 100).toFixed(2)
rate = ((item.total / (items[index - 1]?.total || 0)) * 100).toFixed(2)
}
return { ...item, rate }
})
......@@ -331,22 +338,30 @@ onMounted(fetchCardInstallment)
<div class="row">
<div class="box">
<h3>用户性别分布</h3>
<div class="box-inner">
<v-chart class="chart" :option="genderOption" ref="chart" style="height: 280px" />
</div>
</div>
<div class="box">
<h3>用户年龄分布</h3>
<div class="box-inner">
<v-chart class="chart" :option="ageOption" ref="chart" style="height: 280px" />
</div>
</div>
<div class="box">
<h3>信用卡级别分布</h3>
<div class="box-inner">
<v-chart class="chart" :option="levelOption" ref="chart" style="height: 280px" />
</div>
</div>
<div class="box">
<h3>月收入分布</h3>
<div class="box-inner">
<v-chart class="chart" :option="monthlyOption" ref="chart" style="height: 280px" />
</div>
</div>
</div>
</div>
<div class="group">
<h2>标签及群组分析</h2>
<div class="row">
......@@ -369,9 +384,11 @@ onMounted(fetchCardInstallment)
<div class="row">
<div class="box">
<h3>事件分析</h3>
<div class="box-inner">
<v-chart class="chart" :option="eventOption" ref="chart" style="height: 380px" />
</div>
</div>
</div>
<div class="row">
<div class="box">
<h3>信用卡开卡</h3>
......@@ -449,12 +466,18 @@ onMounted(fetchCardInstallment)
border-radius: 6px;
overflow: hidden;
}
.box-inner {
background-color: #fff;
margin: 0 20px 20px;
border-radius: 4px;
}
}
.card {
margin: 20px;
margin: 0 20px 20px;
background-color: #fff;
padding: 20px;
min-height: 410px;
border-radius: 4px;
.item {
min-height: 40px;
display: flex;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论