$(function () { // var biaoti1 =''; // var biaoti2=''; $.ajax({ url:url+"/certification/certification/listForPage", dataType: "json", type: "POST", success: function (response, status, xhr) { var textable =''; var textable2=''; for (var i = 0; i < response.length; i++) { if (response[i].type == "说明") { textable += "<p class='db-st'><span class='green-text'>â–¼</span>"+response[i].head+"</p><p class='db-content'>"; var neirong = response[i].content.split("{{br}}"); for (var a=0; a<neirong.length;a++) { textable += neirong[a]+'<br />'; } textable += "</p>"; } else if (response[i].type == "ä¿éšœ") { textable2 +="<p class='db-st'><span class='orange-text'>â–¼</span>"+response[i].head+"</p><p class='db-content'>"; var neirong2 = response[i].content.split("{{br}}"); for (var a=0; a<neirong2.length;a++) { textable2 += neirong2[a]+'<br />'; } textable2 += "</p>"; } } $("#text").html(textable); $("#text2").html(textable2); } }); }); function loadPrice() { var price = 0; $.ajax({ url:url+"/jgsz/jgsz/listForPage", data: {}, type: "post", dateType: "json", async: false, success:function (response, status, xhr){ console.log(response); $.each(response,function (i, item) { if(item.ming=='æ‹…ä¿è®¤è¯'){ price = item.jiage; } }); }, error:function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log(JSON.stringify(e)); console.log(e.status); console.log(e.responseText); } }); return price; } $(function () { $("#zfb>a").click(function () { if(UserID){ var price = loadPrice(); if(price){ toPay(price,'ALI','支付担ä¿è®¤è¯') }else{ layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); } }else{ layer.confirm('尚未登录,请先登录', { btn: ['登录','注册'] //按钮 }, function(){ window.location.href='../reg201206/login06.html'; }, function(){ window.location.href='../reg201206/register06.html'; }); } }); $("#wxPay>a").click(function () { if(UserID){ var price = loadPrice(); if(price){ toPay(price,'WX','支付担ä¿è®¤è¯') }else{ layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); } }else{ layer.confirm('尚未登录,请先登录', { btn: ['登录','注册'] //按钮 }, function(){ window.location.href='../reg201206/login06.html'; }, function(){ window.location.href='../reg201206/register06.html'; }); } }) }); function toPay(total_amount, fun,content){ if(userInfo == "" || userInfo == null || userInfo == "null" || userInfo == undefined || userInfo == 'undefined'){ layer.msg("è¯·é‡æ–°ç™»å½•"); return; } var ddh =""; if(fun == 'WX'){ $.ajax({ url:url+"/vip/pay/wxPay", data: { "total_amount": total_amount, "fun": fun, "userMobile": userInfo.id, "update_user":content }, type: "post", dateType: "json", async: false, success: function success(response, status, xhr) { if(response != ""){ var arr = response.split("?author1=ASY&author2=LZN"); ddh = arr[1]; $("#qrcode").empty(); $("#WXPayCaptions").attr("src","../images/WXPayCaptions.png"); var qrcode = new QRCode(document.getElementById("qrcode"), { width : 200, height : 200 }); qrcode.makeCode(arr[0]); //æ•获页 layer.open({ type: 1, shade: false, title: "微信支付", //䏿˜¾ç¤ºæ ‡é¢˜ content: $('#QrCodeParent'), //æ•èŽ·çš„å…ƒç´ ï¼Œæ³¨æ„ï¼šæœ€å¥½è¯¥æŒ‡å®šçš„å…ƒç´ è¦å˜æ”¾åœ¨body最外层,å¦åˆ™å¯èƒ½è¢«å…¶å®ƒçš„ç›¸å¯¹å…ƒç´ æ‰€å½±å“ }); } else { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); } }, error: function error(e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log(JSON.stringify(e)); console.log(e.status); console.log(e.responseText); } }); } else { let num = total_amount; $.ajax({ url:url+"/vip/pay/aliPay", data: { "num": num, "fun": content, "userMobile": userInfo.id }, type: "post", dateType: "json", async: false, success: function success(response, status, xhr) { if(response != "error"){ var arr = response.split("?author1=ASY&author2=LZN"); ddh = arr[1]; $("#qrcode").empty(); $("#WXPayCaptions").attr("src","../images/ALIPayCaptions.jpeg"); let qr_code = $.parseJSON( arr[0] ); //jQuery.parseJSON(jsonstr),å¯ä»¥å°†jsonå—ç¬¦ä¸²è½¬æ¢æˆjson对象 console.log(qr_code); var qrcode = new QRCode(document.getElementById("qrcode"), { width : 200, height : 200 }); qrcode.makeCode(qr_code.alipay_trade_precreate_response.qr_code); //æ•获页 layer.open({ type: 1, shade: false, title: "æ”¯ä»˜å®æ”¯ä»˜", //䏿˜¾ç¤ºæ ‡é¢˜ content: $('#QrCodeParent'), //æ•èŽ·çš„å…ƒç´ ï¼Œæ³¨æ„ï¼šæœ€å¥½è¯¥æŒ‡å®šçš„å…ƒç´ è¦å˜æ”¾åœ¨body最外层,å¦åˆ™å¯èƒ½è¢«å…¶å®ƒçš„ç›¸å¯¹å…ƒç´ æ‰€å½±å“ }); } else { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); } // if(response != ""){ // myWindow=window.open('',response,''); // myWindow.document.write(response); // myWindow.focus(); // // $("#topay").html(); // console.log(response); // } else { // layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); // console.log(status) // console.log(xhr) // } }, error: function error(e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log(JSON.stringify(e)); console.log(e.status); console.log(e.responseText); } }); } checkPay(ddh,fun,total_amount); } function checkPay(ddh,way,amount) { var pay_status = 1; console.log("out_trade_no:"+ddh+ ",create_user:"+userInfo.id+ ",pay_way:"+way+ ",total_amount:"+amount); $.ajax({ url:url+"/vip/pay/checkPay", data: { "out_trade_no":ddh, "create_user":userInfo.id, "pay_way":way, "total_amount":amount }, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { if(response!=null){ pay_status = response; } }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("查询支付状æ€å¤±è´¥"); console.log(e.status); console.log(e.responseText); } }); if(pay_status.length==1&&parseInt(pay_status)==0){ layer.closeAll(); var loading = layer.msg('支付æˆåŠŸ,æ£åœ¨ä¿®æ”¹ä¼šå‘˜ä¿¡æ¯,请勿刷新页é¢', { icon: 16, shade: 0.8, time: false, scrollbar: false }); $.ajax({ url:url+"/user2019/qyml/changeDanBao", data:{"id":UserID}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { if(response==1){ setTimeout(function () { layer.close(loading); layer.msg("修改æˆåŠŸï¼Œå³å°†è·³è½¬ï¼", { icon: 1 }); setTimeout(function () { window.location.href='../manage/'; },2000); },2000); }else{ setTimeout(function () { layer.close(loading); layer.msg("修改失败,请è”系客æœï¼", { icon: 5 }); console.log("changeDanBao!=1"); },2000); } }, error: function (e) { setTimeout(function () { layer.close(loading); layer.msg("修改失败,请è”系客æœï¼", { icon: 5 }); console.log("修改会员信æ¯å¤±è´¥"); console.log(e.status); console.log(e.responseText); },2000); } }); }else{ setTimeout(function () { checkPay(ddh,way,amount) },2000); } }