Browse Source

我的收藏列表

master
林一峰 7 years ago
parent
commit
278eb49fbd
  1. 15
      app/Http/Controllers/Api/UserAddressController.php
  2. 87
      app/Http/Controllers/Weixin/AddressController.php
  3. 50
      app/Http/Controllers/Weixin/CollectGoodsController.php
  4. 22
      app/Http/Controllers/Weixin/UserController.php
  5. 20
      app/Http/Model/CollectGoods.php
  6. 2
      app/Http/Model/User.php
  7. 74
      app/Http/Model/UserAddress.php
  8. 20
      public/css/weixin/style.css
  9. 0
      public/images/weixin/no_user.jpg
  10. 139
      resources/views/weixin/address/index.blade.php
  11. 110
      resources/views/weixin/address/userAddressAdd.blade.php
  12. 111
      resources/views/weixin/collect_goods/index.blade.php
  13. 4
      resources/views/weixin/user/index.blade.php
  14. 5
      resources/views/weixin/user/userGoodsHistory.blade.php
  15. 89
      resources/views/welcome.blade.php
  16. 192
      routes/web.php

15
app/Http/Controllers/Api/UserAddressController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\UserAddress;
@ -23,6 +24,7 @@ class UserAddressController extends CommonController
$data['user_id'] = Token::$uid;
$res = UserAddress::getList($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
@ -68,18 +70,16 @@ class UserAddressController extends CommonController
$data['user_id'] = Token::$uid;
$data['name'] = $request->input('name',null);
$data['mobile'] = $request->input('mobile',null);
$data['country'] = $request->input('country',null);
$data['province'] = $request->input('province',null);
$data['city'] = $request->input('city',null);
$data['district'] = $request->input('district',null);
$data['address'] = $request->input('address',null);
if($request->input('country',null)!==null){$data['country'] = $request->input('country');}
if($request->input('telphone',null)!==null){$data['telphone'] = $request->input('telphone');}
if($request->input('zipcode',null)!==null){$data['zipcode'] = $request->input('zipcode');}
if($request->input('email',null)!==null){$data['email'] = $request->input('email');}
if($request->input('best_time',null)!==null){$data['best_time'] = $request->input('best_time');}
if($request->input('is_default',null)!==null){$data['is_default'] = $request->input('is_default');}
if($data['name']===null || $data['mobile']===null || $data['address']===null || $data['country']===null || $data['province']===null || $data['city']===null || $data['district']===null)
if($data['name']===null || $data['mobile']===null || $data['address']===null || $data['province']===null || $data['city']===null || $data['district']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
@ -130,7 +130,12 @@ class UserAddressController extends CommonController
public function userAddressDelete(Request $request)
{
//参数
$id = $request->input('id',null);
$id = $request->input('id','');
if($id == '')
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = UserAddress::remove($id,Token::$uid);
if(!$res)

87
app/Http/Controllers/Weixin/AddressController.php

@ -0,0 +1,87 @@
<?php
namespace App\Http\Controllers\Weixin;
use App\Http\Controllers\Weixin\CommonController;
use Illuminate\Http\Request;
class AddressController extends CommonController
{
public function __construct()
{
parent::__construct();
}
//收货地址列表
public function index(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_address_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 .= '<div class="flow-have-adr">';
if($v['is_default']==1)
{
$html .= '<p class="f-h-adr-title"><label>'.$v['name'].'</label><span class="ect-colory">'.$v['mobile'].'</span><span class="fr">默认</span></p>';
}
else
{
$html .= '<p class="f-h-adr-title"><label>'.$v['name'].'</label><span class="ect-colory">'.$v['mobile'].'</span></p>';
}
$html .= '<p class="f-h-adr-con">'.$v['province'].$v['city'].$v['district'].' '.$v['address'].'</p>';
$html .= '<div class="adr-edit-del"><a href="'.route('weixin_user_address_update',array('id'=>$v['id'])).'"><i class="iconfont icon-bianji"></i>编辑</a><a href="javascript:del('.$v['id'].');"><i class="iconfont icon-xiao10"></i>删除</a></div>';
$html .= '</div>';
}
}
exit(json_encode($html));
}
return view('weixin.address.index', $data);
}
//收货地址添加
public function userAddressAdd(Request $request)
{
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
//商品列表
$postdata = array(
'access_token' => $_SESSION['weixin_user_info']['access_token'],
'limit' => 10,
'offset' => 0
);
$url = env('APP_API_URL')."/user_address_list";
$goods_list = curl_request($url,$postdata,'GET');
$data['user_address_list'] = $goods_list['data']['list'];
return view('weixin.address.userAddressAdd', $data);
}
}

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

