Browse Source

充值明细

master
ZLW-PC\Administrator 7 years ago
parent
commit
901da36493
  1. 1
      app/Http/Controllers/Api/UserMoneyController.php
  2. 50
      app/Http/Controllers/Weixin/UserController.php
  3. 6
      app/Http/Model/UserRecharge.php
  4. 3
      resources/views/weixin/user/userRecharge.blade.php
  5. 96
      resources/views/weixin/user/userRechargeOrder.blade.php
  6. 2
      resources/views/weixin/user/userRechargeOrderDetail.blade.php
  7. 4
      routes/web.php

1
app/Http/Controllers/Api/UserMoneyController.php

@ -14,6 +14,7 @@ class UserMoneyController extends CommonController
parent::__construct(); parent::__construct();
} }
//余额明细列表
public function userMoneyList(Request $request) public function userMoneyList(Request $request)
{ {
//参数 //参数

50
app/Http/Controllers/Weixin/UserController.php

@ -62,9 +62,53 @@ class UserController extends CommonController
return view('weixin.user.userRecharge'); return view('weixin.user.userRecharge');
} }
//充值明细
public function userRechargeOrder(Request $request)
{
$pagesize = 10;
$offset = 0;
if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
$postdata = array(
'limit' => $pagesize,
'offset' => $offset,
'status' => 1,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/user_recharge_list";
$res = curl_request($url,$postdata,'GET');
$data['list'] = $res['data']['list'];
$data['totalpage'] = ceil($res['data']['count']/$pagesize);
if(isset($_REQUEST['page_ajax']) && $_REQUEST['page_ajax']==1)
{
$html = '';
if($res['data']['list'])
{
foreach($res['data']['list'] as $k => $v)
{
$html .= '<li>';
$html .= '<span class="green">+ '.$v['money'].'</span>';
$html .= '<div class="info"><p class="tit">充值</p>';
$html .= '<p class="time">'.$v['created_at'].'</p></div>';
$html .= '</li>';
}
}
exit(json_encode($html));
}
return view('weixin.user.userRechargeOrder', $data);
}
//用户充值第二步,支付 //用户充值第二步,支付
public function userRechargeOrderDetail($id)
public function userRechargeOrderDetail(Request $request)
{ {
$id = $request->input('id','');
if($id == ''){$this->error_jump(ReturnData::PARAMS_ERROR);}
//获取充值记录详情 //获取充值记录详情
$postdata = array( $postdata = array(
'id' => $id, 'id' => $id,
@ -102,7 +146,7 @@ class UserController extends CommonController
$unifiedOrder->setParameter("body","$body");//商品描述 $unifiedOrder->setParameter("body","$body");//商品描述
$unifiedOrder->setParameter("out_trade_no","$out_trade_no");//商户订单号 $unifiedOrder->setParameter("out_trade_no","$out_trade_no");//商户订单号
$unifiedOrder->setParameter("total_fee","$total_fee");//总金额 $unifiedOrder->setParameter("total_fee","$total_fee");//总金额
//$unifiedOrder->setParameter("attach","$attach"); //附加数据,选填,在查询API和支付通知中原样返回,可作为自定义参数使用,示例:a=1&b=2
$unifiedOrder->setParameter("attach","$attach"); //附加数据,选填,在查询API和支付通知中原样返回,可作为自定义参数使用,示例:a=1&b=2
$unifiedOrder->setParameter("notify_url","$notify_url");//通知地址 $unifiedOrder->setParameter("notify_url","$notify_url");//通知地址
$unifiedOrder->setParameter("trade_type","JSAPI");//交易类型 $unifiedOrder->setParameter("trade_type","JSAPI");//交易类型
$prepay_id = $unifiedOrder->getPrepayId(); $prepay_id = $unifiedOrder->getPrepayId();
@ -111,7 +155,7 @@ class UserController extends CommonController
$jsApiParameters = $jsApi->getParameters(); $jsApiParameters = $jsApi->getParameters();
$data['jsApiParameters'] = $jsApiParameters; $data['jsApiParameters'] = $jsApiParameters;
$data['returnUrl'] = route('weixin_user'); //支付完成要跳转的url
$data['returnUrl'] = route('weixin_user_recharge_order'); //支付完成要跳转的url
return view('weixin.user.userRechargeOrderDetail', $data); return view('weixin.user.userRechargeOrderDetail', $data);
} }

6
app/Http/Model/UserRecharge.php

@ -28,7 +28,7 @@ class UserRecharge extends BaseModel
$limit = isset($limit) ? $limit : 10; $limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0; $offset = isset($offset) ? $offset : 0;
$model = new UserRecharge;
$model = new self();
if(isset($status) && $status!=-1){$where['status'] = $status;} //-1表示获取所有 if(isset($status) && $status!=-1){$where['status'] = $status;} //-1表示获取所有
@ -41,10 +41,6 @@ class UserRecharge extends BaseModel
{ {
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get(); $res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get();
} }
else
{
return false;
}
return $res; return $res;
} }

3
resources/views/weixin/user/userRecharge.blade.php

@ -7,6 +7,7 @@
<div class="classreturn loginsignup"> <div class="classreturn loginsignup">
<div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div> <div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
<div class="ds-in-bl tit center"><span>充值</span></div> <div class="ds-in-bl tit center"><span>充值</span></div>
<div class="ds-in-bl nav_menu"><a href="<?php echo route('weixin_user_recharge_order'); ?>">充值明细</a></div>
</div> </div>
<style> <style>
@ -77,7 +78,7 @@ function chongzhi()
if(res.code==0) if(res.code==0)
{ {
location.href = '<?php echo substr(route('weixin_user_recharge_order_detail',array('id'=>1)), 0, -1); ?>' + res.data;
location.href = '<?php echo route('weixin_user_recharge_order_detail'); ?>?id=' + res.data;
} }
else else
{ {

96
resources/views/weixin/user/userRechargeOrder.blade.php

@ -0,0 +1,96 @@
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>充值明细</title><meta name="keywords" content="关键词"><meta name="description" content="描述"><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
<link href="<?php echo env('APP_URL'); ?>/css/weixin/style.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/weixin/mobile.js"></script></head><body>
<div class="classreturn loginsignup">
<div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
<div class="ds-in-bl tit center"><span>充值明细</span></div>
</div>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<style>
.money_list li{padding:15px;border-bottom:1px solid #ddd;}
.money_list .tit{color:#000;font-size:18px;margin-bottom:5px;}
.money_list .time{color:#8e8e8e;font-size:12px;}
.money_list span{font-size:18px;float:right;vertical-align:middle;margin-top:12px;}
.money_list span.green{color:#04ba06;}
</style>
<div class="floor">
<?php if($list){ ?>
<ul class="money_list cl">
<?php foreach($list as $k=>$v){ ?>
<li>
<span class="green">+ <?php echo $v['money']; ?></span>
<div class="info"><p class="tit">充值</p>
<p class="time"><?php echo $v['created_at']; ?></p></div>
</li>
<?php } ?>
</ul>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</div>
<script>
$(function(){
var ajaxload = false;
var maxpage = false;
var startpage = 1;
var totalpage = <?php echo $totalpage; ?>;
var tmp_url = window.location.href;
msg = tmp_url.split("#");
tmp_url = msg[0];
$(window).scroll(function ()
{
var listheight = $(".money_list").outerHeight();
if ($(document).scrollTop() + $(window).height() >= listheight)
{
if(startpage >= totalpage)
{
//$("#submit_bt_one").html("已是最后一页,没有更多数据!");
return false;
}
if(!ajaxload && !maxpage)
{
ajaxload = true;
//$("#submit_bt_one").html("努力加载中...");
var url = tmp_url;
var nextpage = startpage+1;
$.get(url,{page_ajax:1,page:nextpage},function(res)
{
if(res)
{
$(".money_list").append(res);
startpage++;
if(startpage >= totalpage)
{
maxpage = true;
//$("#submit_bt_one").html("已是最后一页,没有更多数据!");
}
else
{
//$("#submit_bt_one").html("点击加载更多");
}
ajaxload = false;
}
else
{
//$("#submit_bt_one").html("请求失败,请稍候再试!");
ajaxload = false;
}
},'json');
}
}
});
});
</script>
@include('weixin.common.footer')
</body></html>

2
resources/views/weixin/user/userRechargeOrderDetail.blade.php

@ -23,7 +23,7 @@ function jsApiCall()
alert('支付失败!'); alert('支付失败!');
} }
//setTimeout("location.href = '<?php echo $returnUrl; ?>'",2000);
setTimeout("location.href = '<?php echo $returnUrl; ?>'",2000);
} }
); );
} }

