1元,1文
'; $('#box2 .content').html(msg); deposit_tab("#tabs",".tab_con"); $('#box2 .btn').html(''); }else if(pay == 2){ $('#box2 .content').html(msg); $('#box2 .btn').html(''); }else{ $('#box2 .content').html(msg); $('#box2 .btn').html(''); } } else { if(_data.status == -2){ show_login_dialog(); }else{ alert(_data.msg); } } }); } function download_close(){ $('.box').css('display','none'); removeUnScroll(); } $('#box2 .close').click(function() { download_close(); window.top.location.reload(); }); /** * 充值 * @param title */ function deposit_pay(url) { window.open(url); download_close(); } /* * 直接充值 */ function deposit_pay_money2(){ var chosed = $(".thistab a").attr("tab"); $("#"+chosed+" form").append(''); $("#"+chosed+" form").append(''); $("#"+chosed+" form").submit(); } function deposit_pay_money(){ var chosed = $(".thistab a").attr("tab"); $("#"+chosed+" form").append(''); $("#"+chosed+" form").append(''); if(chosed == 'tab1'){ $("#"+chosed+" form").submit(); download_close(); $('#box3').css('display','flex'); unScroll(); $('.box .popup_title').html('支付宝支付'); $('.box .content').html('支付完成后,关闭该窗口
'); } else if(chosed == 'tab2'){ $.ajax({ type: "POST", cache:"false", datatype:"json", url:"http://www.wenkudao.com/index.php?m=pay&c=deposit&a=pay", data:$("#"+chosed+" form").serialize(), error: function(data) { alert("请求发生错误"); }, success: function(data) { var data = JSON.parse(data); download_close(); $('#box3').css('display','flex'); unScroll(); $('#box3 .content').append(data.qrcode); queryAjax(data.out_trade_no); } }); } } /* *前端Ajax持续调用服务端,称为Ajax轮询技术 * * */ function queryAjax(out_trade_no){ $.ajax({ url:"http://www.wenkudao.com/api.php?op=wxpay&action=queryAjax&out_trade_no="+out_trade_no, dataType:"json", success:function(data) { if(data){ $('#box3 .content').append('微信'+data.success+'
'); setTimeout("download_close()",3000); window.top.location.reload(); }else{ setTimeout(function () { queryAjax(out_trade_no); }, 2000); } }, error:function(data){ setTimeout(function () { queryAjax(out_trade_no); }, 2000); } }); } /* * 关闭弹窗,并刷新页面 */ $('#box3 .close').click(function() { download_close(); window.top.location.reload(); }); /** * 兑换 * @param title */ function change_credit(url) { window.open(url); download_close(); } /** * 下载 * @param title */ function download_doc(id,catid) { $.getJSON('http://www.wenkudao.com/api.php?op=download_doc&catid='+catid+'&id='+id+'&action=download_doc'+'&'+Math.random()+'&callback=?', function(_data){ if(_data.status==1){ download_file(_data.data.url); } else { alert(_data.msg); } $('#box2').css('display','none'); removeUnScroll(); }); } /** * 不弹窗下载 * @param title */ function download_file(url) { if (typeof (download_file.iframe) == "undefined") { var iframe = document.createElement("iframe"); download_file.iframe = iframe; document.body.appendChild(download_file.iframe); } download_file.iframe.src = url; download_file.iframe.style.display = "none"; }