62,072
社区成员
发帖
与我相关
我的任务
分享
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>微信支付</title>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="/Public/common/js/jquery-1.10.22.min.js?v=1" ></script>
<script src="../../../../Public/common/js/jquery-1.10.22.min.js" ></script>
<style>
.mask{
position: fixed;
top:0;
left:0;
width:100%;
height:100%;
z-index: 1000;
background: #333;
opacity:0.3;
-moz-opacity: 0.3;
-webkit-opacity: 0.3;
filter:alpha(opacity=30);
display: none;
}
.pop-window{
position: fixed;
top:30%;
width:100%;
z-index: 1000;
display: none;
}
.pop-content{
width:80vw;
height:40vw;
margin: auto;
background: #fff;
border-radius: 2vw;
-moz-border-radius: 2vw;
-webkit-border-radius: 2vw;
text-align: center;
}
.pop-content h2{
line-height:28vw;
font-size: 6vw;
margin: 0;
}
.pop-content span{
display: block;
width:100%;
height:11vw;
line-height: 11vw;
border-top:1px solid #D7D7D7;
font-size:6vw;
}
</style>
</head>
<body>
<div class="mask"></div>
<div class="pop-window">
<div class="pop-content">
<h2></h2>
<span>确定</span>
</div>
</div>
<script type="text/javascript">
var payConfig={"appId":"wxc60986fad91e634a","nonceStr":"oom92qyletzo4uuc0zl03ejz2jmp6557","package":"prepay_id=wx201611040849496292c8ba210896825898","signType":"MD5","timeStamp":"1478220589","paySign":"6E03B581442BD46CA8053BCB0C3B54CA"};
function onBridgeReady(){
WeixinJSBridge.invoke(
'getBrandWCPayRequest',payConfig,
function(res){
if(res.err_msg=="get_brand_wcpay_request:ok"){
window.location.href="http://www.wanhenginfo.com/youdianlifenotify.aspx";
}else if(res.err_msg=="get_brand_wcpay_request:cancel"){
// alert("您已取消支付");
$(".pop-content h2").html("您已取消支付");
$(".mask").show();
$(".pop-window").show();
$(".pop-content span").on("click",function(){
$(".mask").hide();
$(".pop-window").hide();
setTimeout(function(){history.go(-1)},500);
});
}else if(res.err_msg=="get_brand_wcpay_request:fail"){
/*alert(res.err_desc);
setTimeout(function(){history.go(-1)},500);*/
// $(".pop-content h2").html(res.err_desc);
// $(".mask").show();
// $(".pop-window").show();
// $(".pop-content span").on("click",function(){
// $(".mask").hide();
// $(".pop-window").hide();
// setTimeout(function(){history.go(-1)},500);
// });
setTimeout(function(){history.go(-1)},500);
}else if(res.err_msg=="get_brand_wcpay_request:fail_invalid appid"){
/*alert("商户appid无效");
setTimeout(function(){history.go(-1)},500);*/
$(".pop-content h2").html("商户appid无效");
$(".mask").show();
$(".pop-window").show();
$(".pop-content span").on("click",function(){
$(".mask").hide();
$(".pop-window").hide();
setTimeout(function(){history.go(-1)},500);
});
}else {
/*alert("支付遇到失败,请重试");
setTimeout(function(){history.go(-1)},500);*/
$(".pop-content h2").html("支付遇到失败,请重试");
$(".mask").show();
$(".pop-window").show();
$(".pop-content span").on("click",function(){
$(".mask").hide();
$(".pop-window").hide();
setTimeout(function(){history.go(-1)},500);
});
}
}
);
}
if(payConfig.package=='prepay_id='){
alert('订单付款异常,可能已支付或者已经取消支付');
setTimeout(function(){history.go(-1)},500);
}else{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
}else{
onBridgeReady();
}
}
</script>
</body>
</html>