正在显示
4 个修改的文件
包含
42 行增加
和
7 行删除
@@ -19,6 +19,12 @@ | @@ -19,6 +19,12 @@ | ||
19 | </div> | 19 | </div> |
20 | </div> | 20 | </div> |
21 | <div class="form-group"> | 21 | <div class="form-group"> |
22 | + <label class="control-label col-xs-12 col-sm-2">{:__('关键字')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <textarea id="c-keyword" class="form-control" name="row[keyword]">{$row.keyword|htmlentities}</textarea> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
22 | <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | 28 | <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> |
23 | <div class="col-xs-12 col-sm-8"> | 29 | <div class="col-xs-12 col-sm-8"> |
24 | <div class="input-group"> | 30 | <div class="input-group"> |
@@ -21,15 +21,21 @@ | @@ -21,15 +21,21 @@ | ||
21 | </div> | 21 | </div> |
22 | {else /} | 22 | {else /} |
23 | <div class="form-group"> | 23 | <div class="form-group"> |
24 | + <label class="control-label col-xs-12 col-sm-2">{:__('Goodstype_id')}:</label> | ||
25 | + <div class="col-xs-12 col-sm-8"> | ||
26 | + <input id="c-goodstype_id" data-rule="required" data-source="goodstype/selectpage" data-params='{"custom[pid]":["gt","0"]}' class="form-control selectpage" name="row[goodstype_id]" type="text" value="{$row.goodstype_id|htmlentities}"> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + <div class="form-group"> | ||
24 | <label class="control-label col-xs-12 col-sm-2">{:__('Goodsname')}:</label> | 30 | <label class="control-label col-xs-12 col-sm-2">{:__('Goodsname')}:</label> |
25 | <div class="col-xs-12 col-sm-8"> | 31 | <div class="col-xs-12 col-sm-8"> |
26 | <input id="c-goodsname" data-rule="required" class="form-control" name="row[goodsname]" type="text" value="{$row.goodsname|htmlentities}"> | 32 | <input id="c-goodsname" data-rule="required" class="form-control" name="row[goodsname]" type="text" value="{$row.goodsname|htmlentities}"> |
27 | </div> | 33 | </div> |
28 | </div> | 34 | </div> |
29 | <div class="form-group"> | 35 | <div class="form-group"> |
30 | - <label class="control-label col-xs-12 col-sm-2">{:__('Goodstype_id')}:</label> | 36 | + <label class="control-label col-xs-12 col-sm-2">{:__('关键字')}:</label> |
31 | <div class="col-xs-12 col-sm-8"> | 37 | <div class="col-xs-12 col-sm-8"> |
32 | - <input id="c-goodstype_id" data-rule="required" data-source="goodstype/selectpage" data-params='{"custom[pid]":["gt","0"]}' class="form-control selectpage" name="row[goodstype_id]" type="text" value="{$row.goodstype_id|htmlentities}"> | 38 | + <textarea id="c-keyword" class="form-control" name="row[keyword]">{$row.keyword|htmlentities}</textarea> |
33 | </div> | 39 | </div> |
34 | </div> | 40 | </div> |
35 | <div class="form-group"> | 41 | <div class="form-group"> |
@@ -16,6 +16,7 @@ use app\index\model\Goodstype; | @@ -16,6 +16,7 @@ use app\index\model\Goodstype; | ||
16 | use app\index\model\Pic; | 16 | use app\index\model\Pic; |
17 | use app\index\model\Province; | 17 | use app\index\model\Province; |
18 | use app\index\model\Store; | 18 | use app\index\model\Store; |
19 | +use think\Db; | ||
19 | 20 | ||
20 | class Goods extends Frontend | 21 | class Goods extends Frontend |
21 | { | 22 | { |
@@ -192,7 +193,7 @@ class Goods extends Frontend | @@ -192,7 +193,7 @@ class Goods extends Frontend | ||
192 | $where['g.is_clearance'] = ['eq',$param['is_clearance']]; | 193 | $where['g.is_clearance'] = ['eq',$param['is_clearance']]; |
193 | } | 194 | } |
194 | if(!empty($param['keyword'])){ | 195 | if(!empty($param['keyword'])){ |
195 | - $where['t.name|s.name|g.goodsname|g.brand'] = ['like',"%$param[keyword]%"]; | 196 | + $where['t.name|s.name|g.goodsname|g.brand|g.keyword'] = ['like',"%$param[keyword]%"]; |
196 | } | 197 | } |
197 | if(!empty($param['category_id'])){ | 198 | if(!empty($param['category_id'])){ |
198 | $where['g.goodstype_id'] = ['eq',$param['category_id']]; | 199 | $where['g.goodstype_id'] = ['eq',$param['category_id']]; |
@@ -275,7 +276,12 @@ class Goods extends Frontend | @@ -275,7 +276,12 @@ class Goods extends Frontend | ||
275 | } | 276 | } |
276 | $storeModel = new Store(); | 277 | $storeModel = new Store(); |
277 | $evaluateModel = new Evaluate(); | 278 | $evaluateModel = new Evaluate(); |
279 | + //店铺id | ||
280 | + $store_ids = []; | ||
278 | foreach($data as $key => $vo){ | 281 | foreach($data as $key => $vo){ |
282 | + if(!in_array($vo['store_id'],$store_ids)){ | ||
283 | + $store_ids[] = $vo['store_id']; | ||
284 | + } | ||
279 | //判断店铺在该区域是否为会员 | 285 | //判断店铺在该区域是否为会员 |
280 | $insurance = '2'; | 286 | $insurance = '2'; |
281 | $store = $storeModel->findData(['id'=>$vo['store_id']]); | 287 | $store = $storeModel->findData(['id'=>$vo['store_id']]); |
@@ -309,7 +315,8 @@ class Goods extends Frontend | @@ -309,7 +315,8 @@ class Goods extends Frontend | ||
309 | array_multisort($sort,SORT_DESC,$data->items()); | 315 | array_multisort($sort,SORT_DESC,$data->items()); |
310 | } | 316 | } |
311 | } | 317 | } |
312 | - $this->success('SUCCESS','',$data); | 318 | + $store = Db::name('store')->where(['id'=>['in',$store_ids]])->select(); |
319 | + $this->success('SUCCESS','',$data,$store); | ||
313 | } | 320 | } |
314 | public function get_one(){ | 321 | public function get_one(){ |
315 | $param = $this->request->param(); | 322 | $param = $this->request->param(); |
@@ -667,6 +667,9 @@ | @@ -667,6 +667,9 @@ | ||
667 | var geoc; | 667 | var geoc; |
668 | var locationLng = 117.233; | 668 | var locationLng = 117.233; |
669 | var locationLat = 36.11365; | 669 | var locationLat = 36.11365; |
670 | + var mapObj = new BMap.Map("allmap"); | ||
671 | + var point = new BMap.Point(112.331398,39.897445); | ||
672 | + mapObj.centerAndZoom(point,10); | ||
670 | $(function () { | 673 | $(function () { |
671 | // showTableData(); | 674 | // showTableData(); |
672 | // initMap(); | 675 | // initMap(); |
@@ -772,13 +775,18 @@ | @@ -772,13 +775,18 @@ | ||
772 | " <td>"+vo.store_address+""+distance+"</td>\n" + | 775 | " <td>"+vo.store_address+""+distance+"</td>\n" + |
773 | " </tr>"; | 776 | " </tr>"; |
774 | goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id); | 777 | goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id); |
775 | - console.log(goods_html); | ||
776 | }); | 778 | }); |
777 | $('.goods_dom').html(goods_html); | 779 | $('.goods_dom').html(goods_html); |
778 | $('#resultsNum').html(res.data.total+"件"); | 780 | $('#resultsNum').html(res.data.total+"件"); |
779 | //初始化分页 | 781 | //初始化分页 |
780 | var totalPage = Math.ceil(res.data.total/pageNum); | 782 | var totalPage = Math.ceil(res.data.total/pageNum); |
781 | initPaging(res.data.total,res.data.current_page,totalPage,pageNum); | 783 | initPaging(res.data.total,res.data.current_page,totalPage,pageNum); |
784 | + // 随机向地图添加25个标注 | ||
785 | + $(res.wait).each(function (key, w) { | ||
786 | + var point = new BMap.Point(w.lng, w.lat); | ||
787 | + // console.log(point); | ||
788 | + addMarker2(point); | ||
789 | + }); | ||
782 | }, | 790 | }, |
783 | error:function(res){ | 791 | error:function(res){ |
784 | toast('与服务器断开连接'); | 792 | toast('与服务器断开连接'); |
@@ -979,7 +987,7 @@ | @@ -979,7 +987,7 @@ | ||
979 | }) | 987 | }) |
980 | } | 988 | } |
981 | 989 | ||
982 | - //添加标注点 | 990 | + //添加标注中心点 |
983 | function addMarker(point, index){ // 创建图标对象 | 991 | function addMarker(point, index){ // 创建图标对象 |
984 | var myIcon = new BMap.Icon("__CDN__/assets/store/images/mapPoint_icon.png", new BMap.Size(50, 50), {}); | 992 | var myIcon = new BMap.Icon("__CDN__/assets/store/images/mapPoint_icon.png", new BMap.Size(50, 50), {}); |
985 | // 创建标注对象并添加到地图 | 993 | // 创建标注对象并添加到地图 |
@@ -1002,11 +1010,19 @@ | @@ -1002,11 +1010,19 @@ | ||
1002 | mapObj.addOverlay(circle); | 1010 | mapObj.addOverlay(circle); |
1003 | if (point != null) { | 1011 | if (point != null) { |
1004 | circle.addEventListener("lineupdate", function (e) { | 1012 | circle.addEventListener("lineupdate", function (e) { |
1005 | - console.log(circle.getRadius()); //返回圆形覆盖物的半径 | 1013 | + circle.getRadius(); //返回圆形覆盖物的半径 |
1006 | }); | 1014 | }); |
1007 | } | 1015 | } |
1008 | initGoodsList(); | 1016 | initGoodsList(); |
1009 | } | 1017 | } |
1018 | + | ||
1019 | + //添加标注点 | ||
1020 | + function addMarker2(point){ | ||
1021 | + console.log(point); | ||
1022 | + var marker = new BMap.Marker(point); | ||
1023 | + console.log(marker); | ||
1024 | + mapObj.addOverlay(marker); | ||
1025 | + } | ||
1010 | </script> | 1026 | </script> |
1011 | </body> | 1027 | </body> |
1012 | </html> | 1028 | </html> |
-
请 注册 或 登录 后发表评论