6
6
<el-descriptions-item label =" 配送方式: " >
7
7
<dict-tag :type =" DICT_TYPE.TRADE_DELIVERY_TYPE" :value =" formData.order.deliveryType" />
8
8
</el-descriptions-item >
9
+ <!-- TODO 营销活动待实现 -->
9
10
<el-descriptions-item label =" 订单类型: " >
10
11
<dict-tag :type =" DICT_TYPE.TRADE_ORDER_TYPE" :value =" formData.order.type" />
11
12
</el-descriptions-item >
38
39
<el-descriptions-item label =" 申请时间: " >
39
40
{{ formatDate(formData.auditTime) }}
40
41
</el-descriptions-item >
41
- <!-- TODO 营销活动待实现 -->
42
42
<el-descriptions-item label =" 售后类型: " >
43
43
<dict-tag :type =" DICT_TYPE.TRADE_AFTER_SALE_TYPE" :value =" formData.type" />
44
44
</el-descriptions-item >
45
45
<el-descriptions-item label =" 售后方式: " >
46
46
<dict-tag :type =" DICT_TYPE.TRADE_AFTER_SALE_WAY" :value =" formData.way" />
47
47
</el-descriptions-item >
48
- <!-- TODO @puhui999:金额的格式化 -->
49
- <el-descriptions-item label =" 退款金额: " >{{ formData.refundPrice }}</el-descriptions-item >
48
+ <el-descriptions-item label =" 退款金额: " >
49
+ {{ floatToFixed2(formData.refundPrice) }}
50
+ </el-descriptions-item >
50
51
<el-descriptions-item label =" 退款原因: " >{{ formData.applyReason }}</el-descriptions-item >
51
52
<el-descriptions-item label =" 补充描述: " >
52
53
{{ formData.applyDescription }}
53
54
</el-descriptions-item >
54
- <!-- TODO @puhui999:数组,图片 -->
55
- <el-descriptions-item label =" 凭证图片: " > {{ formData.applyPicUrls }}</el-descriptions-item >
55
+ <el-descriptions-item label =" 凭证图片: " >
56
+ <el-image
57
+ v-for =" (item, index) in formData.applyPicUrls"
58
+ :key =" index"
59
+ :src =" item.url"
60
+ class =" w-60px h-60px mr-10px"
61
+ @click =" imagePreview(formData.applyPicUrls)"
62
+ />
63
+ </el-descriptions-item >
56
64
</el-descriptions >
57
65
58
66
<!-- 退款状态 -->
59
67
<el-descriptions :column =" 1" title =" 退款状态" >
60
68
<el-descriptions-item label =" 退款状态: " >
61
69
<dict-tag :type =" DICT_TYPE.TRADE_AFTER_SALE_STATUS" :value =" formData.status" />
62
70
</el-descriptions-item >
63
- <!-- TODO @puhui999:不同状态,展示不同按钮 -->
64
71
<el-descriptions-item label-class-name =" no-colon" >
65
- <el-button type =" primary" @click =" openForm('agree')" >同意售后</el-button >
66
- <el-button type =" primary" @click =" openForm('disagree')" >拒绝售后</el-button >
67
- <el-button type =" primary" @click =" openForm('receive')" >确认收货</el-button >
68
- <el-button type =" primary" @click =" openForm('refuse')" >拒绝收货</el-button >
69
- <el-button type =" primary" @click =" openForm('refund')" >确认退款</el-button >
72
+ <el-button v-if =" formData.status === 10" type =" primary" @click =" agree" >同意售后</el-button >
73
+ <el-button v-if =" formData.status === 10" type =" primary" @click =" disagree" >
74
+ 拒绝售后
75
+ </el-button >
76
+ <el-button v-if =" formData.status === 30" type =" primary" @click =" receive" >
77
+ 确认收货
78
+ </el-button >
79
+ <el-button v-if =" formData.status === 30" type =" primary" @click =" refuse" >拒绝收货</el-button >
80
+ <el-button v-if =" formData.status === 40" type =" primary" @click =" refund" >确认退款</el-button >
70
81
</el-descriptions-item >
71
82
<el-descriptions-item >
72
83
<template #label ><span style =" color : red " >提醒: </span ></template >
@@ -123,7 +134,9 @@ import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
123
134
import { floatToFixed2 } from ' @/utils'
124
135
import { DICT_TYPE } from ' @/utils/dict'
125
136
import { formatDate } from ' @/utils/formatTime'
126
- import UpdateAuditReasonForm from ' @/views/mall/trade/afterSale/components/UpdateAuditReasonForm.vue'
137
+ import UpdateAuditReasonForm from ' @/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue'
138
+ import { createImageViewer } from ' @/components/ImageViewer'
139
+ import { isArray } from ' @/utils/is'
127
140
128
141
defineOptions ({ name: ' TradeOrderDetailForm' })
129
142
@@ -141,34 +154,57 @@ const getDetail = async () => {
141
154
formData .value = await AfterSaleApi .getAfterSale (id )
142
155
}
143
156
}
144
-
145
- /** 各种操作 TODO @puhui999:是不是每个一个方法好点,干净点 */
146
- const openForm = (type : string ) => {
147
- switch (type ) {
148
- case ' agree' :
149
- message .confirm (' 是否同意售后?' ).then (() => {
150
- AfterSaleApi .agree (formData .value .id )
151
- })
152
- break
153
- case ' disagree' :
154
- updateAuditReasonFormRef .value ?.open (formData .value )
155
- break
156
- case ' receive' :
157
- message .confirm (' 是否确认收货?' ).then (() => {
158
- AfterSaleApi .receive (formData .value .id )
159
- })
160
- break
161
- case ' refuse' :
162
- message .confirm (' 是否拒绝收货?' ).then (() => {
163
- AfterSaleApi .refuse (formData .value .id )
164
- })
165
- break
166
- case ' refund' :
167
- message .confirm (' 是否确认退款?' ).then (() => {
168
- AfterSaleApi .refund (formData .value .id )
169
- })
170
- break
157
+ /**
158
+ * 同意售后
159
+ */
160
+ const agree = () => {
161
+ message .confirm (' 是否同意售后?' ).then (() => {
162
+ AfterSaleApi .agree (formData .value .id )
163
+ })
164
+ }
165
+ /**
166
+ * 拒绝售后
167
+ */
168
+ const disagree = () => {
169
+ updateAuditReasonFormRef .value ?.open (formData .value )
170
+ }
171
+ /**
172
+ * 确认收货
173
+ */
174
+ const receive = () => {
175
+ message .confirm (' 是否确认收货?' ).then (() => {
176
+ AfterSaleApi .receive (formData .value .id )
177
+ })
178
+ }
179
+ /**
180
+ * 拒绝收货
181
+ */
182
+ const refuse = () => {
183
+ message .confirm (' 是否拒绝收货?' ).then (() => {
184
+ AfterSaleApi .refuse (formData .value .id )
185
+ })
186
+ }
187
+ /**
188
+ * 确认退款
189
+ */
190
+ const refund = () => {
191
+ message .confirm (' 是否确认退款?' ).then (() => {
192
+ AfterSaleApi .refund (formData .value .id )
193
+ })
194
+ }
195
+ /** 图片预览 */
196
+ const imagePreview = (args ) => {
197
+ const urlList = []
198
+ if (isArray (args )) {
199
+ args .forEach ((item ) => {
200
+ urlList .push (item .url )
201
+ })
202
+ } else {
203
+ urlList .push (args )
171
204
}
205
+ createImageViewer ({
206
+ urlList
207
+ })
172
208
}
173
209
onMounted (async () => {
174
210
await getDetail ()
0 commit comments