@ -11,27 +11,43 @@ class CollectGoodsController extends CommonController
parent::__construct();
}
//商品列表
public function goodslist(Request $request)
//商品收藏列表
public function index(Request $request)
{
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
$pagesize = 10;
$offset = 0;
if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
//商品列表
$postdata = array(
'limit' => 10,
'offset' => 0
'limit' => $pagesize,
'offset' => $offset,
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/goods_list";
$goods_list = curl_request($url,$postdata,'GET');
$data['goods_list'] = $goods_list['data']['list'];
$url = env('APP_API_URL')."/collect_goods_list";
$res = curl_request($url,$postdata,'GET');
$data['list'] = $res['data']['list'];
return view('weixin.goods.goodslist', $data);
$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><a href="'.$v['goods']['goods_detail_url'].'"><span class="goods_thumb"><img alt="'.$v['goods']['title'].'" src="'.env('APP_URL').$v['goods']['litpic'].'"></span></a>';
$html .= '<div class="goods_info"><p class="goods_tit">'.$v['goods']['title'].'</p>';
$html .= '<p class="goods_price">¥<b>'.$v['goods']['price'].'</b></p>';
$html .= '<p class="goods_des fr"><span id="del_history" onclick="delconfirm(\''.route('weixin_user_goods_history_delete',array('id'=>$v['id'])).'\')">删除</span></p>';
$html .= '</div></li>';
}
}
exit(json_encode($html));
}
return view('weixin.collect_goods.index', $data);
}
}

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

@ -14,24 +14,16 @@ class UserController extends CommonController
//个人中心
public function index(Request $request)
{$_SESSION['weixin_user_info']['access_token'] = '72d623d26a1a6d61186a97f9ccf752f7';
if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
{
$_SESSION['weixin_user_info']['access_token'] = '72d623d26a1a6d61186a97f9ccf752f7';
//商品列表
//获取会员信息
$postdata = array(
'limit' => 10,
'offset' => 0
'access_token' => $_SESSION['weixin_user_info']['access_token']
);
$url = env('APP_API_URL')."/goods_list";
$goods_list = curl_request($url,$postdata,'GET');
$data['goods_list'] = $goods_list['data']['list'];
$url = env('APP_API_URL')."/user_info";
$res = curl_request($url,$postdata,'GET');
$data['user_info'] = $res['data'];
return view('weixin.user.index', $data);
}

20
app/Http/Model/CollectGoods.php

@ -37,7 +37,17 @@ class CollectGoods extends BaseModel
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get();
if($res['list'])
{
foreach($res['list'] as $k=>$v)
{
$goods = Goods::getOne(array('id'=>$v['goods_id'],'field'=>array('id', 'typeid', 'tuijian', 'click', 'title', 'sn', 'price','litpic', 'pubdate', 'add_time', 'market_price', 'goods_number', 'sale', 'comments','promote_start_date','promote_price','promote_end_date','goods_img','spec','point')));
$res['list'][$k]['goods'] = $goods;
}
}
}
else
{
@ -47,9 +57,13 @@ class CollectGoods extends BaseModel
return $res;
}
public static function getOne($id)
public static function getOne(array $param)
{
return self::where('id', $id)->first()->toArray();
extract($param); //参数
$where['id'] = $id;
return self::where($where)->first();
}
public static function add(array $data)

