wangzhibo
2026-07-16 b57020623cf0c946706573bf102e548c3a544423
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
83
84
85
86
87
88
89
<template>
    <div class="count-effect">
        <div class="card">
            <div class="card__header">
                <span class="label">{{ $t('总销售额') }}</span>
 
                <cl-svg name="amount" class="icon" />
            </div>
 
            <div class="card__container">
                <cl-number :value="num" class="num" type="amount" suffix="元" />
            </div>
 
            <div class="card__footer">
                <ul class="cop">
                    <li>
                        <span>{{ $t('周同比') }}</span>
 
                        <div class="fall">
                            <el-icon>
                                <bottom-right />
                            </el-icon>
 
                            <span>-4%</span>
                        </div>
                    </li>
 
                    <li>
                        <span>{{ $t('日同比') }}</span>
 
                        <div class="rise">
                            <el-icon>
                                <top-right />
                            </el-icon>
 
                            <span>+7%</span>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>
 
<script lang="ts" setup>
import { BottomRight, TopRight } from '@element-plus/icons-vue';
import { random } from 'lodash-es';
import { onMounted, ref } from 'vue';
 
const rate = ref(0);
const num = ref(0);
 
onMounted(() => {
    rate.value = Math.random() * 30 + 30;
    num.value = random(10000000);
});
</script>
 
<style lang="scss" scoped>
.count-effect {
    .cop {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
 
        li {
            display: flex;
            list-style: none;
            flex: 1;
 
            .fall,
            .rise {
                display: flex;
                align-items: center;
                margin-left: 10px;
            }
 
            .fall {
                color: var(--el-color-success);
            }
 
            .rise {
                color: var(--el-color-danger);
            }
        }
    }
}
</style>