ViewTabs.vue
2.35 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!--
* @Description:
* @Author: huyue
* @Date: 2023-08-16 14:44:03
* @LastEditors: huyue
* @LastEditTime: 2024-07-12 17:01:01
-->
<template>
<div class="tabs flex">
<div class="tab" :style="{width: `calc((100% - ${(tabs.length - 1) * 0.56 + 0.83 * 2}vw) / ${tabs.length})`}" v-for="item in tabs" :key="item.key">
<div v-if="item.key != 'retention'" class="tab-text">{{ numAddSymbol(dataList[item.key]) }}</div>
<div v-else class="tab-text">{{ toFixNum(dataList[item.key]) }}</div>
<div class="tab-title">{{ item.title }}</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'ViewTabs',
data() {
return {
dataList: {},
tabs: [
{
title: '总门店数',
key: 'totalNum'
},
{
title: '当年新增',
key: 'incrNum'
},
{
title: '订阅留存率',
key: 'retention'
// },
// {
// title: '单店产值',
// key: 'outputValue'
}
]
}
},
created() {
this.getEnterpriseOverview()
},
methods: {
toFixNum(val) {
if(!val){
return '0.0%'
}
return (Number(val) * 100).toFixed(1) + '%'
},
getEnterpriseOverview() {
this.api.operational.getEnterpriseOverview().then(res => {
if (res.code == 0) {
this.dataList = res.data.dataList[0]
}
})
}
}
}
</script>
<style scoped lang="scss">
.tabs {
padding: 3.22vh 0.83vw 0;
// padding: 20px 1.67vw;
height: 7.78vh;
width: 100%;
// box-sizing: border-box;
// justify-content: space-between;
.tab {
box-sizing: border-box;
padding: 1.98vh 0.56vw 0;
height: 100%;
// background: #061422;
// box-shadow: inset 0 0 10.42px 0 #3d57ff69;
margin-right: 0.56vw;
background: url(../../../assets/images/operation/tab-bg.png) no-repeat;
background-size: 100% 100%;
text-align: center;
&:last-child {
margin-right: 0;
}
// padding: 2vh 0;
.tab-title {
font-weight: 400;
font-size: 12px;
color: #e8e8e8;
margin-bottom: 0.24vh;
}
.tab-text {
font-weight: 700;
font-size: 24px;
line-height: 30px;
color: #fff;
}
}
}
</style>