Browse Source

order pay

master
ZLW-PC\Administrator 7 years ago
parent
commit
62dd44c374
  1. 32
      app/Http/Controllers/Api/OrderController.php
  2. 44
      app/Http/Controllers/Weixin/OrderController.php
  3. BIN
      public/images/weixin/wxpay_icon.png
  4. BIN
      public/images/weixin/yuepay_icon.png
  5. 63
      resources/views/weixin/order/pay.blade.php
  6. 10
      resources/views/weixin/user/index.blade.php
  7. 5
      routes/web.php

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

@ -25,24 +25,38 @@ class OrderController extends CommonController
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//订单详情
public function orderDetail(Request $request)
{
//参数
$data['user_id'] = Token::$uid;
$res = Order::getList($data);
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//生成订单
public function orderAdd(Request $request)
{return ReturnData::create(ReturnData::SUCCESS);
{
//参数
$data['goods_number'] = $request->input('goods_number','');
$data['goods_id'] = $request->input('goods_id','');
$default_address_id = $request->input('default_address_id','');
$payid = $request->input('payid','');
$user_bonus_id = $request->input('user_bonus_id','');
$shipping_costs = $request->input('shipping_costs','');
$message = $request->input('message','');
if($request->input('goods_attr', '') != ''){$data['goods_attr'] = $request->input('goods_attr');}
if($request->input('shop_id', '') != ''){$data['shop_id'] = $request->input('shop_id');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
//获取商品列表
$cartids = $request->input('cartids','');
if($data['goods_number']=='' || $data['goods_id']=='')
if($cartids=='')
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
return Order::cartAdd($data);
$orderGoods = Cart::cartCheckoutGoodsList(array('ids'=>$cartids,'user_id'=>Token::$uid));
return Order::add($data);
}
//删除订单

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

@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
class OrderController extends CommonController
{
public function __construct()
{
parent::__construct();
}
//订单支付
public function pay($id)
{
//获取订单详情
$postdata = array(
'order_id' => $id, //要支付的订单id
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/order_detail";
$res = curl_request($url,$postdata,'GET');
$data['order_detail'] = $res['data'];
$data['order_id'] = $id;
//获取会员信息
$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'];
//判断余额是否足够
$is_balance_enough = 1; //足够
if($data['order_detail']['total_price']>$data['user_info']['money']){$is_balance_enough = 0;}
$data['is_balance_enough'] = $is_balance_enough;
return view('weixin.order.pay', $data);
}
}

BIN
public/images/weixin/wxpay_icon.png

Binary file not shown.

After

Width: 175  |  Height: 175  |  Size: 131 KiB

BIN
public/images/weixin/yuepay_icon.png

Binary file not shown.

After

Width: 169  |  Height: 168  |  Size: 105 KiB

63
resources/views/weixin/order/pay.blade.php

@ -0,0 +1,63 @@
<!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>
<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:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
</div>
@include('weixin.common.headerNav')
<div class="floor">
<form action="<?php echo route('weixin_order_dopay'); ?>" method="POST" id="goto_pay">
<input type="hidden" name="order_id" value="<?php echo $order_id; ?>">
<div class="step_main">
<div class="clue_on"><p>您的订单已成功生成,选择您想用的支付方式进行支付。</p></div>
<div class="order_info">
<p>订单编号:<span><?php echo $order_id; ?></span></p>
<p>应付金额:<span>¥608.00</span></p>
</div>
<div class="payment mt10">
<h3>选择支付方式付款</h3>
<dl class="defray">
<dd>
<p class="radio"><input id="payment_yuer" name="payment_id" value="4" type="radio"></p>
<label for="payment_yuer"><p class="logo"><img src="<?php echo env('APP_URL'); ?>/images/weixin/yuepay_icon.png"></p>
<p class="explain">余额支付</p></label>
</dd>
<dd>
<p class="radio"><input id="payment_wxpay" name="payment_id" value="3" type="radio" checked="checked"></p>
<label for="payment_wxpay"><p class="logo"><img src="<?php echo env('APP_URL'); ?>/images/weixin/wxpay_icon.png"></p>
<p class="explain">微信支付</p></label>
</dd>
</dl>
<div class="cl"></div>
</div>
<a href="javascript:$('#goto_pay').submit();" class="bottoma" style="margin-top:10px;margin-bottom:15px;background-color:#1aad19;border:1px solid #179e16;color:white;border-radius:2px;text-align:center;">确认支付</a>
<div class="remark" style="color:#666;">
您可以在 <a href="<?php echo route('weixin_order_list'); ?>">我的订单</a> 中查看或取消您的订单。<br>
如果您现在不方便支付,可以随后到 <a href="<?php echo route('weixin_order_list'); ?>">我的订单</a>完成支付,我们会在48小时内为您保留未支付的订单。
</div>
</div>
</form>
</div>
<style>
.step_main{padding:10px;}
.step_main .clue_on{color:#666;}
.step_main .order_info{color:#999;}
.step_main .order_info span{color:#f34;}
.step_main h4,.step_main h3{padding:5px 0;font-weight:normal;color:#333;}
.defray{margin-top:5px;}
.defray dd{min-height:36px;line-height:36px;border-top:1px solid #eee;padding:6px 0;clear:both;}
.defray dd p.logo img{float:left;height:36px;}
.defray dd p.explain{float:left;color:#787878;margin-left:10px;}
.radio{float:left;width:20px;}
.bottoma{display:block;font-size:18px;padding:10px;color:white;background-color:#f23030;text-align:center;}
</style>
@include('weixin.common.footer')
</body></html>

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

@ -52,7 +52,7 @@
<span>我的订单</span>
</div>
<div class="fr">
<a href="/index.php/Mobile/User/order_list.html">
<a href="<?php echo route('weixin_order_list'); ?>">
<span>全部订单</span>
<i class="Mright"></i>
</a>
@ -63,28 +63,28 @@
<div class="floor floor_order">
<ul>
<li>
<a href="/index.php/Mobile/User/order_list/type/WAITPAY.html">
<a href="<?php echo route('weixin_order_list',array('status'=>0)); ?>">
<span>0</span>
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q1.png" alt="">
<p>待付款</p>
</a>
</li>
<li>
<a href="/index.php/Mobile/User/wait_receive/type/WAITRECEIVE.html">
<a href="<?php echo route('weixin_order_list',array('status'=>0)); ?>">
<span>0</span>
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q2.png" alt="">
<p>待收货</p>
</a>
</li>
<li>
<a href="/index.php/Mobile/User/comment/status/0.html">
<a href="<?php echo route('weixin_order_list',array('status'=>0)); ?>">
<span>0</span>
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q3.png" alt="">
<p>待评价</p>
</a>
</li>
<li>
<a href="/index.php/Mobile/User/return_goods_list/type/1.html">
<a href="<?php echo route('weixin_order_list',array('status'=>0)); ?>">
<span>0</span>
<img src="<?php echo env('APP_URL'); ?>/images/weixin/q4.png" alt="">
<p>退款/退货</p>

5
routes/web.php

@ -100,7 +100,9 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin', 'middleware' => ['w
Route::get('/cart_checkout/{ids}', 'CartController@cartCheckout')->name('weixin_cart_checkout');
Route::post('/cart_done', 'CartController@cartDone')->name('weixin_cart_done');
//订单
Route::get('/order_pay/{id}', 'OrderController@orderPay')->name('weixin_order_pay'); //订单支付
Route::get('/order_pay/{id}', 'OrderController@pay')->name('weixin_order_pay'); //订单支付
Route::post('/order_dopay', 'OrderController@dopay')->name('weixin_order_dopay'); //订单支付
Route::get('/order_list', 'OrderController@orderList')->name('weixin_order_list'); //全部订单列表
//收货地址
Route::get('/user_address', 'AddressController@index')->name('weixin_user_address_list');
Route::get('/user_address_add', 'AddressController@userAddressAdd')->name('weixin_user_address_add');
@ -170,6 +172,7 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
//订单
Route::post('/order_add', 'OrderController@orderAdd'); //生成订单
Route::get('/order_list', 'OrderController@orderList'); //订单列表
Route::get('/order_detail', 'OrderController@orderDetail'); //订单详情
//购物车
Route::get('/cart_list', 'CartController@cartList'); //购物车列表
Route::post('/cart_clear', 'CartController@cartClear'); //清空购物车

Loading…
Cancel
Save