|
@@ -6,6 +6,9 @@ var $wOdetail = $('.w-odetail'), |
|
@@ -6,6 +6,9 @@ var $wOdetail = $('.w-odetail'), |
6
|
$wPayment = $('.w-payment'),
|
6
|
$wPayment = $('.w-payment'),
|
7
|
$wAddrinfo = $('.w-addrinfo'),
|
7
|
$wAddrinfo = $('.w-addrinfo'),
|
8
|
$wPerm = $('.w-p-erm'),
|
8
|
$wPerm = $('.w-p-erm'),
|
|
|
9
|
+ time = $('.js-time').data('time'),
|
|
|
10
|
+ timeInterval,
|
|
|
11
|
+ $timer = $('.js-timer'),
|
9
|
orderCode = $wPayment.data('order');
|
12
|
orderCode = $wPayment.data('order');
|
10
|
|
13
|
|
11
|
require('../simple-header');
|
14
|
require('../simple-header');
|
|
@@ -20,6 +23,10 @@ wxPage = { |
|
@@ -20,6 +23,10 @@ wxPage = { |
20
|
});
|
23
|
});
|
21
|
this.setEvent();
|
24
|
this.setEvent();
|
22
|
inter = setInterval(this.checkPayStatus, 3000);
|
25
|
inter = setInterval(this.checkPayStatus, 3000);
|
|
|
26
|
+ this.setTimer();
|
|
|
27
|
+ timeInterval = setInterval(() => {
|
|
|
28
|
+ this.setTimer();
|
|
|
29
|
+ }, 1000);
|
23
|
},
|
30
|
},
|
24
|
setEvent: function() {
|
31
|
setEvent: function() {
|
25
|
$wOdetail.on('click', function() {
|
32
|
$wOdetail.on('click', function() {
|
|
@@ -61,6 +68,25 @@ wxPage = { |
|
@@ -61,6 +68,25 @@ wxPage = { |
61
|
}
|
68
|
}
|
62
|
}
|
69
|
}
|
63
|
});
|
70
|
});
|
|
|
71
|
+ },
|
|
|
72
|
+ setTimer: function() {
|
|
|
73
|
+ if (time < 0) {
|
|
|
74
|
+ return clearInterval(timeInterval);
|
|
|
75
|
+ }
|
|
|
76
|
+
|
|
|
77
|
+ let hour = Math.floor(time / 3600);
|
|
|
78
|
+ let minus = Math.floor((time % 3600) / 60);
|
|
|
79
|
+ let second = time % 60;
|
|
|
80
|
+ let text = '';
|
|
|
81
|
+
|
|
|
82
|
+ if (hour > 0) {
|
|
|
83
|
+ text += hour + '小时';
|
|
|
84
|
+ }
|
|
|
85
|
+
|
|
|
86
|
+ text += minus + '分' + second + '秒';
|
|
|
87
|
+
|
|
|
88
|
+ $timer.text(text);
|
|
|
89
|
+ time--;
|
64
|
}
|
90
|
}
|
65
|
};
|
91
|
};
|
66
|
|
92
|
|