StatisticCard.vue
1.95 KB
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
<!--
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-03-02 11:07:51
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-03-05 17:57:06
* @FilePath: \wx-notification\src\views\evection\components\StatisticCard.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="statistic">
<div class="text">总消费</div>
<div class="value">{{ formatNum(statistic.totalAmount) }}</div>
<div class="ratio">
环比
<span>{{ formatRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing) }}</span>
<div class="arrow-icon" v-if="formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing)">
<img class="just" :src="getIconSrc(formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing))" />
</div>
</div>
</div>
</template>
<script>
import { formatNum, formatRatio, formatWhiteIsRatio, getIconSrc } from '@/utils/tools.js'
export default {
props: {
statistic: {
type: Object,
default: () => {}
},
isPerson:{
type: Boolean,
default: false
}
},
data() {
return {
formatNum,
formatRatio,
formatWhiteIsRatio,
getIconSrc
}
}
}
</script>
<style lang="scss" scoped>
.statistic {
height: 86px;
border-radius: 8px;
padding: 12px;
box-sizing: border-box;
background: linear-gradient(90deg, #3d76fc 0%, #4da6ff 100%);
color: #ffffff;
.text {
font-size: 14px;
font-weight: 400;
}
.value {
font-size: 22px;
font-weight: 600;
margin: 4px 0;
font-family: numberBold;
}
.ratio {
font-size: 12px;
font-family: numberNor;
display: flex;
align-items: center;
span {
margin: 0 2px;
}
.arrow-icon {
width: 13px;
height: 13px;
img {
width: 100%;
}
}
}
}
</style>