jsapi支付

套餐充值
<div class="xbt-page">
	<div class="xbt-page bc-f2 has-header" style="background: #FFFFFF;">

		<div class="weui-cells"
			style="margin-top: 0px; font-weight: 500; position: static;">
			<div class="weui-cell title_name"
				style="background: #edf1f3; border-top: 1px solid #dddfe3;">
			</div>

			<div id="jiaoyilist" class="weui-panel weui-panel_access"
				style="margin-top: 0px; position: static;">
				<!-- js页面显示-->
			</div>

			<div align="center" style="margin-top: 10px;">
				<a href="javascript:doPostMoney();" class="recharge"><span id="spanPos">微信支付</span></a>
			</div>
		</div>

	</div>
</div>

<div>
	<span id="spanCode">123</span>
</div>

<script type="text/javascript" src="http://web.qingmoukeji.com/js/teacher/js/common.min.js"></script>
<script type="text/javascript">
//获取地址栏参数
function GetQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) {
		return unescape(r[2]);
	}
	return null;
}

function doPostMoney(){
	$.ajax({
			type: 'get',
			url: 'http://www.dui1688.com/payByWx?upPayOrderKey=safdsfds&upId=4&openId=oXsfnwZS0uqJZqRdU-KgF0wa61jg',
			data: {
			},
			async: false,
			success: function(data) {
				alert(data.appId);
				alert(data.timeStamp);
				alert(data.nonceStr);
				alert(data.package);
				alert(data.signType);
				alert(data.paySign);
				
				function jsApiCall(){
					WeixinJSBridge.invoke(
						'getBrandWCPayRequest',{
							"appId" : data.appId,
							"timeStamp":data.timeStamp,
							"nonceStr" : data.nonceStr,
							"package" : data.package,
							"signType" : data.signType,
							"paySign" : data.paySign
						},
						function(res){
							if(res.err_msg == "get_brand_wcpay_request:ok" ) {
								alert('支付成功');
							}
						}
					);
				}
				function callpay(){
					if (typeof WeixinJSBridge == "undefined"){
						if(document.addEventListener){
							document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
						}else if (document.attachEvent){
							document.attachEvent('WeixinJSBridgeReady', jsApiCall);
							document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
						}
					}else{
						jsApiCall();
					}
				}
				callpay()

			},
			error: function(jqXHR, textStatus, errorThrown) {

			}
		});
}
	</script>
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读