wxpay.page.js 600 Bytes
/**
 *
 * @author: jiangfeng<jeff.jiang@yoho.cn>
 * @date: 16/9/8
 */

require('yoho-jquery-qrcode');

$(function() {

    $('.qr-code').each(function() {
        $(this).qrcode({
            render: 'table',
            text: $(this).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, 1000);
});