97 lines
2.9 KiB
PHP
97 lines
2.9 KiB
PHP
@extends('Agent::layouts.app')
|
|
|
|
|
|
@section('content')
|
|
<section>
|
|
<!-- 支付-->
|
|
<ul class="modular-list order-confirm-list ce-margin-t-sm">
|
|
<li>
|
|
订单编号
|
|
<span class="pull-right">{{ $order->order_id }}</span>
|
|
</li>
|
|
<li>
|
|
支付金额
|
|
<span class="pull-right confirm-price-color">¥{{ $order->price}}</span>
|
|
</li>
|
|
</ul>
|
|
|
|
<form>
|
|
<ul class="modular-list order-confirm-list ce-margin-t-sm">
|
|
<li>
|
|
<i class="order-pay-icon weixin-icon"></i>
|
|
微信支付
|
|
<div class="order-list-radio pull-right">
|
|
<input type="radio" name="payment" value="WECHAT" id="weixin" checked="">
|
|
<label for="weixin">
|
|
<i class="icon icon-check-circle"></i>
|
|
</label>
|
|
</div>
|
|
</li>
|
|
{{-- <li>
|
|
<i class="order-pay-icon balance-icon"></i>
|
|
账户余额
|
|
<div class="order-list-radio pull-right">
|
|
<input type="radio" name="payment" value="BALANCE" id="balance">
|
|
<label for="balance">
|
|
<i class="icon icon-check-circle"></i>
|
|
</label>
|
|
</div>
|
|
</li> --}}
|
|
</ul>
|
|
<div class="order-pay-btn">
|
|
<button type="button" id="paybtn" >立即支付</button>
|
|
</div>
|
|
</form>
|
|
|
|
</section>
|
|
@endsection
|
|
|
|
@section('script')
|
|
<script>
|
|
var json='';
|
|
$("#paybtn").click(function(){
|
|
var me=$("input[name='payment']:checked");
|
|
|
|
if(me.attr('value')=='WECHAT'){
|
|
$.get("{{ route('Agent.pay.wechat', $order->order_id) }}", function(data) {
|
|
if (data.statusCode == 200) {
|
|
json = JSON.parse(data.message);
|
|
pay();
|
|
}else{
|
|
updateAlert(data.message,'error');
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
|
|
function pay() {
|
|
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();
|
|
}
|
|
}
|
|
|
|
function onBridgeReady() {
|
|
WeixinJSBridge.invoke('getBrandWCPayRequest', json, function(res) {
|
|
if (res.err_msg == "get_brand_wcpay_request:ok" ) {
|
|
setTimeout(function() {
|
|
location.href = "{{ route('Agent.orders.index') }}";
|
|
}, 1000);
|
|
} else {
|
|
console.log(res);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
@endsection
|