search.html
22.6 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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
<html>
<head>
<meta charset="utf-8">
<title>分销商品-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}"/>
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}"/>
<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 rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/category_list.css"/>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js"></script>
<script src="__PUBLIC__/js/global.js?v=__CSSVERSION__"></script>
<script src="__PUBLIC__/js/mobile_common.js?v=__CSSVERSION__"></script>
<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js" ></script>
<style type="text/css">
.touchweb-com_searchListBox .item .commodityMain1 {
width: 60px;
height: 24px;
text-align: center;
font-size: 16px;
color: #FFFFFF;
background-color: #C4182E;
border-radius: 6px;
position: absolute;
right: 0px;
bottom: 0px;
}
</style>
</head>
<body>
<!--<include file="public/navBall" />-->
<div id="navBox" class="mj-float-nav quickclose" style="text-align: center; " onclick="javascript:window.location.href='{:U('Mobile/Distribut/index',array('stoid'=>$Think.request.stoid,'user_id'=>$user_id))}'">
<img src="__STATIC__/images/navBall/shop.png" style="width: 21px;height: 20px;margin:13px auto;">
</div>
<section class="_pre">
<header id="head_search_box" style="position: fixed; top: 0px; width: 100%;">
<div class="search_header">
<a href="javascript:history.back(-1)" class="back search_back"></a>
<div class="search">
<a name="sourch_form" id="sourch_form2">
<div class="text_box" name="list_search_text_box" onClick="return 1;">
<input type="text" class="text" maxlength="100" onkeydown="strkeydown(event,this,'searbtn')"
name="q" id="fq" value="<?php echo urldecode(I('q'));?>"
placeholder="搜索关键字"/>
</div>
<input type="button" id="searbtn" class="submit" onclick="gosear()"/>
</a>
</div>
<a class="menu filtrate" name="list_go_filter" style=" color:#666">筛选</a>
<input id="hidstoid" type="hidden" value="{$stoid}">
</div>
</header>
<div style="height:51px;" class="empty_div"> </div>
<section class="filtrate_term" id="product_sort" style="width: 100%;background:#FFF;">
<ul>
<li class="<if condition=" ($Request.param.sort=='') or ($Request.param.sort=='is_new')">on</if>"><a
href="<?php echo urldecode(U('Mobile/Distribut/search',array_merge(array('stoid'=>getMobileStoId()),$filter_param,array('sort'=>'is_new')),''));?>">最新</a></li>
<li class="<if condition=" $Request.param.sort ==
'sales_sum'">on</if>"><a
href="<?php echo urldecode(U('Mobile/Distribut/search',array_merge(array('stoid'=>getMobileStoId()),$filter_param,array('sort'=>'sales_sum')),''));?>">销量</a></li>
<li class="<if condition=" $Request.param.sort ==
'comment_count'">on</if>"><a
href="<?php echo urldecode(U('Mobile/Distribut/search',array_merge(array('stoid'=>getMobileStoId()),$filter_param,array('sort'=>'comment_count')),''));?>">评论</a></li>
<li class="<if condition=" $Request.param.sort ==
'shop_price'">on</if>"><a
href="<?php echo urldecode(U('Mobile/Distribut/search',array_merge(array('stoid'=>getMobileStoId()),$filter_param,array('sort'=>'shop_price','sort_asc'=>$sort_asc)),''));?>">价格<span
class="arrow_up"></span><span class="arrow_down"></span></a></li>
<li class=""><a href="javascript:;" class="show_type show_list"> </a></li>
</ul>
</section>
<section>
<div class="touchweb-com_searchListBox openList" id="goods_list">
<empty name="goods_list">
<p class="goods_title">抱歉暂时没有相关结果,换个筛选条件试试吧</p>
<else/>
<foreach name="goods_list" item="vo" key="k">
<li>
<a href="{:U('Mobile/Goods/goodsInfo',array('stoid'=>$Think.request.stoid,'id'=>$vo[goods_id]))}" class="item">
<div class="pic_box">
<div class="active_box">
<span style=" background-position:0px -36px">新品</span>
</div>
<!--<img src="{$vo.goods_id|goods_thum_images=400,400}">-->
<img src="{:getimg($vo['original_img'],NOIMG,0,1)}">
<if condition="$vo[dis_type] eq '0'">
<div class="commodityMain1">主营</div>
</if>
</div>
<div class="title_box">{$vo.goods_name}</div>
<div class="price_box">
<span class="new_price"><i>{:getActualPrice($vo)}</i></span>
</div>
<div class="comment_box">已售{$vo.sales_sum}</div>
</a>
<div class="ui-number b">
<a class="decrease" onClick="goods_cut({$vo.goods_id});">-</a>
<input class="num" id="number_{$vo.goods_id}" type="text" onBlur="changePrice();" value="1"
onFocus="if(value=='1') {value=''}" size="4" maxlength="5">
<a class="increase" onClick="goods_add({$vo.goods_id});">+</a>
</div>
<span class="bug_car"
onClick="AjaxAddCart({$vo[goods_id]},$('#number_'+{$vo.goods_id}).val(),0);"><i
class="icon-shop_cart"></i></span>
</li>
</foreach>
</empty>
</div>
<div style="clear:both">
<a href="javascript:;" class="get_more" style="text-align:center; display:none;padding:10px 0">
<img src='__STATIC__/images/category/loader.gif' width="12" height="12"> </a>
</div>
<eq name="mshow" value="1">
<notempty name="goods_list">
<div id="getmore"
style="font-size:.24rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both">
<a href="javascript:void(0)" onClick="ajax_sourch_submit()"
style=" color: #000000;font-size: 14px;text-decoration: none;">点击加载更多</a>
</div>
</notempty>
</eq>
</section>
</section>
<script>
var page = 1;
/*** ajax 提交表单 查询订单列表结果*/
function ajax_sourch_submit() {
$('.get_more').show();
$('#getmore').hide();
page += 1;
$.ajax({
type: "GET",
url: "<?php echo urldecode(U('Mobile/Distribut/search',array_merge(array('stoid'=>getMobileStoId()),$filter_param,array('sort'=>input('sort'),'sort_asc'=>input('sort_asc'))),''));?>/is_ajax/1/p/" + page,//+tab,
// data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
success: function (data) {
$('.get_more').hide();
if ($.trim(data) == '')
$('#getmore a').hide();
else
$('#getmore').show();
$("#goods_list").append(data);
}
});
}
</script>
<section class="_next"
style="-webkit-transform-origin: 0px 0px 0px; opacity: 1; -webkit-transform: scale(1, 1); display: none;">
<header>
<div class="new_header_2" id="filter_header">
<a href="javascript:;" class="back" id="list_filter_back"><span>返回</span></a>
<h2>筛选</h2>
</div>
</header>
<section id="filter_content">
<!--<form method="post" action="{:U('Goods/search')}">-->
<notempty name="filter_brand">
<div class="filtrate_category">
<a href="javascript:;" class="filtrate_category_a">品牌 <span class="up_down">全部展开</span></a>
</div>
<ul class="clearfix filtrate_address filtrate_list att_item" id="brands"
style="display: block; -webkit-transform-origin: 0px 0px 0px; opacity: 1; -webkit-transform: scale(1, 1);">
<foreach name="filter_brand" item="v" key="k">
<li><a data-href="" href="{$v[href]}/stoid/{$Think.request.stoid}" data-key='brand' data-val='{$v[id]}'><i></i>{$v[name]}</a>
</li>
</foreach>
</ul>
</notempty>
<!--价格帅选-->
<if condition="$filter_price neq null">
<div class="filtrate_category">
<a href="javascript:;" class="filtrate_category_a">价格<span class="up_down">全部展开</span></a>
</div>
<ul class="clearfix filtrate_address filtrate_list att_item">
<foreach name="filter_price" item="v" key="k">
<li>
<a href="{$v[href]}/stoid/{$Think.request.stoid}">{$v[value]}</a>
</li>
</foreach>
</ul>
</if>
<!--价格帅选 end-->
<!--<div class="filtrate_has">-->
<!--<h2>其他条件</h2>-->
<!--<ul class="clearfix">-->
<!--<li class="">-->
<!--<label for="">显示全部</label>-->
<!--<input type="radio" name='other_has' id="all_goods" value="1">-->
<!--</li>-->
<!--<li class="">-->
<!--<label for="">网站自营</label>-->
<!--<input type="radio" name='other_has' id="ziying_goods" value="2">-->
<!--</li>-->
<!--<li class="">-->
<!--<label for="">入驻商家</label>-->
<!--<input type="radio" name='other_has' id="ruzhu_goods" value="3">-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<div class="filtrate_has1" style="display:none">
<h2>是否有货</h2>
<ul class="clearfix">
<li class="">
<label for="">仅显示有货</label>
<input type="radio" name='other_youhuo' id="other_youhuo" value='1'>
</li>
</ul>
</div>
<script>
$('.filtrate_has li').click(function () {
$(this).find("input").attr("checked", "checked");
$('.filtrate_has li').removeClass("on");
$(this).addClass("on");
})
$('.filtrate_has1 li').click(function () {
if ($(this).hasClass("on")) {
$(this).find("input").attr("checked", "");
$(this).removeClass("on");
}
else {
$(this).find("input").attr("checked", "checked");
$(this).addClass("on");
}
})
</script>
<ul class="filtrate_btn">
<li><a href="{:U('Distribut/search',array('stoid'=>getMobileStoId()))}" class="reset" id="clear_btn">取消筛选</a></li>
<li><input onclick="gosearall()" class="submit" id="submit_btn" type="button" value="确定"></li>
</ul>
<!--</form>-->
</section>
</section>
<section id="mix_search_div" style="display: none;">
<header class="con floatsearch">
<section class="mix_new_header">
<a href="javascript:void(0)" class="mix_back"></a>
<form class="set_ip" name="sourch_form" id="sourch_form" method="post" action="{:U('Distribut/search',array('stoid'=>$Think.request.stoid))}">
<div class="search">
<div class="text_box">
<input class="keyword text" name="q" id="q" placeholder="请输入关键词" type="text"
value="<?php echo I('q'); ?>"/>
</div>
<span class="mix_submit"
onClick="if($.trim($('#q').val()) != '') $('#sourch_form').submit();"></span>
<a href="javascript:void(0)" class="clear_input" id="clear_input" style="display: block;"></a>
</div>
<input type="button"
onClick="if($.trim($('#q').val()) != '') $('#sourch_form').submit(); else alert('输入搜索词');"
value="搜索" class="mix_filtrate">
</form>
</section>
<section class="mix_search_list"></section>
<section class="mix_recently_search"><h3>热门搜索</h3>
<ul>
<foreach name="tpshop_config.hot_keywords" item="wd" key="k">
<li><a href="{:U('Distribut/search',array('stoid'=>$Think.request.stoid,'q'=>$wd))}"
<if condition="$k eq 0">class="ht"</if>
>{$wd}</a></li>
</foreach>
</ul>
</section>
<div class="spacer"></div>
</header>
</section>
<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/filter.min.js"></script>
<script>
function gosear() {
var q = $("#fq").val();
if ($.trim($('#fq').val()) == '') {
layer.open("请输入搜索关键字", {icon: 2, time: 1000});
$("#fq").focus();
return;
}
var url = "/index.php/mobile/Distribut/search/stoid/"+{$Request.param.stoid}+"/q/"+ q;
window.location.href = url;
}
function gosearall() {
var other_has=$("input[name='other_has']").val();
}
$(document).ready(function () {
//筛选浮层显示控制
var filtrate = $(".filtrate"), submit = $(".submit,.back,.reset");
filtrate.bind("click", function () {
$("._next").show();
$("._pre").hide();
window.scrollTo(0, 0);
});
submit.bind("click", function () {
$("._next").hide();
$("._pre").show();
});
//初始化筛选浮层
bizFilter.init();
});
function goods_cut($val) {
var num_val = document.getElementById('number_' + $val);
var new_num = num_val.value;
var Num = parseInt(new_num);
if (Num > 1) Num = Num - 1;
num_val.value = Num;
}
function goods_add($val) {
var num_val = document.getElementById('number_' + $val);
var new_num = num_val.value;
var Num = parseInt(new_num);
Num = Num + 1;
num_val.value = Num;
}
</script>
<script>
$(function () {
//搜索浮层显示逻辑
var sbox = $("#head_search_box"),
sort = $('#product_sort'),
g_list = $("#goods_list"),
g_m1 = "0", g_m2 = "96px";
var initCss = function (type) {
if (type == 1) {
sort.css({"position": "static", "width": "100%"});
g_list.css("margin-top", g_m1);
} else {
sort.attr("style", "");
g_list.css("margin-top", g_m2);
}
};
var m = {
input: $("#keyword"),
rawAll: '',
dd: $(".text_box"),
cancel: $(".mix_back"),
rawKey: '请输入商品名称 货号',
main: function () {
this.init();
this.be();
},
init: function () {
this.rawAll = this.input.val();
},
be: function () {
var _this = this;
this.input.focus(function () {
var mix_search = $("#mix_search_div");
if (mix_search.length > 0) {
$("._pre").hide();
mix_search.show();
$("#keyword1").focus();
return;
}
var newKey = _this.input.val();
if (newKey != _this.rawKey && newKey != _this.rawAll) {
$(this).val(newKey);
} else {
$(this).val(_this.rawKey);
}
if ($(window).scrollTop() > 0) {
initCss(1);
window.scrollTo(0, 0);
_this.dd.trigger("click"); //for ddclick
}
})
.blur(function () {
var newKey = _this.input.val();
if (newKey === _this.rawKey) {
$(this).val(_this.rawAll);
} else {
$(this).val(newKey);
}
});
this.cancel.bind("click", function () {
$("#mix_search_div").hide();
$("._pre").show();
});
document.getElementById("clear_input").onclick = function () {
$("#mix_search_div").hide();
$("._pre").show();
}
}
};
m.main();
$(window).resize(function () {
sbox.css("width", "100%");
sort.css("width", "100%");
});
//顶部sticky效果
setTimeout(function () {
var sboxH = sbox.height();
var sortH = sort.height();
var sortStart = sort.offset().top - sboxH;
var showEnd = sort.offset().top;
var init = function () {
sbox.css({"position": "fixed", "top": "0"});
window.scrollTo(0, 0);
};
var rawScroll = 0, nowScroll = 0;
var upOrDown = function () {
var delta = 30;
if (nowScroll > rawScroll + delta) {
return 1;
} else if (nowScroll < rawScroll - delta) {
return 2;
} else {
return 0;
}
};
var sticky = function () {
nowScroll = $(window).scrollTop();
if (nowScroll >= sortStart) {
sort.css({"position": "fixed", "top": sboxH});
g_list.css({"margin-top": sortH});
} else {
sort.attr("style", "");
g_list.attr("style", "");
}
if (nowScroll > showEnd + sortH) {
var up = upOrDown();
if (up == 1) {
if (sbox.css("display") != "none") {
sbox.hide();
sort.hide();
}
rawScroll = nowScroll;
} else if (up == 2) {
if (sbox.css("display") == "none") {
sbox.show();
sort.show();
}
rawScroll = nowScroll;
}
} else {
if (sbox.css("display") == "none") {
sbox.show();
sort.show();
}
}
};
init();
$(document).on("touchmove", sticky);
$(window).on("scroll", sticky);
}, 500);
});
$('.show_type').bind("click", function () {
if ($('#goods_list').hasClass('openList')) {
$('#goods_list').removeClass('openList');
$(this).removeClass('show_list');
}
else {
$('#goods_list').addClass('openList');
$(this).addClass('show_list');
}
});
</script>
<script type="text/javascript">
function get_brand(brand_id) {
document.getElementById('brand').value = brand_id;
var obj = document.getElementById('brands').getElementsByTagName('li');
for (var i = 0; i < obj.length; i++) {
obj[i].className = '';
}
document.getElementById('brand_' + brand_id).className = 'on';
}
function get_price(price_min, price_max) {
document.getElementById('price_min').value = price_min;
document.getElementById('price_max').value = price_max;
var obj = document.getElementById('prices').getElementsByTagName('a');
for (var i = 0; i < obj.length; i++) {
obj[i].className = '';
}
document.getElementById('price_' + price_min).className = 'on';
}
function checkSearchForm() {
if (document.getElementById('keywords').value) {
//var frm = document.getElementById('searchForm');
//var type = parseInt(document.getElementById('searchtype').value);
//frm.action = type==0 ? 'search.php' : 'stores.php';
return true;
}
else {
alert("请输入关键词!");
return false;
}
}
</script>
<script type="Text/Javascript" language="JavaScript">
function selectPage(sel) {
sel.form.submit();
}
</script>
<script type="text/javascript">
window.onload = function () {
// Compare.init();
//fixpng();
}
</script>
<script>
function goTop() {
$('html,body').animate({'scrollTop': 0}, 600);
}
</script>
<a href="javascript:goTop();" class="gotop" style=" z-index:9999"><img src="__STATIC__/images/topup.png"></a>
<include file="public/wx_share"/>
</body>
</html>