2
app/Http/Model/User.php

@ -16,7 +16,7 @@ class User extends BaseModel
* @var array
*/
protected $guarded = [];
protected $hidden = ['password'];
/**
* 获取关联到用户的角色
*/

74
app/Http/Model/UserAddress.php

@ -25,24 +25,24 @@ class UserAddress extends BaseModel
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = self::where('user_id', $user_id);
$model = self::where(array('user_id'=>$user_id));
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->get()->toArray();
$res['list'] = $model->skip($offset)->take($limit)->get();
if($res['list'])
{
foreach($res['list'] as $k=>$v)
/* foreach($res['list'] as $k=>$v)
{
$res['list'][$k]['country_name'] = Region::getRegionName($v['country']);
$res['list'][$k]['province_name'] = Region::getRegionName($v['province']);
$res['list'][$k]['city_name'] = Region::getRegionName($v['city']);
$res['list'][$k]['district_name'] = Region::getRegionName($v['district']);
}
} */
}
}
else
@ -62,13 +62,13 @@ class UserAddress extends BaseModel
{
$arr = self::where('id',$address_id)->first();
if($arr)
/* if($arr)
{
$arr->country_name = Region::getRegionName($arr->country);
$arr->province_name = Region::getRegionName($arr->province);
$arr->city_name = Region::getRegionName($arr->city);
$arr->district_name = Region::getRegionName($arr->district);
}
} */
return $arr;
}
@ -77,16 +77,16 @@ class UserAddress extends BaseModel
{
// 取默认地址
$arr = self::join('user','user_address.id', '=', 'user.address_id')
->where('user.id',$user_id)->select('user_address.id','user_address.name','country','province','city','district','address','user_address.mobile','zipcode','best_time')
->where('user.id',$user_id)->select('user_address.id','user_address.name','country','province','city','district','address','user_address.mobile','zipcode')
->first();
if($arr)
/* if($arr)
{
$arr->country_name = Region::getRegionName($arr->country);
$arr->province_name = Region::getRegionName($arr->province);
$arr->city_name = Region::getRegionName($arr->city);
$arr->district_name = Region::getRegionName($arr->district);
}
} */
}
return $arr;
@ -97,20 +97,18 @@ class UserAddress extends BaseModel
extract($param);
$model = new UserAddress;
$model->user_id = $user_id;
$model->name = $name;
$model->email = isset($email) ? $email : '';
$model->country = isset($country) ? $country : 0;
$model->province = isset($province) ? $province : 0;
$model->city = isset($city) ? $city : 0;
$model->district = isset($district) ? $district : 0;
$model->address = $address;
$model->mobile = isset($mobile) ? $mobile : '';
$model->telphone = isset($telphone) ? $telphone : '';
$model->zipcode = isset($zipcode) ? $zipcode : '';
$model->sign_building = isset($sign_building) ? $sign_building : '';
$model->best_time = isset($best_time) ? $best_time : '';
$model->is_default = isset($is_default) ? $is_default : 0;
$model->user_id = $user_id;
$model->name = $name;
$model->address = $address;
$model->mobile = $mobile;
$model->is_default = isset($is_default) ? $is_default : 0;
if(isset($country)){$model->country = isset($country) ? $country : 0;}
if(isset($province)){$model->province = isset($province) ? $province : 0;}
if(isset($city)){$model->city = isset($city) ? $city : 0;}
if(isset($district)){$model->district = isset($district) ? $district : 0;}
if(isset($telphone)){$model->telphone = isset($telphone) ? $telphone : '';}
if(isset($zipcode)){$model->zipcode = isset($zipcode) ? $zipcode : '';}
if ($model->save())
{
@ -118,7 +116,7 @@ class UserAddress extends BaseModel
if (!UserAddress::where('id', $user->address_id)->first() || $model->is_default!=0)
{
self::setDefault($model->id);
self::setDefault($model->id,$user_id);
}
return $model->toArray();
@ -134,25 +132,23 @@ class UserAddress extends BaseModel
if ($model = UserAddress::where('id', $id)->where('user_id', $user_id)->first())
{
$model->user_id = $user_id;
$model->name = $name;
$model->email = isset($email) ? $email : '';
$model->country = isset($country) ? $country : 0;
$model->province = isset($province) ? $province : 0;
$model->city = isset($city) ? $city : 0;
$model->district = isset($district) ? $district : 0;
$model->address = $address;
$model->mobile = isset($mobile) ? $mobile : '';
$model->telphone = isset($telphone) ? $telphone : '';
$model->zipcode = isset($zipcode) ? $zipcode : '';
$model->sign_building = isset($sign_building) ? $sign_building : '';
$model->best_time = isset($best_time) ? $best_time : '';
$model->is_default = isset($is_default) ? $is_default : 0;
$model->is_default = isset($is_default) ? $is_default : 0;
if(isset($name)){$model->name = $country;}
if(isset($country)){$model->country = $country;}
if(isset($province)){$model->province = $province;}
if(isset($city)){$model->city = $city;}
if(isset($district)){$model->district = $district;}
if(isset($address)){$model->address = $address;}
if(isset($mobile)){$model->mobile = $mobile;}
if(isset($telphone)){$model->telphone = $telphone;}
if(isset($zipcode)){$model->zipcode = $zipcode;}
if ($model->save())
{
if ($model->is_default!=0)
{
self::setDefault($model->id);
self::setDefault($model->id,$user_id);
}
return $model->toArray();
@ -175,6 +171,8 @@ class UserAddress extends BaseModel
{
$user->address_id = $address->id;
$user->save();
self::where('id',$address->id)->update(array('is_default' => 1));
}
}
}

20
public/css/weixin/style.css

@ -768,17 +768,15 @@ margin:5px 0
}
.setting .close a {
display: block;
background: #ec5151;
text-align: center;
width: 100%;
height:40px;
line-height:40px;
color: #fff;
font-size:18px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px
display: block;
background: #ec5151;
text-align: center;
padding:10px;
color: #fff;
font-size:18px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px
}
h1.arc_tit, h2.arc_tit{font-weight: normal;font-size: 1.4em;padding: 10px;}

