forked from macrozheng/mall-admin-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orderDetail.vue
549 lines (542 loc) · 20.8 KB
/
orderDetail.vue
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
<template>
<div class="detail-container">
<div>
<el-steps :active="formatStepStatus(order.status)" finish-status="success" align-center>
<el-step title="提交订单" :description="formatTime(order.createTime)"></el-step>
<el-step title="支付订单" :description="formatTime(order.paymentTime)"></el-step>
<el-step title="平台发货" :description="formatTime(order.deliveryTime)"></el-step>
<el-step title="确认收货" :description="formatTime(order.receiveTime)"></el-step>
<el-step title="完成评价" :description="formatTime(order.commentTime)"></el-step>
</el-steps>
</div>
<el-card shadow="never" style="margin-top: 15px">
<div class="operate-container">
<i class="el-icon-warning color-danger" style="margin-left: 20px"></i>
<span class="color-danger">当前订单状态:{{order.status | formatStatus}}</span>
<div class="operate-button-container" v-show="order.status===0">
<el-button size="mini" @click="showUpdateReceiverDialog">修改收货人信息</el-button>
<el-button size="mini">修改商品信息</el-button>
<el-button size="mini" @click="showUpdateMoneyDialog">修改费用信息</el-button>
<el-button size="mini">发送站内信</el-button>
<el-button size="mini">关闭订单</el-button>
<el-button size="mini">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===1">
<el-button size="mini">修改收货人信息</el-button>
<el-button size="mini">发送站内信</el-button>
<el-button size="mini">取消订单</el-button>
<el-button size="mini">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===2||order.status===3">
<el-button size="mini">订单跟踪</el-button>
<el-button size="mini">发送站内信</el-button>
<el-button size="mini">备注订单</el-button>
</div>
<div class="operate-button-container" v-show="order.status===4">
<el-button size="mini">删除订单</el-button>
<el-button size="mini">备注订单</el-button>
</div>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">基本信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="4" class="table-cell-title">订单编号</el-col>
<el-col :span="4" class="table-cell-title">发货单流水号</el-col>
<el-col :span="4" class="table-cell-title">用户账号</el-col>
<el-col :span="4" class="table-cell-title">支付方式</el-col>
<el-col :span="4" class="table-cell-title">订单来源</el-col>
<el-col :span="4" class="table-cell-title">订单类型</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell">{{order.orderSn}}</el-col>
<el-col :span="4" class="table-cell">暂无</el-col>
<el-col :span="4" class="table-cell">{{order.memberUsername}}</el-col>
<el-col :span="4" class="table-cell">{{order.payType | formatPayType}}</el-col>
<el-col :span="4" class="table-cell">{{order.sourceType | formatSourceType}}</el-col>
<el-col :span="4" class="table-cell">{{order.orderType | formatOrderType}}</el-col>
</el-row>
<el-row>
<el-col :span="4" class="table-cell-title">配送方式</el-col>
<el-col :span="4" class="table-cell-title">物流单号</el-col>
<el-col :span="4" class="table-cell-title">自动确认收货时间</el-col>
<el-col :span="4" class="table-cell-title">订单可得优币</el-col>
<el-col :span="4" class="table-cell-title">订单可得成长值</el-col>
<el-col :span="4" class="table-cell-title">活动信息</el-col>
</el-row>
<el-row style="display: table">
<el-col :span="4" class="table-cell">{{order.deliveryCompany | formatNull}}</el-col>
<el-col :span="4" class="table-cell">{{order.deliverySn | formatNull}}</el-col>
<el-col :span="4" class="table-cell">{{order.autoConfirmDay}}天</el-col>
<el-col :span="4" class="table-cell">{{order.integration}}</el-col>
<el-col :span="4" class="table-cell">{{order.growth}}</el-col>
<el-col :span="4" class="table-cell">{{order.promotionInfo}}</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">收货人信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">收货人</el-col>
<el-col :span="6" class="table-cell-title">手机号码</el-col>
<el-col :span="6" class="table-cell-title">邮政编码</el-col>
<el-col :span="6" class="table-cell-title">收货地址</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">{{order.receiverName}}</el-col>
<el-col :span="6" class="table-cell">{{order.receiverPhone}}</el-col>
<el-col :span="6" class="table-cell">{{order.receiverPostCode}}</el-col>
<el-col :span="6" class="table-cell">{{order | formatAddress}}</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">商品信息</span>
</div>
<el-table
ref="orderItemTable"
:data="order.orderItemList"
style="width: 100%;margin-top: 20px" border>
<el-table-column label="商品图片" width="120" align="center">
<template slot-scope="scope">
<img :src="scope.row.productPic" style="height: 80px">
</template>
</el-table-column>
<el-table-column label="商品名称" align="center">
<template slot-scope="scope">
<p>{{scope.row.productName}}</p>
<p>品牌:{{scope.row.productBrand}}</p>
</template>
</el-table-column>
<el-table-column label="价格/货号" width="120" align="center">
<template slot-scope="scope">
<p>价格:¥{{scope.row.productPrice}}</p>
<p>货号:{{scope.row.productSn}}</p>
</template>
</el-table-column>
<el-table-column label="属性" width="120" align="center">
<template slot-scope="scope">
{{scope.row.productAttr | formatProductAttr}}
</template>
</el-table-column>
<el-table-column label="数量" width="120" align="center">
<template slot-scope="scope">
{{scope.row.productQuantity}}
</template>
</el-table-column>
<el-table-column label="小计" width="120" align="center">
<template slot-scope="scope">
¥{{scope.row.productPrice*scope.row.productQuantity}}
</template>
</el-table-column>
</el-table>
<div style="float: right;margin: 20px">
合计:<span class="color-danger">¥{{order.totalAmount}}</span>
</div>
<div style="margin-top: 60px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">费用信息</span>
</div>
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">商品合计</el-col>
<el-col :span="6" class="table-cell-title">运费</el-col>
<el-col :span="6" class="table-cell-title">优惠券</el-col>
<el-col :span="6" class="table-cell-title">积分抵扣</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">¥{{order.totalAmount}}</el-col>
<el-col :span="6" class="table-cell">¥{{order.freightAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.couponAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.integrationAmount}}</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell-title">活动优惠</el-col>
<el-col :span="6" class="table-cell-title">折扣金额</el-col>
<el-col :span="6" class="table-cell-title">订单总金额</el-col>
<el-col :span="6" class="table-cell-title">应付款金额</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">-¥{{order.promotionAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.discountAmount}}</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.totalAmount+order.freightAmount}}</span>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.payAmount+order.freightAmount-order.discountAmount}}</span>
</el-col>
</el-row>
</div>
<div style="margin-top: 20px">
<svg-icon icon-class="marker" style="color: #606266"></svg-icon>
<span class="font-small">操作信息</span>
</div>
<el-table style="margin-top: 20px;width: 100%"
ref="orderHistoryTable"
:data="order.historyList" border>
<el-table-column label="操作者" width="120" align="center">
<template slot-scope="scope">
{{scope.row.operateMan}}
</template>
</el-table-column>
<el-table-column label="操作时间" width="160" align="center">
<template slot-scope="scope">
{{formatTime(scope.row.createTime)}}
</template>
</el-table-column>
<el-table-column label="订单状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatStatus}}
</template>
</el-table-column>
<el-table-column label="付款状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatPayStatus}}
</template>
</el-table-column>
<el-table-column label="发货状态" width="120" align="center">
<template slot-scope="scope">
{{scope.row.orderStatus | formatDeliverStatus}}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{scope.row.note}}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog title="修改收货人信息"
:visible.sync="receiverDialogVisible"
width="40%">
<el-form :model="receiverInfo"
ref="receiverInfoForm"
label-width="150px">
<el-form-item label="收货人姓名:">
<el-input v-model="receiverInfo.receiverName" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="手机号码:">
<el-input v-model="receiverInfo.receiverPhone" style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="邮政编码:">
<el-input v-model="receiverInfo.receiverPostCode" style="width: 200px">
</el-input>
</el-form-item>
<el-form-item label="所在区域:">
<v-distpicker :province="receiverInfo.receiverProvince"
:city="receiverInfo.receiverCity"
:area="receiverInfo.receiverRegion"
@selected="onSelectRegion"></v-distpicker>
</el-form-item>
<el-form-item label="详细地址:">
<el-input v-model="receiverInfo.receiverDetailAddress" type="textarea" rows="3">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="receiverDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="modifyReceiverInfo">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="修改费用信息"
:visible.sync="moneyDialogVisible"
width="40%">
<div class="table-layout">
<el-row>
<el-col :span="6" class="table-cell-title">商品合计</el-col>
<el-col :span="6" class="table-cell-title">运费</el-col>
<el-col :span="6" class="table-cell-title">优惠券</el-col>
<el-col :span="6" class="table-cell-title">积分抵扣</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">¥{{order.totalAmount}}</el-col>
<el-col :span="6" class="table-cell">
<el-input v-model.number="moneyInfo.freightAmount" size="mini"><template slot="prepend">¥</template></el-input>
</el-col>
<el-col :span="6" class="table-cell">-¥{{order.couponAmount}}</el-col>
<el-col :span="6" class="table-cell">-¥{{order.integrationAmount}}</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell-title">活动优惠</el-col>
<el-col :span="6" class="table-cell-title">折扣金额</el-col>
<el-col :span="6" class="table-cell-title">订单总金额</el-col>
<el-col :span="6" class="table-cell-title">应付款金额</el-col>
</el-row>
<el-row>
<el-col :span="6" class="table-cell">-¥{{order.promotionAmount}}</el-col>
<el-col :span="6" class="table-cell">
<el-input v-model.number="moneyInfo.discountAmount" size="mini"><template slot="prepend">-¥</template></el-input>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.totalAmount+moneyInfo.freightAmount}}</span>
</el-col>
<el-col :span="6" class="table-cell">
<span class="color-danger">¥{{order.payAmount+moneyInfo.freightAmount-moneyInfo.discountAmount}}</span>
</el-col>
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="moneyDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="modifyMoneyInfo">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {getOrderDetail,updateReceiverInfo,updateMoneyInfo} from '@/api/order';
import {formatDate} from '@/utils/date';
import VDistpicker from 'v-distpicker';
const defaultReceiverInfo = {
orderId:null,
receiverName:null,
receiverPhone:null,
receiverPostCode:null,
receiverDetailAddress:null,
receiverProvince:null,
receiverCity:null,
receiverRegion:null
};
const defaultMoneyInfo = {
orderId:null,
freightAmount:0,
discountAmount:0
};
export default {
name: 'orderDetail',
components: { VDistpicker },
data() {
return {
id: null,
order: {},
receiverDialogVisible:false,
receiverInfo:Object.assign({},defaultReceiverInfo),
moneyInfo:Object.assign({},defaultMoneyInfo),
moneyDialogVisible:false
}
},
created() {
this.id = this.list = this.$route.query.id;
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
},
filters: {
formatNull(value) {
if(value===undefined||value===null||value===''){
return '暂无';
}else{
return value;
}
},
formatPayType(value) {
if (value === 1) {
return '支付宝';
} else if (value === 2) {
return '微信';
} else {
return '未支付';
}
},
formatSourceType(value) {
if (value === 1) {
return 'APP订单';
} else {
return 'PC订单';
}
},
formatOrderType(value) {
if (value === 1) {
return '秒杀订单';
} else {
return '正常订单';
}
},
formatAddress(order) {
let str = order.receiverProvince;
if (order.receiverCity != null) {
str += " " + order.receiverCity;
}
str += " " + order.receiverRegion;
str += " " + order.receiverDetailAddress;
return str;
},
formatStatus(value) {
if (value === 1) {
return '待发货';
} else if (value === 2) {
return '已发货';
} else if (value === 3) {
return '已完成';
} else if (value === 4) {
return '已关闭';
} else if (value === 5) {
return '无效订单';
} else {
return '待付款';
}
},
formatPayStatus(value) {
if (value === 0) {
return '未支付';
} else if(value===4){
return '已退款';
}else{
return '已支付';
}
},
formatDeliverStatus(value) {
if (value === 0||value === 1) {
return '未发货';
} else {
return '已发货';
}
},
formatProductAttr(value){
if(value==null){
return '';
}else{
let attr = JSON.parse(value);
let result='';
for(let i=0;i<attr.length;i++){
result+=attr[i].key;
result+=":";
result+=attr[i].value;
result+=";";
}
return result;
}
}
},
methods: {
showUpdateMoneyDialog(){
this.moneyDialogVisible=true;
this.moneyInfo.orderId=this.order.id;
this.moneyInfo.freightAmount=this.order.freightAmount;
this.moneyInfo.discountAmount=this.order.discountAmount;
},
modifyMoneyInfo(){
this.$confirm('是否要修改费用信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateMoneyInfo(this.moneyInfo).then(response=>{
this.moneyDialogVisible=false;
this.$message({
type: 'success',
message: '修改成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
},
onSelectRegion(data){
this.receiverInfo.receiverProvince=data.province.value;
this.receiverInfo.receiverCity=data.city.value;
this.receiverInfo.receiverRegion=data.area.value;
},
showUpdateReceiverDialog(){
this.receiverDialogVisible=true;
this.receiverInfo={
orderId:this.order.id,
receiverName:this.order.receiverName,
receiverPhone:this.order.receiverPhone,
receiverPostCode:this.order.receiverPostCode,
receiverDetailAddress:this.order.receiverDetailAddress,
receiverProvince:this.order.receiverProvince,
receiverCity:this.order.receiverCity,
receiverRegion:this.order.receiverRegion
}
},
formatTime(time) {
if (time == null || time === '') {
return '';
}
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStepStatus(value) {
if (value === 1) {
//待发货
return 2;
} else if (value === 2) {
//已发货
return 3;
} else if (value === 3) {
//已完成
return 4;
}else {
//待付款、已关闭、无限订单
return 1;
}
},
modifyReceiverInfo(){
this.$confirm('是否要修改收货信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateReceiverInfo(this.receiverInfo).then(response=>{
this.receiverDialogVisible=false;
this.$message({
type: 'success',
message: '修改成功!'
});
getOrderDetail(this.id).then(response => {
this.order = response.data;
});
});
});
}
}
}
</script>
<style scoped>
.detail-container {
width: 80%;
padding: 20px 20px 20px 20px;
margin: 20px auto;
}
.operate-container {
background: #F2F6FC;
height: 80px;
margin: -20px -20px 0;
line-height: 80px;
}
.operate-button-container {
float: right;
margin-right: 20px
}
.table-layout {
margin-top: 20px;
border-left: 1px solid #DCDFE6;
border-top: 1px solid #DCDFE6;
}
.table-cell {
height: 60px;
line-height: 40px;
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
font-size: 14px;
color: #606266;
text-align: center;
overflow: hidden;
}
.table-cell-title {
border-right: 1px solid #DCDFE6;
border-bottom: 1px solid #DCDFE6;
padding: 10px;
background: #F2F6FC;
text-align: center;
font-size: 14px;
color: #303133;
}
</style>