4
routes/web.php

@ -87,7 +87,6 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin', 'middleware' => ['w
//用户充值 //用户充值
Route::get('/user_recharge', 'UserController@userRecharge')->name('weixin_user_recharge'); Route::get('/user_recharge', 'UserController@userRecharge')->name('weixin_user_recharge');
Route::get('/user_recharge_order', 'UserController@userRechargeOrder')->name('weixin_user_recharge_order'); Route::get('/user_recharge_order', 'UserController@userRechargeOrder')->name('weixin_user_recharge_order');
Route::get('/user_recharge_order_detail/{id}', 'UserController@userRechargeOrderDetail')->name('weixin_user_recharge_order_detail');
//优惠券、红包 //优惠券、红包
Route::get('/user_bonus_list', 'UserController@userBonusList')->name('weixin_user_bonus_list'); Route::get('/user_bonus_list', 'UserController@userBonusList')->name('weixin_user_bonus_list');
//浏览记录 //浏览记录
@ -105,12 +104,12 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin', 'middleware' => ['w
Route::get('/user_address', 'AddressController@index')->name('weixin_user_address_list'); Route::get('/user_address', 'AddressController@index')->name('weixin_user_address_list');
Route::get('/user_address_add', 'AddressController@userAddressAdd')->name('weixin_user_address_add'); Route::get('/user_address_add', 'AddressController@userAddressAdd')->name('weixin_user_address_add');
Route::get('/user_address_update', 'AddressController@userAddressUpdate')->name('weixin_user_address_update'); Route::get('/user_address_update', 'AddressController@userAddressUpdate')->name('weixin_user_address_update');
}); });
//无需token验证,全局 //无需token验证,全局
Route::group(['middleware' => ['web']], function () { Route::group(['middleware' => ['web']], function () {
Route::get('/weixin_user_recharge_order_detail', 'Weixin\UserController@userRechargeOrderDetail')->name('weixin_user_recharge_order_detail'); //微信充值支付,为了配合公众号支付授权目录
Route::post('/dataapi/listarc', 'Api\IndexController@listarc')->name('api_listarc'); Route::post('/dataapi/listarc', 'Api\IndexController@listarc')->name('api_listarc');
Route::post('/dataapi/customer_login', 'Api\WechatAuthController@customerLogin'); Route::post('/dataapi/customer_login', 'Api\WechatAuthController@customerLogin');
Route::post('/dataapi/', 'Api\UserController@signin'); //签到 Route::post('/dataapi/', 'Api\UserController@signin'); //签到
@ -149,6 +148,7 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
//用户充值 //用户充值
Route::post('/user_recharge_add', 'UserRechargeController@userRechargeAdd'); Route::post('/user_recharge_add', 'UserRechargeController@userRechargeAdd');
Route::get('/user_recharge_detail', 'UserRechargeController@userRechargeDetail'); Route::get('/user_recharge_detail', 'UserRechargeController@userRechargeDetail');
Route::get('/user_recharge_list', 'UserRechargeController@userRechargeList');
//用户余额(钱包) //用户余额(钱包)
Route::get('/user_money_list', 'UserMoneyController@userMoneyList'); Route::get('/user_money_list', 'UserMoneyController@userMoneyList');
Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd'); Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd');

Loading…
Cancel
Save