初始化代码
This commit is contained in:
72
application/api/view/payapp/jsapi.html
Normal file
72
application/api/view/payapp/jsapi.html
Normal file
@@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>支付</title>
|
||||
<script type="text/javascript">
|
||||
//调用微信JS api 支付
|
||||
function jsApiCall()
|
||||
{
|
||||
WeixinJSBridge.invoke(
|
||||
'getBrandWCPayRequest',
|
||||
<?php echo $PayConf['jsApiParameters']; ?>,
|
||||
function(res){
|
||||
WeixinJSBridge.log(res.err_msg);
|
||||
//alert(res.err_code+res.err_desc+res.err_msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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>
|
||||
<script type="text/javascript">
|
||||
//获取共享地址
|
||||
function editAddress()
|
||||
{
|
||||
WeixinJSBridge.invoke(
|
||||
'editAddress',
|
||||
<?php echo $PayConf['editAddress']; ?>,
|
||||
function(res){
|
||||
var value1 = res.proviceFirstStageName;
|
||||
var value2 = res.addressCitySecondStageName;
|
||||
var value3 = res.addressCountiesThirdStageName;
|
||||
var value4 = res.addressDetailInfo;
|
||||
var tel = res.telNumber;
|
||||
|
||||
//alert(value1 + value2 + value3 + value4 + ":" + tel);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
window.onload = function(){
|
||||
if (typeof WeixinJSBridge == "undefined"){
|
||||
if( document.addEventListener ){
|
||||
document.addEventListener('WeixinJSBridgeReady', editAddress, false);
|
||||
}else if (document.attachEvent){
|
||||
document.attachEvent('WeixinJSBridgeReady', editAddress);
|
||||
document.attachEvent('onWeixinJSBridgeReady', editAddress);
|
||||
}
|
||||
}else{
|
||||
editAddress();
|
||||
}
|
||||
callpay();
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user