0
public/images/weixin/user68.jpg → public/images/weixin/no_user.jpg

Before

Width: 95  |  Height: 95  |  Size: 14 KiB

After

Width: 95  |  Height: 95  |  Size: 14 KiB

139
resources/views/weixin/address/index.blade.php

@ -0,0 +1,139 @@
<!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:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
</div>
<div class="flool tpnavf cl">
<div class="nav_list">
<ul>
<a href="<?php echo route('weixin'); ?>"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/home_icon.png"><p>首页</p></li></a>
<a href="/Weixin/index.php?m=Store&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/brand_icon.png"><p>分类</p></li></a>
<a href="/Weixin/index.php?m=Cart&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/car_icon.png"><p>购物车</p></li></a>
<a href="/Weixin/index.php?m=User&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/center_icon.png"><p>个人中心</p></li></a></ul>
<div class="cl"></div>
</div>
</div>
<style>
.address_list .flow-have-adr{padding:15px;margin-bottom:10px;background-color:#fff;}
.address_list .f-h-adr-title .ect-colory{color:#e23435;}
.address_list .f-h-adr-title label{font-size:18px;color:#000;margin-right:5px;}
.address_list .f-h-adr-con{color:#777;margin-top:5px;margin-bottom:5px;}
.address_list .adr-edit-del{text-align:right;}
.address_list .adr-edit-del a{color:#777;margin-right:8px;}
.address_list .f-h-adr-title span.fr{background-color: #f23030;color: white;padding:0 5px;}
.bottoma{display:block;font-size:18px;padding:10px;color:white;background-color: #f23030;text-align:center;}
</style>
<a style="margin:10px;" class="bottoma" href="<?php echo route('weixin_user_address_add'); ?>">新增地址</a>
<div class="address_list">
<?php if($list){foreach($list as $k=>$v){ ?>
<div class="flow-have-adr">
<p class="f-h-adr-title"><label><?php echo $v['name']; ?></label><span class="ect-colory"><?php echo $v['mobile']; ?></span><?php if($v['is_default']==1){ ?><span class="fr">默认</span><?php } ?></p>
<p class="f-h-adr-con"><?php echo $v['province'].$v['city'].$v['district'].' '.$v['address']; ?></p>
<div class="adr-edit-del"><a href="<?php echo route('weixin_user_address_update',array('id'=>$v['id'])); ?>"><i class="iconfont icon-bianji"></i>编辑</a><a href="javascript:del(<?php echo $v['id']; ?>);"><i class="iconfont icon-xiao10"></i>删除</a></div>
</div>
<?php }} ?>
</div>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<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 = $(".address_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)
{
$(".address_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');
}
}
});
});
function del(id)
{
//询问框
layer.open({
content: '确定要删除吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/user_address_delete"; ?>';
$.post(url,{access_token:'<?php echo $_SESSION['weixin_user_info']['access_token']; ?>',id:id},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>

110
resources/views/weixin/address/userAddressAdd.blade.php

@ -0,0 +1,110 @@
<!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:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
</div>
<div class="flool tpnavf cl">
<div class="nav_list">
<ul>
<a href="index.html"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/home_icon.png"><p>首页</p></li></a>
<a href="/Weixin/index.php?m=Store&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/brand_icon.png"><p>分类</p></li></a>
<a href="/Weixin/index.php?m=Cart&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/car_icon.png"><p>购物车</p></li></a>
<a href="/Weixin/index.php?m=User&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/center_icon.png"><p>个人中心</p></li></a></ul>
<div class="cl"></div>
</div>
</div>
<style>
.adr_add{margin:0 10px;}
.adr-form-group{margin-top:10px;}
.adr-form-group input[type=text],.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;}
</style>
<div class="adr_add">
<div class="adr-form-group">
<label for="doc-ipt-email-1">收货人</label>
<input name="name" type="text" class="" id="name" placeholder="输入姓名">
</div>
<div class="adr-form-group">
<label for="doc-ipt-email-1">手机号码</label>
<input type="text" name="mobile" class="" id="mobile" placeholder="输入手机号码">
</div>
<div class="adr-form-group">
<label for="doc-ipt-email-1">地区</label>
<input type="text" class="" id="doc-ipt-email-1" placeholder="输入电子邮件">
</div>
<div class="adr-form-group">
<label for="doc-ta-1">详细地址</label>
<textarea name="address" class="" rows="3" id="address"></textarea>
</div>
<div class="adr-form-group">
<label>
<input type="checkbox" name="is_default" id="is_default"> 设为默认
</label>
</div>
</div>
<a style="margin:10px;" class="bottoma" href="javascript:adr_dosubmit();">提交</a>
<script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
<script>
function adr_dosubmit()
{
var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
var url = '<?php echo env('APP_API_URL').'/user_address_add'; ?>';
var name = $("#name").val();
var mobile = $("#mobile").val();
var address = $("#address").val();
var province = '福建';
var city = '厦门';
var district = '湖里';
var is_default = 0;
if(document.getElementById("is_default").checked){is_default = 1;}
$.post(url,{access_token:access_token,name:name,mobile:mobile,address:address,province:province,city:city,district:district,is_default:is_default},function(res)
{
if(res.code==0)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
window.history.back();
}
else
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
var url = "http://www.baidu.com";
location.href = url;
}
},'json');
}
</script>
</body></html>

111
resources/views/weixin/collect_goods/index.blade.php

@ -0,0 +1,111 @@
<!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>
<div class="floor">
<ul class="goods_list_s cl">
<?php if($list){foreach($list as $k=>$v){ ?>
<li><a href="<?php echo $v['goods']['goods_detail_url']; ?>"><span class="goods_thumb"><img alt="<?php echo $v['goods']['title']; ?>" src="<?php echo env('APP_URL'); ?><?php echo $v['goods']['litpic']; ?>"></span></a>
<div class="goods_info"><p class="goods_tit"><?php echo $v['goods']['title']; ?></p>
<p class="goods_price"><b><?php echo $v['goods']['price']; ?></b></p>
<p class="goods_des fr"><span id="del_history" onclick="del('<?php echo $v['goods_id']; ?>')">删除</span></p>
</div></li>
<?php }} ?>
</ul>
</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 = $(".goods_list_s").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)
{
$(".goods_list_s").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');
}
}
});
});
function del(goods_id)
{
//询问框
layer.open({
content: '确定要删除吗?'
,btn: ['确定', '取消']
,yes: function(){
var url = '<?php echo env('APP_API_URL')."/collect_goods_delete"; ?>';
$.post(url,{goods_id:goods_id,access_token:'<?php echo $_SESSION['weixin_user_info']['access_token']; ?>'},function(res)
{
//提示
layer.open({
content: res.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
if(res.code==0)
{
location.reload();
}
},'json');
}
});
}
</script>
@include('weixin.common.footer')
</body></html>

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

@ -7,11 +7,11 @@
<!--<a href="">-->
<div class="fl personicon">
<div class="personicon">
<img src="<?php echo env('APP_URL'); ?>/images/weixin/user68.jpg">
<img src="<?php echo $user_info['head_img']; ?>" onerror="this.src='<?php echo env('APP_URL'); ?>/images/weixin/no_user.jpg'">
</div>
</div>
<div class="fl lors">
<span>15280719357</span>
<span><?php if($user_info['user_name']){echo $user_info['user_name'];}else{echo $user_info['mobile'];} ?></span>
</div>
<!--</a>-->
</div>

5
resources/views/weixin/user/userGoodsHistory.blade.php

@ -78,9 +78,8 @@ $(function(){
},'json');
}
}
});
})
});
});
</script>
@include('weixin.common.footer')

