messageReport.vue
5.13 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<template>
<view class="h-page" ref="uv-back-top">
<CustomNavBar :title="t('PreMenu.regionalRanking')" />
<view :style="`position: fixed;z-index: 99;top: ${navHeight + 44}px;`">
<PageOptions
default-type="account"
:options="xAxisFields"
:options-props="{ label: 'name', value: 'key' }"
@change="handleOptionsChange"
choose-group="1"
has-store="0"
/>
</view>
<view style="height: 164rpx"></view>
<view class="h-c-container">
<view class="summary-stats-wrap">
<!-- 总体统计 -->
<view class="summary-stats">
<view class="stat-item">
<view class="stat-label">Alert Count</view>
<view class="stat-value">306</view>
</view>
<view class="stat-item">
<view class="stat-label">Processed</view>
<view class="stat-value">224</view>
</view>
<view class="stat-item">
<view class="stat-label">Unprocessed</view>
<view class="stat-value">82</view>
</view>
</view>
<!-- 详细表格 -->
<view class="detail-table">
<!-- 表头 -->
<view class="table-header">
<view class="header-cell store-name">Store Name</view>
<view class="header-cell alert-count">Alert Count</view>
<view class="header-cell processed">Processed</view>
</view>
<!-- 表格数据 -->
<view
class="table-row"
v-for="(item, index) in tableData"
:key="index"
>
<view class="table-cell store-name">{{ item.storeName }}</view>
<view class="table-cell alert-count">{{ item.alertCount }}</view>
<view class="table-cell processed">{{ item.processed }}</view>
</view>
</view>
</view>
</view>
<uv-back-top
:scroll-top="scrollTop"
zIndex="999"
icon="arrow-upward"
></uv-back-top>
</view>
</template>
<script setup>
import { onReachBottom, onPageScroll } from "@dcloudio/uni-app";
import { ref, computed, onMounted } from "vue";
import { getStageObj } from "@/utils";
import { useNav } from "@/hooks";
import PageOptions from "@/components/PageOptions.vue";
import CustomNavBar from "@/components/CustomNav.nvue";
import { t } from "@/plugins/index.js";
import { getMallStatisticsApi } from "@/api";
const { navHeight } = useNav();
const status = ref("loading");
const tableData = ref([]);
onReachBottom(() => {});
const scrollTop = ref(0);
onPageScroll((e) => {
scrollTop.value = e.scrollTop;
// #ifdef APP-NVUE
scrollTop.value = e.detail.scrollTop;
// #endif
});
const params = ref({});
const totalParam = ref({});
const handleOptionsChange = (e, key) => {
page.value = 1;
params.value = e;
status.value = "loading";
};
const getMessageReport = () => {
const param = {
accountId: getStageObj("account")?.id, // 集团id
startTime: params.value.startDate,
endTime: params.value.endDate,
};
getMallStatisticsApi(param).then((res) => {
console.log(res, "resgetMessageReport");
totalParam.value = {
alertCount: res?.data?.total,
processed: res?.data?.closeEdSum,
unprocessed: res?.data?.unCloseSum,
};
const list = res?.data?.resultMap;
tableData.value = list.map((item) => ({
storeName: item?.mallName,
alertCount:
(item.statusCountMap?.CLOSED || 0) + (item.statusCountMap?.NEW || 0),
processed: item.statusCountMap?.CLOSED,
}));
console.log(tableData.value, "tableData.value");
});
};
onMounted(() => {
getMessageReport();
});
const page = ref(1);
const xAxisFields = ref([]);
</script>
<style lang="scss">
.h-page {
/* #ifdef H5 */
min-height: calc(100vh - 44px);
/* #endif */
/* #ifndef H5 */
min-height: 100vh;
/* #endif */
background-color: #ffffff;
.h-c-container {
padding: 0 0rpx 20rpx;
flex: 1;
}
}
.summary-stats-wrap {
padding: 32rpx;
background-color: #fff;
flex: 1;
}
.summary-stats {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
padding: 38rpx 0;
background: #ffffff;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #eef0f3;
}
.stat-item {
text-align: center;
flex: 1;
position: relative;
&:not(:last-child)::after {
content: "";
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 2rpx;
height: 84rpx;
background-color: #e1e4ea;
}
}
.stat-label {
font-weight: 400;
font-size: 24rpx;
color: #1d2541;
margin-bottom: 16rpx;
}
.stat-value {
font-weight: bold;
font-size: 36rpx;
color: #202328;
}
.detail-table {
width: 100%;
}
// 表格
.table-header {
display: flex;
padding: 18rpx 24rpx;
background: #f9f9fc;
.header-cell {
font-weight: 500;
font-size: 26rpx;
color: #1d2541;
}
}
.table-row {
display: flex;
padding: 18rpx 24rpx;
border-bottom: 1rpx solid #f2f2f6;
}
.table-cell {
font-weight: 400;
font-size: 26rpx;
color: #202328;
}
.store-name {
flex: 1;
text-align: left;
}
.alert-count {
flex: 1;
text-align: center;
}
.processed {
flex: 1;
text-align: center;
}
</style>