searchstores.html
11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>选择收货地址</title>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
<script type="text/javascript" src="__PUBLIC__/js/global.js?v=__CSSVERSION__"></script>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="format-detection" content="email=no"/>
<meta name="format-detection" content="address=no;">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="default"/>
<link href="__PUBLIC__/static/font/css/font-awesome.min.css" rel="stylesheet" />
<style type="text/css">
html,body,ul,ol{margin: 0;padding: 0; font-family: 'SimHei',Arial; }
ul,ol{list-style: none;}
i{font-style:normal;}
.storesList{ padding-top:0px;background-color: #fff}
.storesList li{padding: 10px;font-size: 0;color: #000000;}
.storesList li .map{border-bottom: 1px solid #EEEEEE; line-height: 30px; }
.storesList li span{ vertical-align: middle;display: inline-block;*display: inline;*zoom: 1;}
.storesList li span.left{width: 20%;text-align: center;}
.storesList li span.left a{color: #c3172d;}
.storesList li span.right{width: 100%;}
.storesList li span a{color: #000000;text-decoration: none;}
.storesList li .tel{margin-top: 10px;}
.storesList li .red{color: #C4182E;}
.ml20{margin-left: 20px;}
.index_search_mid {
width: 100%;
margin: auto;
height: 60px;
background-color:#F5F5F5;
}
.index_search_mid span {
display: block;
width: 40px;
height: 36px;
left: 5px;
}
.index_search_mid input {
width: 100%;
height: 35px;
line-height:35px;
border: none;
-webkit-appearance: none;
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
-webkit-rtl-ordering: logical;
-webkit-user-select: text;
cursor: auto;
font-size: 14px;
color: #111;
text-indent: 10px;
border-radius: 5px;
margin: auto;
background-color: #EAEAEA;
padding-left: 30px; font-family: 'SimHei',Arial;
}
.index_search_mid select {
width: 100%;
height: 35px;
line-height: 35px;
border: none;
font-size: 14px;
color: #111;
text-indent: 10px;
border-radius: 5px;
margin: auto;
background-color: #EAEAEA;
margin-top: 4px;
font-family: Arial;
}
.index_search_mid span img {
display: block;
width: 21px;
height: 20px;
margin: auto;
padding: 7px 0 0 10px;
}
.pickname{font-size: 16px; line-height: 30px; }
.addressfont{ font-size: 14px; color:#848484}
.telfont{ font-size: 16px;}
.buttonclass {
width: 80px;
height: 30px;
line-height: 30px;
text-align: center;
border: solid 1px #c3172d;
border-radius: 10px;
font-size: 14px;
color: #c3172d;
}
.searchimg{
background:url('__STATIC__/images/search.png') no-repeat left ;
position:absolute;
width:50px;
height:30px;
top:4px;
left:5px;
z-index:99;
}
#container {
background-color:#eee;
width:100%;
min-height:280px;
}
.selbutton{ float:left; width: 40px;
width:13px;height:13px;border-radius:50%;background-color:#ccc;display: block;
margin-top:10px;
}
.rightaddress{ float:right; width: 90%}
.clear{ clear:both;}
</style>
</head>
<body>
<div>
<div class="index_search_mid">
<Div style="float: left;width: 30%; padding-left: 3%; padding-top: 6px">
<select name="storetype" id="storetype" onchange="gosear();">
<option value="" selected>所有分类</option>
<volist name="storetype" id="list">
<option value="{$list.cat_id}">{$list.cat_name}</option>
</volist>
</select>
</Div>
<div style="float: left;width: 55%; padding-left: 3%; padding-top: 10px;">
<Div style=" position:relative;">
<div class="searchimg" id="searbtn" onclick="gosear();"></div>
<input type="text" id="search_text" class="" placeholder="请输入门店名称" value="" onkeydown="strkeydown(event,this,'searbtn')">
</Div>
</div>
</div>
<Div style="clear: both"></Div>
<div id="container"></div>
<ul class="storesList">
<!--<li>-->
<!--<div class="selbutton"></div>-->
<!--<div class="rightaddress"> <div class="pickname">贝贝门店</div><div class="map"><span class="right addressfont">福建省厦门市思明区厦门思明区125号</span></span></div>-->
<!--</div>-->
<!--<div class="clear"></div>-->
<!--</li>-->
</ul>
</div>
</body>
</html>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=MJVBZ-2BMR5-6S5I3-QQGIX-JCS6Q-NLFBK"></script>
<script>
var sid="{$Think.request.stoid}";
var page = 1;
var issortsto=1;
var IsLoading = false; //是否加载数据
var lng=118.56726;
var lat= 24.97171;
$(function () {
//
if(isWeiXin()){
var tt= layer.open({shadeClose: false,type: 2 ,content: '加载中'});
$.ajax({
type : "POST",
url:"/index.php?m=Mobile&c=Index&a=ajaxGetWxConfig&stoid="+sid+"&t="+Math.random(),
data:{'askUrl':encodeURIComponent(location.href.split('#')[0])},
dataType:'JSON',
success: function(res)
{
wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: ['openLocation','getLocation'] // 功能列表,我们要使用JS-SDK的什么功能
});
wx.ready(function () {
wx.getLocation({
success: function (res) {
lng = res.longitude; // 经度,浮点数,范围为180 ~ -180
lat = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var center = new qq.maps.LatLng(lat,lng);
var map = new qq.maps.Map(document.getElementById('container'),{
center: center,
zoom: 16
});
var marker = new qq.maps.Marker({
position: center,
draggable: true,
map: map
});
//添加监听事件
qq.maps.event.addListener(map, 'click', function(event) {
// alert('您点击的位置为:[' + event.latLng.getLng() + ',' + event.latLng.getLat() + ']');
lng=event.latLng.getLng();
lat=event.latLng.getLat();
page=1;
new_mapshow(lng,lat);
});
new_mapshow(lng,lat);
layer.close(tt);
},
cancel: function (res) {
layer.close(tt);
},
fail: function(res) {
layer.close(tt);
},
error: function () {
layer.close(tt);
}
});
});
},
error:function(){
layer.closeAll();
return false;
}
});
}
else
{
var center = new qq.maps.LatLng(lat,lng);
var map = new qq.maps.Map(document.getElementById('container'),{
center: center,
zoom: 16
});
var marker = new qq.maps.Marker({
position: center,
draggable: true,
map: map
});
//添加监听事件
qq.maps.event.addListener(map, 'touchmove', function(event) {
//alert('您点击的位置为:[' + event.latLng.getLng() + ',' + event.latLng.getLat() + ']');
lng=event.latLng.getLng();
lat=event.latLng.getLat();
page=1;
new_mapshow(lng,lat);
});
new_mapshow(lng,lat);
}
})
//搜索
function gosear() {
page=1;
new_mapshow(lng,lat);
}
function new_mapshow(ulx,uly) {
lng=ulx;lat=uly;
ajax_sourch_submit();
}
$(window).scroll(function () {
totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
if ($(document).height() <= totalheight) {
if (IsLoading == true) {
IsLoading = false;
ajax_sourch_submit();
}
}
});
/*** 门店列表加载*/
function ajax_sourch_submit() {
var stoid="{$Think.request.stoid}";
var param="";
if ($("#search_text").val()!="")
{
param+="&key="+$("#search_text").val();
}
if ($("#storetype").val()!="")
{
param+="&storetype="+$("#storetype").val();
}
// alert("/index.php?m=Mobile&c=Stores&a=storespage&p="+page+"&stoid="+stoid+"&is_ajax=1&lx="+lng+"&ly="+lat+param);
// return false;
var ii0=layer.open({shadeClose: false,type: 2 ,content: '加载中'});
$.ajax({
type: "GET",
url: "/index.php?m=Mobile&c=Stores&a=storespage&p="+page+"&stoid="+stoid+"&is_ajax=1&lx="+lng+"&ly="+lat+param,
beforeSend:function()
{
},
success: function(data) {
layer.closeAll();
layer.close(ii0);
var html="";
if(data.state==0) {
if (page == 1) {
$(".storesList").html("");
layer.open({content:'找不到相关数据',time:1});
} else {
layer.open({content:'没有更多数据了',time:1});
}
}else if(data.state==1)
{
for (i = 0; i < data.item.length; i++) {
html += "<li onclick=\"selectadd("+ data.item[i]["pickup_id"]+",'"+data.item[i]["pickup_name"]+"')\">";
html += " <div class='selbutton'></div><div class='rightaddress'><div class='pickname'>" + data.item[i]["pickup_name"] + "</div>";
html += "<div class='map'>";
html += "<span class='right addressfont'>" + data.item[i]["address"] + "</span>";
html += "</div></div><div class='clear'></div> </li>";
}
if (page == 1) {
$(".storesList").html(html);
}
else
{
$(".storesList").append(html);
}
page += 1;
IsLoading = true;
}
else
{
$(".storesList").html("");
layer.open({content:'获取数据失败',time:1});
}
},
error:function()
{
layer.close(ii0);
layer.closeAll();
layer.open({content:'获取数据失败',time:1});
}
});
}
function isWeiXin(){
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger'){
return true;
}else{
return false;
}
}
function selectadd(id,name) {
alert(id+name);
}
</script>