代码语言:javascript复制
<script src="jquery-3.4.1.min.js"></script>
<script src="qrcode.min.js"></script>
<script>
$.ajax({
type: 'get',
url: url,
dataType: "json",
success: function (res) {
layer.close(loading);
var no = res.no;
new QRCode(document.getElementById("wx_ewm"),{//对象
text: decodeURIComponent(res.url),//解码微信支付二维码
width: 120,//二维码大小
height: 120,//二维码高
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H//级别
} );
var url = "";//回调url
var data = {'no': no};//订单号
clearInterval(timer);
timer = setInterval(function(){
$.post(url,data,function(res){
if(res == 'yes'){
parent.location.href = "";//支付成功跳转地址
}
})
},3000)
},
error: function (res) {
console.log(res)
}
});
</script>