作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

地方

... ... @@ -54,7 +54,13 @@ class PayController extends HomeBaseController
if ($result->return_code == 'SUCCESS' && $result->result_code == 'SUCCESS'){
$prepayId = $result->prepay_id;
$jsApiParameters=$payment->configForJSSDKPayment($prepayId);
$this->assign('jsApiParameters',json_encode($jsApiParameters));
$this->assign(
array(
'jsApiParameters'=>json_encode($jsApiParameters),
'total'=>$data['total'],
'title'=>'橙象保单'
)
);
return $this->fetch();
}else{
$this->error('支付参数错误','',$result);
... ...
... ... @@ -19,6 +19,7 @@
//支付取消逻辑
}else if (res.err_msg=='get_brand_wcpay_request:ok'){
//支付成功逻辑
window.location.href="{:url('index/index/index')}";
}else{
//支付失败逻辑
}
... ... @@ -43,8 +44,8 @@
<body>
<div class="wenx_xx">
<div class="mz">DEF0000000001</div>
<div class="wxzf_price">¥0.01</div>
<div class="mz">{$title}</div>
<div class="wxzf_price">¥{$total}</div>
</div>
<div class="skf_xinf">
<div class="all_w"> <span class="bt">收款方</span> <span class="fr">{$site_info.site_name}</span> </div>
... ...
<!DOCTYPE html>
<html>
<head>
<title>微信支付</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/lanren.css">
<script type="text/javascript">
//调用微信JS api 支付
function jsApiCall()
{
WeixinJSBridge.invoke(
"getBrandWCPayRequest",
{$jsApiParameters},
function(res){
WeixinJSBridge.log(res.err_msg);
alert(res.err_code+res.err_desc+res.err_msg);
if (res.err_msg=='get_brand_wcpay_request:cancel'){
//支付取消逻辑
}else if (res.err_msg=='get_brand_wcpay_request:ok'){
//支付成功逻辑
}else{
//支付失败逻辑
}
}
);
}
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>
</head>
<body>
<div class="wenx_xx">
<div class="mz">DEF0000000001</div>
<div class="wxzf_price">¥0.01</div>
</div>
<div class="skf_xinf">
<div class="all_w"> <span class="bt">收款方</span> <span class="fr">{$site_info.site_name}</span> </div>
</div>
<a onclick="callpay()" class="ljzf_but all_w">立即支付</a>
<script type="text/javascript">
callpay();
</script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<title>微信支付成功</title>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/lanren.css">
</head>
<body >
<div class="zfcg_box ">
<div class="all_w">
<img src="__TMPL__/public/assets/images/cg_03.jpg" > 支付成功 </div>
</div>
<div class="cgzf_info">
<div class="wenx_xx">
<div class="mz">{$site_info.site_name|default='请定义商品名称'}</div>
<div class="wxzf_price">¥{$info.real_price|default='请定义商品金额'}</div>
</div>
<div class="spxx_shop">
<div class=" mlr_pm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>交易时间</td>
<td align="right">{$info.pay_time|date='Y-m-d H:i:s',###}</td>
</tr>
<tr>
<td>商户单号</td>
<td align="right">{$info.order_sn|default='请定义商户单号'}</td>
</tr>
<tr>
<td>交易单号</td>
<td align="right">{$info.transaction_id|default='请定义交易单号'}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="wzxfcgde_tb"><img src="__TMPL__/public/assets/images/cg_07.jpg" ></div>
</body>
</html>
\ No newline at end of file
... ...