|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: ch
|
|
|
|
|
* @Date: 2022-03-31 17:53:43
|
|
|
|
|
* @LastEditors: ch
|
|
|
|
|
* @LastEditTime: 2022-03-31 20:43:19
|
|
|
|
|
* @LastEditTime: 2022-04-14 15:01:49
|
|
|
|
|
* @Description: file content
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
@ -17,7 +17,7 @@ import {DictOrderStatus } from '@/common/dicts/order'
|
|
|
|
|
import Enum from "@/common/plugins/enum"
|
|
|
|
|
export default {
|
|
|
|
|
props : {
|
|
|
|
|
orderInfo : {
|
|
|
|
|
data : {
|
|
|
|
|
type : Object,
|
|
|
|
|
default : {}
|
|
|
|
|
}
|
|
|
|
@ -25,55 +25,68 @@ export default {
|
|
|
|
|
data(){
|
|
|
|
|
return {
|
|
|
|
|
ctxData : {
|
|
|
|
|
awaitPay : {name:'待付款', tips:'', icon: require('@/static/order/fk.png')},
|
|
|
|
|
close : {name:'交易关闭' , tips:'关闭原因', icon: require('@/static/order/qx.png')},
|
|
|
|
|
awaitSend : {name:'等待发货', tips:'您的包裹整装待发', icon: require('@/static/order/fh.png')},
|
|
|
|
|
finishSend : {name:'已发货', tips:'您的包裹正向您飞来', icon: require('@/static/order/fh.png')},
|
|
|
|
|
finishReceiving : {name:'已收货', icon: require('@/static/order/fh.png')},
|
|
|
|
|
end : {name:'交易成功', icon: require('@/static/order/cg.png')},
|
|
|
|
|
"1" : {
|
|
|
|
|
name:'请等待商家处理', tips:'', icon: require('@/static/order/cg.png')},
|
|
|
|
|
"2" : {name:'退款关闭' , tips:'', icon: require('@/static/order/qx.png')},
|
|
|
|
|
"3" : {name:'请寄回商品,并填写物流信息', tips:'', icon: require('@/static/order/cg.png')},
|
|
|
|
|
"4" : {name:'快递已发出,等待商家收货', tips:'您的包裹正在退回的路上', icon: require('@/static/order/cg.png')},
|
|
|
|
|
"5" : {name:'快递已收货,等待商家退款', tips:'',icon: require('@/static/order/cg.png')},
|
|
|
|
|
"6" : {name:'退款成功', tips: '退款将于7个工作日内原路返回,注意查收',icon: require('@/static/order/cg.png')},
|
|
|
|
|
"7" : {name:'退款关闭', tips: '', icon: require('@/static/order/qx.png')},
|
|
|
|
|
},
|
|
|
|
|
ctxCon : {},
|
|
|
|
|
secondNum : 0
|
|
|
|
|
ctxCon : {
|
|
|
|
|
name : '--',
|
|
|
|
|
icon: require('@/static/order/cg.png')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted(){
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
watch : {
|
|
|
|
|
orderInfo(nVal){
|
|
|
|
|
this.ctxCon = this.ctxData[this.statusKey];
|
|
|
|
|
if(this.statusKey === 'awaitPay'){
|
|
|
|
|
let expireTime = (new Date(this.orderInfo.expireTime)).getTime(),
|
|
|
|
|
curTime = (new Date(this.orderInfo.serverTime)).getTime(),
|
|
|
|
|
second = Math.floor((expireTime - curTime) / 1000);
|
|
|
|
|
this.secondNum = second > 0 ? second : 0;
|
|
|
|
|
this.timer()
|
|
|
|
|
}else if(this.statusKey === 'close'){
|
|
|
|
|
this.ctxCon.tips = this.orderInfo.closeReason;
|
|
|
|
|
watch:{
|
|
|
|
|
data(newData){
|
|
|
|
|
if(newData){
|
|
|
|
|
this.setCtxCon();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
// 从字典表获取状态key
|
|
|
|
|
statusKey (){
|
|
|
|
|
return DictOrderStatus[this.orderInfo.orderStatus].value
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
/**
|
|
|
|
|
* 待付款的计时器
|
|
|
|
|
* 根据当前状态显示不同文案
|
|
|
|
|
*/
|
|
|
|
|
timer(){
|
|
|
|
|
if(this.secondNum == 0){
|
|
|
|
|
this.$emit('close');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.secondNum--;
|
|
|
|
|
let minute = parseInt(this.secondNum / 60);
|
|
|
|
|
let second = parseInt(this.secondNum % 60);
|
|
|
|
|
this.ctxCon.tips = `剩余${minute > 0 ? `${minute}分` : ''} ${second}秒`;
|
|
|
|
|
// console.log(this.ctxCon.tips);
|
|
|
|
|
setTimeout(()=>this.timer(),1000)
|
|
|
|
|
setCtxCon(){
|
|
|
|
|
const {refundStatus, handleExpireTime, returnExpireTime, refundExpireTime, closeReason} = this.data;
|
|
|
|
|
this.ctxCon = this.ctxData[refundStatus];
|
|
|
|
|
switch(refundStatus){
|
|
|
|
|
case 1 :
|
|
|
|
|
this.ctxCon.tips = `您的申请已经提交,还剩${this.calcTimer(handleExpireTime)}`;
|
|
|
|
|
break;
|
|
|
|
|
case 3 :
|
|
|
|
|
this.ctxCon.tips = `还剩${this.calcTimer(returnExpireTime)}`;
|
|
|
|
|
break;
|
|
|
|
|
case 5 :
|
|
|
|
|
this.ctxCon.tips = `若商家未及时处理,退款将在${this.calcTimer(refundExpireTime)}后自动退回`;
|
|
|
|
|
break;
|
|
|
|
|
case 2 :
|
|
|
|
|
case 7 :
|
|
|
|
|
this.ctxCon.tips = closeReason;
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 计算距下个节点处理时间
|
|
|
|
|
*/
|
|
|
|
|
calcTimer (time){
|
|
|
|
|
const expireTime = (new Date(time)).getTime();
|
|
|
|
|
const curTime = (new Date(this.data.serverTime)).getTime();
|
|
|
|
|
// const curTime = (new Date('2022-4-16 15:22:00')).getTime();
|
|
|
|
|
const minute = parseInt((expireTime - curTime) / 60000);
|
|
|
|
|
const day = parseInt(Math.floor(minute / 1440));
|
|
|
|
|
const hour = parseInt(Math.floor((minute - day * 1440) / 60));
|
|
|
|
|
const m = parseInt(Math.floor(minute - ((day * 24 + hour) * 60)));
|
|
|
|
|
return `${day ? `${day}天${hour}时${m}分` : (hour ? `${hour}时${m}分` : ( m ? `${m}分` : '1分'))}`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -81,14 +94,16 @@ export default {
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
|
|
.status{
|
|
|
|
|
padding: 30rpx 60rpx 0;
|
|
|
|
|
padding: 48rpx 60rpx 0;
|
|
|
|
|
margin-bottom: 48rpx;
|
|
|
|
|
min-height: 130rpx;
|
|
|
|
|
position: relative;
|
|
|
|
|
&--icon{
|
|
|
|
|
width: 100rpx;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 60rpx;
|
|
|
|
|
top: 10rpx;
|
|
|
|
|
top: 51rpx;
|
|
|
|
|
}
|
|
|
|
|
&--name{
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
@ -97,7 +112,7 @@ export default {
|
|
|
|
|
&--desc{
|
|
|
|
|
font-size: $font-size-base;
|
|
|
|
|
color: $color-grey4;
|
|
|
|
|
margin-bottom: 48rpx;
|
|
|
|
|
// margin-bottom: 48rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|