AuctionBidMonitor.vue
6.46 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
<template>
<a-card title="竞拍监控" size="default" class="mt-10 approve-view-notice">
<a-flex class="auction-control" justify="space-between">
<div style="width: 165px;">
<a-statistic title="当前在线竞拍人数" :value="bidCount.minuteCount??0" :precision="0" :value-style="statisticStyle">
</a-statistic>
<p>平均{{ bidCount.hourCount ?? 0 }}人/小时</p>
</div>
<v-chart :option="bidCountOption" style="height: 120px" theme="walden"/>
</a-flex>
<a-tabs v-model:activeKey="activeKey" centered>
<a-tab-pane key="1" tab="热门车辆">
<router-link v-for="(item, index) in rates" :key="index" :to="{path:'/auction/view',query:{auctionId:item.auctionId}}">
<div class="auction-item">
<div class="vehicle-item-title">
<p> {{ item.carSeriesName }} {{ item.carTypeName }}</p>
<p> {{ $filters.formatNumber(item.accountCount * 100 / item.browserHistoryCount, 0) }}% <span class="account-count">{{ item.accountCount }}</span></p>
</div>
<a-progress :percent="item.accountCount *100/ item.browserHistoryCount" :show-info="false"/>
</div>
</router-link>
<a-empty v-if="rates?.length===0" :image="simpleImage"></a-empty>
</a-tab-pane>
<a-tab-pane key="2" tab="时段分布">
<div v-for="(item, index) in timePeriods" :key="index" class="auction-item">
<div class="vehicle-item-title">
<p> {{ item.startTime.substring(0, 5) }} 至 {{ item.endTime.substring(0, 5) }}</p>
<p> 出价人数:{{ item.bidCount }} 围观人数:{{ item.viewCount }} </p>
</div>
<a-progress :percent="item.bidCount *100/ item.viewCount" :show-info="true"/>
</div>
<a-empty v-if="timePeriods?.length===0" :image="simpleImage"></a-empty>
</a-tab-pane>
<a-tab-pane key="3" tab="地域分布">
<div v-for="(item, index) in provinceRates" :key="index" class="auction-item">
<div class="vehicle-item-title">
<p> {{ $filters.formatAreaName(item.provinceCode) }} </p>
<p> {{ $filters.formatNumber(item.accountCount * 100 / item.browserHistoryCount, 0) }}% <span class="account-count">{{ item.accountCount }}</span></p>
</div>
<a-progress :percent="item.accountCount *100/ item.browserHistoryCount" :show-info="false"/>
</div>
<a-empty v-if="provinceRates?.length===0" :image="simpleImage"></a-empty>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script lang="ts">
import {Component, Vue} from "vue-facing-decorator";
import {BidController} from "@/api/BidController";
import dayjs from "dayjs";
import {AuctionController} from "@/api/AuctionController";
import {AuctionVehicleRate} from "lib/src/entity/analysis/domain/AuctionVehicleRate";
import {ProvinceRate} from "lib/src/entity/analysis/domain/ProvinceRate";
import {AnalysisController} from "@/api/AnalysisController";
import {TimePeriod} from "lib/src/entity/analysis/domain/TimePeriod";
import {Empty} from "ant-design-vue";
@Component({
components: {}
})
export default class AuctionBidMonitor extends Vue {
activeKey = '1';
statisticStyle = {fontSize: '28px', fontWeight: 600};
simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
bidCountOption = {
tooltip: {
trigger: 'axis',
formatter: (params) => {
let relVal = params[0].name + ':00,' + params[0].value + '人'
return relVal
},
},
grid: {top: '1px', bottom: '20px', left: '10px', right: '11px'},
xAxis: {
type: 'category',
boundaryGap: false,
axisTick: {show: false},
showSymbol: false,
data: []
},
yAxis: {
type: 'value',
axisLabel: {
show: false
},
splitLine: {
show: false
}
},
series: [
{
data: [],
symbol: 'none',
type: 'line',
areaStyle: {}
}
]
};
rates: AuctionVehicleRate[] = [];
provinceRates: ProvinceRate[] = [];
bidCount = {minuteCount: 0, hourCount: 0};
timerId = 0;
timePeriods: TimePeriod[] = [];
created(): void {
const today = dayjs();
BidController.getBidAccountCountGroupByHour(this.axios, today).then(res => {
const indexCounts = res.data;
const xAxisData = [];
const seriesData = [];
for (let i = 0; i < 24; i++) {
xAxisData.push(i);
const item = indexCounts.find(item => item.index === i);
seriesData.push(item ? item.value : 0);
}
this.bidCountOption.xAxis.data = xAxisData;
this.bidCountOption.series[0].data = seriesData;
});
AuctionController.getAuctionCountRate(this.axios).then(res => {
this.rates = res.data;
});
AnalysisController.getProvinceCountRate(this.axios).then(res => {
this.provinceRates = res.data;
});
AnalysisController.getTimePeriodsToday(this.axios).then(res => {
this.timePeriods = res.data;
});
this.timerId = setInterval(() => {
this.loadData();
}, 60000);
}
destroyed(): void {
clearInterval(this.timerId);
}
loadData(): void {
BidController.getAccountCountByCreateTimeAfter(this.axios).then(res => {
this.bidCount = res.data;
});
}
}
</script>
<style lang="less" scoped>
.approve-view-notice ::v-deep(.ant-card-body) {
padding-top: 6px;
}
.auction-control {
border-radius: 8px;
background: linear-gradient(129.4deg, #F7FAFFFF 0%, #F5F9FF38 36.53%, #F7FAFFFF 100%);
padding: 12px 6px 12px 12px;
margin: 6px 0;
}
.vehicle-item-title {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
margin-bottom: 1px;
}
.account-count {
padding-left: 10px;
font-size: 15px;
font-weight: 600;
}
</style>