wxpay.page.js
1.08 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
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/9/8
*/
var $orderDetail = $('.order-detail'),
$qrCode = $('.qr-code'),
$orderDetailCtrl = $('#order-detail-ctrl');
require('yoho-jquery-qrcode');
$(function() {
// 展开详情/收起详情
$orderDetailCtrl.click(function() {
var $this = $(this);
if ($orderDetail.is(':hidden')) {
// 展开状态
$this.html('收起详情<i class="iconfont up"></i>');
} else {
// 收起状态
$this.html('订单详情<i class="iconfont down"></i>');
}
$orderDetail.slideToggle('slow');
});
$qrCode.qrcode({
render: 'div',
size: 270,
text: $qrCode.data('qr')
});
function queryOrderState() {
var code = $('.qr-code').data('code');
$.get('/shopping/pay/online/weixin/state', {code: code}, function(data) {
if (data && data.code === 200) {
location.href = data.data.href;
}
});
}
setInterval(queryOrderState, 2500);
});