89
resources/views/welcome.blade.php

@ -1,89 +0,0 @@
<!doctype html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Styles -->
<style>
html, body {
background-color: #fff;
color: #636b6f;
font-family: 'Raleway', sans-serif;
font-weight: 100;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 84px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 12px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head><body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@if (Auth::check())
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ url('/login') }}">Login</a>
<a href="{{ url('/register') }}">Register</a>
@endif
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
</html>

192
routes/web.php

@ -75,8 +75,10 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin'], function () {
Route::get('/cart', 'CartController@index')->name('weixin_cart');
//收货地址
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_update', 'AddressController@userAddressUpdate')->name('weixin_user_address_update');
//页面跳转
Route::get('/jump', 'IndexController@jump')->name('weixin_jump');
@ -84,6 +86,96 @@ Route::group(['prefix' => 'weixin', 'namespace' => 'Weixin'], function () {
});
//无需token验证,全局
Route::group(['middleware' => ['web']], function () {
Route::post('/dataapi/listarc', 'Api\IndexController@listarc')->name('api_listarc');
Route::post('/dataapi/customer_login', 'Api\WechatAuthController@customerLogin');
Route::post('/dataapi/', 'Api\UserController@signin'); //签到
});
//API接口路由,无需token验证
Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web']], function () {
//轮播图
Route::get('/slide_list', 'SlideController@slideList');
//文章
Route::get('/article_list', 'ArticleController@articleList');
Route::get('/article_detail', 'ArticleController@articleDetail');
Route::get('/arctype_list', 'ArctypeController@arctypeList');
Route::get('/arctype_detail', 'ArctypeController@arctypeDetail');
//商品
Route::get('/goods_list', 'GoodsController@goodsList'); //商品列表
Route::get('/goodstype_list', 'GoodsTypeController@goodsTypeList'); //商品分类列表
});
//API接口路由,需token验证
Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web','token']], function () {
//用户中心
Route::post('/user_signin', 'UserController@signin'); //签到
Route::get('/user_info', 'UserController@userInfo'); //用户详细信息
Route::post('/user_info_update', 'UserController@userInfoUpdate'); //修改用户信息
Route::get('/user_list', 'UserController@userList'); //用户列表
Route::get('/user_money_list', 'UserMoneyController@userMoneyList'); //用户余额明细
Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd'); //添加余额明细
//浏览记录
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::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('/collect_goods_list', 'CollectGoodsController@collectGoodsList'); //收藏商品列表
Route::post('/collect_goods_add', 'CollectGoodsController@collectGoodsAdd'); //收藏商品
Route::post('/collect_goods_delete', 'CollectGoodsController@collectGoodsDelete'); //取消收藏商品
//订单
//购物车
Route::get('/cart_list', 'CartController@cartList'); //购物车列表
Route::post('/cart_clear', 'CartController@cartClear'); //清空购物车
Route::post('/cart_add', 'CartController@cartAdd'); //添加购物车
Route::post('/cart_update', 'CartController@cartUpdate'); //修改购物车
//分销
//积分
Route::get('/user_point_list', 'UserPointController@userPointList'); //用户积分列表
Route::post('/user_point_add', 'UserPointController@userPointAdd');
//优惠券
Route::get('/user_bonus_list', 'BonusController@userBonusList'); //用户优惠券列表
Route::post('/user_get_bonus', 'BonusController@userGetBonus'); //用户获取优惠券
Route::get('/bonus_list', 'BonusController@bonusList'); //可用获取的优惠券列表
Route::post('/bonus_add', 'BonusController@bonusAdd'); //添加优惠券
Route::post('/bonus_update', 'BonusController@bonusUpdate'); //修改优惠券
Route::post('/bonus_delete', 'BonusController@bonusDelete'); //删除优惠券
//微信
//意见反馈
Route::get('/feedback_list', 'FeedBackController@feedbackList');
Route::post('/feedback_add', 'FeedBackController@feedbackAdd');
//其它
Route::get('/verifycode_check', 'VerifyCodeController@check'); //验证码校验
Route::get('/andriod_upgrade', 'IndexController@andriodUpgrade'); //安卓升级
//图片上传
Route::post('/image_upload', 'ImageController@imageUpload'); //普通文件/图片上传
//二维码
Route::get('/create_simple_qrcode', 'QrcodeController@createSimpleQrcode');
//收货地址
Route::get('/user_address_list', 'UserAddressController@userAddressList');
Route::get('/user_address_detail', 'UserAddressController@userAddressDetail');
Route::post('/user_address_setdefault', 'UserAddressController@userAddressSetDefault');
Route::post('/user_address_add', 'UserAddressController@userAddressAdd');
Route::post('/user_address_update', 'UserAddressController@userAddressUpdate');
Route::post('/user_address_delete', 'UserAddressController@userAddressDelete');
//地区,省市区
Route::get('/region_list', 'RegionController@regionList');
Route::get('/region_detail', 'RegionController@regionDetail');
});
//后台路由
Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['web']], function () {
Route::get('/', 'IndexController@index')->name('admin');
@ -207,100 +299,4 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w
Route::get('/jump', 'LoginController@jump')->name('admin_jump');
//测试
Route::get('/test', 'LoginController@test')->name('admin_test');
});
//无需token验证,全局
Route::group(['middleware' => ['web']], function () {
Route::post('/dataapi/listarc', 'Api\IndexController@listarc')->name('api_listarc');
Route::post('/dataapi/customer_login', 'Api\WechatAuthController@customerLogin');
Route::post('/dataapi/', 'Api\UserController@signin'); //签到
});
//API接口路由,无需token验证
Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web']], function () {
//轮播图
Route::get('/slide_list', 'SlideController@slideList');
//文章
Route::get('/article_list', 'ArticleController@articleList');
Route::get('/article_detail', 'ArticleController@articleDetail');
Route::get('/arctype_list', 'ArctypeController@arctypeList');
Route::get('/arctype_detail', 'ArctypeController@arctypeDetail');
//商品
Route::get('/goods_list', 'GoodsController@goodsList'); //商品列表
Route::get('/goodstype_list', 'GoodsTypeController@goodsTypeList'); //商品分类列表
});
//API接口路由,需token验证
Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web','token']], function () {
//用户中心
Route::post('/user_signin', 'UserController@signin'); //签到
Route::get('/user_info', 'UserController@userInfo'); //用户详细信息
Route::post('/user_info_update', 'UserController@userInfoUpdate'); //修改用户信息
Route::get('/user_list', 'UserController@userList'); //用户列表
Route::get('/user_money_list', 'UserMoneyController@userMoneyList'); //用户余额明细
Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd'); //添加余额明细
//浏览记录
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::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('/collect_goods_list', 'CollectGoodsController@collectGoodsList'); //收藏商品列表
Route::post('/collect_goods_add', 'CollectGoodsController@collectGoodsAdd'); //收藏商品
Route::post('/collect_goods_delete', 'CollectGoodsController@collectGoodsDelete'); //取消收藏商品
//订单
//购物车
Route::get('/cart_list', 'CartController@cartList'); //购物车列表
Route::post('/cart_clear', 'CartController@cartClear'); //清空购物车
Route::post('/cart_add', 'CartController@cartAdd'); //添加购物车
Route::post('/cart_update', 'CartController@cartUpdate'); //修改购物车
//分销
//积分
Route::get('/user_point_list', 'UserPointController@userPointList'); //用户积分列表
Route::post('/user_point_add', 'UserPointController@userPointAdd');
//优惠券
Route::get('/user_bonus_list', 'BonusController@userBonusList'); //用户优惠券列表
Route::post('/user_get_bonus', 'BonusController@userGetBonus'); //用户获取优惠券
Route::get('/bonus_list', 'BonusController@bonusList'); //可用获取的优惠券列表
Route::post('/bonus_add', 'BonusController@bonusAdd'); //添加优惠券
Route::post('/bonus_update', 'BonusController@bonusUpdate'); //修改优惠券
Route::post('/bonus_delete', 'BonusController@bonusDelete'); //删除优惠券
//微信
//意见反馈
Route::get('/feedback_list', 'FeedBackController@feedbackList');
Route::post('/feedback_add', 'FeedBackController@feedbackAdd');
//其它
Route::get('/verifycode_check', 'VerifyCodeController@check'); //验证码校验
Route::get('/andriod_upgrade', 'IndexController@andriodUpgrade'); //安卓升级
//图片上传
Route::post('/image_upload', 'ImageController@imageUpload'); //普通文件/图片上传
//二维码
Route::get('/create_simple_qrcode', 'QrcodeController@createSimpleQrcode');
//收货地址
Route::get('/user_address_list', 'UserAddressController@userAddressList');
Route::get('/user_address_detail', 'UserAddressController@userAddressDetail');
Route::post('/user_address_setdefault', 'UserAddressController@userAddressSetDefault');
Route::post('/user_address_add', 'UserAddressController@userAddressAdd');
Route::post('/user_address_update', 'UserAddressController@userAddressUpdate');
Route::post('/user_address_delete', 'UserAddressController@userAddressDelete');
//地区,省市区
Route::get('/region_list', 'RegionController@regionList');
Route::get('/region_detail', 'RegionController@regionDetail');
});
});
Loading…
Cancel
Save