ApproveHistoryTimelineWithPrice.vue
6.26 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
<template>
<a-timeline class="mt-10">
<a-timeline-item v-for="item in approveHistories" :color="auditStateColor(item.auditState)" :key="item.historyId">
<div class="title-container">
<div class="title-type">
<span class="label">操作类型:</span>
{{ $t('enum.auditState.' + item.auditState) }}
</div>
<div class="title-type">
<span class="label">市场参考价:</span>
¥{{ item.referencePrice }}元
</div>
<div class="title-type">
<span class="label">起拍价:</span>
¥{{ item.startingBidPrice }}元
</div>
<div class="title-type">
<span class="label">保留价:</span>
¥{{ item.reservePrice }}元
</div>
<div class="title-type">
<span class="label">佣金金额:</span>
¥{{ item.fixedCommission ?? '-' }}元
</div>
<div class="title-type">
<span class="label">成本价:</span>
¥{{ appraiseObj.vehicle?.evaluationTransaction?.purchasePrice }}元
</div>
<div class="title-type">
<span class="label">预计经销差:</span>
¥{{ expectedProfitMethod(item.reservePrice, appraiseObj.fixedCommission, appraiseObj.vehicle?.evaluationTransaction?.purchasePrice) }}元
</div>
<div class="title-remark" v-if="item.remark" :title="item.remark">
<span class="label">备注:</span>{{ item.remark }}
</div>
</div>
<p class="time-label">
<a-tooltip :title="item.user.userName" class="mr-16"> {{ item.user.realName }}</a-tooltip>
<span> {{ item.createTime }}</span>
</p>
</a-timeline-item>
<a-timeline-item v-if="createTime">
<div class="title-container">
<div class="title-type">
<span class="label">操作类型:</span>
提交审核
</div>
<div class="title-type">
<span class="label">市场参考价:</span>
¥{{ appraiseObj.referencePrice }}元
</div>
<div class="title-type">
<span class="label">起拍价:</span>
¥{{ appraiseObj.startingBidPrice }}元
</div>
<div class="title-type">
<span class="label">保留价:</span>
¥{{ appraiseObj.reservePrice }}元
</div>
<div class="title-type">
<span class="label">佣金金额:</span>
¥{{ appraiseObj.fixedCommission }}元
</div>
<div class="title-type">
<span class="label">成本价:</span>
¥{{ appraiseObj.vehicle?.evaluationTransaction?.purchasePrice }}元
</div>
<div class="title-type">
<span class="label">预计经销差:</span>
¥{{ expectedProfitMethod(appraiseObj.reservePrice, appraiseObj.fixedCommission, appraiseObj.vehicle?.evaluationTransaction?.purchasePrice) }}元
</div>
<div class="title-remark" v-if="remark" :title="remark">
<span class="label">备注:</span>{{ remark }}
</div>
</div>
<p class="time-label">
<user-real-name :user-name="starter"></user-real-name>
<span class="ml-8"> {{ createTime }}</span>
</p>
</a-timeline-item>
</a-timeline>
</template>
<script lang="ts">
import {Component, Prop, Vue} from 'vue-facing-decorator';
import {ApproveHistory, ApproveHistory_ApproveType} from "lib/src/entity/track/entity/ApproveHistory";
import {ApproveController} from "@/api/ApproveController";
import {AuditState} from "lib/src/entity/enum_types";
import UserRealName from "@/components/UserRealName.vue";
@Component({
components: {UserRealName}
})
export default class ApproveHistoryTimeline extends Vue {
@Prop({type: String, required: true})
approveType: ApproveHistory_ApproveType;
@Prop({type: Number, required: true})
approveId: number;
@Prop({type: String, required: false})
createTime: Date | string;
@Prop({type: String, required: false})
starter: string;
@Prop({type: String, required: false})
remark: string;
approveHistories: ApproveHistory[] = [];
@Prop({type: Object, required: false})
appraiseObj: appraiseObj = {};
created(): void {
ApproveController.getAppraisePricesByVehicleIdExcludingUnaudited(this.axios, this.appraiseObj?.vehicle?.vehicleId).then(res => {
this.approveHistories = res.data;
});
}
expectedProfitMethod(reservePrice, commission, purchasePrice) {
// 预计经销差=保留价+佣金-成本价
if (!reservePrice || !purchasePrice) {
return '-';
}
// 佣金字段可能是0或空,需要特殊处理
const commissionPrice = commission || 0;
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((reservePrice + commissionPrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
auditStateColor(auditState: AuditState): string {
switch (auditState) {
case "AUDITED":
return 'green';
case "REJECTED":
return 'red';
case 'UNAUDITED':
return 'blue';
}
return 'gray';
}
}
</script>
<style scoped lang="less">
.label {
color: #777C85FF;
}
.title-container {
display: flex;
flex-wrap: wrap;
width: 100%;
align-items: center;
}
.title-type {
display: flex;
align-items: center;
margin-right: 20px;
}
.title-remark {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
flex: 1;
}
.time-label {
font-size: 12px;
color: #777C85FF;
}
</style>