AuctionOrderFunnel.vue
9.58 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<template>
<a-spin :spinning="loading">
<a-card title="拍卖流程核心漏斗" size="default" class="mt-10">
<template #extra>
<a-segmented v-model:value="segment" :options="segments" @change="changeDateRange">
</a-segmented>
<a-range-picker v-if="segment==='custom'" v-model:value="dateRange" @change="changeDateRange" :allowClear="false" class="ml-8"></a-range-picker>
</template>
<a-row :gutter="16" class="ml-10">
<a-col :span="8" style="text-align: center;">
<a-statistic class="stat" title="总车源数" :value="totalCount" :precision="0"></a-statistic>
</a-col>
<a-col :span="8" style="text-align: center;">
<a-statistic class="stat" title="最终成交" :value="orderCount" :precision="0"></a-statistic>
</a-col>
<a-col :span="8" style="text-align: center;">
<a-statistic class="stat" title="转化率" :value="totalCount!==0?(orderCount*100/totalCount):0" :precision="1" suffix="%"></a-statistic>
</a-col>
</a-row>
<div class="step-card">
<a-tooltip color="blue">
<template #title>
<a-space direction="vertical">
<p>环节名称:总车源数</p>
<p>绝对数值:{{ totalCount }}</p>
</a-space>
</template>
<div class="step step-1">
总车源数 {{ totalCount }}
</div>
</a-tooltip>
<p>
<ArrowDownOutlined class="mr-8"/>
{{ totalCount !== 0 ? (warehousingCount * 100 / totalCount).toFixed(1) : 0 }}%
</p>
<a-tooltip color="blue">
<template #title>
<a-space direction="vertical">
<p>环节名称:入库车辆</p>
<p>绝对数值:{{ warehousingCount }}</p>
<p>与上一环节转化率:{{ totalCount !== 0 ? (warehousingCount * 100 / totalCount).toFixed(1) : 0 }}%</p>
<p>与初始环节转化率:{{ totalCount !== 0 ? (warehousingCount * 100 / totalCount).toFixed(1) : 0 }}%</p>
</a-space>
</template>
<div class="step step-2">
入库车辆 {{ warehousingCount }}
</div>
</a-tooltip>
<p>
<ArrowDownOutlined class="mr-8"/>
{{ warehousingCount !== 0 ? (auctionCount * 100 / warehousingCount).toFixed(1) : 0 }}%
</p>
<a-tooltip color="blue">
<template #title>
<a-space direction="vertical">
<p>环节名称:参拍车辆</p>
<p>绝对数值:{{ auctionCount }}</p>
<p>与上一环节转化率:{{ warehousingCount !== 0 ? (auctionCount * 100 / warehousingCount).toFixed(1) : 0 }}%</p>
<p>与初始环节转化率:{{ totalCount !== 0 ? (auctionCount * 100 / totalCount).toFixed(1) : 0 }}%</p>
</a-space>
</template>
<div class="step step-3">
参拍车辆 {{ auctionCount }}
</div>
</a-tooltip>
<p>
<ArrowDownOutlined class="mr-8"/>
{{ auctionCount !== 0 ? (orderCount * 100 / auctionCount).toFixed(1) : 0 }}%
</p>
<a-tooltip color="blue">
<template #title>
<a-space direction="vertical">
<p>环节名称:成交车辆</p>
<p>绝对数值:{{ orderCount }}</p>
<p>与上一环节转化率:{{ auctionCount !== 0 ? (orderCount * 100 / auctionCount).toFixed(1) : 0 }}%</p>
<p>与初始环节转化率:{{ totalCount !== 0 ? (orderCount * 100 / totalCount).toFixed(1) : 0 }}%</p>
</a-space>
</template>
<div class="step step-4">
成交车辆 {{ orderCount }}
</div>
</a-tooltip>
<p>
<ArrowDownOutlined class="mr-8"/>
{{ orderCount !== 0 ? (completedCount * 100 / orderCount).toFixed(1) : 0 }}%
</p>
<a-tooltip color="blue">
<template #title>
<a-space direction="vertical">
<p>环节名称:过户成功</p>
<p>绝对数值:{{ completedCount }}</p>
<p>与上一环节转化率: {{ orderCount !== 0 ? (completedCount * 100 / orderCount).toFixed(1) : 0 }}%</p>
<p>与初始环节转化率:{{ totalCount !== 0 ? (completedCount * 100 / totalCount).toFixed(1) : 0 }}%</p>
</a-space>
</template>
<div class="step step-5">
过户成功 {{ completedCount }}
</div>
</a-tooltip>
</div>
</a-card>
</a-spin>
</template>
<script lang="ts">
import {Component, Vue} from 'vue-facing-decorator';
import {ArrowDownOutlined} from "@ant-design/icons-vue";
import {VehicleController} from "@/api/VehicleController";
import dayjs from "dayjs";
@Component({components: {ArrowDownOutlined}})
export default class AuctionOrderFunnel extends Vue {
segments = [{label: '今日', value: 'today'}, {label: '昨日', value: 'yesterday'}, {label: '近7天', value: 'day7'}, {label: '近30天', value: 'day30'}
, {label: '自定义', value: 'custom'}];
dateRange = [];
segment = 'day30';
vehicleCount: any = {};
/**
* 总车源数
*/
totalCount = 0;
warehousingCount = 0;
auctionCount = 0;
/**
* 成交车辆
*/
orderCount = 0;
completedCount = 0;
loading = false;
created(): void {
this.changeDateRange();
}
changeDateRange(): void {
switch (this.segment) {
case 'today':
this.dateRange = [dayjs(), dayjs()];
break;
case 'yesterday':
this.dateRange = [dayjs().add(-1, 'days'), dayjs().add(-1, 'days')];
break;
case 'day7':
this.dateRange = [dayjs().add(-7, 'days'), dayjs()];
break;
case 'day30':
this.dateRange = [dayjs().add(-30, 'days'), dayjs()];
break;
case 'custom':
break;
}
this.loadData();
}
loadData(): void {
this.loading = true;
VehicleController.getVehicleCountByStateAndDateRange(this.axios, this.dateRange[0], this.dateRange[1]).then(res => {
this.vehicleCount = res.data;
this.calVehicleCount();
}).finally(() => this.loading = false);
}
calVehicleCount(): void {
let total = 0;
let warehousingCount = 0;
let auctionCount = 0;
let orderCount = 0;
let completedCount = 0;
for (const key in this.vehicleCount) {
total = total + this.vc(key);
if (key !== 'INVENTORY') {
warehousingCount = warehousingCount + this.vc(key);
if (key !== 'VENUE' && key !== 'TO_BE_PRICED' && key !== 'PRICED') {
auctionCount = auctionCount + this.vc(key);
if (key !== 'PENDING_AUCTION' && key !== 'WAIT_AUCTION' && key !== 'PREVIEW' && key !== 'AUCTIONING') {
orderCount = orderCount + this.vc(key);
if (key !== 'CONTRACT_UNSIGNED' && key !== 'UNPAID' && key !== 'WAIT_PICKUP' && key !== 'TRANSFERRING') {
completedCount = completedCount + this.vc(key);
}
}
}
}
}
this.totalCount = total;
this.warehousingCount = warehousingCount;
this.auctionCount = auctionCount;
this.orderCount = orderCount;
this.completedCount = completedCount;
}
vc(state: string): number {
const num = this.vehicleCount[state];
if (num) {
return num;
} else {
return 0;
}
}
}
</script>
<style scoped lang="less">
.stat {
border-radius: 8px;
//background: linear-gradient(129.4deg, #F7FAFF 0%, #EBF3FF 36.53%, #F7FAFF 100%);
background: linear-gradient(129.4deg, #F7FAFFFF 0%, #F7FAFFFF 36.53%, #F7FAFFFF 100%);
padding: 12px 16px 12px 16px;
}
.step-card {
padding: 30px 48px 0 48px;
text-align: center;
p {
line-height: 36px;
}
}
.step {
height: 32px;
opacity: 1;
border-radius: 6px;
text-align: center;
align-items: center;
padding: 5px 0 5px 0;
display: inline-block;
}
.step-1 {
background: #EBF3FF;
width: 100%;
color: #777C85;
}
.step-2 {
background: #C2D8FF;
width: 80%;
color: #777C85;
}
.step-3 {
background: #78A8FB;
width: 60%;
color: #ffffff;
}
.step-4 {
background: #3D84FF;
width: 40%;
color: #ffffff;
}
.step-5 {
background: #1956FE;
width: 20%;
color: #ffffff;
}
</style>