Commit 0466b989 by 朱继来

添加钱包退款

parent f32a0d67
......@@ -34,6 +34,8 @@ function getCoupon($order_id)
// 获取会员账号
function getAccountName($user_id)
{
if (!$user_id) return false;
$userMainModel = new UserMainModel();
$user = $userMainModel->where('user_id', $user_id)->select('mobile', 'email')->first();
......@@ -42,6 +44,7 @@ function getAccountName($user_id)
return $user->mobile ? $user->mobile : $user->email;
}
// 获取支付名称
function getPayName($order_id)
{
$payLog = DB::connection('order')
......
......@@ -13,7 +13,7 @@ use App\Http\Page;
use App\Model\UserMainModel;
// 获取会员账号
function getUserName($user_id)
function getAccountName($user_id)
{
if (!$user_id) return false;
......@@ -40,6 +40,26 @@ function getOrderAmount($order_id)
return $order->order_amount;
}
// 获取支付名称
function getPayName($order_id)
{
$payLog = DB::connection('order')
->table('lie_pay_log')
->where(['order_id' => $order_id])
->select('pay_name')
->get();
if (!empty($payLog)) {
foreach ($payLog as $v) {
$payName[] = $v->pay_name;
}
return implode(',', $payName);
}
return false;
}
class RefundController extends Controller
{
// 页面用户、菜单信息
......@@ -91,9 +111,10 @@ class RefundController extends Controller
$map['order_sn'] = $request->input('order_sn', '');
$map['sku_name'] = $request->input('sku_name', '');
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['apply_status'] = $request->input('apply_status', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['apply_status'] = $request->input('apply_status', '');
$map['order_goods_type'] = 1; // 联营退货
//获取订单列表
......@@ -142,4 +163,23 @@ class RefundController extends Controller
return view('refundDetails', $info);
}
// 钱包退款
public function walletRefund(Request $request)
{
$data['order_id'] = $request->input('order_id');
$data['refund_amount'] = $request->input('amount');
$data['pay_code'] = 'alipay';
$url = Config('website.api_domain').'refund/recharge';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = curlApi($url, $data, "POST");
if (!$temp) return ['errcode'=>44300, 'errmsg'=>'未获取到退款地址'];
return ['errcode'=>0, 'errmsg'=>'获取成功', 'data'=>$temp];
}
}
......@@ -110,6 +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');
});
// 不需要登陆态
......
......@@ -62,12 +62,14 @@
function refundCommon(url) {
var order_sn = $('input[name="order_sn"]').val(),
sku_name = $('input[name="sku_name"]').val(),
apply_status = $('#apply_status').val() ? $('#apply_status').val() : '',
order_payment_mode = $('#order_payment_mode').val() ? $('#order_payment_mode').val() : '',
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
apply_status = $('#apply_status').val() ? $('#apply_status').val() : '';
time_end = $('input[name="time_end"]').val();
if (url == '/refund_export') {
if (!order_sn && !sku_name && !time_start && !time_end && !apply_status) {
if (!order_sn && !sku_name && !apply_status && !order_payment_mode && !time_start && !time_end) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
......@@ -81,6 +83,14 @@
listUrl += '&sku_name=' + specialStr(sku_name);
}
if (order_payment_mode) {
listUrl += '&order_payment_mode=' + order_payment_mode;
}
if (apply_status) {
listUrl += '&apply_status=' + apply_status;
}
if(time_start){
time_start = Date.parse(time_start) / 1000;
......@@ -93,11 +103,7 @@
listUrl += '&time_end='+time_end;
}
if (apply_status) {
listUrl += '&apply_status=' + apply_status;
}
if (!order_sn && !sku_name && !time_start && !time_end && !apply_status) {
if (!order_sn && !sku_name && !apply_status && !order_payment_mode && !time_start && !time_end) {
listUrl = '/refund_order';
}
......@@ -114,6 +120,35 @@
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)
}
})
})
}
}
});
......
......@@ -10,7 +10,7 @@
</tr>
<tr>
<th>用户账号</th>
<td>{{ App\Http\Controllers\getUserName($refund->create_uid) }}</td>
<td>{{ App\Http\Controllers\getAccountName($refund->create_uid) }}</td>
</tr>
<tr>
<th>申请时间</th>
......
......@@ -23,12 +23,15 @@
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
<dt>支付方式:</dt>
<dd>
<select id="order_payment_mode" name="order_payment_mode" class="form-control order_payment_mode selectpicker" title="全部" multiple>
@if (Config('params.order_paid_name'))
@foreach (Config('params.order_paid_name') as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
@endforeach
@endif
</select>
</dd>
</dl>
......@@ -42,6 +45,16 @@
</select>
</dd>
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
</dd>
</dl>
</td>
</tr>
</table>
......@@ -67,6 +80,7 @@
<th class="pl30">手动差额</th>
<th class="pl30">最终退款总额</th>
<th class="pl30">申请状态</th>
<th class="pl30">支付方式</th>
<th class="pl30">处理时间</th>
<th class="pl30">操作</th>
</tr>
......@@ -81,7 +95,7 @@
@foreach ($list as $v)
<tr>
<td class="show-list">{{$v['create_time'] ? date('Y-m-d H:i:s', $v['create_time']) : ''}}</td>
<td class="show-list">{{$v['mobile'] ? $v['mobile'] : $v['email']}}</td>
<td class="show-list"><?php print_r(App\Http\Controllers\getAccountName($v['user_id'])); ?></td>
<td class="show-list">{{$v['order_sn']}}</td>
<?php
$currencySign = $v['currency'] == 1 ? '¥' : '$';
......@@ -98,10 +112,18 @@
}
?>
</td>
<?php $pay_name = App\Http\Controllers\getPayName($v['order_id']); ?>
<td class="show-list"><?php print_r($pay_name); ?></td>
<td class="show-list">{{$v['refund_time'] ? date('Y-m-d H:i:s', $v['refund_time']) : ''}}</td>
<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>
@endif
</div>
</td>
</tr>
......@@ -118,8 +140,9 @@
<script>
var apply_status = "{{$condition['apply_status']}}";
var order_payment_mode = "{{$condition['order_payment_mode']}}";
$(".apply_status").selectpicker({
$(".apply_status, .order_payment_mode").selectpicker({
actionsBox:true, //在下拉选项添加选中所有和取消选中的按钮
countSelectedText:"已选中{0}项",
selectedTextFormat:"count > 5",
......@@ -128,6 +151,7 @@
})
$('.apply_status').selectpicker('val', apply_status.split(',')).trigger("change");
$('.order_payment_mode').selectpicker('val', order_payment_mode.split(',')).trigger("change");
$.lie.refund.index();
</script>
\ No newline at end of file
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