Commit 9ddefb4c by 朱继来

调整钱包退款

parent 7da7cfa3
......@@ -164,11 +164,16 @@ class RefundController extends Controller
}
// 钱包退款
public function walletRefund(Request $request)
public function walletRefund(Request $request, $id)
{
$data['order_id'] = $request->input('order_id');
$data['refund_amount'] = $request->input('amount');
$data['pay_code'] = 'alipay';
// 获取退款单
$refund = DB::connection('order')->table('lie_order_refund')->where('refund_id', $id)->first();
if (!$refund) echo '未获取到退款单';
$data['order_id'] = $refund->order_id;
$data['refund_amount'] = number_format($refund->pay_amount - $refund->price_fall, 2);
$data['pay_code'] = 'unionpay';
$url = Config('website.api_domain').'refund/recharge';
......@@ -177,9 +182,9 @@ class RefundController extends Controller
$temp = curlApi($url, $data, "POST");
if (!$temp) return ['errcode'=>44300, 'errmsg'=>'未获取到退款地址'];
if (!$temp) echo '未获取到退款地址';
return ['errcode'=>0, 'errmsg'=>'获取成功', 'data'=>$temp];
echo $temp;
}
}
......@@ -110,7 +110,7 @@ Route::group(['middleware' => 'web'], function () {
Route::get('/refund_order', 'RefundController@refundList');
Route::get('/refund_export', 'RefundController@refundExport');
Route::get('/refund_details/{id}', 'RefundController@refundDetails');
Route::post('/ajax/wallet_refund', 'RefundController@walletRefund');
Route::match(['get', 'post'], '/wallet_refund/{id}', 'RefundController@walletRefund');
});
// 不需要登陆态
......
......@@ -120,35 +120,30 @@
refundCommon('/refund_export');
})
// 钱包退款
$('.wallet-refund').click(function(){
var order_id = $(this).data('oid');
var amount = $(this).data('amount');
$.ajax({
url : 'ajax/wallet_refund',
type: 'post',
data: {order_id: order_id, amount: amount},
dataType: 'json',
success: function (resp) {
if (resp.errcode == 0) {
layer.open({
type: 2,
area:['600px', '450px'],
title: '扫码退款',
content: resp.data,
});
return false;
}
layer.msg(resp.errmsg);
},
error: function (err) {
console.log(err)
}
})
})
// // 钱包退款
// $('.wallet-refund').click(function(){
// var order_id = $(this).data('oid');
// var amount = $(this).data('amount');
// $.ajax({
// url : 'ajax/wallet_refund',
// type: 'post',
// data: {order_id: order_id, amount: amount},
// dataType: 'json',
// success: function (resp) {
// if (resp.errcode == 0) {
// window.href =
// return false;
// }
// layer.msg(resp.errmsg);
// },
// error: function (err) {
// console.log(err)
// }
// })
// })
}
}
});
......
......@@ -118,11 +118,11 @@
<td>
<div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/refund_details/{{$v['refund_id']}}" target="_blank">查看申请</a>
<!-- <a class="btn btn-info wallet-refund" data-oid="{{$v['order_id']}}" data-amount="{{number_format($v['pay_amount'] - $v['price_fall'], 2)}}" target="_blank">钱包退款</a> -->
<!-- 退款申请已处理且为钱包支付 -->
@if ($v['status'] == 10 && strpos($pay_name, '钱包支付') !== false)
<a class="btn btn-info wallet-refund" data-oid="{{$v['order_id']}}" data-amount="{{number_format($v['pay_amount'] - $v['price_fall'], 2)}}" target="_blank">钱包退款</a>
<!-- <a class="btn btn-info wallet-refund" data-oid="{{$v['order_id']}}" data-amount="{{number_format($v['pay_amount'] - $v['price_fall'], 2)}}" target="_blank">钱包退款</a> -->
<a class="btn btn-info" href="/wallet_refund/{{$v['refund_id']}}" target="_blank">钱包退款</a>
@endif
</div>
</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment