wechatqrcode.js 916 Bytes
/**
 * 微信支付页面
 */

var $ = require('yoho.jquery'),
    $wOdetail = $('.w-odetail'),
    $payHost = $('#payHost').val(),
    $paySuccessUrl = $('#paySuccessUrl').val(),
    $wPerm = $('.w-p-erm');

require('../../plugin/jquery.qrcode');

$wOdetail.click(function() {
    $('.w-addrinfo').slideToggle('slow');

    if ($wOdetail.find('i').hasClass('up')) {
        $wOdetail.html('收起详情<i class="down"></i>');
    } else {
        $wOdetail.html('订单详情<i class="up"></i>');
    }
});

$wPerm.qrcode({
    render: 'table',
    text: $wPerm.data('url')
});

function checkPayStatus() {
    $.ajax({
        url: $payHost,
        dataType: 'jsonp',
        success: function(data) {
            if (data.message === 'success') {
                window.location.href = $paySuccessUrl;
            }
        }
    });
}


setInterval(checkPayStatus, 3000);