Browse Source

order comment withdraw

master
ZLW-PC\Administrator 7 years ago
parent
commit
4a0dce40e8
  1. 1
      app/Common/function.php
  2. 65
      app/Http/Controllers/Api/CommentController.php
  3. 146
      app/Http/Controllers/Api/OrderController.php
  4. 24
      app/Http/Controllers/Api/UserController.php
  5. 12
      app/Http/Controllers/Api/UserWithdrawController.php
  6. 105
      app/Http/Controllers/Weixin/OrderController.php
  7. 64
      app/Http/Controllers/Weixin/UserController.php
  8. 47
      app/Http/Controllers/Weixin/WxPayController.php
  9. 63
      app/Http/Model/Comment.php
  10. 22
      app/Http/Model/Order.php
  11. 2
      app/Http/Model/UserRecharge.php
  12. 52
      app/Http/Model/UserWithdraw.php
  13. 42
      resources/views/weixin/order/orderComment.blade.php
  14. 101
      resources/views/weixin/order/orderDetail.blade.php
  15. 100
      resources/views/weixin/order/orderList.blade.php
  16. 12
      resources/views/weixin/user/index.blade.php
  17. 2
      resources/views/weixin/user/userAccount.blade.php
  18. 125
      resources/views/weixin/user/userWithdraw.blade.php
  19. 98
      resources/views/weixin/user/userWithdrawList.blade.php
  20. 21
      routes/web.php

1
app/Common/function.php

@ -18,7 +18,6 @@ if (! function_exists('curl_request'))
case 'POST' :
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
break;
case 'PUT' :
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');

65
app/Http/Controllers/Api/CommentController.php

