正在显示
24 个修改的文件
包含
2541 行增加
和
84 行删除
@@ -80,7 +80,7 @@ if (!function_exists('cdnurl')) { | @@ -80,7 +80,7 @@ if (!function_exists('cdnurl')) { | ||
80 | * @param boolean $domain 是否显示域名 或者直接传入域名 | 80 | * @param boolean $domain 是否显示域名 或者直接传入域名 |
81 | * @return string | 81 | * @return string |
82 | */ | 82 | */ |
83 | - function cdnurl($url, $domain = false) | 83 | + function cdnurl($url, $domain = true) |
84 | { | 84 | { |
85 | $regex = "/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i"; | 85 | $regex = "/^((?:[a-z]+:)?\/\/|data:image\/)(.*)/i"; |
86 | $url = preg_match($regex, $url) ? $url : \think\Config::get('upload.cdnurl') . $url; | 86 | $url = preg_match($regex, $url) ? $url : \think\Config::get('upload.cdnurl') . $url; |
@@ -108,7 +108,11 @@ class HomeBase extends Controller | @@ -108,7 +108,11 @@ class HomeBase extends Controller | ||
108 | */ | 108 | */ |
109 | public function getUserId(){ | 109 | public function getUserId(){ |
110 | if (empty($this->userId)) { | 110 | if (empty($this->userId)) { |
111 | - $this->redirect("user/login_view"); | 111 | + if($this->request->isAjax()){ |
112 | + $this->error('用户未登录~',url("user/login_view")); | ||
113 | + }else{ | ||
114 | + $this->redirect("user/login_view"); | ||
115 | + } | ||
112 | } | 116 | } |
113 | $user = Db::name('user')->where(['id'=>$this->userId])->find(); | 117 | $user = Db::name('user')->where(['id'=>$this->userId])->find(); |
114 | if($user['status'] != 'normal'){ | 118 | if($user['status'] != 'normal'){ |
@@ -58,10 +58,10 @@ if (!function_exists('distance')) { | @@ -58,10 +58,10 @@ if (!function_exists('distance')) { | ||
58 | */ | 58 | */ |
59 | function distance($work, $user) | 59 | function distance($work, $user) |
60 | { | 60 | { |
61 | - $lng1 = $user['longitude'];//经度1 | ||
62 | - $lat1 = $user['latitude'];//纬度1 | ||
63 | - $lng2 = $work['longitude'];//经度2 | ||
64 | - $lat2 = $work['latitude'];//纬度2 | 61 | + $lng1 = $user['lng'];//经度1 |
62 | + $lat1 = $user['lat'];//纬度1 | ||
63 | + $lng2 = $work['lng'];//经度2 | ||
64 | + $lat2 = $work['lat'];//纬度2 | ||
65 | 65 | ||
66 | $EARTH_RADIUS = 6378137; //地球半径 | 66 | $EARTH_RADIUS = 6378137; //地球半径 |
67 | $RAD = pi() / 180.0; | 67 | $RAD = pi() / 180.0; |
@@ -73,7 +73,7 @@ if (!function_exists('distance')) { | @@ -73,7 +73,7 @@ if (!function_exists('distance')) { | ||
73 | $s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))); | 73 | $s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))); |
74 | $s = $s * $EARTH_RADIUS; | 74 | $s = $s * $EARTH_RADIUS; |
75 | $result = round($s * 10000) / 10000; | 75 | $result = round($s * 10000) / 10000; |
76 | - return $result/1000; | 76 | + return round($result/1000,2); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | if (!function_exists('getAge')) { | 79 | if (!function_exists('getAge')) { |
application/index/controller/Address.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/13 | ||
6 | + * Time: 16:14 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\controller; | ||
10 | + | ||
11 | + | ||
12 | +use app\common\controller\HomeBase; | ||
13 | + | ||
14 | +class Address extends HomeBase | ||
15 | +{ | ||
16 | + public function add(){ | ||
17 | + $user_id = $this->getUserId(); | ||
18 | + $param = $this->request->param(); | ||
19 | + $validate = new \think\Validate([ | ||
20 | + 'name' => 'require', | ||
21 | + 'province_id' => 'require', | ||
22 | + 'city_id' => 'require', | ||
23 | + 'county_id' => 'require', | ||
24 | + 'phone' => 'require', | ||
25 | + 'address' => 'require', | ||
26 | + ]); | ||
27 | + if (!$validate->check($param)) { | ||
28 | + $this->error($validate->getError()); | ||
29 | + } | ||
30 | + $addressModel = new \app\index\model\Address(); | ||
31 | + $param['user_id'] = $user_id; | ||
32 | + $param['createtime'] = time(); | ||
33 | + $param['updatetime'] = time(); | ||
34 | + $param['is_default'] = "2"; | ||
35 | + $result = $addressModel->insertData($param); | ||
36 | + if(empty($result)){ | ||
37 | + $this->error('sql执行失败'); | ||
38 | + } | ||
39 | + $this->success('SUCCESS','',['address_id'=>$result]); | ||
40 | + } | ||
41 | + public function edit(){ | ||
42 | + $user_id = $this->getUserId(); | ||
43 | + $param = $this->request->param(); | ||
44 | + $validate = new \think\Validate([ | ||
45 | + 'address_id' => 'require', | ||
46 | + 'name' => 'require', | ||
47 | + 'province_id' => 'require', | ||
48 | + 'city_id' => 'require', | ||
49 | + 'county_id' => 'require', | ||
50 | + 'phone' => 'require', | ||
51 | + 'address' => 'require', | ||
52 | + ]); | ||
53 | + if (!$validate->check($param)) { | ||
54 | + $this->error($validate->getError()); | ||
55 | + } | ||
56 | + $addressModel = new \app\index\model\Address(); | ||
57 | + $param['updatetime'] = time(); | ||
58 | + $result = $addressModel->updateData(['id'=>$param['address_id'],'user_id'=>$user_id],$param); | ||
59 | + if(empty($result)){ | ||
60 | + $this->error('sql执行失败'); | ||
61 | + } | ||
62 | + $this->success('SUCCESS','',['address_id'=>$param['address_id']]); | ||
63 | + } | ||
64 | + public function update(){ | ||
65 | + $user_id = $this->getUserId(); | ||
66 | + $param = $this->request->param(); | ||
67 | + $validate = new \think\Validate([ | ||
68 | + 'name' => 'require', | ||
69 | + 'province_id' => 'require', | ||
70 | + 'city_id' => 'require', | ||
71 | + 'county_id' => 'require', | ||
72 | + 'phone' => 'require', | ||
73 | + 'address' => 'require', | ||
74 | + ]); | ||
75 | + if (!$validate->check($param)) { | ||
76 | + $this->error($validate->getError()); | ||
77 | + } | ||
78 | + $param['updatetime'] = time(); | ||
79 | + $addressModel = new \app\index\model\Address(); | ||
80 | + if(!empty($param['address_id'])){ | ||
81 | + $address_id = $param['address_id']; | ||
82 | + unset($param['address_id']); | ||
83 | + $result = $addressModel->updateData(['id'=>$address_id,'user_id'=>$user_id],$param); | ||
84 | + }else{ | ||
85 | + unset($param['address_id']); | ||
86 | + $param['user_id'] = $user_id; | ||
87 | + $param['createtime'] = time(); | ||
88 | + $param['is_default'] = "2"; | ||
89 | + $result = $addressModel->insertData($param); | ||
90 | + $address_id = $result; | ||
91 | + } | ||
92 | + if(empty($result)){ | ||
93 | + $this->error('sql执行失败'); | ||
94 | + } | ||
95 | + $data = $addressModel->findData(['id'=>$address_id]); | ||
96 | + $this->success('SUCCESS','',$data); | ||
97 | + } | ||
98 | +} |
application/index/controller/Car.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/11 | ||
6 | + * Time: 11:41 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\controller; | ||
10 | + | ||
11 | + | ||
12 | +use app\common\controller\HomeBase; | ||
13 | +use app\index\model\Store; | ||
14 | + | ||
15 | +class Car extends HomeBase | ||
16 | +{ | ||
17 | + /** | ||
18 | + * 购物车页面 | ||
19 | + * @return mixed | ||
20 | + */ | ||
21 | + public function index(){ | ||
22 | + $user_id = $this->getUserId(); | ||
23 | + $carModel = new \app\index\model\Car(); | ||
24 | + $car1 = $carModel->where(['user_id'=>$user_id])->group('store_id')->select(); | ||
25 | + $store_ids = []; | ||
26 | + foreach($car1 as $key => $c1){ | ||
27 | + $store_ids[] = $c1['store_id']; | ||
28 | + } | ||
29 | + $goodsModel = new \app\index\model\Goods(); | ||
30 | + $storeModel = new Store(); | ||
31 | + $store = $storeModel->selectData(['id'=>['in',$store_ids]]); | ||
32 | + $store = collection($store)->toArray(); | ||
33 | + foreach($store as $key1 => $s){ | ||
34 | + $car = $carModel->selectData(['store_id'=>$s['id']]); | ||
35 | + foreach($car as $key2 => $c){ | ||
36 | + $goods = $goodsModel->findData(['g.id'=>$c['goods_id']]); | ||
37 | + $car[$key2]['goods'] = $goods; | ||
38 | + } | ||
39 | + $store[$key1]['car'] = collection($car)->toArray(); | ||
40 | + } | ||
41 | + $this->assign('data',$store); | ||
42 | + $this->assign('title','购物车'); | ||
43 | + return $this->fetch(); | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * 更新购物车 | ||
48 | + */ | ||
49 | + public function add(){ | ||
50 | + $user_id = $this->getUserId(); | ||
51 | + $goods_id = $this->request->param('goods_id',0,'intval'); | ||
52 | + $number = $this->request->param('number',1,'intval'); | ||
53 | + $type = $this->request->param('type',0,'intval');//1增,2减 | ||
54 | + $province_id = $this->request->param('province_id',0,'intval'); | ||
55 | + if(empty($goods_id) || empty($number) || empty($type) || empty($province_id)){ | ||
56 | + $this->error("缺少必要参数"); | ||
57 | + } | ||
58 | + $goodsModel = new \app\index\model\Goods(); | ||
59 | + $data = $goodsModel->findData(['g.id'=>$goods_id]); | ||
60 | + if(empty($data)){ | ||
61 | + $this->error('查询为空'); | ||
62 | + } | ||
63 | + if($data['status'] != '1'){ | ||
64 | + $this->error('该商品已下架'); | ||
65 | + } | ||
66 | + $storeModel = new Store(); | ||
67 | + $store = $storeModel->findData(['id'=>$data['store_id']]); | ||
68 | + //判断该区域是否为会员 | ||
69 | + if($store['is_svip'] != '1'){ | ||
70 | + if($store['is_vip'] != '1'){ | ||
71 | + $this->error('该商品不可以进行该操作~'); | ||
72 | + }else{ | ||
73 | + if(!in_array($province_id,$store['province_ids'])){ | ||
74 | + $this->error('该商品不可以进行该操作~'); | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | + $carModel = new \app\index\model\Car(); | ||
79 | + $arr['user_id'] = $user_id; | ||
80 | + $arr['goods_id'] = $goods_id; | ||
81 | + $arr['store_id'] = $data['store_id']; | ||
82 | + $arr['number'] = $number; | ||
83 | + $car = $carModel->findData(['user_id'=>$user_id,'goods_id'=>$goods_id]); | ||
84 | + if(empty($car)){ | ||
85 | + //新增 | ||
86 | + //判断库存是否充足 | ||
87 | + if($data['inventory'] < 1){ | ||
88 | + $this->error("商品 【$data[goodsname]】 库存不足~"); | ||
89 | + } | ||
90 | + $arr['createtime'] = time(); | ||
91 | + $result = $carModel->insertData($arr); | ||
92 | + }else{ | ||
93 | + //更新 | ||
94 | + $arr['updatetime'] = time(); | ||
95 | + if($type == 1){ | ||
96 | + //增加数量 | ||
97 | + //判断库存是否充足 | ||
98 | + if($data['inventory'] < 1){ | ||
99 | + $this->error("商品 【$data[goodsname]】 库存不足~"); | ||
100 | + } | ||
101 | + $result = $carModel->where(['id'=>$car['id']])->setInc('number',$number); | ||
102 | + }else{ | ||
103 | + //减少数量 | ||
104 | + if($car['number'] <= 1){ | ||
105 | + $this->error('不能再减了~'); | ||
106 | + } | ||
107 | + $result = $carModel->where(['id'=>$car['id']])->setDec('number',$number); | ||
108 | + } | ||
109 | + } | ||
110 | + if(empty($result)){ | ||
111 | + $this->error('sql执行失败'); | ||
112 | + } | ||
113 | + $car = $carModel->findData(['user_id'=>$user_id,'goods_id'=>$goods_id]); | ||
114 | + $this->success('SUCCESS','',['number'=>$car['number']]); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 删除购物车 | ||
119 | + */ | ||
120 | + public function del(){ | ||
121 | + $car_ids = $this->request->param('car_ids'); | ||
122 | + $car_ids = explode(',',$car_ids); | ||
123 | + if(empty($car_ids)){ | ||
124 | + $this->error('缺少必要参数'); | ||
125 | + } | ||
126 | + $carModel = new \app\index\model\Car(); | ||
127 | + $result = $carModel->where(['id'=>['in',$car_ids]])->delete(); | ||
128 | + $this->success('SUCCESS'); | ||
129 | + } | ||
130 | +} |
application/index/controller/Collect.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/11 | ||
6 | + * Time: 15:20 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\controller; | ||
10 | + | ||
11 | + | ||
12 | +use app\common\controller\HomeBase; | ||
13 | +use app\index\model\Goodscollect; | ||
14 | + | ||
15 | +class Collect extends HomeBase | ||
16 | +{ | ||
17 | + public function index(){ | ||
18 | + $user_id = $this->getUserId(); | ||
19 | + $goods_id = $this->request->param('goods_id',0,'intval'); | ||
20 | + if(empty($goods_id)){ | ||
21 | + $this->error('缺少必要参数'); | ||
22 | + } | ||
23 | + $where['user_id'] = ['eq',$user_id]; | ||
24 | + $where['goods_id'] = ['eq',$goods_id]; | ||
25 | + $collectModel = new Goodscollect(); | ||
26 | + $data = $collectModel->findData($where); | ||
27 | + $arr['user_id'] = $user_id; | ||
28 | + $arr['goods_id'] = $goods_id; | ||
29 | + $arr['createtime'] = time(); | ||
30 | + if(empty($data)){ | ||
31 | + $result = $collectModel->insertData($arr); | ||
32 | + }else{ | ||
33 | + $result = $collectModel->deleteData($where); | ||
34 | + } | ||
35 | + if(empty($result)){ | ||
36 | + $this->error('sql执行失败'); | ||
37 | + } | ||
38 | + $this->success('SUCCESS',$result); | ||
39 | + } | ||
40 | +} |
@@ -11,6 +11,7 @@ namespace app\index\controller; | @@ -11,6 +11,7 @@ namespace app\index\controller; | ||
11 | 11 | ||
12 | use app\common\controller\HomeBase; | 12 | use app\common\controller\HomeBase; |
13 | use app\index\model\Evaluate; | 13 | use app\index\model\Evaluate; |
14 | +use app\index\model\Goodscollect; | ||
14 | use app\index\model\Goodstype; | 15 | use app\index\model\Goodstype; |
15 | use app\index\model\Pic; | 16 | use app\index\model\Pic; |
16 | use app\index\model\Province; | 17 | use app\index\model\Province; |
@@ -46,6 +47,7 @@ class Goods extends HomeBase | @@ -46,6 +47,7 @@ class Goods extends HomeBase | ||
46 | * @return mixed | 47 | * @return mixed |
47 | */ | 48 | */ |
48 | public function detail(){ | 49 | public function detail(){ |
50 | + $user_id = $this->userId; | ||
49 | $goods_id = $this->request->param('goods_id',0,'intval'); | 51 | $goods_id = $this->request->param('goods_id',0,'intval'); |
50 | if(empty($goods_id)){ | 52 | if(empty($goods_id)){ |
51 | $this->error('缺少必要参数'); | 53 | $this->error('缺少必要参数'); |
@@ -58,6 +60,16 @@ class Goods extends HomeBase | @@ -58,6 +60,16 @@ class Goods extends HomeBase | ||
58 | if($data['status'] != '1'){ | 60 | if($data['status'] != '1'){ |
59 | $this->error('该商品已下架'); | 61 | $this->error('该商品已下架'); |
60 | } | 62 | } |
63 | + //收藏 | ||
64 | + $is_collect = "2"; | ||
65 | + if(!empty($user_id)){ | ||
66 | + $collectModel = new Goodscollect(); | ||
67 | + $collect = $collectModel->findData(['user_id'=>$user_id,'goods_id'=>$goods_id]); | ||
68 | + if(!empty($collect)){ | ||
69 | + $is_collect = "1"; | ||
70 | + } | ||
71 | + } | ||
72 | + $data['is_collect'] = $is_collect; | ||
61 | //获取评论 | 73 | //获取评论 |
62 | $evaluateModel = new Evaluate(); | 74 | $evaluateModel = new Evaluate(); |
63 | $comments_count1 = $evaluateModel->countData(['goods_id'=>$goods_id]);//全部评论数量 | 75 | $comments_count1 = $evaluateModel->countData(['goods_id'=>$goods_id]);//全部评论数量 |
@@ -125,10 +137,19 @@ class Goods extends HomeBase | @@ -125,10 +137,19 @@ class Goods extends HomeBase | ||
125 | $where['g.status'] = ['eq','1']; | 137 | $where['g.status'] = ['eq','1']; |
126 | if(!empty($param['province_id'])){ | 138 | if(!empty($param['province_id'])){ |
127 | $storeModel = new Store(); | 139 | $storeModel = new Store(); |
128 | - $store = $storeModel->selectData(['province_ids'=>['like',"%,$param[province_id],%"]]); | 140 | + $store = $storeModel->selectData([]); |
129 | $store_ids = []; | 141 | $store_ids = []; |
130 | foreach($store as $key => $s){ | 142 | foreach($store as $key => $s){ |
131 | $store_ids[] = $s['id']; | 143 | $store_ids[] = $s['id']; |
144 | + /*//判断该区域是否为会员 | ||
145 | + if($s['is_svip'] == '1'){ | ||
146 | + $store_ids[] = $s['id']; | ||
147 | + continue; | ||
148 | + } | ||
149 | + if($s['is_vip'] == '1' && in_array($param['province_id'],$s['province_ids'])){ | ||
150 | + $store_ids[] = $s['id']; | ||
151 | + continue; | ||
152 | + }*/ | ||
132 | } | 153 | } |
133 | $where['g.store_id'] = ['in',$store_ids]; | 154 | $where['g.store_id'] = ['in',$store_ids]; |
134 | } | 155 | } |
@@ -170,9 +191,28 @@ class Goods extends HomeBase | @@ -170,9 +191,28 @@ class Goods extends HomeBase | ||
170 | } | 191 | } |
171 | } | 192 | } |
172 | $goodsModel = new \app\index\model\Goods(); | 193 | $goodsModel = new \app\index\model\Goods(); |
194 | + $ids = []; | ||
195 | + if(!empty($param['lng']) && !empty($param['lat'])){ | ||
196 | + $data = $goodsModel | ||
197 | + ->alias('g') | ||
198 | + ->field('g.*,t.name as goodstype_name,s.lng,s.lat,s.name as store_name,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money') | ||
199 | + ->join('sto_goodstype t','t.id = g.goodstype_id') | ||
200 | + ->join('sto_store s','s.id = g.store_id') | ||
201 | + ->where($where) | ||
202 | + ->order($order) | ||
203 | + ->select(); | ||
204 | + foreach($data as $key => $vo){ | ||
205 | + //计算距离 | ||
206 | + $distance = distance($param,$vo); | ||
207 | + if($distance <= 50){ | ||
208 | + $ids[] = $vo['id']; | ||
209 | + } | ||
210 | + } | ||
211 | + $where['g.id'] = ['in',$ids]; | ||
212 | + } | ||
173 | $data = $goodsModel | 213 | $data = $goodsModel |
174 | ->alias('g') | 214 | ->alias('g') |
175 | - ->field('g.*,t.name as goodstype_name,s.name as store_name,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money') | 215 | + ->field('g.*,t.name as goodstype_name,s.lng,s.lat,s.name as store_name,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money') |
176 | ->join('sto_goodstype t','t.id = g.goodstype_id') | 216 | ->join('sto_goodstype t','t.id = g.goodstype_id') |
177 | ->join('sto_store s','s.id = g.store_id') | 217 | ->join('sto_store s','s.id = g.store_id') |
178 | ->where($where) | 218 | ->where($where) |
@@ -185,19 +225,27 @@ class Goods extends HomeBase | @@ -185,19 +225,27 @@ class Goods extends HomeBase | ||
185 | $storeModel = new Store(); | 225 | $storeModel = new Store(); |
186 | $evaluateModel = new Evaluate(); | 226 | $evaluateModel = new Evaluate(); |
187 | foreach($data as $key => $vo){ | 227 | foreach($data as $key => $vo){ |
228 | + //判断店铺在该区域是否为会员 | ||
188 | $insurance = '2'; | 229 | $insurance = '2'; |
189 | $store = $storeModel->findData(['id'=>$vo['store_id']]); | 230 | $store = $storeModel->findData(['id'=>$vo['store_id']]); |
190 | - if($store['is_vip'] == '1' && $store['is_svip'] == '1'){ | 231 | + if($store['is_svip'] == '1' || ($store['is_vip'] == '1' && in_array($param['province_id'],$store['province_ids']))){ |
191 | $insurance = '1'; | 232 | $insurance = '1'; |
192 | } | 233 | } |
193 | - $data[$key]['store_is_vip'] = $store['is_vip']; | ||
194 | - $data[$key]['store_ids_svip'] = $store['is_svip']; | ||
195 | $data[$key]['insurance'] = $insurance; | 234 | $data[$key]['insurance'] = $insurance; |
196 | //计算平均分 | 235 | //计算平均分 |
197 | $score_count = $evaluateModel->where(['goods_id'=>$vo['id']])->count(); | 236 | $score_count = $evaluateModel->where(['goods_id'=>$vo['id']])->count(); |
198 | $score_sum = $evaluateModel->where(['goods_id'=>$vo['id']])->sum('level'); | 237 | $score_sum = $evaluateModel->where(['goods_id'=>$vo['id']])->sum('level'); |
199 | $average_score = !empty($score_sum) ? round($score_sum/$score_count,2) : 0; | 238 | $average_score = !empty($score_sum) ? round($score_sum/$score_count,2) : 0; |
200 | $data[$key]['average_score'] = $average_score; | 239 | $data[$key]['average_score'] = $average_score; |
240 | + //计算距离 | ||
241 | + $distance = 0; | ||
242 | + if(!empty($param['lng']) && !empty($param['lat'])){ | ||
243 | + $distance = distance($param,$vo); | ||
244 | + if($distance <= 50){ | ||
245 | + $ids[] = $vo['id']; | ||
246 | + } | ||
247 | + } | ||
248 | + $data[$key]['distance'] = $distance; | ||
201 | } | 249 | } |
202 | if(!empty($param['sort'])){ | 250 | if(!empty($param['sort'])){ |
203 | if($param['sort'] == 2){ | 251 | if($param['sort'] == 2){ |
@@ -207,4 +255,25 @@ class Goods extends HomeBase | @@ -207,4 +255,25 @@ class Goods extends HomeBase | ||
207 | } | 255 | } |
208 | $this->success('SUCCESS','',$data); | 256 | $this->success('SUCCESS','',$data); |
209 | } | 257 | } |
258 | + public function get_one(){ | ||
259 | + $param = $this->request->param(); | ||
260 | + if(empty($param['goods_id']) || empty($param['province_id'])){ | ||
261 | + $this->error('缺少必要参数'); | ||
262 | + } | ||
263 | + $goodsModel = new \app\index\model\Goods(); | ||
264 | + $data = $goodsModel->findData(['g.id'=>$param['goods_id']]); | ||
265 | + if(empty($data)){ | ||
266 | + $this->error('查询为空','',['result'=>2]); | ||
267 | + } | ||
268 | + $storeModel = new Store(); | ||
269 | + $store = $storeModel->findData(['id'=>$data['store_id']]); | ||
270 | + if(empty($store)){ | ||
271 | + $this->error('查询为空','',['result'=>2]); | ||
272 | + } | ||
273 | + $result = 2; | ||
274 | + if($store['is_svip'] == '1' || ($store['is_vip'] == '1' && in_array($param['province_id'],$store['province_ids']))){ | ||
275 | + $result = 1; | ||
276 | + } | ||
277 | + $this->success('SUCCESS','',['result'=>$result]); | ||
278 | + } | ||
210 | } | 279 | } |
application/index/controller/Order.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/12 | ||
6 | + * Time: 18:19 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\controller; | ||
10 | + | ||
11 | + | ||
12 | +use app\common\controller\HomeBase; | ||
13 | +use app\index\model\Address; | ||
14 | +use app\index\model\Area; | ||
15 | +use app\index\model\Store; | ||
16 | + | ||
17 | +class Order extends HomeBase | ||
18 | +{ | ||
19 | + public function confirm(){ | ||
20 | + $user_id = $this->getUserId(); | ||
21 | +// $car_ids = $this->request->param('car_ids'); | ||
22 | + $data = $this->request->param('data'); | ||
23 | + $province_id = $this->request->param('province_id',0,'intval'); | ||
24 | + if(empty($data) || empty($province_id)){ | ||
25 | + $this->error('缺少必要参数'); | ||
26 | + } | ||
27 | + $data = json_decode($data,true); | ||
28 | + /*if(!empty($car_ids)){ | ||
29 | + $car_ids = explode(',',$car_ids); | ||
30 | + $carModel = new \app\index\model\Car(); | ||
31 | + $result = $carModel->where(['id'=>$car_ids])->delete(); | ||
32 | + if(empty($result)){ | ||
33 | + $this->error('sql执行失败'); | ||
34 | + } | ||
35 | + }*/ | ||
36 | + $goodsModel = new \app\index\model\Goods(); | ||
37 | + $goods_price = []; | ||
38 | + $store_ids = []; | ||
39 | + foreach($data as $key1 => $vo){ | ||
40 | + //获取店铺id | ||
41 | + $goods = $goodsModel->findData(['g.id'=>$vo['goods_id']]); | ||
42 | + $data[$key1]['store_id'] = $goods['store_id']; | ||
43 | + $store_ids[] = $goods['store_id']; | ||
44 | + } | ||
45 | + $storeModel = new Store(); | ||
46 | + $store = $storeModel->selectData(['id'=>['in',$store_ids]]); | ||
47 | + foreach($store as $key2 => $s){ | ||
48 | + if($s['is_svip'] != '1'){ | ||
49 | + if($s['is_vip'] != '1' && !in_array($province_id,$s['province_ids'])){ | ||
50 | + $this->error("店铺 【$s[name]】 不可以进行购买~"); | ||
51 | + } | ||
52 | + } | ||
53 | + $goods_ids = []; | ||
54 | + $number = []; | ||
55 | + foreach($data as $key3 => $vo){ | ||
56 | + if($vo['store_id'] == $s['id']){ | ||
57 | + $goods_ids[] = $vo['goods_id']; | ||
58 | + $number[] = $vo['number']; | ||
59 | + } | ||
60 | + } | ||
61 | + $store[$key2]['goods_ids'] = $goods_ids; | ||
62 | + $goods_arr = []; | ||
63 | + foreach($goods_ids as $key4 => $goods_id){ | ||
64 | + $goods = $goodsModel->findData(['g.id'=>$goods_id]); | ||
65 | + if($goods['inventory'] < $number[$key4]){ | ||
66 | + $this->error("商品 【$goods[goodsname]】 库存不足~"); | ||
67 | + } | ||
68 | + $goods['number'] = $number[$key4]; | ||
69 | + $goods_price[] = $goods['price']*$number[$key4]; | ||
70 | + $goods_arr[] = $goods; | ||
71 | + } | ||
72 | + //商品总价格 | ||
73 | + $store[$key2]['sum_goods_price'] = array_sum($goods_price); | ||
74 | + //商品实际支付价格 | ||
75 | + $goods_total = $store[$key2]['sum_goods_price']; | ||
76 | + $store[$key2]['goods_total'] = $goods_total; | ||
77 | + //配送价格 | ||
78 | + $postage_price = 0; | ||
79 | + if($goods_total < $s['money']){ | ||
80 | + $postage_price = $store['freight']; | ||
81 | + } | ||
82 | + $store[$key2]['postage_price'] = $postage_price; | ||
83 | + $store[$key2]['goods'] = $goods_arr; | ||
84 | + } | ||
85 | + //总合计 | ||
86 | + $goods_total1 = 0; | ||
87 | + $postage_price1 = 0; | ||
88 | + foreach($store as $key => $vo3){ | ||
89 | + $goods_total1 = $goods_total1 + $vo3['goods_total']; | ||
90 | + $postage_price1 = $postage_price1 + $vo3['postage_price']; | ||
91 | + } | ||
92 | + $total = $goods_total1 + $postage_price1; | ||
93 | + //收货地址 | ||
94 | + $addressModel = new Address(); | ||
95 | + $address = $addressModel->selectData(['user_id'=>$user_id]); | ||
96 | + //省市区三级联动 | ||
97 | + $areaModel = new Area(); | ||
98 | + $province = $areaModel->selectData(['pid'=>0,'level'=>1]); | ||
99 | + $province_id = !empty($province[0]['id']) ? $province[0]['id'] : 0; | ||
100 | + $city = $areaModel->selectData(['pid'=>$province_id,'level'=>2]); | ||
101 | + $city_id = !empty($city[0]['id']) ? $city[0]['id'] : 0; | ||
102 | + $county = $areaModel->selectData(['pid'=>$city_id,'level'=>3]); | ||
103 | + $this->assign('province',$province); | ||
104 | + $this->assign('city',$city); | ||
105 | + $this->assign('county',$county); | ||
106 | + $this->assign('store',$store); | ||
107 | + $this->assign('total',$total); | ||
108 | + $this->assign('address',$address); | ||
109 | + $this->assign('title','确认订单'); | ||
110 | + return $this->fetch(); | ||
111 | + } | ||
112 | +} |
@@ -10,6 +10,7 @@ namespace app\index\controller; | @@ -10,6 +10,7 @@ namespace app\index\controller; | ||
10 | 10 | ||
11 | 11 | ||
12 | use app\common\controller\HomeBase; | 12 | use app\common\controller\HomeBase; |
13 | +use app\index\model\Area; | ||
13 | use app\index\model\Province; | 14 | use app\index\model\Province; |
14 | use fast\Http; | 15 | use fast\Http; |
15 | 16 | ||
@@ -51,4 +52,20 @@ class Sundry extends HomeBase | @@ -51,4 +52,20 @@ class Sundry extends HomeBase | ||
51 | $province_id = $provinceModel->where(['name'=>$province_name])->value('id'); | 52 | $province_id = $provinceModel->where(['name'=>$province_name])->value('id'); |
52 | $this->success('SUCCESS','',['province_id'=>$province_id]); | 53 | $this->success('SUCCESS','',['province_id'=>$province_id]); |
53 | } | 54 | } |
55 | + | ||
56 | + /** | ||
57 | + * 省市区三级联动 | ||
58 | + */ | ||
59 | + public function get_area(){ | ||
60 | + $pid = $this->request->param('pid',0,'intval'); | ||
61 | + $level = $this->request->param('level',0,'intval'); | ||
62 | + if(empty($level)){ | ||
63 | + $this->error('缺少必要参数'); | ||
64 | + } | ||
65 | + $where['pid'] = ['eq',$pid]; | ||
66 | + $where['level'] = ['eq',$level]; | ||
67 | + $areaModel = new Area(); | ||
68 | + $data = $areaModel->selectData($where); | ||
69 | + $this->success('SUCCESS','',$data); | ||
70 | + } | ||
54 | } | 71 | } |
application/index/model/Address.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/13 | ||
6 | + * Time: 10:57 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\model; | ||
10 | + | ||
11 | + | ||
12 | +use think\Model; | ||
13 | + | ||
14 | +class Address extends Model | ||
15 | +{ | ||
16 | + public function selectData($where){ | ||
17 | + $data = $this->where($where)->order('createtime desc')->select(); | ||
18 | + $areaModel = new Area(); | ||
19 | + foreach ($data as $key => $vo){ | ||
20 | + $province_name = $areaModel->where(['id'=>$vo['province_id']])->value('name'); | ||
21 | + $city_name = $areaModel->where(['id'=>$vo['city_id']])->value('name'); | ||
22 | + $county_name = $areaModel->where(['id'=>$vo['county_id']])->value('name'); | ||
23 | + $data[$key]['province_name'] = $province_name; | ||
24 | + $data[$key]['city_name'] = $city_name; | ||
25 | + $data[$key]['county_name'] = $county_name; | ||
26 | + } | ||
27 | + return $data; | ||
28 | + } | ||
29 | + public function findData($where){ | ||
30 | + $data = $this->where($where)->find(); | ||
31 | + $areaModel = new Area(); | ||
32 | + $province_name = $areaModel->where(['id'=>$data['province_id']])->value('name'); | ||
33 | + $city_name = $areaModel->where(['id'=>$data['city_id']])->value('name'); | ||
34 | + $county_name = $areaModel->where(['id'=>$data['county_id']])->value('name'); | ||
35 | + $data['province_name'] = $province_name; | ||
36 | + $data['city_name'] = $city_name; | ||
37 | + $data['county_name'] = $county_name; | ||
38 | + return $data; | ||
39 | + } | ||
40 | + public function insertData($data){ | ||
41 | + $result = $this->insertGetId($data); | ||
42 | + return $result; | ||
43 | + } | ||
44 | + public function updateData($where,$data){ | ||
45 | + $result = $this->where($where)->update($data); | ||
46 | + return $result; | ||
47 | + } | ||
48 | +} |
application/index/model/Area.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/13 | ||
6 | + * Time: 13:34 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\model; | ||
10 | + | ||
11 | + | ||
12 | +use think\Model; | ||
13 | + | ||
14 | +class Area extends Model | ||
15 | +{ | ||
16 | + public function selectData($where){ | ||
17 | + $data = $this->where($where)->order('id asc')->select(); | ||
18 | + return $data; | ||
19 | + } | ||
20 | + public function findData($where){ | ||
21 | + $data = $this->where($where)->find(); | ||
22 | + return $data; | ||
23 | + } | ||
24 | +} |
application/index/model/Car.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/11 | ||
6 | + * Time: 11:58 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\model; | ||
10 | + | ||
11 | + | ||
12 | +use think\Model; | ||
13 | + | ||
14 | +class Car extends Model | ||
15 | +{ | ||
16 | + public function insertData($data){ | ||
17 | + $result = $this->insertGetId($data); | ||
18 | + return $result; | ||
19 | + } | ||
20 | + public function updateData($where,$data){ | ||
21 | + $result = $this->where($where)->update($data); | ||
22 | + return $result; | ||
23 | + } | ||
24 | + public function selectData($where){ | ||
25 | + $data = $this->where($where)->order('createtime desc')->select(); | ||
26 | + return $data; | ||
27 | + } | ||
28 | + public function findData($where){ | ||
29 | + $data = $this->where($where)->find(); | ||
30 | + return $data; | ||
31 | + } | ||
32 | +} |
@@ -20,6 +20,9 @@ class Goods extends Model | @@ -20,6 +20,9 @@ class Goods extends Model | ||
20 | } | 20 | } |
21 | return $data; | 21 | return $data; |
22 | } | 22 | } |
23 | + public function getThumbnailAttr($value){ | ||
24 | + return cdnurl($value); | ||
25 | + } | ||
23 | public function selectData($where){ | 26 | public function selectData($where){ |
24 | $where['g.status'] = ['eq','1']; | 27 | $where['g.status'] = ['eq','1']; |
25 | $data = $this | 28 | $data = $this |
@@ -32,14 +35,9 @@ class Goods extends Model | @@ -32,14 +35,9 @@ class Goods extends Model | ||
32 | ->select(); | 35 | ->select(); |
33 | $storeModel = new Store(); | 36 | $storeModel = new Store(); |
34 | foreach($data as $key => $vo){ | 37 | foreach($data as $key => $vo){ |
35 | - $insurance = '2'; | ||
36 | $store = $storeModel->findData(['id'=>$vo['store_id']]); | 38 | $store = $storeModel->findData(['id'=>$vo['store_id']]); |
37 | - if($store['is_vip'] == '1' && $store['is_svip'] == '1'){ | ||
38 | - $insurance = '1'; | ||
39 | - } | ||
40 | $data[$key]['store_is_vip'] = $store['is_vip']; | 39 | $data[$key]['store_is_vip'] = $store['is_vip']; |
41 | - $data[$key]['store_ids_svip'] = $store['is_svip']; | ||
42 | - $data[$key]['insurance'] = $insurance; | 40 | + $data[$key]['store_is_svip'] = $store['is_svip']; |
43 | } | 41 | } |
44 | return $data; | 42 | return $data; |
45 | } | 43 | } |
@@ -55,34 +53,24 @@ class Goods extends Model | @@ -55,34 +53,24 @@ class Goods extends Model | ||
55 | ->paginate($pageNum); | 53 | ->paginate($pageNum); |
56 | $storeModel = new Store(); | 54 | $storeModel = new Store(); |
57 | foreach($data as $key => $vo){ | 55 | foreach($data as $key => $vo){ |
58 | - $insurance = '2';//保险logo | ||
59 | $store = $storeModel->findData(['id'=>$vo['store_id']]); | 56 | $store = $storeModel->findData(['id'=>$vo['store_id']]); |
60 | - if($store['is_vip'] == '1' && $store['is_svip'] == '1'){ | ||
61 | - $insurance = '1'; | ||
62 | - } | ||
63 | $data[$key]['store_is_vip'] = $store['is_vip']; | 57 | $data[$key]['store_is_vip'] = $store['is_vip']; |
64 | - $data[$key]['store_ids_svip'] = $store['is_svip']; | ||
65 | - $data[$key]['insurance'] = $insurance; | 58 | + $data[$key]['store_is_svip'] = $store['is_svip']; |
66 | } | 59 | } |
67 | return $data; | 60 | return $data; |
68 | } | 61 | } |
69 | public function findData($where){ | 62 | public function findData($where){ |
70 | $data = $this | 63 | $data = $this |
71 | ->alias('g') | 64 | ->alias('g') |
72 | - ->field('g.*,t.name as goodstype_name,s.name as store_name,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money') | 65 | + ->field('g.*,t.name as goodstype_name,s.lng,s.lat,s.name as store_name,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money') |
73 | ->join('sto_goodstype t','t.id = g.goodstype_id') | 66 | ->join('sto_goodstype t','t.id = g.goodstype_id') |
74 | ->join('sto_store s','s.id = g.store_id') | 67 | ->join('sto_store s','s.id = g.store_id') |
75 | ->where($where) | 68 | ->where($where) |
76 | ->find(); | 69 | ->find(); |
77 | $storeModel = new Store(); | 70 | $storeModel = new Store(); |
78 | - $insurance = '2';//保险logo | ||
79 | $store = $storeModel->findData(['id'=>$data['store_id']]); | 71 | $store = $storeModel->findData(['id'=>$data['store_id']]); |
80 | - if($store['is_vip'] == '1' && $store['is_svip'] == '1'){ | ||
81 | - $insurance = '1'; | ||
82 | - } | ||
83 | $data['store_is_vip'] = $store['is_vip']; | 72 | $data['store_is_vip'] = $store['is_vip']; |
84 | - $data['store_ids_svip'] = $store['is_svip']; | ||
85 | - $data['insurance'] = $insurance; | 73 | + $data['store_is_svip'] = $store['is_svip']; |
86 | return $data; | 74 | return $data; |
87 | } | 75 | } |
88 | } | 76 | } |
application/index/model/Goodscollect.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2020/5/11 | ||
6 | + * Time: 14:33 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\index\model; | ||
10 | + | ||
11 | + | ||
12 | +use think\Model; | ||
13 | + | ||
14 | +class Goodscollect extends Model | ||
15 | +{ | ||
16 | + public function insertData($data){ | ||
17 | + $result = $this->insert($data); | ||
18 | + return $result; | ||
19 | + } | ||
20 | + public function updateData($where,$data){ | ||
21 | + $result = $this->where($where)->update($data); | ||
22 | + return $result; | ||
23 | + } | ||
24 | + public function findData($where){ | ||
25 | + $data = $this->where($where)->find(); | ||
26 | + return $data; | ||
27 | + } | ||
28 | + public function deleteData($where){ | ||
29 | + $result = $this->where($where)->delete(); | ||
30 | + return $result; | ||
31 | + } | ||
32 | +} |
@@ -13,13 +13,24 @@ use think\Model; | @@ -13,13 +13,24 @@ use think\Model; | ||
13 | 13 | ||
14 | class Store extends Model | 14 | class Store extends Model |
15 | { | 15 | { |
16 | + public function getProvinceIdsAttr($value){ | ||
17 | + $province_ids = []; | ||
18 | + if(!empty($value)){ | ||
19 | + $province_ids = explode(',',trim($value,',')); | ||
20 | + } | ||
21 | + return $province_ids; | ||
22 | + } | ||
23 | + public function getThumbnailAttr($value){ | ||
24 | + return cdnurl($value); | ||
25 | + } | ||
16 | public function selectData($where){ | 26 | public function selectData($where){ |
17 | $data = $this->where($where)->select(); | 27 | $data = $this->where($where)->select(); |
28 | + $areaModel = new Area(); | ||
18 | foreach($data as $key => $vo){ | 29 | foreach($data as $key => $vo){ |
19 | - //判断是否为会员 | 30 | + //判断会员是否过期 |
20 | $is_vip = '2'; | 31 | $is_vip = '2'; |
21 | - if(!empty($vo['vip_pasttime'])){ | ||
22 | - if($vo['vip_pasttime'] > time()){ | 32 | + if(!empty($vo['vip_passtime'])){ |
33 | + if($vo['vip_passtime'] > time()){ | ||
23 | $is_vip = "1"; | 34 | $is_vip = "1"; |
24 | } | 35 | } |
25 | } | 36 | } |
@@ -31,15 +42,22 @@ class Store extends Model | @@ -31,15 +42,22 @@ class Store extends Model | ||
31 | } | 42 | } |
32 | $data[$key]['is_vip'] = $is_vip; | 43 | $data[$key]['is_vip'] = $is_vip; |
33 | $data[$key]['is_svip'] = $is_svip; | 44 | $data[$key]['is_svip'] = $is_svip; |
45 | + //获取省市区 | ||
46 | + $province_name = $areaModel->where(['id'=>$vo['province_id']])->value('name'); | ||
47 | + $city_name = $areaModel->where(['id'=>$vo['city_id']])->value('name'); | ||
48 | + $county_name = $areaModel->where(['id'=>$vo['county_id']])->value('name'); | ||
49 | + $data[$key]['province_name'] = $province_name; | ||
50 | + $data[$key]['city_name'] = $city_name; | ||
51 | + $data[$key]['county_name'] = $county_name; | ||
34 | } | 52 | } |
35 | return $data; | 53 | return $data; |
36 | } | 54 | } |
37 | public function findData($where){ | 55 | public function findData($where){ |
38 | $data = $this->where($where)->find(); | 56 | $data = $this->where($where)->find(); |
39 | - //判断是否为会员 | 57 | + //判断会员是否过期 |
40 | $is_vip = '2'; | 58 | $is_vip = '2'; |
41 | - if(!empty($data['vip_pasttime'])){ | ||
42 | - if($data['vip_pasttime'] > time()){ | 59 | + if(!empty($data['vip_passtime'])){ |
60 | + if($data['vip_passtime'] > time()){ | ||
43 | $is_vip = "1"; | 61 | $is_vip = "1"; |
44 | } | 62 | } |
45 | } | 63 | } |
@@ -51,6 +69,14 @@ class Store extends Model | @@ -51,6 +69,14 @@ class Store extends Model | ||
51 | } | 69 | } |
52 | $data['is_vip'] = $is_vip; | 70 | $data['is_vip'] = $is_vip; |
53 | $data['is_svip'] = $is_svip; | 71 | $data['is_svip'] = $is_svip; |
72 | + //获取省市区 | ||
73 | + $areaModel = new Area(); | ||
74 | + $province_name = $areaModel->where(['id'=>$data['province_id']])->value('name'); | ||
75 | + $city_name = $areaModel->where(['id'=>$data['city_id']])->value('name'); | ||
76 | + $county_name = $areaModel->where(['id'=>$data['county_id']])->value('name'); | ||
77 | + $data['province_name'] = $province_name; | ||
78 | + $data['city_name'] = $city_name; | ||
79 | + $data['county_name'] = $county_name; | ||
54 | return $data; | 80 | return $data; |
55 | } | 81 | } |
56 | } | 82 | } |
@@ -15,8 +15,8 @@ class User extends Model | @@ -15,8 +15,8 @@ class User extends Model | ||
15 | $data = $this->where($where)->find(); | 15 | $data = $this->where($where)->find(); |
16 | //判断是否为会员 | 16 | //判断是否为会员 |
17 | $is_vip = '2'; | 17 | $is_vip = '2'; |
18 | - if(!empty($data['vip_pasttime'])){ | ||
19 | - if($data['vip_pasttime'] > time()){ | 18 | + if(!empty($data['vip_passtime'])){ |
19 | + if($data['vip_passtime'] > time()){ | ||
20 | $is_vip = "1"; | 20 | $is_vip = "1"; |
21 | } | 21 | } |
22 | } | 22 | } |
application/index/view/car/index.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="zh"> | ||
3 | +{include file="public/head"/} | ||
4 | +<!--swiper引入--> | ||
5 | +<link rel="stylesheet" href="__CDN__/assets/store/js/Swiper-3.4.2/css/swiper.min.css"> | ||
6 | +<script type="text/javascript" src="__CDN__/assets/store/js/Swiper-3.4.2/js/swiper.min.js"></script> | ||
7 | +<style> | ||
8 | + body{ | ||
9 | + background: rgba(249,249,249,1); | ||
10 | + } | ||
11 | + .content{ | ||
12 | + width: 100%; | ||
13 | + font-size: 0; | ||
14 | + background: rgba(249,249,249,1); | ||
15 | + } | ||
16 | + | ||
17 | + /*购物车样式*/ | ||
18 | + .content .shoppingCartBox{ | ||
19 | + width: 100%; | ||
20 | + background: rgba(249,249,249,1); | ||
21 | + } | ||
22 | + | ||
23 | + /*购物车标题部分样式*/ | ||
24 | + .content .shoppingCartBox .shoppingCartTitleBox{ | ||
25 | + width: 1200px; | ||
26 | + background: rgba(255,255,255,1); | ||
27 | + margin: 0 auto 12px auto; | ||
28 | + font-size: 16px; | ||
29 | + font-family: PingFang SC; | ||
30 | + font-weight: 500; | ||
31 | + color: rgba(61,68,77,1); | ||
32 | + border-radius:8px; | ||
33 | + } | ||
34 | + .content .shoppingCartBox .shoppingCartTitleBox .titleBox{ | ||
35 | + width: 1200px; | ||
36 | + height: 62px; | ||
37 | + line-height: 62px; | ||
38 | + } | ||
39 | + .content .shoppingCartBox .shoppingCartTitleBox .titleBox span:first-child{ | ||
40 | + display: inline-block; | ||
41 | + float: left; | ||
42 | + width: 6px; | ||
43 | + height: 20px; | ||
44 | + margin-top: 21px; | ||
45 | + background: rgba(0,159,142,1); | ||
46 | + border-radius: 2px; | ||
47 | + } | ||
48 | + .content .shoppingCartBox .shoppingCartTitleBox .titleBox span:nth-child(2){ | ||
49 | + height: 22px; | ||
50 | + line-height: 22px; | ||
51 | + float: left; | ||
52 | + margin-top: 20px; | ||
53 | + padding-left: 12px; | ||
54 | + font-size: 16px; | ||
55 | + font-family: PingFang SC; | ||
56 | + font-weight: 500; | ||
57 | + color: rgba(0,159,142,1); | ||
58 | + } | ||
59 | + .content .shoppingCartBox .shoppingCartTitleBox .shoppingCartTitle{ | ||
60 | + width: 100%; | ||
61 | + height: 70px; | ||
62 | + padding: 0 30px; | ||
63 | + line-height: 70px; | ||
64 | + font-size: 16px; | ||
65 | + font-family: PingFang SC; | ||
66 | + font-weight: 500; | ||
67 | + color: rgba(61,68,77,1); | ||
68 | + } | ||
69 | + .content .shoppingCartBox .shoppingCartTitleBox .shoppingCartTitle table{ | ||
70 | + width: 100%; | ||
71 | + height: 100%; | ||
72 | + } | ||
73 | + | ||
74 | + /*购物车商品部分样式*/ | ||
75 | + .content .shopListBox{ | ||
76 | + width: 1200px; | ||
77 | + margin: 0 auto; | ||
78 | + } | ||
79 | + .content .shopListBox .shopBox{ | ||
80 | + margin-bottom: 12px; | ||
81 | + } | ||
82 | + .content .shopListBox .shopBox .title{ | ||
83 | + width: 100%; | ||
84 | + height: 39px; | ||
85 | + padding: 0 30px; | ||
86 | + font-size: 14px; | ||
87 | + font-family: PingFang SC; | ||
88 | + font-weight: 500; | ||
89 | + color: rgba(61,68,77,1); | ||
90 | + border-bottom: 1px solid rgba(238,238,238,1); | ||
91 | + background: rgba(255,255,255,1); | ||
92 | + border-radius: 8px 8px 0 0; | ||
93 | + } | ||
94 | + .content .shopListBox .shopBox .title p{ | ||
95 | + display: inline-block; | ||
96 | + height: 39px; | ||
97 | + line-height: 39px; | ||
98 | + font-size: 14px; | ||
99 | + font-family: PingFang SC; | ||
100 | + font-weight:500; | ||
101 | + color: rgba(61,68,77,1); | ||
102 | + } | ||
103 | + .content .shopListBox .shopBox .title p:first-child{ | ||
104 | + width: 276px; | ||
105 | + } | ||
106 | + .content .shopListBox .shopBox .title p:nth-child(2){ | ||
107 | + width: 130px; | ||
108 | + } | ||
109 | + .content .shopListBox .shopBox .title p:nth-child(3){ | ||
110 | + color:rgba(234,50,43,1); | ||
111 | + } | ||
112 | + .content .shopListBox .shopBox .title p:nth-child(3) img{ | ||
113 | + margin-top: -5px; | ||
114 | + } | ||
115 | + .content .shopListBox .shopBox .title p:nth-child(3) span{ | ||
116 | + /*vertical-align: middle;*/ | ||
117 | + } | ||
118 | + .content .shopListBox .shopBox ul{ | ||
119 | + width: 100%; | ||
120 | + background: rgba(255,255,255,1); | ||
121 | + border-radius: 0 0 8px 8px; | ||
122 | + } | ||
123 | + .content .shopListBox .shopBox ul li{ | ||
124 | + list-style-type: none; | ||
125 | + width: 100%; | ||
126 | + height: 120px; | ||
127 | + padding: 0 30px; | ||
128 | + | ||
129 | + } | ||
130 | + .content .shopListBox .shopBox ul li div{ | ||
131 | + display: inline-block; | ||
132 | + } | ||
133 | + .content .shopListBox .shopBox ul li .radioBox{ | ||
134 | + width: 40px; | ||
135 | + height: 100%; | ||
136 | + line-height: 120px; | ||
137 | + border-bottom: transparent; | ||
138 | + } | ||
139 | + .content .shopListBox .shopBox ul li .imgBox{ | ||
140 | + width: 110px; | ||
141 | + height: 100%; | ||
142 | + line-height: 120px; | ||
143 | + display: inline-block; | ||
144 | + } | ||
145 | + .content .shopListBox .shopBox ul li .imgBox img{ | ||
146 | + width: 72px; | ||
147 | + height: 72px; | ||
148 | + } | ||
149 | + .content .shopListBox .shopBox ul li .borderBox{ | ||
150 | + width: 1100px; | ||
151 | + height: 100%; | ||
152 | + float: right; | ||
153 | + border-bottom:1px solid rgba(238,238,238,1); | ||
154 | + font-size: 14px; | ||
155 | + font-family: PingFang SC; | ||
156 | + font-weight: 500; | ||
157 | + color: rgba(91,94,99,1); | ||
158 | + | ||
159 | + } | ||
160 | + .content .shopListBox .shopBox ul li .commodityNameBox{ | ||
161 | + width: 416px; | ||
162 | + height: 100%; | ||
163 | + } | ||
164 | + .content .shopListBox .shopBox ul li .commodityNameBox p{ | ||
165 | + margin: 0; | ||
166 | + } | ||
167 | + .content .shopListBox .shopBox ul li .unitPriceBox{ | ||
168 | + width: 109px; | ||
169 | + height: 100%; | ||
170 | + text-align: center; | ||
171 | + } | ||
172 | + .content .shopListBox .shopBox ul li .numberBox{ | ||
173 | + width: 183px; | ||
174 | + height: 100%; | ||
175 | + text-align: center; | ||
176 | + } | ||
177 | + .content .shopListBox .shopBox ul li .numberBox .input-group-btn{ | ||
178 | + width: 30px; | ||
179 | + height: 30px; | ||
180 | + } | ||
181 | + .content .shopListBox .shopBox ul li .numberBox .input-group-btn button{ | ||
182 | + width: 100%; | ||
183 | + height: 100%; | ||
184 | + margin: 0; | ||
185 | + padding: 0; | ||
186 | + border:1px solid rgba(238,238,238,1); | ||
187 | + color: #5B5E63; | ||
188 | + } | ||
189 | + .content .shopListBox .shopBox ul li .numberBox .input-group-btn:first-child{ | ||
190 | + float: left; | ||
191 | + } | ||
192 | + .content .shopListBox .shopBox ul li .numberBox .contInput{ | ||
193 | + width: 56px; | ||
194 | + height: 30px; | ||
195 | + text-align: center; | ||
196 | + color: #5B5E63; | ||
197 | + } | ||
198 | + .content .shopListBox .shopBox ul li .subtotalBox{ | ||
199 | + width: 150px; | ||
200 | + height: 100%; | ||
201 | + text-align: center; | ||
202 | + } | ||
203 | + .content .shopListBox .shopBox ul li .operationBox{ | ||
204 | + width: 110px; | ||
205 | + height: 100%; | ||
206 | + text-align: right; | ||
207 | + } | ||
208 | + .content .shopListBox .shopBox ul li .operationBox .btnSpan{ | ||
209 | + cursor: pointer; | ||
210 | + } | ||
211 | + .content .shopListBox .shopBox ul li .operationBox .btnSpan span{ | ||
212 | + vertical-align: middle; | ||
213 | + } | ||
214 | + | ||
215 | + /*结算订单部分样式*/ | ||
216 | + .content .submitBox { | ||
217 | + width: 1200px; | ||
218 | + height: 52px; | ||
219 | + background: rgba(255, 255, 255, 1); | ||
220 | + border-radius: 8px; | ||
221 | + margin: 60px auto 50px auto; | ||
222 | + padding-left: 30px; | ||
223 | + } | ||
224 | + .content .submitBox .myCheckBox{ | ||
225 | + display: inline-block; | ||
226 | + width: 66px; | ||
227 | + height: 52px; | ||
228 | + line-height: 52px; | ||
229 | + margin: 0; | ||
230 | + font-size:12px; | ||
231 | + font-family:PingFang SC; | ||
232 | + font-weight:500; | ||
233 | + color:rgba(140,145,152,1); | ||
234 | + } | ||
235 | + .content .submitBox .myCheckBox #checkAll_bottom{ | ||
236 | + vertical-align: middle; | ||
237 | + margin: -2px 6px 0 0; | ||
238 | + } | ||
239 | + .content .submitBox .myCheckBox span{ | ||
240 | + /*vertical-align: middle;*/ | ||
241 | + } | ||
242 | + .content .submitBox p { | ||
243 | + display: inline-block; | ||
244 | + width: 100px; | ||
245 | + height: 52px; | ||
246 | + line-height: 52px; | ||
247 | + font-size: 14px; | ||
248 | + font-family: PingFang SC; | ||
249 | + font-weight: 500; | ||
250 | + color: rgba(140, 145, 152, 1); | ||
251 | + margin: 0; | ||
252 | + } | ||
253 | + .content .submitBox .btnP{ | ||
254 | + cursor: pointer; | ||
255 | + } | ||
256 | + .content .submitBox .totalPrice { | ||
257 | + width: 730px; | ||
258 | + text-align: right; | ||
259 | + padding-right: 21px; | ||
260 | + } | ||
261 | + .content .submitBox .totalPrice span { | ||
262 | + font-size: 16px; | ||
263 | + color: rgba(234, 50, 43, 1); | ||
264 | + } | ||
265 | + .content .submitBox .totalPrice #totalCount{ | ||
266 | + font-size: 12px; | ||
267 | + color: rgba(61,68,77,1); | ||
268 | + } | ||
269 | + .content .submitBox .btn { | ||
270 | + width: 170px; | ||
271 | + height: 52px; | ||
272 | + background: rgba(0, 159, 142, 1); | ||
273 | + border: 0; | ||
274 | + font-size: 16px; | ||
275 | + font-family: PingFang SC; | ||
276 | + font-weight: 500; | ||
277 | + line-height: 22px; | ||
278 | + color: rgba(255, 255, 255, 1); | ||
279 | + border-radius: 0; | ||
280 | + margin-top: -12px; | ||
281 | + } | ||
282 | +</style> | ||
283 | +<body> | ||
284 | +{include file="public/header"/} | ||
285 | +<!--主要内容--> | ||
286 | +<div class="content"> | ||
287 | + <div class="navBarBox"> | ||
288 | + <ul> | ||
289 | + <li><a href="{:url('index/index')}">首页</a></li> | ||
290 | + <li><a href="{:url('goods/index')}">采购中心</a></li> | ||
291 | + <li><a href="">帮买服务</a></li> | ||
292 | + <li><a href="">产品维修</a></li> | ||
293 | + <li><a href="">关于我们</a></li> | ||
294 | + </ul> | ||
295 | + </div> | ||
296 | + | ||
297 | + <div class="shoppingCartBox"> | ||
298 | + <!--购物车头部部分--> | ||
299 | + <div class="shoppingCartTitleBox"> | ||
300 | + <div class="titleBox"> | ||
301 | + <span></span> | ||
302 | + <span>我的购物车</span> | ||
303 | + </div> | ||
304 | + <div class="shoppingCartTitle"> | ||
305 | + <table> | ||
306 | + <tr> | ||
307 | + <td style="width: 155px"> | ||
308 | + <div style="display:inline-block;height: 70px;line-height: 70px"> | ||
309 | + <input id="checkAll_top" type="checkbox" style="margin: 0 10px 0 0;vertical-align: middle"> | ||
310 | + </div> | ||
311 | + | ||
312 | + <span style="vertical-align: middle">全选</span> | ||
313 | + </td> | ||
314 | + <td style="width: 415px">商品</td> | ||
315 | + <td style="width: 117px;text-align: center">单价</td> | ||
316 | + <td style="width: 186px;text-align: center">数量</td> | ||
317 | + <td style="width: 152px;text-align: center">小计</td> | ||
318 | + <td style="text-align: right">操作</td> | ||
319 | + </tr> | ||
320 | + </table> | ||
321 | + </div> | ||
322 | + </div> | ||
323 | + | ||
324 | + <!--购物车商品部分--> | ||
325 | + <div class="shopListBox"> | ||
326 | + {foreach name="$data" item="vo"} | ||
327 | + <div class="shopBox" data-free_freight="{$vo.money}" data-freight="{$vo.freight}"> | ||
328 | + <div class="title"> | ||
329 | + <p>{$vo.name}</p> | ||
330 | + <p>运费:{eq name="$vo.freight" value="0"}免运费{else /}¥{$vo.freight}{/eq}</p> | ||
331 | + {neq name="$vo.freight" value="0"} | ||
332 | + <p> | ||
333 | + <img src="__CDN__/assets/store/images/discountImg.png" alt="img"> | ||
334 | + <span>满{$vo.money}元免运费</span> | ||
335 | + </p> | ||
336 | + {/neq} | ||
337 | + </div> | ||
338 | + <ul> | ||
339 | + {foreach name="$vo.car" item="c"} | ||
340 | + <li> | ||
341 | + <div class="radioBox"><input class="commodityCheck" type="checkbox" data-goods_id="{$c.goods_id}" data-number="{$c.number}" value="{$c.id}"></div> | ||
342 | + <div class="borderBox"> | ||
343 | + <div class="imgBox"> | ||
344 | + <img src="{$c.goods.thumbnail}" alt="img"> | ||
345 | + </div> | ||
346 | + <div class="commodityNameBox"> | ||
347 | + <p style="width: 196px">{$c.goods.goodsname}</p> | ||
348 | + </div> | ||
349 | + <div class="unitPriceBox"> | ||
350 | + ¥{$c.goods.price} | ||
351 | + </div> | ||
352 | + <div class="numberBox"> | ||
353 | + <div class="input-group"> | ||
354 | + <div class="input-group-btn"> | ||
355 | + <button type="button" class="btn btn-default car-decrease" data-goods_id="{$c.goods_id}" data-type="2">-</button> | ||
356 | + </div> | ||
357 | + <input type="text" class="form-control contInput" value="{$c.number}"> | ||
358 | + <div class="input-group-btn"> | ||
359 | + <button type="button" class="btn btn-default car-add" data-goods_id="{$c.goods_id}" data-type="1">+</button> | ||
360 | + </div> | ||
361 | + </div> | ||
362 | + </div> | ||
363 | + <div class="subtotalBox"> | ||
364 | + ¥{$c.goods.price*$c.number} | ||
365 | + </div> | ||
366 | + <div class="operationBox"> | ||
367 | + <span class="btnSpan" onclick="del(this,{$c.id})"> | ||
368 | + <img src="__CDN__/assets/store/images/icon_del.png" alt=""> | ||
369 | + <span>删除</span> | ||
370 | + </span> | ||
371 | + </div> | ||
372 | + </div> | ||
373 | + </li> | ||
374 | + {/foreach} | ||
375 | + </ul> | ||
376 | + </div> | ||
377 | + {/foreach} | ||
378 | + </div> | ||
379 | + | ||
380 | + <!--结算订单部分--> | ||
381 | + <div class="submitBox"> | ||
382 | + <div class="myCheckBox"> | ||
383 | + <input id="checkAll_bottom" type="checkbox"> | ||
384 | + <span>全选</span> | ||
385 | + </div> | ||
386 | + <p class="btnP" onclick="delSelect()">删除选中商品</p> | ||
387 | + <p class="btnP" onclick="clearFun()">清空购物车</p> | ||
388 | + <p class="totalPrice">已选择 <span id="totalCount">0</span> 件商品 总价:<span style="color: #EA322B">¥</span><span id="totalPrice">0.00</span></p> | ||
389 | + <button type="button" class="btn" onclick="settlement()">去结算</button> | ||
390 | + </div> | ||
391 | + </div> | ||
392 | +</div> | ||
393 | +{include file="public/footer"/} | ||
394 | +{include file="public/js"/} | ||
395 | +<script> | ||
396 | + $(function () { | ||
397 | + initLocation(); | ||
398 | + }); | ||
399 | + | ||
400 | + //定位当前位置 | ||
401 | + function initLocation(){ | ||
402 | + // 百度地图API功能 | ||
403 | + var map = new BMap.Map("allmap"); | ||
404 | + var point = new BMap.Point(116.331398,39.897445); | ||
405 | + map.centerAndZoom(point,12); | ||
406 | + var geolocation = new BMap.Geolocation(); | ||
407 | + geolocation.getCurrentPosition(function(r){ | ||
408 | + $('#locationText').html(r.address.province + "" + r.address.city); | ||
409 | + if(this.getStatus() == BMAP_STATUS_SUCCESS){ | ||
410 | + var mk = new BMap.Marker(r.point); | ||
411 | + map.addOverlay(mk); | ||
412 | + map.panTo(r.point); | ||
413 | + //省份名称转换为id | ||
414 | + $.ajax({ | ||
415 | + url:"{:url('index/sundry/get_province_id')}", | ||
416 | + type:"POST", | ||
417 | + data:{"province_name":r.address.province}, | ||
418 | + async:false, | ||
419 | + success:function(res){ | ||
420 | + if(res.code == 1){ | ||
421 | + province_id = res.data.province_id; | ||
422 | + lng = r.point.lng; | ||
423 | + lat = r.point.lat; | ||
424 | + }else{ | ||
425 | + toast(res.msg); | ||
426 | + } | ||
427 | + }, | ||
428 | + error:function(res){ | ||
429 | + toast('与服务器断开连接'); | ||
430 | + } | ||
431 | + }); | ||
432 | + } else { | ||
433 | + toast('failed'+this.getStatus()); | ||
434 | + } | ||
435 | + },{enableHighAccuracy: true}) | ||
436 | + } | ||
437 | + | ||
438 | + //去结算 | ||
439 | + function settlement() { | ||
440 | + if($("input[class='commodityCheck']:checked").length == 0){ | ||
441 | + toast('请选择要结算的商品'); | ||
442 | + return false; | ||
443 | + } | ||
444 | + var data = []; | ||
445 | + for(var i=0;i<$("input[class='commodityCheck']:checked").length;i++){ | ||
446 | + var obj = {}; | ||
447 | + var goods_id = $("input[class='commodityCheck']:checked").eq(i).attr('data-goods_id'); | ||
448 | + var number = $("input[class='commodityCheck']:checked").eq(i).attr('data-number'); | ||
449 | + obj.goods_id = goods_id; | ||
450 | + obj.number = number; | ||
451 | + data.push(obj); | ||
452 | + } | ||
453 | + data = JSON.stringify(data); | ||
454 | + var str = "{:url('index/order/confirm',array('data'=>'DATA','province_id'=>'PROVINCE_ID'))}"; | ||
455 | + window.location.href = str.replace("DATA",data).replace("PROVINCE_ID",province_id); | ||
456 | + } | ||
457 | + | ||
458 | + //单个删除按钮 | ||
459 | + function del(_this,car_id) { | ||
460 | + $.ajax({ | ||
461 | + url:"{:url('index/car/del')}", | ||
462 | + type:"POST", | ||
463 | + data:{'car_ids':car_id}, | ||
464 | + success:function(res){ | ||
465 | + if(res.code == 1){ | ||
466 | + $(_this).closest('li').remove(); | ||
467 | + for(var i=$('.shopBox').length;i>-1;i--){ | ||
468 | + console.log($($('.shopBox')[i]).find('li').length); | ||
469 | + if($($('.shopBox')[i]).find('li').length == 0){ | ||
470 | + $($('.shopBox')[i]).remove(); | ||
471 | + } | ||
472 | + } | ||
473 | + contTotalPrice(); | ||
474 | + toast('操作成功'); | ||
475 | + } | ||
476 | + }, | ||
477 | + error:function(res){ | ||
478 | + toast('与服务器断开连接'); | ||
479 | + } | ||
480 | + }); | ||
481 | + } | ||
482 | + | ||
483 | + //删除选中商品 | ||
484 | + function delSelect() { | ||
485 | + var commodityCheck = $("input[class='commodityCheck']:checked"); | ||
486 | + var car_ids = []; | ||
487 | + $(commodityCheck).each(function (key, vo) { | ||
488 | + car_ids.push(commodityCheck.eq(key).val()); | ||
489 | + }); | ||
490 | + if(car_ids.length < 1){ | ||
491 | + toast('请至少选择一个商品删除~'); | ||
492 | + return false; | ||
493 | + } | ||
494 | + car_ids = car_ids.toString(); | ||
495 | + $.ajax({ | ||
496 | + url:"{:url('index/car/del')}", | ||
497 | + type:"POST", | ||
498 | + data:{"car_ids":car_ids}, | ||
499 | + success:function(res){ | ||
500 | + if(res.code == 1){ | ||
501 | + $("input[class='commodityCheck']:checked").closest('li').remove(); | ||
502 | + for(var i=$('.shopBox').length;i>-1;i--){ | ||
503 | + console.log($($('.shopBox')[i]).find('li').length); | ||
504 | + if($($('.shopBox')[i]).find('li').length == 0){ | ||
505 | + $($('.shopBox')[i]).remove(); | ||
506 | + } | ||
507 | + } | ||
508 | + contTotalPrice(); | ||
509 | + toast('操作成功'); | ||
510 | + }else{ | ||
511 | + toast(res.msg); | ||
512 | + } | ||
513 | + }, | ||
514 | + error:function(res){ | ||
515 | + toast('与服务器断开连接'); | ||
516 | + } | ||
517 | + }); | ||
518 | + } | ||
519 | + | ||
520 | + //清空购物车 | ||
521 | + function clearFun() { | ||
522 | + var commodityCheck = $("input[class='commodityCheck']"); | ||
523 | + var car_ids = []; | ||
524 | + $(commodityCheck).each(function (key, vo) { | ||
525 | + car_ids.push(commodityCheck.eq(key).val()); | ||
526 | + }); | ||
527 | + car_ids = car_ids.toString(); | ||
528 | + $.ajax({ | ||
529 | + url:"{:url('index/car/del')}", | ||
530 | + type:"POST", | ||
531 | + data:{"car_ids":car_ids}, | ||
532 | + success:function(res){ | ||
533 | + if(res.code == 1){ | ||
534 | + $('.shopBox').remove(); | ||
535 | + contTotalPrice(); | ||
536 | + toast('操作成功'); | ||
537 | + }else{ | ||
538 | + toast(res.msg); | ||
539 | + } | ||
540 | + }, | ||
541 | + error:function(res){ | ||
542 | + toast('与服务器断开连接'); | ||
543 | + } | ||
544 | + }); | ||
545 | + } | ||
546 | + | ||
547 | + //头部全选按钮 | ||
548 | + $('#checkAll_top').on('change', function() { | ||
549 | + if(this.checked) { | ||
550 | + $('#checkAll_bottom').prop('checked', true) | ||
551 | + } else { | ||
552 | + $('#checkAll_bottom').prop('checked', false) | ||
553 | + } | ||
554 | + checkedAll(this) | ||
555 | + }); | ||
556 | + | ||
557 | + //尾部全选按钮 | ||
558 | + $('#checkAll_bottom').on('change', function() { | ||
559 | + if(this.checked) { | ||
560 | + $('#checkAll_top').prop('checked', true) | ||
561 | + } else { | ||
562 | + $('#checkAll_top').prop('checked', false) | ||
563 | + } | ||
564 | + checkedAll(this) | ||
565 | + }); | ||
566 | + | ||
567 | + //全选、反选 | ||
568 | + function checkedAll(_this) { | ||
569 | + if(_this.checked) { | ||
570 | + $('.shopBox').find('.commodityCheck').prop('checked', true); | ||
571 | + } else { | ||
572 | + $('.shopBox').find('.commodityCheck').prop('checked', false); | ||
573 | + } | ||
574 | + contTotalPrice(); | ||
575 | + } | ||
576 | + | ||
577 | + //单个商品选择按钮 | ||
578 | + $('.commodityCheck').on('change', function() { | ||
579 | + if($('.shopBox ul li').length == $("input[class='commodityCheck']:checked").length){ | ||
580 | + $('#checkAll_top').prop('checked', true); | ||
581 | + $('#checkAll_bottom').prop('checked', true); | ||
582 | + }else{ | ||
583 | + $('#checkAll_top').prop('checked', false); | ||
584 | + $('#checkAll_bottom').prop('checked', false); | ||
585 | + } | ||
586 | + contTotalPrice(); | ||
587 | + }); | ||
588 | + | ||
589 | + //数量减 | ||
590 | + $('.car-decrease').on('click', function() { | ||
591 | + var self = $(this); | ||
592 | + var goods_id = self.attr('data-goods_id'); | ||
593 | + var type = self.attr('data-type'); | ||
594 | + $.ajax({ | ||
595 | + url:"{:url('index/car/add')}", | ||
596 | + type:"POST", | ||
597 | + data:{'goods_id':goods_id,'type':type,'province_id':province_id}, | ||
598 | + success:function(res){ | ||
599 | + if(res.code == 1){ | ||
600 | + var val = parseInt(self.closest('li').find('.contInput').val()); | ||
601 | + (val===1)?1:(val--); | ||
602 | + $(self.closest('li').find('.contInput')[0]).val(val); | ||
603 | + contPrice(self, val); | ||
604 | + toast('操作成功'); | ||
605 | + }else{ | ||
606 | + toast(res.msg); | ||
607 | + } | ||
608 | + }, | ||
609 | + error:function(res){ | ||
610 | + toast('与服务器断开连接'); | ||
611 | + } | ||
612 | + }); | ||
613 | + }); | ||
614 | + | ||
615 | + //数量加 | ||
616 | + $('.car-add').on('click', function() { | ||
617 | + var self = $(this); | ||
618 | + var goods_id = self.attr('data-goods_id'); | ||
619 | + var type = self.attr('data-type'); | ||
620 | + $.ajax({ | ||
621 | + url:"{:url('index/car/add')}", | ||
622 | + type:"POST", | ||
623 | + data:{'goods_id':goods_id,'type':type,'province_id':province_id}, | ||
624 | + success:function(res){ | ||
625 | + if(res.code == 1){ | ||
626 | + var val = parseInt(self.closest('li').find('.contInput').val()); | ||
627 | + val++; | ||
628 | + $(self.closest('li').find('.contInput')[0]).val(val); | ||
629 | + contPrice(self, val); | ||
630 | + toast('操作成功'); | ||
631 | + }else{ | ||
632 | + toast(res.msg); | ||
633 | + } | ||
634 | + }, | ||
635 | + error:function(res){ | ||
636 | + toast('与服务器断开连接'); | ||
637 | + } | ||
638 | + }); | ||
639 | + }); | ||
640 | + | ||
641 | + //计算小计 | ||
642 | + function contPrice(_this, val){ | ||
643 | + var unitPrice = parseInt($($(_this).closest('li').find('.unitPriceBox')[0]).html().split('¥')[1]); | ||
644 | + $($(_this).closest('li').find('.subtotalBox')[0]).html('¥' + (unitPrice * val).toFixed(2)); | ||
645 | + contTotalPrice(); | ||
646 | + } | ||
647 | + | ||
648 | + //计算总数、总价 | ||
649 | + function contTotalPrice() { | ||
650 | + var totalCount = 0; | ||
651 | + var totalPrice = 0; | ||
652 | + var totalFreight = 0; | ||
653 | + /*for(var i=0;i<$('.shopBox ul li').length;i++){ | ||
654 | + if($($('.shopBox ul li')[i]).find('.commodityCheck')[0].checked==true){ | ||
655 | + var subtotalNum = parseInt($($('.shopBox ul li')[i]).find('.contInput').val()); | ||
656 | + totalCount += subtotalNum; | ||
657 | + | ||
658 | + var subtotal = parseInt($($('.shopBox ul li')[i]).find('.subtotalBox').html().split('¥')[1]); | ||
659 | + | ||
660 | + var freight = parseInt($($('.shopBox')[i]).attr('data-freight'));//运费 | ||
661 | + var free_freight = parseInt($($('.shopBox')[i]).attr('data-free_freight'));//满免运费 | ||
662 | + if(subtotal < free_freight){ | ||
663 | + subtotal += freight; | ||
664 | + } | ||
665 | + console.log(subtotal); | ||
666 | + console.log(free_freight); | ||
667 | + console.log(freight); | ||
668 | + totalPrice += subtotal; | ||
669 | + } | ||
670 | + }*/ | ||
671 | + for(var i1=0;i1<$('.shopBox').length;i1++){ | ||
672 | + var freight = parseInt($($('.shopBox')[i1]).attr('data-freight'));//运费 | ||
673 | + var free_freight = parseInt($($('.shopBox')[i1]).attr('data-free_freight'));//满免运费 | ||
674 | + for(var i2=0;i2<$('.shopBox').eq(i1).find('ul li').length;i2++){ | ||
675 | + if($('.shopBox').eq(i1).find('ul li').eq(i2).find('.commodityCheck')[0].checked==true) { | ||
676 | + var subtotalNum = parseInt($('.shopBox').eq(i1).find('ul li').eq(i2).find('.contInput').val()); | ||
677 | + totalCount += subtotalNum; | ||
678 | + | ||
679 | + var subtotal = parseInt($('.shopBox').eq(i1).find('ul li').eq(i2).find('.subtotalBox').html().split('¥')[1]); | ||
680 | + totalPrice += subtotal; | ||
681 | + } | ||
682 | + } | ||
683 | + if (totalPrice < free_freight) { | ||
684 | + totalFreight += freight; | ||
685 | + totalPrice += totalFreight; | ||
686 | + } | ||
687 | + if($("input[class='commodityCheck']:checked").length == 0){ | ||
688 | + totalPrice -= totalFreight; | ||
689 | + } | ||
690 | + } | ||
691 | + | ||
692 | + $('#totalCount').html(totalCount.toFixed(0)); | ||
693 | + $('#totalPrice').html(totalPrice.toFixed(2)); | ||
694 | + } | ||
695 | + | ||
696 | +</script> | ||
697 | +</body> | ||
698 | +</html> |
@@ -255,7 +255,7 @@ | @@ -255,7 +255,7 @@ | ||
255 | } | 255 | } |
256 | .content .commodityInfoBox .commodityInfoMain .brandBox{ | 256 | .content .commodityInfoBox .commodityInfoMain .brandBox{ |
257 | width: 100%; | 257 | width: 100%; |
258 | - height: 80px; | 258 | + /*height: 80px;*/ |
259 | padding-left: 20px; | 259 | padding-left: 20px; |
260 | font-size: 16px; | 260 | font-size: 16px; |
261 | font-family: PingFang SC; | 261 | font-family: PingFang SC; |
@@ -584,10 +584,10 @@ | @@ -584,10 +584,10 @@ | ||
584 | <p>库存数量:<span id="inventory">{$data.inventory}</span></p> | 584 | <p>库存数量:<span id="inventory">{$data.inventory}</span></p> |
585 | </div> | 585 | </div> |
586 | <div class="brandBox"> | 586 | <div class="brandBox"> |
587 | - <div class="nsuranceBox"> | 587 | + <!--<div class="nsuranceBox"> |
588 | <img src="__CDN__/assets/store/images/insurance_icon.png" alt="img"> | 588 | <img src="__CDN__/assets/store/images/insurance_icon.png" alt="img"> |
589 | <span>中国人民保险公司承保</span> | 589 | <span>中国人民保险公司承保</span> |
590 | - </div> | 590 | + </div>--> |
591 | <p>品牌:<span id="brand">{$data.brand}</span></p> | 591 | <p>品牌:<span id="brand">{$data.brand}</span></p> |
592 | </div> | 592 | </div> |
593 | <div class="unitBox"> | 593 | <div class="unitBox"> |
@@ -607,15 +607,20 @@ | @@ -607,15 +607,20 @@ | ||
607 | <p>合计:<span id="totalPrice">¥{$data.price}</span></p> | 607 | <p>合计:<span id="totalPrice">¥{$data.price}</span></p> |
608 | </div> | 608 | </div> |
609 | <div class="bottobBox"> | 609 | <div class="bottobBox"> |
610 | - <button class="btn buy" onclick="buy()"> | 610 | + <!--<button class="btn buy" onclick="buy()"> |
611 | 立即购买 | 611 | 立即购买 |
612 | </button> | 612 | </button> |
613 | - <button class="btn addToCart" onclick="addToCart()"> | 613 | + <button class="btn addToCart" onclick="addToCart({$data.id})"> |
614 | 加入购物车 | 614 | 加入购物车 |
615 | - </button> | ||
616 | - <button id="collectionBtn" class="btn collection" onclick="collection()"> | 615 | + </button>--> |
616 | + <button id="collectionBtn" class="btn collection {if condition='$data.is_collect eq 1'}collected{/if}" onclick="collection({$data.id})"> | ||
617 | + {if condition="$data.is_collect eq 2"} | ||
617 | <img src="__CDN__/assets/store/images/collection_dark.png" alt="user"> | 618 | <img src="__CDN__/assets/store/images/collection_dark.png" alt="user"> |
618 | - <span style="font-family: 黑体;vertical-align: middle;">收藏</span> | 619 | + <span style="font-family: 黑体;vertical-align: middle;color: rgba(91,94,99,1);">收藏</span> |
620 | + {else /} | ||
621 | + <img src="__CDN__/assets/store/images/collection_light.png" alt="user"> | ||
622 | + <span style="font-family: 黑体;vertical-align: middle;color: #FF9417;">收藏</span> | ||
623 | + {/if} | ||
619 | </button> | 624 | </button> |
620 | </div> | 625 | </div> |
621 | </div> | 626 | </div> |
@@ -870,11 +875,101 @@ | @@ -870,11 +875,101 @@ | ||
870 | {include file="public/footer"/} | 875 | {include file="public/footer"/} |
871 | {include file="public/js"/} | 876 | {include file="public/js"/} |
872 | <script> | 877 | <script> |
878 | + var goods_id = "{$data.id}"; | ||
879 | + var html1 = "<button class=\"btn buy\" onclick=\"buy("+goods_id+")\">\n" + | ||
880 | + " 立即购买\n" + | ||
881 | + " </button>\n" + | ||
882 | + " <button class=\"btn addToCart\" onclick=\"addToCart("+goods_id+")\">\n" + | ||
883 | + " 加入购物车\n" + | ||
884 | + " </button>"; | ||
885 | + var html2 = "<button class=\"btn buy\" onclick=\"buy()\">\n" + | ||
886 | + " 购买咨询\n" + | ||
887 | + " </button>"; | ||
888 | + var insurance1 = "<div class=\"nsuranceBox\">\n" + | ||
889 | + " <img src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">\n" + | ||
890 | + " <span>中国人民保险公司承保</span>\n" + | ||
891 | + " </div>"; | ||
892 | + var insurance2 = ""; | ||
873 | $(function () { | 893 | $(function () { |
874 | initPinnerClick(); | 894 | initPinnerClick(); |
875 | evaluateVal({$probability1}, {$probability1}, {$probability2}, {$probability3});//调用此方法显示好评度 | 895 | evaluateVal({$probability1}, {$probability1}, {$probability2}, {$probability3});//调用此方法显示好评度 |
896 | + initLocation(); | ||
876 | }); | 897 | }); |
877 | 898 | ||
899 | + //定位当前位置 | ||
900 | + function initLocation(){ | ||
901 | + // 百度地图API功能 | ||
902 | + var map = new BMap.Map("allmap"); | ||
903 | + var point = new BMap.Point(116.331398,39.897445); | ||
904 | + map.centerAndZoom(point,12); | ||
905 | + var geolocation = new BMap.Geolocation(); | ||
906 | + geolocation.getCurrentPosition(function(r){ | ||
907 | + $('#locationText').html(r.address.province + "" + r.address.city); | ||
908 | + if(this.getStatus() == BMAP_STATUS_SUCCESS){ | ||
909 | + var mk = new BMap.Marker(r.point); | ||
910 | + map.addOverlay(mk); | ||
911 | + map.panTo(r.point); | ||
912 | + //省份名称转换为id | ||
913 | + $.ajax({ | ||
914 | + url:"{:url('index/sundry/get_province_id')}", | ||
915 | + type:"POST", | ||
916 | + data:{"province_name":r.address.province}, | ||
917 | + async:false, | ||
918 | + success:function(res){ | ||
919 | + if(res.code == 1){ | ||
920 | + province_id = res.data.province_id; | ||
921 | + lng = r.point.lng; | ||
922 | + lat = r.point.lat; | ||
923 | + getGoods(); | ||
924 | + }else{ | ||
925 | + $('.bottobBox').prepend(html2); | ||
926 | + $('.brandBox').prepend(insurance2); | ||
927 | + toast(res.msg); | ||
928 | + } | ||
929 | + }, | ||
930 | + error:function(res){ | ||
931 | + $('.bottobBox').prepend(html2); | ||
932 | + $('.brandBox').prepend(insurance2); | ||
933 | + toast('与服务器断开连接'); | ||
934 | + } | ||
935 | + }); | ||
936 | + } else { | ||
937 | + $('.bottobBox').prepend(html2); | ||
938 | + $('.brandBox').prepend(insurance2); | ||
939 | + toast('failed'+this.getStatus()); | ||
940 | + } | ||
941 | + },{enableHighAccuracy: true}) | ||
942 | + } | ||
943 | + | ||
944 | + //获取商品信息 | ||
945 | + function getGoods(){ | ||
946 | + $.ajax({ | ||
947 | + url:"{:url('index/goods/get_one')}", | ||
948 | + type:"POST", | ||
949 | + data:{"goods_id":goods_id,'province_id':province_id}, | ||
950 | + success:function(res){ | ||
951 | + if(res.code == 1){ | ||
952 | + if(res.data.result == '1'){ | ||
953 | + $('.bottobBox').prepend(html1); | ||
954 | + $('.brandBox').prepend(insurance1); | ||
955 | + }else{ | ||
956 | + $('.bottobBox').prepend(html2); | ||
957 | + $('.brandBox').prepend(insurance2); | ||
958 | + } | ||
959 | + }else{ | ||
960 | + $('.bottobBox').prepend(html2); | ||
961 | + $('.brandBox').prepend(insurance2); | ||
962 | + toast(res.msg); | ||
963 | + } | ||
964 | + }, | ||
965 | + error:function(res){ | ||
966 | + $('.bottobBox').prepend(html2); | ||
967 | + $('.brandBox').prepend(insurance2); | ||
968 | + toast("与服务器断开连接"); | ||
969 | + } | ||
970 | + }); | ||
971 | + } | ||
972 | + | ||
878 | //初始化数字框点击事件 | 973 | //初始化数字框点击事件 |
879 | function initPinnerClick() { | 974 | function initPinnerClick() { |
880 | $('.spinner .btn:first-of-type').on('click', function() { | 975 | $('.spinner .btn:first-of-type').on('click', function() { |
@@ -922,33 +1017,50 @@ | @@ -922,33 +1017,50 @@ | ||
922 | } | 1017 | } |
923 | 1018 | ||
924 | //加入购物车 | 1019 | //加入购物车 |
925 | - function addToCart() { | ||
926 | - //setCookie('user_name','', -1); | ||
927 | - var userName = getCookie('user_name'); | ||
928 | - if(userName == null || userName == ''){ | ||
929 | - window.location.href = 'login.html?page=commodityDetail'; | ||
930 | - }else{ | ||
931 | - $.message({ | ||
932 | - message:'已加入购物车', | ||
933 | - type:'success' | ||
934 | - }); | ||
935 | - } | 1020 | + function addToCart(goods_id) { |
1021 | + $.ajax({ | ||
1022 | + url:"{:url('index/car/add')}", | ||
1023 | + type:"POST", | ||
1024 | + data:{"goods_id":goods_id,"type":1,'province_id':province_id}, | ||
1025 | + success:function(res){ | ||
1026 | + if(res.code == 1){ | ||
1027 | + toast('操作成功'); | ||
1028 | + }else{ | ||
1029 | + toast(res.msg); | ||
1030 | + } | ||
1031 | + }, | ||
1032 | + error:function(res){ | ||
1033 | + toast("与服务器断开连接"); | ||
1034 | + } | ||
1035 | + }); | ||
936 | } | 1036 | } |
937 | 1037 | ||
938 | //收藏、取消收藏 | 1038 | //收藏、取消收藏 |
939 | - function collection() { | ||
940 | - var userName = getCookie('user_name'); | ||
941 | - if(userName == null || userName == ''){ | ||
942 | - window.location.href = 'login.html?page=commodityDetail'; | ||
943 | - }else{ | ||
944 | - if($('#collectionBtn').hasClass('collected')){ | ||
945 | - $('#collectionBtn img').attr('src','__CDN__/assets/store/images/collection_dark.png'); | ||
946 | - $('#collectionBtn').removeClass('collected'); | ||
947 | - }else{ | ||
948 | - $('#collectionBtn img').attr('src','__CDN__/assets/store/images/collection_light.png'); | ||
949 | - $('#collectionBtn').addClass('collected'); | 1039 | + function collection(goods_id) { |
1040 | + $.ajax({ | ||
1041 | + url:"{:url('index/collect/index')}", | ||
1042 | + type:"POST", | ||
1043 | + data:{"goods_id":goods_id}, | ||
1044 | + success:function(res){ | ||
1045 | + if(res.code == 1){ | ||
1046 | + if($('#collectionBtn').hasClass('collected')){ | ||
1047 | + $('#collectionBtn img').attr('src','__CDN__/assets/store/images/collection_dark.png'); | ||
1048 | + $('#collectionBtn span').css('color','rgba(91,94,99,1)'); | ||
1049 | + $('#collectionBtn').removeClass('collected'); | ||
1050 | + }else{ | ||
1051 | + $('#collectionBtn img').attr('src','__CDN__/assets/store/images/collection_light.png'); | ||
1052 | + $('#collectionBtn span').css('color','#FF9417'); | ||
1053 | + $('#collectionBtn').addClass('collected'); | ||
1054 | + } | ||
1055 | + toast('操作成功'); | ||
1056 | + }else{ | ||
1057 | + toast(res.msg); | ||
1058 | + } | ||
1059 | + }, | ||
1060 | + error:function(res){ | ||
1061 | + toast("与服务器断开连接"); | ||
950 | } | 1062 | } |
951 | - } | 1063 | + }) |
952 | } | 1064 | } |
953 | 1065 | ||
954 | //评价数据:好评度,好评,中评,差评 | 1066 | //评价数据:好评度,好评,中评,差评 |
@@ -476,9 +476,9 @@ | @@ -476,9 +476,9 @@ | ||
476 | $(vo.property).each(function (key2, p) { | 476 | $(vo.property).each(function (key2, p) { |
477 | property += "<span>"+p+"</span>"; | 477 | property += "<span>"+p+"</span>"; |
478 | }); | 478 | }); |
479 | - var insurance = "<img class=\"insurance_icon\" src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">"; | 479 | + var insurance = ""; |
480 | if(vo.insurance == '1'){ | 480 | if(vo.insurance == '1'){ |
481 | - insurance = ""; | 481 | + insurance = "<img class=\"insurance_icon\" src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">"; |
482 | } | 482 | } |
483 | var str = "<div class=\"commodityBox\">\n" + | 483 | var str = "<div class=\"commodityBox\">\n" + |
484 | " <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" + | 484 | " <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" + |
@@ -569,9 +569,9 @@ | @@ -569,9 +569,9 @@ | ||
569 | $(vo.property).each(function (key2, p) { | 569 | $(vo.property).each(function (key2, p) { |
570 | property += "<span>"+p+"</span>"; | 570 | property += "<span>"+p+"</span>"; |
571 | }); | 571 | }); |
572 | - var insurance = "<img class=\"insurance_icon\" src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">"; | 572 | + var insurance = ""; |
573 | if(vo.insurance == '1'){ | 573 | if(vo.insurance == '1'){ |
574 | - insurance = "" | 574 | + insurance = "<img class=\"insurance_icon\" src=\"__CDN__/assets/store/images/insurance_icon.png\" alt=\"img\">" |
575 | } | 575 | } |
576 | var str = "<div class=\"commodityBox\">\n" + | 576 | var str = "<div class=\"commodityBox\">\n" + |
577 | " <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" + | 577 | " <a href=\"{:url('index/goods/detail',array('goods_id'=>'GOODS_ID'))}\">\n" + |
@@ -669,9 +669,9 @@ | @@ -669,9 +669,9 @@ | ||
669 | var locationLat = 39.11365; | 669 | var locationLat = 39.11365; |
670 | $(function () { | 670 | $(function () { |
671 | // showTableData(); | 671 | // showTableData(); |
672 | - initMap(); | 672 | + // initMap(); |
673 | tableClick(); | 673 | tableClick(); |
674 | - initPaging(); | 674 | + // initPaging(); |
675 | initLocation();//获取定位信息 | 675 | initLocation();//获取定位信息 |
676 | }); | 676 | }); |
677 | 677 | ||
@@ -752,7 +752,7 @@ | @@ -752,7 +752,7 @@ | ||
752 | " <td>"+vo.store_name+property+"\n" + | 752 | " <td>"+vo.store_name+property+"\n" + |
753 | " <td>"+vo.brand+"</td>\n" + | 753 | " <td>"+vo.brand+"</td>\n" + |
754 | " <td>单价:¥"+vo.price+"</td>\n" + | 754 | " <td>单价:¥"+vo.price+"</td>\n" + |
755 | - " <td>"+vo.store_address+"(10km)</td>\n" + | 755 | + " <td>"+vo.store_address+"("+vo.distance+"km)</td>\n" + |
756 | " </tr>"; | 756 | " </tr>"; |
757 | goods_html += str.replace("GOODS_ID",vo.id); | 757 | goods_html += str.replace("GOODS_ID",vo.id); |
758 | }); | 758 | }); |
@@ -909,7 +909,7 @@ | @@ -909,7 +909,7 @@ | ||
909 | function initMap() { | 909 | function initMap() { |
910 | var point = new BMap.Point(locationLng, locationLat); | 910 | var point = new BMap.Point(locationLng, locationLat); |
911 | mapObj = new BMap.Map("mapDiv"); | 911 | mapObj = new BMap.Map("mapDiv"); |
912 | - mapObj.centerAndZoom(point, 15); | 912 | + mapObj.centerAndZoom(point, 12); |
913 | mapObj.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 | 913 | mapObj.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 |
914 | mapObj.setDefaultCursor('pointer'); | 914 | mapObj.setDefaultCursor('pointer'); |
915 | addMarker(point, 999); | 915 | addMarker(point, 999); |
@@ -963,11 +963,10 @@ | @@ -963,11 +963,10 @@ | ||
963 | 963 | ||
964 | //添加标注点 | 964 | //添加标注点 |
965 | function addMarker(point, index){ // 创建图标对象 | 965 | function addMarker(point, index){ // 创建图标对象 |
966 | - var myIcon = new BMap.Icon("__CDN__/assets/store/images/mapPoint_icon.png", new BMap.Size(45, 45), {}); | 966 | + var myIcon = new BMap.Icon("__CDN__/assets/store/images/mapPoint_icon.png", new BMap.Size(50, 50), {}); |
967 | // 创建标注对象并添加到地图 | 967 | // 创建标注对象并添加到地图 |
968 | var marker = new BMap.Marker(point, {icon: myIcon}); | 968 | var marker = new BMap.Marker(point, {icon: myIcon}); |
969 | mapObj.addOverlay(marker); | 969 | mapObj.addOverlay(marker); |
970 | - console.log(marker); | ||
971 | } | 970 | } |
972 | 971 | ||
973 | //查询50KM范围内在售商品 | 972 | //查询50KM范围内在售商品 |
application/index/view/order/confirm.html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="zh"> | ||
3 | +{include file="public/head"/} | ||
4 | +<!--swiper引入--> | ||
5 | +<link rel="stylesheet" href="__CDN__/assets/store/js/Swiper-3.4.2/css/swiper.min.css"> | ||
6 | +<script type="text/javascript" src="__CDN__/assets/store/js/Swiper-3.4.2/js/swiper.min.js"></script> | ||
7 | +<style> | ||
8 | + /*新增、修改收货人信息模态窗*/ | ||
9 | + .modal-dialog { | ||
10 | + width: 423px; | ||
11 | + height: 485px; | ||
12 | + } | ||
13 | + | ||
14 | + .modal-header { | ||
15 | + height: 80px; | ||
16 | + border: 0; | ||
17 | + } | ||
18 | + | ||
19 | + .modal-body { | ||
20 | + padding: 10px 24px 20px 24px; | ||
21 | + max-height: none; | ||
22 | + } | ||
23 | + | ||
24 | + .modal-title { | ||
25 | + height: 50px; | ||
26 | + line-height: 50px; | ||
27 | + text-align: center; | ||
28 | + font-size: 20px; | ||
29 | + font-family: PingFang SC; | ||
30 | + font-weight: 500; | ||
31 | + color: rgba(6, 18, 30, 1); | ||
32 | + } | ||
33 | + | ||
34 | + form { | ||
35 | + font-size: 14px; | ||
36 | + font-family: PingFang SC; | ||
37 | + font-weight: 500; | ||
38 | + color: rgba(61, 68, 77, 1); | ||
39 | + } | ||
40 | + | ||
41 | + form .form-group { | ||
42 | + width: 100%; | ||
43 | + height: 54px; | ||
44 | + margin: 0 0 20px 0; | ||
45 | + position: relative; | ||
46 | + } | ||
47 | + | ||
48 | + form .form-group .tipsInfo { | ||
49 | + position: absolute; | ||
50 | + width: 100%; | ||
51 | + height: 20px; | ||
52 | + font-size: 10px; | ||
53 | + color: red; | ||
54 | + top: 55px; | ||
55 | + left: 0; | ||
56 | + } | ||
57 | + | ||
58 | + form .form-group .form-control { | ||
59 | + width: 100%; | ||
60 | + height: 100%; | ||
61 | + box-shadow: none; | ||
62 | + } | ||
63 | + | ||
64 | + form .form-group:nth-child(3), form .form-group:nth-child(5) { | ||
65 | + position: relative; | ||
66 | + } | ||
67 | + | ||
68 | + form .form-group:nth-child(3) span { | ||
69 | + display: inline-block; | ||
70 | + position: absolute; | ||
71 | + top: 15px; | ||
72 | + right: 20px; | ||
73 | + font-size: 16px; | ||
74 | + font-family: PingFang SC; | ||
75 | + font-weight: 400; | ||
76 | + color: rgba(140, 145, 152, 1); | ||
77 | + } | ||
78 | + | ||
79 | + form .form-group:nth-child(5) span { | ||
80 | + display: inline-block; | ||
81 | + position: absolute; | ||
82 | + top: 35px; | ||
83 | + left: 12px; | ||
84 | + font-size: 16px; | ||
85 | + font-family: PingFang SC; | ||
86 | + font-weight: 400; | ||
87 | + line-height: 22px; | ||
88 | + color: rgba(140, 145, 152, 1); | ||
89 | + } | ||
90 | + | ||
91 | + form p { | ||
92 | + height: 22px; | ||
93 | + padding-left: 9px; | ||
94 | + font-size: 16px; | ||
95 | + font-family: PingFang SC; | ||
96 | + font-weight: 500; | ||
97 | + line-height: 22px; | ||
98 | + color: rgba(6, 18, 30, 1); | ||
99 | + } | ||
100 | + | ||
101 | + form button { | ||
102 | + width: 100%; | ||
103 | + height: 51px; | ||
104 | + border: 0 !important; | ||
105 | + background: rgba(0, 159, 142, 1) !important; | ||
106 | + border-radius: 2px !important; | ||
107 | + font-size: 18px !important; | ||
108 | + font-family: PingFang SC; | ||
109 | + font-weight: 400 !important; | ||
110 | + color: rgba(255, 255, 255, 1) !important; | ||
111 | + } | ||
112 | + | ||
113 | + form .imgBox { | ||
114 | + margin-bottom: 20px; | ||
115 | + } | ||
116 | +</style> | ||
117 | +<style> | ||
118 | + body { | ||
119 | + background: rgba(249, 249, 249, 1); | ||
120 | + } | ||
121 | + | ||
122 | + .content { | ||
123 | + width: 100%; | ||
124 | + font-size: 0; | ||
125 | + } | ||
126 | + | ||
127 | + /*订单信息部分样式*/ | ||
128 | + .content .orderInfoBox { | ||
129 | + width: 100%; | ||
130 | + /*height: 905px;*/ | ||
131 | + background: rgba(249, 249, 249, 1); | ||
132 | + } | ||
133 | + | ||
134 | + .content .orderInfoBox .titleBox { | ||
135 | + width: 1200px; | ||
136 | + height: 60px; | ||
137 | + line-height: 60px; | ||
138 | + background: rgba(255, 255, 255, 1); | ||
139 | + border-radius: 8px; | ||
140 | + margin: 12px auto; | ||
141 | + } | ||
142 | + | ||
143 | + .content .orderInfoBox .titleBox span:first-child { | ||
144 | + display: inline-block; | ||
145 | + float: left; | ||
146 | + width: 6px; | ||
147 | + height: 20px; | ||
148 | + margin-top: 21px; | ||
149 | + background: rgba(0, 159, 142, 1); | ||
150 | + border-radius: 2px; | ||
151 | + } | ||
152 | + | ||
153 | + .content .orderInfoBox .titleBox span:nth-child(2) { | ||
154 | + height: 22px; | ||
155 | + line-height: 22px; | ||
156 | + float: left; | ||
157 | + margin-top: 20px; | ||
158 | + padding-left: 12px; | ||
159 | + font-size: 16px; | ||
160 | + font-family: PingFang SC; | ||
161 | + font-weight: 500; | ||
162 | + color: rgba(0, 159, 142, 1); | ||
163 | + } | ||
164 | + | ||
165 | + /*物流方式部分样式*/ | ||
166 | + .content .orderInfoBox .sendModeBox { | ||
167 | + width: 1200px; | ||
168 | + height: 108px; | ||
169 | + background: rgba(255, 255, 255, 1); | ||
170 | + border-radius: 8px; | ||
171 | + margin: 0 auto 12px auto; | ||
172 | + } | ||
173 | + | ||
174 | + .content .orderInfoBox .title { | ||
175 | + width: 100%; | ||
176 | + height: 40px; | ||
177 | + padding: 0 30px; | ||
178 | + font-size: 14px; | ||
179 | + font-family: PingFang SC; | ||
180 | + font-weight: 500; | ||
181 | + line-height: 40px; | ||
182 | + color: rgba(61, 68, 77, 1); | ||
183 | + border-bottom: 1px solid rgba(238, 238, 238, 1); | ||
184 | + margin: 0; | ||
185 | + } | ||
186 | + | ||
187 | + .content .orderInfoBox .sendModeBox ul { | ||
188 | + width: 100%; | ||
189 | + height: 68px; | ||
190 | + padding: 0 30px; | ||
191 | + } | ||
192 | + | ||
193 | + .content .orderInfoBox .sendModeBox ul li { | ||
194 | + list-style-type: none; | ||
195 | + float: left; | ||
196 | + width: 95px; | ||
197 | + height: 65px; | ||
198 | + line-height: 65px; | ||
199 | + margin-right: 30px; | ||
200 | + font-size: 14px; | ||
201 | + font-family: PingFang SC; | ||
202 | + font-weight: 400; | ||
203 | + color: rgba(6, 18, 30, 1); | ||
204 | + cursor: pointer; | ||
205 | + } | ||
206 | + | ||
207 | + .content .orderInfoBox .sendModeBox ul li img { | ||
208 | + width: 16px; | ||
209 | + height: 16px; | ||
210 | + margin-right: 12px; | ||
211 | + } | ||
212 | + | ||
213 | + /*快递_收货人信息部分样式*/ | ||
214 | + .content .orderInfoBox .consigneeBox { | ||
215 | + width: 1200px; | ||
216 | + background: rgba(255, 255, 255, 1); | ||
217 | + border-radius: 8px; | ||
218 | + margin: 0 auto 12px auto; | ||
219 | + } | ||
220 | + | ||
221 | + .content .orderInfoBox .title { | ||
222 | + display: inline-block; | ||
223 | + } | ||
224 | + | ||
225 | + .content .orderInfoBox .title span { | ||
226 | + display: inline-block; | ||
227 | + float: right; | ||
228 | + width: 84px; | ||
229 | + height: 40px; | ||
230 | + font-size: 14px; | ||
231 | + font-family: PingFang SC; | ||
232 | + font-weight: 500; | ||
233 | + line-height: 40px; | ||
234 | + color: rgba(0, 159, 142, 1); | ||
235 | + cursor: pointer; | ||
236 | + } | ||
237 | + | ||
238 | + .content .orderInfoBox .consigneeBox ul { | ||
239 | + width: 100%; | ||
240 | + padding: 0; | ||
241 | + } | ||
242 | + | ||
243 | + .content .orderInfoBox .consigneeBox ul li { | ||
244 | + list-style-type: none; | ||
245 | + width: 100%; | ||
246 | + height: 112px; | ||
247 | + cursor: pointer; | ||
248 | + } | ||
249 | + | ||
250 | + .content .orderInfoBox .consigneeBox ul li .imgBox { | ||
251 | + float: left; | ||
252 | + width: 76px; | ||
253 | + height: 100%; | ||
254 | + text-align: center; | ||
255 | + line-height: 112px; | ||
256 | + } | ||
257 | + | ||
258 | + .content .orderInfoBox .consigneeBox ul li .contentBox { | ||
259 | + width: 1090px; | ||
260 | + height: 100%; | ||
261 | + margin-left: 77px; | ||
262 | + overflow: hidden; | ||
263 | + border-bottom: 1px solid rgba(238, 238, 238, 1); | ||
264 | + } | ||
265 | + | ||
266 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box { | ||
267 | + width: 100%; | ||
268 | + height: 20px; | ||
269 | + } | ||
270 | + | ||
271 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box:first-child { | ||
272 | + margin: 30px 0 12px 0; | ||
273 | + } | ||
274 | + | ||
275 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box { | ||
276 | + margin: 0; | ||
277 | + font-size: 14px; | ||
278 | + font-family: PingFang SC; | ||
279 | + font-weight: 500; | ||
280 | + line-height: 20px; | ||
281 | + color: rgba(91, 94, 99, 1); | ||
282 | + } | ||
283 | + | ||
284 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box p { | ||
285 | + margin: 0; | ||
286 | + display: inline-block; | ||
287 | + } | ||
288 | + | ||
289 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box p .phone { | ||
290 | + display: inline-block; | ||
291 | + margin-left: 10px; | ||
292 | + font-size: 12px; | ||
293 | + } | ||
294 | + | ||
295 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box .btnSpan { | ||
296 | + display: inline-block; | ||
297 | + width: 60px; | ||
298 | + height: 17px; | ||
299 | + float: right; | ||
300 | + text-align: right; | ||
301 | + } | ||
302 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box .btnSpan span { | ||
303 | + display: inline-block; | ||
304 | + vertical-align: middle; | ||
305 | + } | ||
306 | + .content .orderInfoBox .consigneeBox ul li .contentBox .box .btnSpan img{ | ||
307 | + margin-right: 6px; | ||
308 | + } | ||
309 | + | ||
310 | + /*跑腿_收货人信息*/ | ||
311 | + .content .orderInfoBox .errandsBox { | ||
312 | + display: none; | ||
313 | + width: 1200px; | ||
314 | + background: rgba(255, 255, 255, 1); | ||
315 | + border-radius: 8px; | ||
316 | + margin: 0 auto 12px auto; | ||
317 | + } | ||
318 | + | ||
319 | + .content .orderInfoBox .errandsBox ul { | ||
320 | + width: 100%; | ||
321 | + /*padding: 0 30px;*/ | ||
322 | + } | ||
323 | + | ||
324 | + .content .orderInfoBox .errandsBox ul li { | ||
325 | + list-style-type: none; | ||
326 | + width: 100%; | ||
327 | + height: 116px; | ||
328 | + cursor: pointer; | ||
329 | + } | ||
330 | + | ||
331 | + .content .orderInfoBox .errandsBox ul li .imgBox { | ||
332 | + float: left; | ||
333 | + width: 76px; | ||
334 | + height: 100%; | ||
335 | + text-align: center; | ||
336 | + line-height: 112px; | ||
337 | + } | ||
338 | + | ||
339 | + .content .orderInfoBox .errandsBox ul li .contentBox { | ||
340 | + width: 1064px; | ||
341 | + height: 100%; | ||
342 | + margin-left: 77px; | ||
343 | + overflow: hidden; | ||
344 | + border-bottom: 1px solid rgba(238, 238, 238, 1); | ||
345 | + padding-top: 20px; | ||
346 | + } | ||
347 | + | ||
348 | + .content .orderInfoBox .errandsBox ul li .contentBox p { | ||
349 | + font-size: 14px; | ||
350 | + font-family: PingFang SC; | ||
351 | + font-weight: 500; | ||
352 | + line-height: 20px; | ||
353 | + color: rgba(91, 94, 99, 1); | ||
354 | + margin-bottom: 8px; | ||
355 | + } | ||
356 | + | ||
357 | + /*支付方式部分样式*/ | ||
358 | + .content .orderInfoBox .payModeBox { | ||
359 | + width: 1200px; | ||
360 | + height: 264px; | ||
361 | + background: rgba(255, 255, 255, 1); | ||
362 | + border-radius: 8px; | ||
363 | + margin: 0 auto 12px auto; | ||
364 | + } | ||
365 | + | ||
366 | + .content .orderInfoBox .payModeBox ul { | ||
367 | + width: 100%; | ||
368 | + padding: 0 30px; | ||
369 | + } | ||
370 | + | ||
371 | + .content .orderInfoBox .payModeBox ul li { | ||
372 | + list-style-type: none; | ||
373 | + width: 100%; | ||
374 | + height: 68px; | ||
375 | + cursor: pointer; | ||
376 | + } | ||
377 | + | ||
378 | + .content .orderInfoBox .payModeBox ul li .imgBox { | ||
379 | + float: left; | ||
380 | + width: 76px; | ||
381 | + height: 100%; | ||
382 | + text-align: center; | ||
383 | + line-height: 68px; | ||
384 | + } | ||
385 | + | ||
386 | + .content .orderInfoBox .payModeBox ul li .contentBox { | ||
387 | + width: 1064px; | ||
388 | + height: 100%; | ||
389 | + margin-left: 77px; | ||
390 | + overflow: hidden; | ||
391 | + border-bottom: 1px solid rgba(238, 238, 238, 1); | ||
392 | + padding-top: 20px; | ||
393 | + font-size: 14px; | ||
394 | + font-family: PingFang SC; | ||
395 | + font-weight: 400; | ||
396 | + line-height: 20px; | ||
397 | + color: rgba(6, 18, 30, 1); | ||
398 | + } | ||
399 | + | ||
400 | + /*二维码部分样式*/ | ||
401 | + .content .orderInfoBox .downloadBox { | ||
402 | + display: none; | ||
403 | + width: 1200px; | ||
404 | + height: 132px; | ||
405 | + border-radius: 8px; | ||
406 | + margin: 8px auto 0 auto; | ||
407 | + padding: 0 30px; | ||
408 | + } | ||
409 | + | ||
410 | + .content .orderInfoBox .downloadBox div { | ||
411 | + display: inline-block; | ||
412 | + width: 100px; | ||
413 | + } | ||
414 | + | ||
415 | + .content .orderInfoBox .downloadBox div img { | ||
416 | + width: 100px; | ||
417 | + height: 100px; | ||
418 | + margin-bottom: 12px; | ||
419 | + } | ||
420 | + | ||
421 | + .content .orderInfoBox .downloadBox div p { | ||
422 | + margin: 0; | ||
423 | + width: 100px; | ||
424 | + height: 20px; | ||
425 | + text-align: center; | ||
426 | + font-size: 14px; | ||
427 | + font-family: PingFang SC; | ||
428 | + font-weight: 400; | ||
429 | + line-height: 20px; | ||
430 | + color: rgba(6, 18, 30, 1); | ||
431 | + } | ||
432 | + | ||
433 | + /*提交订单部分样式*/ | ||
434 | + .content .orderInfoBox .submitBox { | ||
435 | + width: 1200px; | ||
436 | + height: 52px; | ||
437 | + background: rgba(255, 255, 255, 1); | ||
438 | + border-radius: 8px; | ||
439 | + margin: 60px auto 50px auto; | ||
440 | + padding-left: 30px; | ||
441 | + } | ||
442 | + | ||
443 | + .content .orderInfoBox .submitBox p { | ||
444 | + display: inline-block; | ||
445 | + width: 160px; | ||
446 | + height: 52px; | ||
447 | + line-height: 52px; | ||
448 | + font-size: 14px; | ||
449 | + font-family: PingFang SC; | ||
450 | + font-weight: 500; | ||
451 | + color: rgba(140, 145, 152, 1); | ||
452 | + margin: 0; | ||
453 | + } | ||
454 | + | ||
455 | + .content .orderInfoBox .submitBox p:nth-child(3) { | ||
456 | + width: 680px; | ||
457 | + text-align: right; | ||
458 | + padding-right: 21px; | ||
459 | + } | ||
460 | + | ||
461 | + .content .orderInfoBox .submitBox p:nth-child(3) span { | ||
462 | + font-size: 16px; | ||
463 | + color: rgba(234, 50, 43, 1); | ||
464 | + } | ||
465 | + | ||
466 | + .content .orderInfoBox .submitBox .btn { | ||
467 | + width: 170px; | ||
468 | + height: 52px; | ||
469 | + background: rgba(0, 159, 142, 1); | ||
470 | + border: 0; | ||
471 | + font-size: 16px; | ||
472 | + font-family: PingFang SC; | ||
473 | + font-weight: 500; | ||
474 | + line-height: 22px; | ||
475 | + color: rgba(255, 255, 255, 1); | ||
476 | + border-radius: 0; | ||
477 | + margin-top: -12px; | ||
478 | + } | ||
479 | +</style> | ||
480 | +<body> | ||
481 | +{include file="public/header"/} | ||
482 | +<!--主要内容--> | ||
483 | +<div class="content"> | ||
484 | + <div class="navBarBox"> | ||
485 | + <ul> | ||
486 | + <li><a href="{:url('index/index')}">首页</a></li> | ||
487 | + <li><a href="{:url('goods/index')}">采购中心</a></li> | ||
488 | + <li><a href="">帮买服务</a></li> | ||
489 | + <li><a href="">产品维修</a></li> | ||
490 | + <li><a href="">关于我们</a></li> | ||
491 | + </ul> | ||
492 | + </div> | ||
493 | + | ||
494 | + <!--订单信息部分--> | ||
495 | + <div class="orderInfoBox"> | ||
496 | + <!--标题部分--> | ||
497 | + <div class="titleBox"> | ||
498 | + <span></span> | ||
499 | + <span id="orderTitle">订单确认</span> | ||
500 | + </div> | ||
501 | + | ||
502 | + <!--物流方式--> | ||
503 | + <div class="sendModeBox"> | ||
504 | + <p class="title">物流方式</p> | ||
505 | + <ul> | ||
506 | + <li onclick="changeSendMode('express')"><img id="expressImg" src="__CDN__/assets/store/images/checkbox_orange.png" alt="img">快递运输 | ||
507 | + </li> | ||
508 | + <li onclick="changeSendMode('dada')"><img id="dadaImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img">达达快递 | ||
509 | + </li> | ||
510 | + <li onclick="changeSendMode('meiTuan')"><img id="meiTuanImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img">美团跑腿 | ||
511 | + </li> | ||
512 | + </ul> | ||
513 | + </div> | ||
514 | + | ||
515 | + <!--快递_收货人信息--> | ||
516 | + <div class="consigneeBox"> | ||
517 | + <p class="title"> | ||
518 | + 收货人信息 | ||
519 | + <span onclick="addConsignee()">新增收货地址</span> | ||
520 | + </p> | ||
521 | + <ul class="address_box"> | ||
522 | + {foreach name="$address" item="a"} | ||
523 | + <li onclick="changeConsignee(this)" data-address_id="{$a.id}"> | ||
524 | + <div class="imgBox"> | ||
525 | + <img class="checkImg" src="{if condition='$a.is_default eq 1'}__CDN__/assets/store/images/checkbox_orange.png{else /}__CDN__/assets/store/images/radioUnSelect.png{/if}" alt="img"> | ||
526 | + </div> | ||
527 | + <div class="contentBox address-{$a.id}"> | ||
528 | + <div class="box"> | ||
529 | + <p> | ||
530 | + <span class="name">{$a.name}</span> | ||
531 | + <span class="phone">{$a.phone}</span> | ||
532 | + </p> | ||
533 | + <span class="btnSpan" onclick="edit(this)"> | ||
534 | + <img src="__CDN__/assets/store/images/icon_bianji.png" alt="img"> | ||
535 | + <span></span>编辑 | ||
536 | + </span> | ||
537 | + </div> | ||
538 | + <div class="box"> | ||
539 | + <p class="address"> | ||
540 | + <span data-province_id="{$a.province_id}">{$a.province_name}</span> | ||
541 | + <span data-city_id="{$a.city_id}">{$a.city_name}</span> | ||
542 | + <span data-county_id="{$a.county_id}">{$a.county_name}</span> | ||
543 | + <span>{$a.address}</span> | ||
544 | + </p> | ||
545 | + <span class="btnSpan" onclick="del(this)"><img src="__CDN__/assets/store/images/icon_del.png" alt=""> | ||
546 | + <span>删除</span> | ||
547 | + </span> | ||
548 | + </div> | ||
549 | + </div> | ||
550 | + </li> | ||
551 | + {/foreach} | ||
552 | + </ul> | ||
553 | + </div> | ||
554 | + <!--跑腿_收货人信息--> | ||
555 | + <div class="errandsBox"> | ||
556 | + <p class="title"> | ||
557 | + 店铺信息 | ||
558 | + </p> | ||
559 | + <ul> | ||
560 | + {foreach name="$store" item="s"} | ||
561 | + <li onclick="changeErrands(this)"> | ||
562 | + <div class="imgBox"> | ||
563 | + <img class="checkImg" src="__CDN__/assets/store/images/checkbox_orange.png" alt="img"> | ||
564 | + </div> | ||
565 | + <div class="contentBox"> | ||
566 | + <p>联系人(店铺名称):<span class="shopName">{$s.name}</span></p> | ||
567 | + <p>电话:<span class="phone">{$s.phone}</span></p> | ||
568 | + <p>店铺地址: | ||
569 | + <span class="address"> | ||
570 | + <span data-province_id="{$s.province_id}">{$s.province_name}</span> | ||
571 | + <span data-city_id="{$s.city_id}">{$s.city_name}</span> | ||
572 | + <span data-county_id="{$s.county_id}">{$s.county_name}</span> | ||
573 | + <span>{$s.address}</span> | ||
574 | + </span> | ||
575 | + </p> | ||
576 | + </div> | ||
577 | + </li> | ||
578 | + {/foreach} | ||
579 | + </ul> | ||
580 | + </div> | ||
581 | + | ||
582 | + <!--支付方式--> | ||
583 | + <div class="payModeBox"> | ||
584 | + <p class="title">支付方式</p> | ||
585 | + <ul> | ||
586 | + <li onclick="changePayMode(this,'weChat')"> | ||
587 | + <div class="imgBox"> | ||
588 | + <img class="checkImg" src="__CDN__/assets/store/images/checkbox_orange.png" alt="img"> | ||
589 | + </div> | ||
590 | + <div class="contentBox"> | ||
591 | + <img src="__CDN__/assets/store/images/weixin.png" alt="img"> | ||
592 | + 微信支付 | ||
593 | + </div> | ||
594 | + </li> | ||
595 | + <li onclick="changePayMode(this,'aliPay')"> | ||
596 | + <div class="imgBox"> | ||
597 | + <img class="checkImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img"> | ||
598 | + </div> | ||
599 | + <div class="contentBox"> | ||
600 | + <img src="__CDN__/assets/store/images/zhufubao.png" alt="img"> | ||
601 | + 支付宝 | ||
602 | + </div> | ||
603 | + </li> | ||
604 | + <li onclick="changePayMode(this,'yunPay')"> | ||
605 | + <div class="imgBox"> | ||
606 | + <img class="checkImg" src="__CDN__/assets/store/images/radioUnSelect.png" alt="img"> | ||
607 | + </div> | ||
608 | + <div class="contentBox"> | ||
609 | + <img src="__CDN__/assets/store/images/yunshanfu.png" alt="img"> | ||
610 | + 云闪付 | ||
611 | + </div> | ||
612 | + </li> | ||
613 | + </ul> | ||
614 | + </div> | ||
615 | + | ||
616 | + <!--二维码部分--> | ||
617 | + <div class="downloadBox"> | ||
618 | + <div> | ||
619 | + <img src="__CDN__/assets/store/images/dadaCode.png" alt="img"> | ||
620 | + <p>下载达达</p> | ||
621 | + </div> | ||
622 | + <div> | ||
623 | + <img src="__CDN__/assets/store/images/meiTuanCode.png" alt="img"> | ||
624 | + <p>下载美团</p> | ||
625 | + </div> | ||
626 | + </div> | ||
627 | + | ||
628 | + <!--提交订单部分--> | ||
629 | + <div class="submitBox"> | ||
630 | + <p>商品金额:<span>¥150.00</span></p> | ||
631 | + <p>物流费用:<span>¥0.00</span></p> | ||
632 | + <p>应付总额:<span>¥198.00</span></p> | ||
633 | + <button id="submitBtn" type="button" class="btn" onclick="submitOrder()">提交订单</button> | ||
634 | + </div> | ||
635 | + </div> | ||
636 | +</div> | ||
637 | + | ||
638 | +<!--新增、修改收货人信息模态窗--> | ||
639 | +<div class="modal fade" id="changeInfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" | ||
640 | + aria-hidden="true"> | ||
641 | + <div class="modal-dialog"> | ||
642 | + <div class="modal-content"> | ||
643 | + <div class="modal-header"> | ||
644 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> | ||
645 | + <img src="__CDN__/assets/store/images/close_icon.png" alt="close"> | ||
646 | + </button> | ||
647 | + <h4 class="modal-title" id="myModalLabel"> | ||
648 | + 新增/修改收货人信息 | ||
649 | + </h4> | ||
650 | + </div> | ||
651 | + <div class="modal-body"> | ||
652 | + <form> | ||
653 | + <div class="form-group"> | ||
654 | + <input type="text" class="form-control" id="userName" placeholder="姓名"> | ||
655 | + <span id="userNameTips" class="tipsInfo"></span> | ||
656 | + </div> | ||
657 | + <div class="form-group"> | ||
658 | + <input type="text" class="form-control" id="phoneNum" placeholder="手机号"> | ||
659 | + <span id="phoneNumTips" class="tipsInfo"></span> | ||
660 | + </div> | ||
661 | + <div style="display: flex;"> | ||
662 | + <div class="form-group"> | ||
663 | + <select id="province" class="form-control" placeholder="请选择省份"> | ||
664 | + <option value="">请选择</option> | ||
665 | + {foreach name="$province" item="p"} | ||
666 | + <option value="{$p.id}">{$p.name}</option> | ||
667 | + {/foreach} | ||
668 | + </select> | ||
669 | + </div> | ||
670 | + <div class="form-group"> | ||
671 | + <select id="city" class="form-control" placeholder="请选择城市"> | ||
672 | + <option value="">请选择</option> | ||
673 | + <!--{foreach name="$city" item="c"} | ||
674 | + <option value="{$c.id}">{$c.name}</option> | ||
675 | + {/foreach}--> | ||
676 | + </select> | ||
677 | + </div> | ||
678 | + <div class="form-group"> | ||
679 | + <select id="county" class="form-control" placeholder="请选择省份"> | ||
680 | + <option value="">请选择</option> | ||
681 | + <!--{foreach name="$county" item="c"} | ||
682 | + <option value="{$c.id}">{$c.name}</option> | ||
683 | + {/foreach}--> | ||
684 | + </select> | ||
685 | + </div> | ||
686 | + </div> | ||
687 | + <div class="form-group"> | ||
688 | + <input type="text" class="form-control" id="addressDetail" placeholder="详细地址"> | ||
689 | + <span id="addressDetailTips" class="tipsInfo"></span> | ||
690 | + </div> | ||
691 | + <input type="hidden" id="address_id" value=""/> | ||
692 | + <button type="button" class="btn btn-submit" onclick="sendInfo()">确定</button> | ||
693 | + </form> | ||
694 | + </div> | ||
695 | + </div> | ||
696 | + </div> | ||
697 | +</div> | ||
698 | +{include file="public/footer"/} | ||
699 | +{include file="public/js"/} | ||
700 | +<script> | ||
701 | + var sendMode = 'express'; | ||
702 | + var payMode = 'weChat'; | ||
703 | + $(function () { | ||
704 | + var source = window.location.href.split('source=')[1]; | ||
705 | + if (source){ | ||
706 | + $('#orderTitle').html('订单详情'); | ||
707 | + $('#submitBtn').hide(); | ||
708 | + } | ||
709 | + }); | ||
710 | + | ||
711 | + //更换运输方式 | ||
712 | + function changeSendMode(type) { | ||
713 | + $('.sendModeBox ul li img').attr('src', '__CDN__/assets/store/images/radioUnSelect.png'); | ||
714 | + sendMode = type; | ||
715 | + if (type == 'express') { | ||
716 | + //快递 | ||
717 | + $('.errandsBox,.downloadBox').hide(); | ||
718 | + $('.consigneeBox').show(); | ||
719 | + $('#expressImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
720 | + } else if (type == 'dada') { | ||
721 | + //达达 | ||
722 | + $('.consigneeBox').hide(); | ||
723 | + $('.errandsBox,.downloadBox').show(); | ||
724 | + $('#dadaImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
725 | + } else { | ||
726 | + //美团 | ||
727 | + $('.consigneeBox').hide(); | ||
728 | + $('.errandsBox,.downloadBox').show(); | ||
729 | + $('#meiTuanImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
730 | + } | ||
731 | + } | ||
732 | + | ||
733 | + //新增收货信息 | ||
734 | + function addConsignee() { | ||
735 | + $('#userName').val(''); | ||
736 | + $('#phoneNum').val(''); | ||
737 | + $('#addressDetail').val(''); | ||
738 | + $('#address_id').val(''); | ||
739 | + getProvince(); | ||
740 | + getCity(); | ||
741 | + getCounty(); | ||
742 | + $('#changeInfoModal').modal(); | ||
743 | + } | ||
744 | + | ||
745 | + //发送收货人信息 | ||
746 | + function sendInfo() { | ||
747 | + var name = $('#userName').val(); | ||
748 | + var phone = $('#phoneNum').val(); | ||
749 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
750 | + var province_id = $('#province').val(); | ||
751 | + var city_id = $('#city').val(); | ||
752 | + var county_id = $('#county').val(); | ||
753 | + var address = $('#addressDetail').val(); | ||
754 | + var address_id = $('#address_id').val(); | ||
755 | + if(name == ''){ | ||
756 | + toast('请输入姓名'); | ||
757 | + return false; | ||
758 | + }else if(phone == ''){ | ||
759 | + toast('请输入电话'); | ||
760 | + return false; | ||
761 | + }else if(!reg.test(phone)){ | ||
762 | + toast('请输入正确的手机号'); | ||
763 | + return false; | ||
764 | + }else if(province_id == ''){ | ||
765 | + toast('请选择省份'); | ||
766 | + return false; | ||
767 | + }else if(city_id == ''){ | ||
768 | + toast('请选择城市'); | ||
769 | + return false; | ||
770 | + }else if(county_id == ''){ | ||
771 | + toast('请选择区/县'); | ||
772 | + return false; | ||
773 | + }else if(address == ''){ | ||
774 | + toast('请输入详细地址'); | ||
775 | + return false; | ||
776 | + } | ||
777 | + $.ajax({ | ||
778 | + url:"{:url('index/address/update')}", | ||
779 | + type:"POST", | ||
780 | + data:{'name':name,'phone':phone,'province_id':province_id,'city_id':city_id,'county_id':county_id,'address':address,'address_id':address_id}, | ||
781 | + success:function (res) { | ||
782 | + if(res.code == 1){ | ||
783 | + var data = res.data; | ||
784 | + if(address_id != ''){ | ||
785 | + //编辑 | ||
786 | + var html = "<div class=\"box\">\n" + | ||
787 | + " <p>\n" + | ||
788 | + " <span class=\"name\">"+data.name+"</span>\n" + | ||
789 | + " <span class=\"phone\">"+data.phone+"</span>\n" + | ||
790 | + " </p>\n" + | ||
791 | + " <span class=\"btnSpan\" onclick=\"edit(this)\">\n" + | ||
792 | + " <img src=\"__CDN__/assets/store/images/icon_bianji.png\" alt=\"img\">\n" + | ||
793 | + " <span></span>编辑\n" + | ||
794 | + " </span>\n" + | ||
795 | + " </div>\n" + | ||
796 | + " <div class=\"box\">\n" + | ||
797 | + " <p class=\"address\">\n" + | ||
798 | + " <span data-province_id=\""+data.province_id+"\">"+data.province_name+"</span>\n" + | ||
799 | + " <span data-city_id=\""+data.city_id+"\">"+data.city_name+"</span>\n" + | ||
800 | + " <span data-county_id=\""+data.county_id+"\">"+data.county_name+"</span>\n" + | ||
801 | + " <span>"+data.address+"</span>\n" + | ||
802 | + " </p>\n" + | ||
803 | + " <span class=\"btnSpan\" onclick=\"del(this)\"><img src=\"__CDN__/assets/store/images/icon_del.png\" alt=\"\">\n" + | ||
804 | + " <span>删除</span>\n" + | ||
805 | + " </span>\n" + | ||
806 | + " </div>"; | ||
807 | + $(".address-"+data.id+"").html(html); | ||
808 | + }else{ | ||
809 | + //新增 | ||
810 | + var html = "<li onclick=\"changeConsignee(this)\" data-address_id=\""+data.id+"\">\n" + | ||
811 | + " <div class=\"imgBox\">\n" + | ||
812 | + " <img class=\"checkImg\" src=\"__CDN__/assets/store/images/checkbox_orange.png\" alt=\"img\">\n" + | ||
813 | + " </div>\n" + | ||
814 | + " <div class=\"contentBox address-"+data.id+"\">\n" + | ||
815 | + " <div class=\"box\">\n" + | ||
816 | + " <p>\n" + | ||
817 | + " <span class=\"name\">"+data.name+"</span>\n" + | ||
818 | + " <span class=\"phone\">"+data.phone+"</span>\n" + | ||
819 | + " </p>\n" + | ||
820 | + " <span class=\"btnSpan\" onclick=\"edit(this)\">\n" + | ||
821 | + " <img src=\"__CDN__/assets/store/images/icon_bianji.png\" alt=\"img\">\n" + | ||
822 | + " <span></span>编辑\n" + | ||
823 | + " </span>\n" + | ||
824 | + " </div>\n" + | ||
825 | + " <div class=\"box\">\n" + | ||
826 | + " <p class=\"address\">\n" + | ||
827 | + " <span data-province_id=\""+data.province_id+"\">"+data.province_name+"</span>\n" + | ||
828 | + " <span data-city_id=\""+data.city_id+"\">"+data.city_name+"</span>\n" + | ||
829 | + " <span data-county_id=\""+data.county_id+"\">"+data.county_name+"</span>\n" + | ||
830 | + " <span>"+data.address+"</span>\n" + | ||
831 | + " </p>\n" + | ||
832 | + " <span class=\"btnSpan\" onclick=\"del(this)\"><img src=\"__CDN__/assets/store/images/icon_del.png\" alt=\"\">\n" + | ||
833 | + " <span>删除</span>\n" + | ||
834 | + " </span>\n" + | ||
835 | + " </div>\n" + | ||
836 | + " </div>\n" + | ||
837 | + " </li>"; | ||
838 | + //将所有收货地址变为未选中状态 | ||
839 | + $('.imgBox').find('img').attr('src',"__CDN__/assets/store/images/radioUnSelect.png"); | ||
840 | + $('.address_box').prepend(html); | ||
841 | + } | ||
842 | + $('#changeInfoModal').modal('hide'); | ||
843 | + toast('操作成功'); | ||
844 | + } | ||
845 | + }, | ||
846 | + error:function (res) { | ||
847 | + toast('与服务器断开连接'); | ||
848 | + } | ||
849 | + }); | ||
850 | + } | ||
851 | + | ||
852 | + //更改收货人 | ||
853 | + function changeConsignee(obj) { | ||
854 | + $('.content .orderInfoBox .consigneeBox ul li .checkImg').attr('src', '__CDN__/assets/store/images/radioUnSelect.png'); | ||
855 | + $(obj).find('.checkImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
856 | + var name = $(obj).find('.name').html(); | ||
857 | + var phone = $(obj).find('.phone').html(); | ||
858 | + var address = $(obj).find('.address').html(); | ||
859 | + } | ||
860 | + | ||
861 | + //更改跑腿收货人 | ||
862 | + function changeErrands(obj) { | ||
863 | + $('.content .orderInfoBox .errandsBox ul li .checkImg').attr('src', '__CDN__/assets/store/images/radioUnSelect.png'); | ||
864 | + $(obj).find('.checkImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
865 | + var name = $(obj).find('.shopName').html().split('<span')[0]; | ||
866 | + var phone = $(obj).find('.phone').html(); | ||
867 | + var address = $(obj).find('.address').html(); | ||
868 | + } | ||
869 | + | ||
870 | + //修改收件信息 | ||
871 | + function edit(obj) { | ||
872 | + /*console.log($(obj).parent().next('.address').html()); | ||
873 | + var name = $(obj).parent().find('.name').html().split('<span')[0]; | ||
874 | + var phone = $(obj).parent().find('.phone').html(); | ||
875 | + $('#userName').val(name); | ||
876 | + $('#phoneNum').val(phone); | ||
877 | + var province_id2 = $(obj).parents().find('.address').find('span').eq(0).attr('data-province_id'); | ||
878 | + console.log(province_id2); | ||
879 | + getProvince(0,province_id2); | ||
880 | + var city_id2 = $(obj).parents().find('.address').find('span').eq(1).attr('data-city_id'); | ||
881 | + console.log(city_id2); | ||
882 | + getCity(province_id2,city_id2); | ||
883 | + var county_id2 = $(obj).parents().find('.address').find('span').eq(2).attr('data-county_id'); | ||
884 | + console.log(county_id2); | ||
885 | + getCounty(city_id2,county_id2); | ||
886 | + $('#addressDetail').val(); | ||
887 | + $('#changeInfoModal').modal();*/ | ||
888 | + var address_id = $(obj).parent().parent().parent().attr('data-address_id'); | ||
889 | + var name = $(obj).prev().find('span').eq(0).html(); | ||
890 | + var phone = $(obj).prev().find('span').eq(1).html(); | ||
891 | + var province_id2 = $(obj).parent().next().find('.address span').eq(0).attr('data-province_id'); | ||
892 | + var city_id2 = $(obj).parent().next().find('.address span').eq(1).attr('data-city_id'); | ||
893 | + var county_id2 = $(obj).parent().next().find('.address span').eq(2).attr('data-county_id'); | ||
894 | + var address = $(obj).parent().next().find('.address span').eq(3).html(); | ||
895 | + $('#userName').val(name); | ||
896 | + $('#phoneNum').val(phone); | ||
897 | + getProvince(0,province_id2); | ||
898 | + getCity(province_id2,city_id2); | ||
899 | + getCounty(city_id2,county_id2); | ||
900 | + $('#addressDetail').val(address); | ||
901 | + $('#address_id').val(address_id); | ||
902 | + $('#changeInfoModal').modal(); | ||
903 | + } | ||
904 | + | ||
905 | + //删除收件信息 | ||
906 | + function del(obj) { | ||
907 | + $(obj).parent().parent().parent('li').remove(); | ||
908 | + } | ||
909 | + | ||
910 | + //修改支付方式 | ||
911 | + function changePayMode(obj, type) { | ||
912 | + $('.content .orderInfoBox .payModeBox ul li .checkImg').attr('src', '__CDN__/assets/store/images/radioUnSelect.png'); | ||
913 | + $(obj).find('.checkImg').attr('src', '__CDN__/assets/store/images/checkbox_orange.png'); | ||
914 | + if (type == 'weChat') { | ||
915 | + //微信支付 | ||
916 | + payMode = 'weChat'; | ||
917 | + } else if (type == 'aliPay') { | ||
918 | + //支付宝支付 | ||
919 | + payMode = 'aliPay'; | ||
920 | + } else { | ||
921 | + //云闪付 | ||
922 | + payMode = 'yunPay'; | ||
923 | + } | ||
924 | + } | ||
925 | + | ||
926 | + //提交订单 | ||
927 | + function submitOrder() { | ||
928 | + | ||
929 | + } | ||
930 | + | ||
931 | + //更换省份 | ||
932 | + $("#province").on("change",function(){ | ||
933 | + var province_id2 = $(this).val(); | ||
934 | + getCity(province_id2); | ||
935 | + getCounty(); | ||
936 | + }); | ||
937 | + | ||
938 | + //更换城市 | ||
939 | + $("#city").on("change",function(){ | ||
940 | + var city_id2 = $(this).val(); | ||
941 | + getCounty(city_id2); | ||
942 | + }); | ||
943 | + | ||
944 | + //获取省份 | ||
945 | + function getProvince(pid = 0,select_id = 0){ | ||
946 | + $.ajax({ | ||
947 | + url:"{:url('index/sundry/get_area')}", | ||
948 | + type:"POST", | ||
949 | + data:{"pid":pid,'level':1}, | ||
950 | + success:function (res) { | ||
951 | + console.log(res); | ||
952 | + var html = "<option value=\"\">请选择</option>"; | ||
953 | + if(res.code == 1){ | ||
954 | + $(res.data).each(function (key1, vo) { | ||
955 | + var is_select = ""; | ||
956 | + if(select_id == vo.id){ | ||
957 | + is_select = "selected"; | ||
958 | + } | ||
959 | + html += "<option value=\""+vo.id+"\" "+is_select+">"+vo.name+"</option>"; | ||
960 | + }); | ||
961 | + } | ||
962 | + console.log(html); | ||
963 | + $('#province').html(html); | ||
964 | + }, | ||
965 | + error:function (res) { | ||
966 | + toast('与服务器断开连接') | ||
967 | + } | ||
968 | + }) | ||
969 | + } | ||
970 | + | ||
971 | + //获取城市 | ||
972 | + function getCity(province_id2, select_id = 0){ | ||
973 | + $.ajax({ | ||
974 | + url:"{:url('index/sundry/get_area')}", | ||
975 | + type:"POST", | ||
976 | + data:{"pid":province_id2,'level':2}, | ||
977 | + success:function (res) { | ||
978 | + console.log(res); | ||
979 | + var html = "<option value=\"\">请选择</option>"; | ||
980 | + if(res.code == 1){ | ||
981 | + $(res.data).each(function (key1, vo) { | ||
982 | + var is_select = ""; | ||
983 | + if(select_id == vo.id){ | ||
984 | + is_select = "selected"; | ||
985 | + } | ||
986 | + html += "<option value=\""+vo.id+"\" "+is_select+">"+vo.name+"</option>"; | ||
987 | + }); | ||
988 | + } | ||
989 | + console.log(html); | ||
990 | + $('#city').html(html); | ||
991 | + }, | ||
992 | + error:function (res) { | ||
993 | + toast('与服务器断开连接') | ||
994 | + } | ||
995 | + }) | ||
996 | + } | ||
997 | + | ||
998 | + //获取区/县 | ||
999 | + function getCounty(city_id2, select_id = 0){ | ||
1000 | + $.ajax({ | ||
1001 | + url:"{:url('index/sundry/get_area')}", | ||
1002 | + type:"POST", | ||
1003 | + data:{"pid":city_id2,'level':3}, | ||
1004 | + success:function (res) { | ||
1005 | + console.log(res); | ||
1006 | + var html = "<option value=\"\">请选择</option>"; | ||
1007 | + if(res.code == 1){ | ||
1008 | + $(res.data).each(function (key1, vo) { | ||
1009 | + var is_select = ""; | ||
1010 | + if(select_id == vo.id){ | ||
1011 | + is_select = "selected"; | ||
1012 | + } | ||
1013 | + html += "<option value=\""+vo.id+"\" "+is_select+">"+vo.name+"</option>"; | ||
1014 | + }); | ||
1015 | + } | ||
1016 | + $('#county').html(html); | ||
1017 | + }, | ||
1018 | + error:function (res) { | ||
1019 | + toast('与服务器断开连接') | ||
1020 | + } | ||
1021 | + }) | ||
1022 | + } | ||
1023 | +</script> | ||
1024 | +</body> | ||
1025 | +</html> |
@@ -12,13 +12,13 @@ | @@ -12,13 +12,13 @@ | ||
12 | </a> | 12 | </a> |
13 | {/empty} | 13 | {/empty} |
14 | {notempty name="$token"} | 14 | {notempty name="$token"} |
15 | - <a href="personalCenter.html" class="btn btn-warning"> | 15 | + <a href="{:url('index/member/index')}" class="btn btn-warning"> |
16 | <img src="__CDN__/assets/store/images/user.png" alt="shop"> | 16 | <img src="__CDN__/assets/store/images/user.png" alt="shop"> |
17 | 个人中心 | 17 | 个人中心 |
18 | </a> | 18 | </a> |
19 | {/notempty} | 19 | {/notempty} |
20 | {notempty name="$token"} | 20 | {notempty name="$token"} |
21 | - <a href="shoppingCart.html" class="btn"> | 21 | + <a href="{:url('index/car/index')}" class="btn"> |
22 | <img src="__CDN__/assets/store/images/icon_gouwu.png" alt="shop"> | 22 | <img src="__CDN__/assets/store/images/icon_gouwu.png" alt="shop"> |
23 | 购物车 | 23 | 购物车 |
24 | </a> | 24 | </a> |
1 | .toast{ | 1 | .toast{ |
2 | position: fixed; | 2 | position: fixed; |
3 | - z-index: 999; | 3 | + z-index: 9999; |
4 | background: rgba(0,0,0,0.5); | 4 | background: rgba(0,0,0,0.5); |
5 | color: #ffffff; | 5 | color: #ffffff; |
6 | padding: 12px 25px; | 6 | padding: 12px 25px; |
@@ -13,10 +13,13 @@ | @@ -13,10 +13,13 @@ | ||
13 | display: none; | 13 | display: none; |
14 | } | 14 | } |
15 | .bg{ | 15 | .bg{ |
16 | - z-index: 999; | 16 | + z-index: 9999; |
17 | width: 100%; | 17 | width: 100%; |
18 | height: 100%; | 18 | height: 100%; |
19 | display: none; | 19 | display: none; |
20 | position: fixed; | 20 | position: fixed; |
21 | top: 0; | 21 | top: 0; |
22 | +} | ||
23 | +::-webkit-scrollbar{ | ||
24 | + display:none; | ||
22 | } | 25 | } |
-
请 注册 或 登录 后发表评论