AccountBasicData.nvue
3.57 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
<view class="c-list">
<view class="c-l-item" v-for="(item,index) in cardData" :key="item.key">
<view class="c-list_item_title">
<text class="c-list_item_title_text">{{ item.name }}</text>
</view>
<view class="c-list_item_value">
<text class="c-list_item_value_text">{{formatValue(item)}}</text>
</view>
<view class="c-list_item_other" v-if="average_key.includes(item.key)">
<text class="c-list_item_other_text">{{ t('navData.averexposure') }}: {{item.average}}</text>
</view>
</view>
</view>
</template>
<script setup>
import {
formatSeconds,
getStageObj
} from '@/utils'
import {
t
} from '@/plugins/index.js'
const props = defineProps({
cardData: {
type: Array,
default: () => []
}
})
// 需要展示店均的key列表
// 依次: 集团总客流人数、集团总客流、过店人次、批次客流
const average_key = ['account_passenger_number', 'account_passenger_flow', 'mall_customer_group',
'mall_outside_number'
]
// 需要格式化时间key列表
// 依次:顾客停留时间 顾客滞留时间
const time_key = ['custom_residence_time', 'custom_residence_time']
// 需要合并展示的值
// 依次:成人&儿童
const conbine_key = {
'mall_customer_adult_child': ['adult', 'child']
}
const formatValue = (item) => {
// 格式化时间
if (time_key.includes(item.key)) {
return formatSeconds(item.value)
}
// 格式化合并项
if (conbine_key[item.key]) {
return conbine_key[item.key].map(elKey => item[elKey]).join('/')
}
if (item.unit === '%') {
return `${item.value}%`
}
if (item.value > 1000000) {
return (item.value / 10000).toFixed(2) + 'w'
}
return item.value
}
</script>
<style lang="scss">
.c-list {
padding: 28rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
.c-l-item {
width: 320rpx;
height: 194rpx;
padding: 24rpx 0 0 24rpx;
border-radius: 8rpx;
border: 2rpx solid #EDEFF3;
margin-bottom: 14rpx;
display: flex;
flex-direction: column;
.c-list_item_title {
.c-list_item_title_text {
font-size: 26rpx;
color: #656A72;
}
}
.c-list_item_value {
margin: 14rpx 0;
&_text {
color: #202328;
font-family: D-DIN-PRO-700-Bold;
font-size: 44rpx;
}
}
.c-list_item_other {
&_text {
font-size: 24rpx;
color: #90949D;
}
}
}
// &_item {
// /* 三列布局核心计算 */
// height: 160rpx;
// /* 以下保持原有样式 */
// align-items: center;
// &_title {
// flex-direction: row;
// &_text {
// font-size: 26rpx;
// color: #202328;
// }
// &_icon {}
// }
// &_value {
// width: 100%;
// margin: 8rpx 0;
// &_text {
// /* #ifdef APP */
// lines: 1;
// /* #endif */
// /* #ifdef H5 || MP-WEIXIN */
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// /* #endif */
// font-weight: bold;
// text-align: center;
// font-size: 36rpx;
// color: #202328;
// }
// }
// &_other {
// &_text {
// font-size: 20rpx;
// color: #6d778f;
// flex-direction: row;
// }
// }
// }
}
</style>