@ -15,17 +15,19 @@ class CommentController extends CommonController
parent::__construct();
}
public function goodsCommentList(Request $request)
public function commentList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$data['user_id'] = Token::$uid;
$data['comment_type'] = $request->input('comment_type', 0); //0商品评价,1文章评价
if($request->input('comment_rank', null) !== null){$data['comment_rank'] = $request->input('comment_rank');}
if($request->input('comment_rank', '') != ''){$data['comment_rank'] = $request->input('comment_rank');}
if($request->input('id_value', '') != ''){$data['id_value'] = $request->input('id_value');}
if($request->input('parent_id', '') != ''){$data['parent_id'] = $request->input('parent_id');}
$res = Comment::getList($data);
if($res !== true)
if($res === false)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
@ -33,16 +35,14 @@ class CommentController extends CommonController
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//添加评价
public function goodsCommentAdd(Request $request)
//添加一条评价
public function commentAdd(Request $request)
{
//参数
$data['comment_type'] = $request->input('comment_type',0);
$data['id_value'] = $request->input('id_value',null);
$data['content'] = $request->input('content',null);
$data['comment_rank'] = $request->input('comment_rank',null);
if($request->input('email', null) !== null){$data['email'] = $request->input('email');}
if($request->input('user_name', null) !== null){$data['user_name'] = $request->input('user_name');}
if($request->input('ip_address', null) !== null){$data['ip_address'] = $request->input('ip_address');}
if($request->input('parent_id', null) !== null){$data['parent_id'] = $request->input('parent_id');}
$data['add_time'] = time();
@ -54,47 +54,50 @@ class CommentController extends CommonController
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = Comment::add($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return Comment::add($data);
}
//评价批量添加
public function commentBatchAdd(Request $request)
{
if($request->input('comment',null)===null){return ReturnData::create(ReturnData::PARAMS_ERROR);}
$comment = json_decode($request->input('comment'),true);
foreach($comment as $k=>$v)
{
$comment[$k]['user_id'] = Token::$uid;
$comment[$k]['ip_address'] = Helper::getRemoteIp();
$comment[$k]['add_time'] = time();
}
return ReturnData::create(ReturnData::SUCCESS,$res);
return Comment::batchAdd($comment);
}
public function goodsCommentUpdate(Request $request)
public function commentUpdate(Request $request)
{
//参数
$id = $request->input('id',null);
$data['comment_type'] = $request->input('comment_type',0);
$data['id_value'] = $request->input('id_value',null);
$data['content'] = $request->input('content',null);
$data['comment_rank'] = $request->input('comment_rank',null);
if($request->input('email', null) !== null){$data['email'] = $request->input('email');}
if($request->input('user_name', null) !== null){$data['user_name'] = $request->input('user_name');}
if($request->input('content', null) !== null){$data['content'] = $request->input('content');}
if($request->input('comment_rank', null) !== null){$data['comment_rank'] = $request->input('comment_rank');}
if($request->input('ip_address', null) !== null){$data['ip_address'] = $request->input('ip_address');}
if($request->input('parent_id', null) !== null){$data['parent_id'] = $request->input('parent_id');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
$data['ip_address'] = Helper::getRemoteIp();
if($id===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = Comment::modify(array('id'=>$id),$data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
if(isset($data))
{
$data['user_id'] = Token::$uid;
Comment::modify(array('id'=>$id),$data);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
return ReturnData::create(ReturnData::SUCCESS);
}
//删除评价
public function goodsCommentDelete(Request $request)
public function commentDelete(Request $request)
{
//参数
$data['comment_type'] = $request->input('comment_type',null);
@ -107,7 +110,7 @@ class CommentController extends CommonController
}
$res = Comment::remove($data);
if($res !== true)
if($res === false)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}

146
app/Http/Controllers/Api/OrderController.php

@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\Order;
use DB;
class OrderController extends CommonController
{
@ -19,7 +20,7 @@ class OrderController extends CommonController
{
//参数
$data['user_id'] = Token::$uid;
$data['status'] = $request->input('status','');
$data['status'] = $request->input('status',-1);
return Order::getList($data);
}
@ -32,6 +33,7 @@ class OrderController extends CommonController
$data['order_id'] = $request->input('order_id','');
if($request->input('order_status','') != ''){$data['order_status'] = $request->input('order_status');}
if($request->input('pay_status','') != ''){$data['pay_status'] = $request->input('pay_status');}
if($request->input('refund_status','') != ''){$data['refund_status'] = $request->input('refund_status');}
if($data['order_id']=='')
{
@ -64,6 +66,148 @@ class OrderController extends CommonController
return Order::add($data);
}
//订单修改
public function orderUpdate(Request $request)
{
if($request->input('id', '')!=''){$where['id'] = $request->input('id');}
if($request->input('order_sn', '')!=''){$where['order_sn'] = $request->input('order_sn');}
if($request->input('order_amount', '')!=''){$data['order_amount'] = $request->input('order_amount');}
if($request->input('out_trade_no', '')!=''){$data['out_trade_no'] = $request->input('out_trade_no');}
if($request->input('shipping_name', '')!=''){$data['shipping_name'] = $request->input('shipping_name');}
if($request->input('shipping_id', '')!=''){$data['shipping_id'] = $request->input('shipping_id');}
if($request->input('shipping_sn', '')!=''){$data['shipping_sn'] = $request->input('shipping_sn');}
if($request->input('shipping_fee', '')!=''){$data['shipping_fee'] = $request->input('shipping_fee');}
if($request->input('shipping_time', '')!=''){$data['shipping_time'] = $request->input('shipping_time');}
if($request->input('name', '')!=''){$data['name'] = $request->input('name');}
if($request->input('province', '')!=''){$data['province'] = $request->input('province');}
if($request->input('city', '')!=''){$data['city'] = $request->input('city');}
if($request->input('district', '')!=''){$data['district'] = $request->input('district');}
if($request->input('address', '')!=''){$data['address'] = $request->input('address');}
if($request->input('zipcode', '')!=''){$data['zipcode'] = $request->input('zipcode');}
if($request->input('mobile', '')!=''){$data['mobile'] = $request->input('mobile');}
if($request->input('message', '')!=''){$data['message'] = $request->input('message');}
if($request->input('is_comment', '')!=''){$data['is_comment'] = $request->input('is_comment');}
if($request->input('is_delete', '')!=''){$data['is_delete'] = $request->input('is_delete');}
if($request->input('to_buyer', '')!=''){$data['to_buyer'] = $request->input('to_buyer');}
if($request->input('invoice', '')!=''){$data['invoice'] = $request->input('invoice');}
if($request->input('invoice_title', '')!=''){$data['invoice_title'] = $request->input('invoice_title');}
if($request->input('invoice_taxpayer_number', '')!=''){$data['invoice_taxpayer_number'] = $request->input('invoice_taxpayer_number');}
if(!isset($where)){return ReturnData::create(ReturnData::PARAMS_ERROR);}
if (isset($data))
{
$where['user_id'] = Token::$uid;
Order::modify($where,$data);
}
return ReturnData::create(ReturnData::SUCCESS);
}
//订单状态修改
public function orderStatusUpdate(Request $request)
{
$type = $request->input('type','');
if($request->input('id', '')!=''){$where['id'] = $request->input('id');}
$where['user_id'] = Token::$uid;
if($type=='' || $where['id'] =='')
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
//修改订单状态,1设为支付,2设为取消,3设为确认收货,4设为退款退货,5设为删除,6设为已评价
if($type == 1)
{
//判断订单是否存在或本人
$where['order_status'] = 0;
$where['pay_status'] = 0;
$order = Order::where($where)->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
//判断用户余额是否足够
$user_money = DB::table('user')->where(array('id'=>Token::$uid))->value('money');
if($order['order_amount']>$user_money){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'余额不足');}
$data['pay_status'] = 1;
$data['pay_money'] = $order['order_amount']; //支付金额
$data['pay_id'] = $request->input('pay_id','');
$data['pay_time'] = $request->input('pay_time',time());
if($request->input('pay_name', '')!=''){$data['pay_name'] = $request->input('pay_name');}
//扣除用户余额
if($data['pay_money']<=0 || !DB::table('user')->where(array('id'=>Token::$uid))->decrement('money', $data['pay_money']))
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
//增加用户余额记录
DB::table('user_money')->insert(array('user_id'=>Token::$uid,'type'=>1,'money'=>$data['pay_money'],'des'=>'订单余额支付','user_money'=>DB::table('user')->where(array('id'=>Token::$uid))->value('money'),'add_time'=>time()));
}
elseif($type == 2)
{
//判断订单是否存在或本人
$where['order_status'] = 0;
$where['pay_status'] = 0;
$order = Order::where($where)->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
$data['order_status'] = 1;
}
elseif($type == 3)
{
//判断订单是否存在或本人
$where['order_status'] = 0;
$where['refund_status'] = 0;
$where['pay_status'] = 1;
$order = Order::where($where)->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
$data['order_status'] = 3;
$data['shipping_status'] = 2;
$data['refund_status'] = 0;
$data['is_comment'] = 0;
}
elseif($type == 4)
{
//判断订单是否存在或本人
$where['order_status'] = 3;
$where['refund_status'] = 0;
$where['shipping_status'] = 2;
$order = Order::where($where)->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
$data['refund_status'] = 1;
}
elseif($type == 5)
{
//判断订单是否存在或本人
$order = Order::where(array('order_status'=>3,'refund_status'=>0))->orWhere(array('order_status'=>1))->orWhere(array('order_status'=>2))->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
$data['is_delete'] = 1;
}
elseif($type == 6)
{
//判断订单是否存在或本人
$where['order_status'] = 3;
$where['refund_status'] = 0;
$order = Order::where($where)->first();
if(!$order){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'订单不存在');}
$data['is_comment'] = 1;
}
//修改订单状态
if (isset($data))
{
Order::modify($where,$data);
}
return ReturnData::create(ReturnData::SUCCESS);
}
//删除订单
public function orderDelete(Request $request)
{

24
app/Http/Controllers/Api/UserController.php

@ -34,12 +34,13 @@ class UserController extends CommonController
if($request->input('user_name', null)!==null)
{
$data['user_name'] = $request->input('user_name');
if(User::getOneUser($data))
{
return ReturnData::create(ReturnData::PARAMS_ERROR,null,'用户名已存在');
}
}
if($request->input('email', null)!==null){$data['email'] = $request->input('email');}
if($request->input('sex', null)!==null){$data['sex'] = $request->input('sex');}
if($request->input('birthday', null)!==null){$data['birthday'] = $request->input('birthday');}
@ -63,7 +64,26 @@ class UserController extends CommonController
return ReturnData::create(ReturnData::SUCCESS);
}
//修改用户余额
public function userMoneyUpdate(Request $request)
{
$data['money'] = $request->input('money','');
if($data['money'] == '' || $data['money'] <= 0)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$user = User::getOneUser(array('id'=>Token::$uid));
$data['money'] = $user['money'] - $data['money'];
if(User::modify(array('id'=>Token::$uid),$data))
{
return ReturnData::create(ReturnData::SUCCESS);
}
}
//修改用户密码、支付密码
public function userPasswordUpdate(Request $request)
{

12
app/Http/Controllers/Api/UserWithdrawController.php

@ -40,14 +40,16 @@ class UserWithdrawController extends CommonController
$data['method'] = $request->input('method','');
$data['money'] = $request->input('money','');
$data['account'] = $request->input('account','');
$data['name'] = $request->input('name','');
if($request->input('note', '') != ''){$data['note'] = $request->input('note');}
if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
if($request->input('bank_name', '') != ''){$data['bank_name'] = $request->input('bank_name');}
if($request->input('bank_place', '') != ''){$data['bank_place'] = $request->input('bank_place');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
$data['pay_password'] = $request->input('pay_password','');
if($data['method']=='' || $data['money']=='' || $data['account']=='')
if($data['method']=='' || $data['money']=='' || $data['account']=='' || $data['name']=='' || $data['pay_password']=='')
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
@ -57,13 +59,7 @@ class UserWithdrawController extends CommonController
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = UserWithdraw::add($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
return UserWithdraw::add($data);
}
//修改提现

105
app/Http/Controllers/Weixin/OrderController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;
class OrderController extends CommonController
{
@ -20,7 +21,7 @@ class OrderController extends CommonController
if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
$status = $request->input('status','');
$status = $request->input('status',-1);
$postdata = array(
'limit' => $pagesize,
@ -72,7 +73,63 @@ class OrderController extends CommonController
return view('weixin.order.orderDetail', $data);
}
//订单评价
public function orderComment(Request $request)
{
if(Helper::isPostRequest())
{
if($_POST['comment'])
{
foreach($_POST['comment'] as $k=>$v)
{
$_POST['comment'][$k]['comment_type'] = 0;
$_POST['comment'][$k]['comment_rank'] = 5;
}
}
else
{
$this->error_jump('评论失败');
}
$postdata = array(
'order_id' => $_POST['order_id'],
'comment' => json_encode($_POST['comment']),
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/comment_batch_add";
$res = curl_request($url,$postdata,'POST');
if($res['code']!=0){$this->error_jump('评论失败');}
//订单状态设为已评价
$postdata = array(
'id' => $_POST['order_id'],
'type' => 6,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/order_status_update";
$res = curl_request($url,$postdata,'POST');
$this->success_jump('评论成功',route('weixin_order_list'));
}
$id = $request->input('id','');
if($id==''){$this->error_jump('您访问的页面不存在或已被删除!');}
$postdata = array(
'order_id' => $id,
'order_status' => 3,
'refund_status' => 0,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/order_detail";
$res = curl_request($url,$postdata,'GET');
$data['post'] = $res['data'];
if(empty($data['post'])){$this->error_jump('您访问的页面不存在或已被删除!');}
return view('weixin.order.orderComment', $data);
}
//订单支付
public function pay($id)
{
@ -138,6 +195,49 @@ class OrderController extends CommonController
}
}
//订单余额支付
public function orderYuepay(Request $request)
{
$order_id = $request->input('order_id','');
//获取订单详情
$postdata = array(
'order_id' => $order_id, //要支付的订单id
'order_status' => 0,
'pay_status' => 0,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/order_detail";
$res = curl_request($url,$postdata,'GET');
$order_detail = $res['data'];
if($res['code']!=0){$this->error_jump('订单不存在或已过期');}
//获取会员信息
$postdata = array(
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/user_info";
$res = curl_request($url,$postdata,'GET');
$user_info = $res['data'];
if($order_detail['order_amount']>$user_info['money']){$this->error_jump('余额不足');}
//修改订单状态
$postdata = array(
'id' => $order_detail['id'],
'type' => 1,
'pay_id' => 1,
'pay_name' => '余额支付',
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/order_status_update";
$res = curl_request($url,$postdata,'POST');
if($res['code']!=0){$this->error_jump('支付失败');}
$this->success_jump('支付成功',route('weixin_order_list'));
}
//订单余额支付
public function orderWxpay(Request $request)
{
$order_id = $request->input('order_id','');
@ -153,7 +253,6 @@ class OrderController extends CommonController
$res = curl_request($url,$postdata,'GET');
$data['order_detail'] = $res['data'];
$data['order_id'] = $order_id;
if($res['code']!=0){$this->error_jump('订单不存在或已过期');}
//微信支付-start

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

@ -109,6 +109,64 @@ class UserController extends CommonController
return view('weixin.user.userAccount', $data);
}
//提现
public function userWithdraw(Request $request)
{
$postdata = array(
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/user_info";
$res = curl_request($url,$postdata,'GET');
$data['user_info'] = $res['data'];
$data['is_withdraw'] = 0; //是否达到可提现要求,0否
$data['min_withdraw_money'] = sysconfig('CMS_MIN_WITHDRAWAL_MONEY'); //最低可提现金额
if($data['user_info']['money']>=$data['min_withdraw_money']){$data['is_withdraw'] = 1;}
return view('weixin.user.userWithdraw', $data);
}
//提现明细
public function userWithdrawList(Request $request)
{
$pagesize = 10;
$offset = 0;
if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
$postdata = array(
'limit' => $pagesize,
'offset' => $offset,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/user_withdraw_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="des">收款账号:'.$v['name'].' ,提现方式:'.$v['method'].' ,姓名:'.$v['name'].'<br>状态:<font color="red">'.$v['status_text'].'</font></p>';
$html .= '<p class="time">'.date('Y-m-d H:i:s',$v['add_time']).'</p></div>';
$html .= '</li>';
}
}
exit(json_encode($html));
}
return view('weixin.user.userWithdrawList', $data);
}
//用户充值
public function userRecharge(Request $request)
{
@ -169,15 +227,15 @@ class UserController extends CommonController
);
$url = env('APP_API_URL')."/user_recharge_detail";
$res = curl_request($url,$postdata,'GET');
$data['post'] = $res['data'];
$user_recharge = $data['post'] = $res['data'];
//微信支付-start
require_once(resource_path('org/wxpay/WxPayConfig.php')); // 导入微信配置类
require_once(resource_path('org/wxpay/WxPayPubHelper.class.php')); // 导入微信支付类
$body = '充值';//订单详情
$out_trade_no = '20177878738';//订单号
$total_fee = floatval(0.01*100);//价格0.01
$out_trade_no = $user_recharge['recharge_sn'];//订单号
$total_fee = floatval($user_recharge['money']*100);//价格0.01
$attach = 'pay_type=1'; //pay_type=1充值支付
$notify_url = route('weixin_wxpay_notify');//通知地址
$wxconfig= \WxPayConfig::wxconfig();

47
app/Http/Controllers/Weixin/WxPayController.php

@ -3,6 +3,7 @@ namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
use DB;
class WxPayController extends CommonController
{
@ -30,10 +31,52 @@ class WxPayController extends CommonController
if($post_data['result_code'] == 'SUCCESS')
{
$pay_money = $post_data['total_fee']/100;
$pay_time_timestamp = strtotime(date_format(date_create($post_data['time_end']),"Y-m-d H:i:s"));
//$post_data['out_trade_no']
//$post_data['transaction_id']
//$post_data['total_fee']
file_put_contents("2.txt",$post_data['total_fee'].'--'.$post_data['out_trade_no'].'--'.$post_data['attach']);
//附加参数pay_type:1充值支付,2订单支付
if($post_data['pay_type'] == 1)
{
//获取充值支付记录
$user_recharge = DB::table('user_recharge')->where(array('recharge_sn'=>$post_data['out_trade_no'],'status'=>0))->first();
if(!$user_recharge){exit;}
if($pay_money < $user_recharge->money){exit;} //如果支付金额小于要充值的金额
//更新充值支付记录状态
DB::table('user_recharge')->where(array('recharge_sn'=>$post_data['out_trade_no'],'status'=>0))->update(array('pay_time'=>$pay_time_timestamp,'pay_type'=>1,'status'=>1,'trade_no'=>$post_data['transaction_id'],'pay_money'=>$pay_money));
//增加用户余额
DB::table('user')->where(array('id'=>$user_recharge->user_id))->decrement('money', $pay_money);
//添加用户余额记录
DB::table('user_money')->insert(array('user_id'=>$user_recharge->user_id,'type'=>0,'money'=>$pay_money,'des'=>'充值','user_money'=>DB::table('user')->where(array('id'=>$user_recharge->user_id))->value('money'),'add_time'=>time()));
}
if($post_data['pay_type'] == 2)
{
//获取订单记录
$order = DB::table('order')->where(array('order_sn'=>$post_data['out_trade_no'],'order_status'=>0,'pay_status'=>0))->first();
if(!$order){exit;}
if($pay_money < $order->order_amount){exit;} //如果支付金额小于订单金额
//修改订单状态
$order_update_data['pay_status'] = 1;
$order_update_data['pay_money'] = $pay_money; //支付金额
$order_update_data['pay_id'] = 2;
$order_update_data['pay_time'] = $pay_time_timestamp;
$order_update_data['pay_name'] = '微信';
$order_update_data['out_trade_no'] = $post_data['transaction_id'];
DB::table('order')->where(array('order_sn'=>$post_data['out_trade_no'],'order_status'=>0,'pay_status'=>0))->update($order_update_data);
}
if($post_data['pay_type'] == 3)
{
}
if($post_data['pay_type'] == 4)
{
}
file_put_contents("2.txt",$post_data['total_fee'].'--'.$post_data['out_trade_no'].'--'.$post_data['attach'].'--'.$post_data['pay_type']);
echo "SUCCESS";
}
else

63
app/Http/Model/Comment.php

@ -2,6 +2,7 @@
namespace App\Http\Model;
use App\Common\Token;
use App\Common\ReturnData;
class Comment extends BaseModel
{
@ -28,15 +29,17 @@ class Comment extends BaseModel
extract($param); //参数:limit,offset
$where['user_id'] = $user_id;
$where['comment_type'] = $comment_type; //0商品评价,1文章评价
$where['status'] = self::SHOW_COMMENT;
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new Comment;
$model = new self;
if(isset($comment_rank)){$where['comment_rank'] = $comment_rank;} //评价分
if(isset($id_value)){$where['id_value'] = $id_value;} //商品的id
if(isset($comment_type)){$where['comment_type'] = $comment_type;} //0商品评价,1文章评价
if(isset($parent_id)){$where['parent_id'] = $parent_id;}
$model = $model->where($where);
@ -45,31 +48,63 @@ class Comment extends BaseModel
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return '暂无记录';
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get();
}
return $res;
}
public static function getOne($id)
public static function getOne($where)
{
return self::where('id', $id)->first()->toArray();
return self::where($where)->first();
}
public static function add(array $data)
{
if(self::where(array('user_id'=>$data['user_id'],'id_value'=>$data['id_value'],'comment_type'=>$data['comment_type']))->first()){return '亲,您已经评价啦!';}
if(!isset($data['comment_type']) || !isset($data['id_value']) || !isset($data['user_id']) || $data['comment_type']===null || $data['id_value']===null || $data['user_id']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
if(!isset($data['content']) && !isset($data['comment_rank']))
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
else
{
if($data['content']===null && $data['comment_rank']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
}
if(self::where(array('user_id'=>$data['user_id'],'id_value'=>$data['id_value'],'comment_type'=>$data['comment_type']))->first()){return ReturnData::create(ReturnData::SYSTEM_FAIL,null,'亲,您已经评价啦!');}
if ($id = self::insertGetId($data))
{
return true;
return ReturnData::create(ReturnData::SUCCESS,$id);
}
return false;
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
//批量添加
public static function batchAdd(array $data)
{
$res = '';
if($data)
{
foreach($data as $k=>$v)
{
$id = self::add($v);
if($id['code']==0){$res[] = $id['data'];}else{return $id;}
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
public static function modify($where, array $data)
@ -87,7 +122,7 @@ class Comment extends BaseModel
{
if(!self::where(array('user_id'=>$data['user_id'],'comment_type'=>$data['comment_type'],'id_value'=>$data['id_value']))->first()){return '商品尚未评价';}
if (!self::where(array('user_id'=>$data['user_id'],'comment_type'=>$data['comment_type'],'id_value'=>$data['id_value']))->delete())
if (self::where(array('user_id'=>$data['user_id'],'comment_type'=>$data['comment_type'],'id_value'=>$data['id_value']))->delete() === false)
{
return false;
}

22
app/Http/Model/Order.php

@ -73,8 +73,8 @@ class Order extends BaseModel
foreach($order_list as $k=>$v)
{
$order_status_arr = self::getOrderStatusText($v);
$order_list[$k]['order_status_text'] = $order_status_arr['text'];
$order_list[$k]['order_status_num'] = $order_status_arr['num'];
$order_list[$k]['order_status_text'] = $order_status_arr?$order_status_arr['text']:'';
$order_list[$k]['order_status_num'] = $order_status_arr?$order_status_arr['num']:'';
$order_goods = OrderGoods::where(array('order_id'=>$v['id']))->get();
$order_list[$k]['goods_list'] = $order_goods;
@ -223,12 +223,12 @@ class Order extends BaseModel
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
if (self::where($where)->update($data) === false)
{
return true;
return false;
}
return false;
return true;
}
//删除一条记录
@ -243,7 +243,7 @@ class Order extends BaseModel
return true;
}
//获取订单状态文字1待付款,2待发货,3待收货,4待评价(确认收货,交易成功),5退款/售后
//获取订单状态文字:1待付款,2待发货,3待收货,4待评价(确认收货,交易成功),5退款/售后,6已取消,7无效
public static function getOrderStatusText($where)
{
$res = '';
@ -259,7 +259,7 @@ class Order extends BaseModel
{
$res = array('text'=>'待收货','num'=>3);
}
elseif($where['order_status'] == 3 && $where['refund_status'] == 0 && $where['shipping_status'] == 2 && $where['is_comment'] == 0)
elseif($where['order_status'] == 3 && $where['refund_status'] == 0)
{
$res = array('text'=>'交易成功','num'=>4);
}
@ -267,6 +267,14 @@ class Order extends BaseModel
{
$res = array('text'=>'售后','num'=>5);
}
elseif($where['order_status'] == 1)
{
$res = array('text'=>'已取消','num'=>6);
}
elseif($where['order_status'] == 2)
{
$res = array('text'=>'无效','num'=>7);
}
return $res;
}

2
app/Http/Model/UserRecharge.php

@ -52,6 +52,8 @@ class UserRecharge extends BaseModel
public static function add(array $data)
{
$data['recharge_sn'] = date('YmdHis'.rand(1000,9999));
if ($id = self::insertGetId($data))
{
return $id;

52
app/Http/Model/UserWithdraw.php

@ -3,6 +3,7 @@ namespace App\Http\Model;
use App\Common\Token;
use DB;
use App\Common\ReturnData;
class UserWithdraw extends BaseModel
{
@ -41,6 +42,11 @@ class UserWithdraw extends BaseModel
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get();
foreach($res['list'] as $k=>$v)
{
$res['list'][$k]['status_text'] = self::getStatusText($v);
}
}
else
{
@ -62,12 +68,26 @@ class UserWithdraw extends BaseModel
public static function add(array $data)
{
$user = User::where(array('id'=>$data['user_id'],'pay_password'=>$data['pay_password']))->first();
if(!$user){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'支付密码错误');}
unset($data['pay_password']);
$min_withdraw_money = sysconfig('CMS_MIN_WITHDRAWAL_MONEY'); //最低可提现金额
if($user['money']<$data['money']){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'余额不足');}
if($user['money']<$min_withdraw_money){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'用户金额小于最小提现金额');}
if($data['money']<$min_withdraw_money){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'提现金额不得小于最小提现金额');}
if ($id = self::insertGetId($data))
{
return $id;
//扣除用户余额
DB::table('user')->where(array('id'=>$data['user_id']))->decrement('money', $data['money']);
//增加用户余额记录
DB::table('user_money')->insert(array('user_id'=>$data['user_id'],'type'=>1,'money'=>$data['money'],'des'=>'提现','user_money'=>DB::table('user')->where(array('id'=>$data['user_id']))->value('money'),'add_time'=>time()));
return ReturnData::create(ReturnData::SUCCESS,$id);
}
return false;
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
public static function modify($where, array $data)
@ -90,4 +110,32 @@ class UserWithdraw extends BaseModel
return true;
}
//获取提现状态文字:0未处理,1处理中,2成功,3取消,4拒绝
public static function getStatusText($where)
{
$res = '';
if($where['status'] == 0)
{
$res = '未处理';
}
elseif($where['status'] == 1)
{
$res = '处理中';
}
elseif($where['status'] == 2)
{
$res = '成功';
}
elseif($where['status'] == 3)
{
$res = '取消';
}
elseif($where['status'] == 4)
{
$res = '拒绝';
}
return $res;
}
}

42
resources/views/weixin/order/orderComment.blade.php

@ -0,0 +1,42 @@
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>发表评价</title><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>
<meta name="keywords" content="关键词"><meta name="description" content="描述"></head><body style="background-color:#f1f1f1;">
<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 class="ds-in-bl nav_menu"><a href="javascript:submit();" style="color:#e94e45;">发布</a></div>
</div>
<form action="<?php echo route('weixin_order_comment'); ?>" method="post" id="myform">
<?php if($post){ ?>
<input name="order_id" type="hidden" value="<?php echo $post['id']; ?>">
<div class="floor">
<?php if($post['goods_list']){foreach($post['goods_list'] as $k=>$v){ ?>
<div class="tit_h mt10"><img src="<?php echo $v['goods_img']; ?>"> <span class="fr"></span></div>
<div style="padding:10px 10px 8px 10px;background-color:#fff;"><textarea rows="4" name="comment[<?php echo $k; ?>][content]" onfocus="if(value=='宝贝满足你的期待吗?说说你的使用心得,分享给想买的TA们吧'){value=''}" onblur="if(value==''){value='宝贝满足你的期待吗?说说你的使用心得,分享给想买的TA们吧'}">宝贝满足你的期待吗?说说你的使用心得,分享给想买的TA们吧</textarea></div>
<div class="tit_h" style="border-top:1px solid #eee;"><input type="checkbox" name="comment[<?php echo $k; ?>][is_anonymous]" value="1" checked> 匿名 <span class="fr">你写的评价会以匿名的形式展现</span></div>
<input name="comment[<?php echo $k; ?>][id_value]" type="hidden" value="<?php echo $v['goods_id']; ?>">
<?php }} ?>
</div>
<?php }else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
<?php } ?>
</form>
<style>
.tit_h{font-size:16px;font-weight:400;background-color:#fff;color:#383838;height:42px;line-height:41px;padding-left:10px;padding-right:10px;border-bottom:1px solid #eee;}
.tit_h span{color:#999;font-size:14px;}
.tit_h img{width:28px;height:28px;}
textarea{width:100%;border:none;color:#999;}
</style>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<script>
function submit()
{
$("#myform").submit();
}
</script>
</body></html>

101
resources/views/weixin/order/orderDetail.blade.php

@ -13,7 +13,7 @@
@include('weixin.common.headerNav')
<div class="orderdetail-des">
<p><?php echo $post['order_status_text']; ?></p>
<p>订单状态:<?php echo $post['order_status_text']; ?></p>
</div>
<style>
.orderdetail-des{background:#ea5a3d;padding:20px 10px;color:#fff;font-size:18px;}
@ -44,7 +44,7 @@
</ul>
<p class="des">合计: <?php echo $post['order_amount']; ?> <small>(含运费:¥<?php echo $post['shipping_fee']; ?>)</small></p>
<div class="tag"><a href="" class="activate">我要付款</a><a href="">评价</a></div>
<div class="tag"><?php if($post['order_status_num']==4 || $post['order_status_num']==6 || $post['order_status_num']==7){ ?><a href="javascript:del_order(<?php echo $post['id']; ?>);">删除</a><?php } ?><?php if($post['order_status_num']==1){ ?><a href="javascript:cancel_order(<?php echo $post['id']; ?>);">取消订单</a><?php } ?><?php if($post['order_status_num']==1){ ?><a href="<?php echo route('weixin_order_pay',array('id'=>$post['id'])); ?>">付款</a><?php } ?><?php if($post['order_status_num']==3){ ?><a href="http://m.kuaidi100.com/index_all.html?type=<?php echo $post['shipping_name']; ?>&postid=<?php echo $post['shipping_sn']; ?>#result">查看物流</a><?php } ?><?php if($post['order_status_num']==3 || $post['order_status_num']==2){ ?><a href="javascript:done_order(<?php echo $post['id']; ?>);">确认收货</a><?php } ?><?php if($post['order_status_num']==4){ ?><a class="activate" href="<?php echo route('weixin_order_comment',array('id'=>$post['id'])); ?>">评价</a><?php } ?></div>
</div>
<style>
.goodslist{background-color:#fbfbfb;}
@ -71,5 +71,102 @@
.order_expand{background-color:#fff;padding:10px;font-size:14px;color:#666;}
</style>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<script>
var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
//取消订单
function cancel_order(order_id)
{
//询问框
layer.open({
content: '确定要取消该订单吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:2},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
//确认收货
function done_order(order_id)
{
//询问框
layer.open({
content: '确定要这样操作吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:3},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
//删除订单
function del_order(order_id)
{
//询问框
layer.open({
content: '确定要删除该订单吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:5},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
</script>
@include('weixin.common.footer')
</body></html>

100
resources/views/weixin/order/orderList.blade.php

@ -51,7 +51,7 @@ var swiper = new Swiper('.swiper-nav', {
</a>
<p class="des">合计: <?php echo $value['order_amount']; ?> <small>(含运费:¥<?php echo $value['shipping_fee']; ?>)</small></p>
<div class="tag"><?php if($value['order_status_num']==1){ ?><a href="<?php echo route('weixin_order_pay',array('id'=>$value['id'])); ?>">我要付款</a><?php } ?><a href="" class="activate">评价</a></div>
<div class="tag"><?php if($value['order_status_num']==4 || $value['order_status_num']==6 || $value['order_status_num']==7){ ?><a href="javascript:del_order(<?php echo $value['id']; ?>);">删除</a><?php } ?><?php if($value['order_status_num']==1){ ?><a href="javascript:cancel_order(<?php echo $value['id']; ?>);">取消订单</a><?php } ?><?php if($value['order_status_num']==1){ ?><a href="<?php echo route('weixin_order_pay',array('id'=>$value['id'])); ?>">付款</a><?php } ?><?php if($value['order_status_num']==3){ ?><a href="http://m.kuaidi100.com/index_all.html?type=<?php echo $value['shipping_name']; ?>&postid=<?php echo $value['shipping_sn']; ?>#result">查看物流</a><?php } ?><?php if($value['order_status_num']==3 || $value['order_status_num']==2){ ?><a href="javascript:done_order(<?php echo $value['id']; ?>);">确认收货</a><?php } ?><?php if($value['order_status_num']==4){ ?><a class="activate" href="<?php echo route('weixin_order_comment',array('id'=>$value['id'])); ?>">评价</a><?php } ?></div>
</div>
<?php }}else{ ?>
<div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
@ -72,4 +72,102 @@ var swiper = new Swiper('.swiper-nav', {
.tag a{color:#666;background-color:#fff;border:1px solid #ddd;border-radius:5px;font-size:14px;padding:2px 6px;display:inline-block;margin-right:10px;}
.tag a.activate{color:#ea6f5a;border:1px solid #ea6f5a;}
</style>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<script>
var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
//取消订单
function cancel_order(order_id)
{
//询问框
layer.open({
content: '确定要取消该订单吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:2},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
//确认收货
function done_order(order_id)
{
//询问框
layer.open({
content: '确定要这样操作吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:3},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
//删除订单
function del_order(order_id)
{
//询问框
layer.open({
content: '确定要删除该订单吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/order_status_update"; ?>';
$.post(url,{access_token:access_token,id:order_id,type:5},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
else
{
}
},'json');
}
});
}
</script>
</body></html>

12
resources/views/weixin/user/index.blade.php

@ -64,28 +64,28 @@
<ul>
<li>
<a href="<?php echo route('weixin_order_list',array('status'=>1)); ?>">
<span>0</span>
<!-- <span>0</span> -->
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q1.png" alt="">
<p>待付款</p>
</a>
</li>
<li>
<a href="<?php echo route('weixin_order_list',array('status'=>3)); ?>">
<span>0</span>
<!-- <span>0</span> -->
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q2.png" alt="">
<p>待收货</p>
</a>
</li>
<li>
<a href="<?php echo route('weixin_order_list',array('status'=>4)); ?>">
<span>0</span>
<!-- <span>0</span> -->
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q3.png" alt="">
<p>待评价</p>
</a>
</li>
<li>
<a href="<?php echo route('weixin_order_list',array('status'=>5)); ?>">
<span>0</span>
<!-- <span>0</span> -->
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q4.png" alt="">
<p>退款/退货</p>
</a>
@ -152,7 +152,7 @@
</a>
</div>
</div>
<div class="myorder p">
<!-- <div class="myorder p">
<div class="content30">
<a href="/index.php/Mobile/User/comment/status/1.html">
<div class="order">
@ -166,7 +166,7 @@
</div>
</a>
</div>
</div>
</div> -->
<!-- <div class="myorder p">
<div class="content30">
<a href="/index.php/Mobile/Goods/integralMall.html">

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

@ -23,7 +23,7 @@
<div class="money"><small></small><?php echo $user_info['money']; ?></div>
<br>
<a style="margin:10px;background-color:#1aad19;text-align:center;color:white;border:1px solid #179e16;" class="bottoma" href="<?php echo route('weixin_user_recharge'); ?>">充值</a>
<a style="margin:0 10px 10px 10px;background-color:#f1f1f1;text-align:center;color:#000;border:1px solid #bfbfbf;" class="bottoma" href="javascript:tixian();">提现</a>
<a style="margin:0 10px 10px 10px;background-color:#f1f1f1;text-align:center;color:#000;border:1px solid #bfbfbf;" class="bottoma" href="<?php echo route('weixin_user_withdraw'); ?>">提现</a>
</div>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>

125
resources/views/weixin/user/userWithdraw.blade.php

@ -0,0 +1,125 @@
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>提现</title><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>
<meta name="keywords" content="关键词"><meta name="description" content="描述"></head><body style="background-color:#f1f1f1;">
<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 class="ds-in-bl nav_menu"><a href="<?php echo route('weixin_user_withdraw_list'); ?>" style="color:#999;">提现明细</a></div>
</div>
<style>
.adr_add{margin:0 10px;}
.adr-form-group{margin-top:10px;}
.adr-form-group input[type=text],.adr-form-group input[type=password],.adr-form-group textarea{display: block;width: 100%;font-size:16px;padding:10px;color: #777;vertical-align: middle;background-color: #fff;background-image: none;border: 1px solid #ddd;border-radius: 0;box-sizing:border-box;}
.bottoma{display:block;font-size:18px;padding:10px;color:white;background-color:#f23030;text-align:center;}
.yongjin_tip{padding:10px;background-color:#FFC;color:#666;border-bottom:1px solid #DDD;font-size:14px;}.yongjin_tip b{color:red;}
</style>
<div class="yongjin_tip">余额:<b><?php echo $user_info['money']; ?></b>,手续费率:<b>0.5%</b>,最少金额:<b>¥<?php echo $min_withdraw_money; ?></b></div>
<div class="adr_add">
<div class="adr-form-group">
<label><font color="red">*</font>收款人姓名</label>
<input name="name" type="text" class="" id="name" placeholder="输入姓名">
</div>
<div class="adr-form-group" class="text" style="background-color:#FFF; line-height:38px;">
&nbsp;&nbsp;<label for="tx_alipay"><input type="radio" checked="checked" name="method" value="alipay" id="tx_alipay">支付宝</label>&nbsp;
<label for="tx_bank"><input type="radio" name="method" value="bank" id="tx_bank">银行卡</label>
</div>
<div class="adr-form-group">
<label><font color="red">*</font>提现金额</label>
<input name="money" type="text" class="" id="money" placeholder="可提现金额:<?php if($is_withdraw==1){echo $user_info['money'];}else{echo '0';} ?>">
</div>
<div class="adr-form-group">
<label><font color="red">*</font>收款账号</label>
<input name="account" type="text" class="" id="account" placeholder="">
</div>
<div id='bank' style="display:none;">
<div class="adr-form-group">
<label><font color="red">*</font>收款银行</label>
<input name="bank_name" type="text" class="" id="bank_name" placeholder="">
</div>
<div class="adr-form-group">
<label><font color="red">*</font>开户行</label>
<input name="bank_place" type="text" class="" id="bank_place" placeholder="">
</div>
</div>
<div class="adr-form-group">
<label><font color="red">*</font>支付密码(<a style="color:green;" href="<?php echo route('weixin_userinfo'); ?>">设置</a>)</label>
<input name="pay_password" type="password" class="" id="pay_password" placeholder="输入支付密码">
</div>
</div>
<a style="margin:10px;" class="bottoma" href="javascript:submit();">提交</a>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/md5.min.js"></script>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<script>
var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
$(function(){
$('#tx_alipay').click(function(){
$('#bank').hide();
});
$('#tx_bank').click(function(){
$('#bank').show();
});
});
function submit()
{
var url = '<?php echo env('APP_API_URL').'/user_withdraw_add'; ?>';
var name = $("#name").val();
var method = $('[name="method"][checked]').val();
var money = $("#money").val();
var account = $("#account").val();
var bank_name = $("#bank_name").val();
var bank_place = $("#bank_place").val();
var pay_password = $("#pay_password").val();
if(name == '' || method == '' || money == '' || account == '' || pay_password == '')
{
//提示
layer.open({
content: '请填写必填项'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}
if(method == 'bank')
{
if(bank_name == '' || bank_place == '')
{
//提示
layer.open({
content: '请填写必填项'
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}
}
$.post(url,{access_token:access_token,name:name,method:method,money:money,account:account,bank_name:bank_name,bank_place:bank_place,pay_password:md5(pay_password)},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.href = "<?php echo route('weixin_user_withdraw_list'); ?>";
}
else
{
}
},'json');
}
</script>
</body></html>

98
resources/views/weixin/user/userWithdrawList.blade.php

@ -0,0 +1,98 @@
<!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 .des{color:#999;font-size:16px;margin-bottom:5px;}
.money_list .time{color:#8e8e8e;font-size:12px;}
.money_list span{font-size:18px;float:right;vertical-align:middle;margin-top:5px;}
.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="des">收款账号:<?php echo $v['name']; ?> ,提现方式:<?php echo $v['method']; ?> ,姓名:<?php echo $v['name']; ?><br>状态:<font color="red"><?php echo $v['status_text']; ?></font></p>
<p class="time"><?php echo date('Y-m-d H:i:s',$v['add_time']); ?></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>

21
routes/web.php

@ -88,6 +88,8 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin', 'middleware' => ['w
Route::get('/user_point_list', 'UserController@userPointList')->name('weixin_user_point_list');
Route::get('/user_message_list', 'UserController@userMessageList')->name('weixin_user_message_list');
Route::get('/user_distribution', 'UserController@userDistribution')->name('weixin_user_distribution');
Route::any('/user_withdraw', 'UserController@userWithdraw')->name('weixin_user_withdraw');
Route::get('/user_withdraw_list', 'UserController@userWithdrawList')->name('weixin_user_withdraw_list');
//用户充值
Route::get('/user_recharge', 'UserController@userRecharge')->name('weixin_user_recharge');
Route::get('/user_recharge_order', 'UserController@userRechargeOrder')->name('weixin_user_recharge_order');
@ -110,6 +112,7 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin', 'middleware' => ['w
Route::get('/order_detail', 'OrderController@orderDetail')->name('weixin_order_detail'); //订单详情
Route::get('/order_wxpay', 'OrderController@orderWxpay')->name('weixin_order_wxpay'); //订单微信支付
Route::get('/order_yuepay', 'OrderController@orderYuepay')->name('weixin_order_yuepay'); //订单余额支付
Route::any('/order_comment', 'OrderController@orderComment')->name('weixin_order_comment'); //订单评价
//收货地址
Route::get('/user_address', 'AddressController@index')->name('weixin_user_address_list');
Route::get('/user_address_add', 'AddressController@userAddressAdd')->name('weixin_user_address_add');
@ -158,6 +161,7 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
Route::post('/user_info_update', 'UserController@userInfoUpdate'); //修改用户信息
Route::post('/user_password_update', 'UserController@userPasswordUpdate'); //修改用户密码、支付密码
Route::get('/user_list', 'UserController@userList'); //用户列表
Route::post('/user_money_update', 'UserController@userMoneyUpdate'); //修改用户余额
//用户充值
Route::post('/user_recharge_add', 'UserRechargeController@userRechargeAdd');
Route::get('/user_recharge_detail', 'UserRechargeController@userRechargeDetail');
@ -169,22 +173,29 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
Route::get('/user_message_list', 'UserMessageController@userMessageList');
Route::post('/user_message_add', 'UserMessageController@userMessageAdd');
Route::post('/user_message_update', 'UserMessageController@userMessageUpdate');
//用户提现
Route::get('/user_withdraw_list', 'UserWithdrawController@userWithdrawList');
Route::post('/user_withdraw_add', 'UserWithdrawController@userWithdrawAdd');
Route::post('/user_withdraw_update', 'UserWithdrawController@userWithdrawUpdate');
//浏览记录
Route::get('/user_goods_history_list', 'UserGoodsHistoryController@userGoodsHistoryList'); //我的足迹列表
Route::post('/user_goods_history_delete', 'UserGoodsHistoryController@userGoodsHistoryDelete'); //我的足迹删除一条
Route::post('/user_goods_history_clear', 'UserGoodsHistoryController@userGoodsHistoryClear'); //我的足迹清空
Route::post('/user_goods_history_add', 'UserGoodsHistoryController@userGoodsHistoryAdd'); //我的足迹添加
//商品评价
Route::get('/goods_comment_list', 'CommentController@goodsCommentList'); //商品评价列表
Route::post('/goods_comment_add', 'CommentController@goodsCommentAdd'); //商品评价添加
Route::post('/goods_comment_update', 'CommentController@goodsCommentUpdate'); //商品评价修改
Route::post('/goods_comment_delete', 'CommentController@goodsCommentDelete'); //商品评价删除
//评价
Route::get('/comment_list', 'CommentController@commentList'); //商品评价列表
Route::post('/comment_add', 'CommentController@commentAdd'); //商品评价添加
Route::post('/comment_batch_add', 'CommentController@commentBatchAdd'); //商品评价添加
Route::post('/comment_update', 'CommentController@commentUpdate'); //商品评价修改
Route::post('/comment_delete', 'CommentController@commentDelete'); //商品评价删除
//商品收藏
Route::get('/collect_goods_list', 'CollectGoodsController@collectGoodsList'); //收藏商品列表
Route::post('/collect_goods_add', 'CollectGoodsController@collectGoodsAdd'); //收藏商品
Route::post('/collect_goods_delete', 'CollectGoodsController@collectGoodsDelete'); //取消收藏商品
//订单
Route::post('/order_add', 'OrderController@orderAdd'); //生成订单
Route::post('/order_update', 'OrderController@orderUpdate'); //订单修改
Route::post('/order_status_update', 'OrderController@orderStatusUpdate'); //订单修改
Route::get('/order_list', 'OrderController@orderList'); //订单列表
Route::get('/order_detail', 'OrderController@orderDetail'); //订单详情
//购物车

Loading…
Cancel
Save