<include file="Public:header" />
<div class="am-panel am-panel-default" style="border-color: #ddd;margin:50px 10px 10px 10px;">
  <div class="am-panel-hd"  style="color:#0e90d2;background-color: #f5f5f5;border-color: #ddd;border-bottom: 2px solid #0e90d2;">微信支付<span style="color:red; padding:0 5px;">￥{$pay_cash}</span>元</div>
  <div class="am-panel-bd">
		<button type="button" class="am-btn am-btn-success am-btn-block" style="height:50px;" onClick="callpay()">去支付</button>
  </div>
</div>
<script type="text/javascript">

	//调用微信JS api 支付
	function jsApiCall()
	{
		WeixinJSBridge.invoke(
			'getBrandWCPayRequest',
			<?php echo $jsApiParameters; ?>,
			function(res){
				//alert(res.err_msg);
				if(res.err_msg =='get_brand_wcpay_request:ok'){  
				    window.location.href='index.php?m=User&a=order'; 
				}
			}
		);
	}

	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();
		}
	}
</script>
<include file="Public:footer" />