From c8e358e423355e8fc36a379630104a5b612907f4 Mon Sep 17 00:00:00 2001 From: "ZLW-PC\\Administrator" <374861669@qq.com> Date: Thu, 16 Nov 2017 17:32:24 +0800 Subject: [PATCH] cartcheckout --- .../Controllers/Weixin/CartController.php | 10 +- app/Http/Model/Cart.php | 6 +- app/Http/Model/UserAddress.php | 2 +- public/css/weixin/style.css | 6 +- public/js/weixin/mobile.js | 13 +- .../views/weixin/cart/cartCheckout.blade.php | 315 +++++++++++++++--- routes/web.php | 1 + 7 files changed, 304 insertions(+), 49 deletions(-) diff --git a/app/Http/Controllers/Weixin/CartController.php b/app/Http/Controllers/Weixin/CartController.php index 4fdc521..9a4a674 100644 --- a/app/Http/Controllers/Weixin/CartController.php +++ b/app/Http/Controllers/Weixin/CartController.php @@ -64,7 +64,6 @@ class CartController extends CommonController $res = curl_request($url,$postdata,'GET'); $data['user_default_address'] = $res['data']; - //用户收货地址列表 //收货地址列表 $postdata = array( 'limit' => 100, @@ -73,6 +72,15 @@ class CartController extends CommonController $url = env('APP_API_URL')."/user_address_list"; $res = curl_request($url,$postdata,'GET'); $data['address_list'] = $res['data']['list']; + $data['cartids'] = $ids; + + //获取会员信息 + $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']; return view('weixin.cart.cartCheckout', $data); } diff --git a/app/Http/Model/Cart.php b/app/Http/Model/Cart.php index f426c46..db049ce 100644 --- a/app/Http/Model/Cart.php +++ b/app/Http/Model/Cart.php @@ -198,6 +198,7 @@ class Cart extends BaseModel // 获取购物车列表 $cartList = self::where(array('user_id'=>$user_id))->whereIn('id', $cartIds)->get(); + $total_price = 0;//总金额 if(!empty($cartList)) { @@ -211,13 +212,16 @@ class Cart extends BaseModel $cartList[$k]->is_promote = 0; if(Goods::bargain_price($goods->price,$goods->promote_start_date,$goods->promote_end_date) > 0){$cartList[$k]->is_promote = 1;} - $cartList[$k]->final_price = Goods::get_final_price($v['goods_id']); //商品最终价格 + $cartList[$k]->final_price = Goods::get_final_price($v['goods_id']); //商品最终价格 $cartList[$k]->goods_detail_url = route('weixin_goods_detail',array('id'=>$v['goods_id'])); $cartList[$k]->title = $goods->title; $cartList[$k]->litpic = $goods->litpic; + + $total_price += $cartList[$k]->final_price*$tempInfo['price']; } } + $res['list'] = $cartList; $res['list'] = $cartList; return ReturnData::create(ReturnData::SUCCESS,$res); diff --git a/app/Http/Model/UserAddress.php b/app/Http/Model/UserAddress.php index 38fe811..af2179f 100644 --- a/app/Http/Model/UserAddress.php +++ b/app/Http/Model/UserAddress.php @@ -90,7 +90,7 @@ class UserAddress extends BaseModel { extract($param); - if(UserAddress::where('user_id', $user_id)->count() >= 3) + if(UserAddress::where('user_id', $user_id)->count() >= 10) { return ReturnData::create(ReturnData::PARAMS_ERROR,null,'最多10个收货地址'); } diff --git a/public/css/weixin/style.css b/public/css/weixin/style.css index 92cbea5..20a230d 100644 --- a/public/css/weixin/style.css +++ b/public/css/weixin/style.css @@ -7,6 +7,8 @@ a{color:#333;text-decoration:none}.cse a,.cses{color:#008000;}.ofh{overflow:hidd .table-cell{display:table;width:100%;} .box{margin-left:10px;margin-right:10px;overflow:hidden;} +.mask_layer{width:100%;height:100%;background:rgba(0,0,0,0.7);position:fixed;top:0;} +#mask_msg{background:rgba(0,0,0,0.7);position:fixed;top:30%;left:20%;width:60%;border-radius:4px;padding:10px 0;text-align:center;color:#fff;font-size:14px;display:none;z-index:999;} .foohi{height:52px;} .footer{left:0px;bottom:0px;width:100%;position:fixed;border-top:1px solid #efefef;background:#fff;} @@ -926,7 +928,3 @@ top: 0; - - - - diff --git a/public/js/weixin/mobile.js b/public/js/weixin/mobile.js index f6a7ff3..50d8828 100644 --- a/public/js/weixin/mobile.js +++ b/public/js/weixin/mobile.js @@ -41,4 +41,15 @@ function validatemobile(mobile) } return true; -} \ No newline at end of file +} + +//提示层 +function messageNotice(message,time) +{ + time = time*1000 || 3000; + // 创建一个 Mask 层,追加到body中 + $('body').append('
'); + $('#mask_msg').html(message); + $('#mask_msg').show(); + setInterval(function(){$('#mask_msg').remove();},time); +} diff --git a/resources/views/weixin/cart/cartCheckout.blade.php b/resources/views/weixin/cart/cartCheckout.blade.php index 96d238a..e652b94 100644 --- a/resources/views/weixin/cart/cartCheckout.blade.php +++ b/resources/views/weixin/cart/cartCheckout.blade.php @@ -15,6 +15,9 @@ @include('weixin.common.headerNav') +