orderDetail.vue
11.4 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!-- 订单详情 -->
<template>
<div class="order-detail marketing">
<div class="edit-box">
<div class="container m-b-20">
<p class="edit-title">订单信息</p>
<el-form label-width="100px"
:inline="true">
<el-row v-for="(item, index) in detailFormDataRow"
:key="index">
<el-form-item v-for="(subItem, subIndex) in item.rowList"
:key="subIndex"
:label="subItem.label"
class="row-item">
<span class="detail-txt ellipsis-1"
:title="detailForm[subItem.name]">{{ detailForm[subItem.name] ? detailForm[subItem.name] + (subItem.suffix || '') : '-' }}</span>
</el-form-item>
</el-row>
<el-form-item label="其他信息">{{ detailForm.formDescribe }}</el-form-item>
</el-form>
</div>
<div :class="['container', orderRefund ? 'm-b-20' : 'edit-container']">
<p class="edit-title">发货信息</p>
<el-form label-width="100px"
:inline="true">
<el-form-item label="物流信息">
<span>{{ detailForm.deliveryCompany }} {{ detailForm.deliveryNumber }}</span>
</el-form-item>
</el-form>
<div v-if="orderGoods.length"
class="p-l-40">
<table class="show-table">
<tbody>
<tr v-for="(item, index) in orderGoods"
:key="index"
style="height: 70px;">
<td><img :src="item.goodsImage"
class="img-60" /></td>
<td>{{ item.goodsName }}</td>
<td>{{ item.specificationData }}</td>
<td>{{ item.activityPrice ? item.activityPrice : item.retailPrice }}元 *
{{ item.goodsNumber }}</td>
</tr>
<tr v-if="detailForm.subOrderCoupon"
style="height: 40px;">
<td style="text-align: left;"
colspan="3">优惠券</td>
<td>{{ detailForm.subOrderCoupon.discountAmount }}元</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="container edit-container"
v-if="orderRefund">
<p class="edit-title">售后信息</p>
<el-form label-width="100px"
:inline="true">
<el-row v-for="(item, index) in afterInfoDataRow"
:key="index">
<el-form-item v-for="(subItem, subIndex) in item.rowList"
:key="subIndex"
:label="subItem.label">
<span class="detail-txt ellipsis-1"
:title="orderRefund[subItem.name]">{{ orderRefund[subItem.name] || '-' }}</span>
</el-form-item>
</el-row>
</el-form>
<div class="form-img">
<el-form label-width="100px"
:inline="true">
<el-form-item label="售后凭证">
<div class="flex">
<span v-for="(item, index) in orderRefund.imgUrls"
:key="index">
<el-image class="img-60 comment-img"
:src="item"
:preview-src-list="[item]"></el-image>
</span>
</div>
</el-form-item>
</el-form>
</div>
</div>
</div>
<GLFooter>
<el-button @click="handleCancel"
size="medium">取消</el-button>
</GLFooter>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import { orderManageStatusList, orderSourceList, deliveryTypeList } from '@/common/constant'
export default {
name: 'orderDetail',
data() {
return {
size: 'small',
title: '查看订单',
editChildRef: 'editChildRef',
routeInfo: {
orderCode: ''
},
detailForm: {},
orderRefund: null,
orderGoods: [],
// 订单信息
detailFormDataRow: [],
detailFormData: [
{
label: '订单编号',
name: 'orderCode'
},
{
label: '商户订单号',
name: 'outTradeNo'
},
{
label: '订单时间',
name: 'createdDateStr'
},
{
label: '手机号码',
name: 'customerPhone'
},
{
label: '推荐人',
name: 'shareStaffName'
},
{
label: '推荐人类型',
name: 'shareStaffTypeName'
},
{
label: '车架号',
name: 'vin'
},
{
label: '门店信息',
name: 'merchantName'
},
{
label: '客户名称',
name: 'customerName'
},
{
label: '分润比例',
name: 'takeFee',
suffix: '%'
},
{
label: '订单类型',
name: 'orderSourceName'
},
{
label: '订单状态',
name: 'orderStatusName'
},
{
label: '支付定金',
name: 'payPrice'
},
{
label: '尾款',
name: 'crowdFundingPrice'
},
{
label: '发货地址',
name: 'shipAddress'
},
{
label: '微信名称',
name: 'weChatName'
},
{
label: '活动名称',
name: 'activityName'
},
{
label: '商品名称',
name: 'goodsName'
}
],
// 售后信息
afterInfoDataRow: [],
afterInfoData: [
{
label: '售后类型',
name: 'refundTypeName'
},
{
label: '申请金额',
name: 'refundPrice'
},
{
label: '申请时间',
name: 'createdDateStr'
},
{
label: '申请描述',
name: 'remark'
},
{
label: '快递公司',
name: 'deliveryCompany'
},
{
label: '快递单号',
name: 'deliveryNumber'
}
// {
// label: '售后凭证',
// name: ''
// }
],
// 基本数据
baseData: {
orderStatusList: orderManageStatusList,
orderSourceList: orderSourceList,
deliveryTypeList: deliveryTypeList,
refundTypeList: [
{ confId: '1', confName: '退款退货' },
{ confId: '2', confName: '退款不退货' },
{ confId: '3', confName: '众筹订单退款' }
],
shareStaffTypeList: [
{ confId: '1', confName: '个微' },
{ confId: '2', confName: '企微' }
]
}
}
},
created() {
this.formToRow('afterInfoData')
},
mounted() {
this.setMinHeight('.edit-box')
this.routeInfo = this.$route.query
this.getInfo()
},
methods: {
formToRow(formName, numOfRow = 3) {
var rowNum = Math.ceil(this[formName].length / numOfRow)
for (var i = 0; i < rowNum; i++) {
for (var j = 0; j < numOfRow; j++) {
if (j == 0) {
this[formName + 'Row'][i] = {
rowList: []
}
}
if (i * numOfRow + j < this[formName].length) {
this[formName + 'Row'][i].rowList.push(this[formName][i * numOfRow + j])
}
}
}
},
getInfo() {
this.$apis.orderManage.getOrderDetailApi({ orderCode: this.routeInfo.orderCode }).then(res => {
this.detailForm = res
this.orderRefund = res.orderRefund || null
this.detailForm.createdDateStr = dayjs(this.detailForm.createdDate).format('YYYY-MM-DD HH:mm:ss')
if (this.orderRefund) {
this.orderRefund.refundTypeName = this.baseData.refundTypeList.map(item => item.confId).includes(res.orderRefund.refundType + '') ? this.baseData.refundTypeList.find(item => item.confId == res.orderRefund.refundType).confName : '-'
this.orderRefund.createdDateStr = dayjs(this.orderRefund.createdDate).format('YYYY-MM-DD HH:mm:ss')
this.orderRefund.refundPrice = this.orderRefund.refundPrice + '元'
}
if (this.detailForm.shareStaffType) {
this.detailForm.shareStaffTypeName = this.baseData.shareStaffTypeList.map(item => item.confId).includes(this.detailForm.shareStaffType + '') ? this.baseData.shareStaffTypeList.find(item => item.confId == this.detailForm.shareStaffType).confName : '-'
}
if (this.detailForm.subOrderCoupon) {
this.detailForm.subOrderCoupon.discountAmount = (this.detailForm.subOrderCoupon.discountAmount / 100).toFixed(2)
}
this.orderGoods = res.orderGoods || []
this.detailForm.payPrice = res.payPrice ? res.payPrice + '元' : '0元'
this.detailForm.orderSourceName = this.baseData.orderSourceList.map(item => item.confId).includes(res.orderSource + '') ? this.baseData.orderSourceList.find(item => item.confId == res.orderSource).confName : '-'
this.detailForm.orderStatusName = this.baseData.orderStatusList.map(item => item.confId).includes(res.orderStatus + '') ? this.baseData.orderStatusList.find(item => item.confId == res.orderStatus).confName : '-'
if (!this.detailForm.takeFee) {
var takeFeeIdx = this.detailFormData.findIndex(item => item.name == 'takeFee')
this.detailFormData.splice(takeFeeIdx, 1)
}
if (res.orderSource == 4) {
let idx = this.detailFormData.findIndex(item => item.name == 'shipAddress')
this.detailFormData.splice(idx, 1)
}
// 其他信息
var formDescribeObj = {
label: '其他信息',
name: 'formDescribe',
contentName: 'formContent',
attrList: ['First', 'Second']
}
this.detailForm[formDescribeObj.name] = ''
this.detailForm[formDescribeObj.name] = this.detailForm.plateNo ? '车牌号:' + this.detailForm.plateNo + ' ' : ''
this.detailForm[formDescribeObj.name] += this.detailForm.vehicleType ? '品牌车型:' + this.detailForm.vehicleType + ' ' : ''
formDescribeObj.attrList.forEach(item => {
let label = this.detailForm[formDescribeObj.name + item]
let value = this.detailForm[formDescribeObj.contentName + item]
if (label) {
this.detailForm[formDescribeObj.name] += label + ':' + value + ' '
}
})
// 商品名称
this.detailForm.goodsName = this.detailForm.orderGoods.length ? this.detailForm.orderGoods.map(item => item.goodsName).join(',') : '-'
this.formToRow('detailFormData')
})
},
handleCancel() {
this.$router.push({
path: '/orderManage/index'
})
}
}
}
</script>
<style>
.marketing.order-detail .el-form--inline .el-form-item {
margin: 0;
}
.marketing.order-detail .el-form--inline .el-form-item__content {
height: 30px;
}
.marketing.order-detail .form-img .el-form--inline .el-form-item__content {
height: auto !important;
}
.marketing.order-detail .flex {
justify-content: flex-start;
}
.marketing.order-detail .row-item {
width: 33%;
}
.detail-txt {
display: inline-block;
width: 220px;
}
.marketing.order-detail .show-table > tbody > tr > td {
text-align: center;
vertical-align: middle;
}
.marketing.order-detail .show-table td {
padding-right: 20px;
}
.order-detail .comment-img {
margin-top: 10px;
margin-right: 20px;
}
</style>