202 lines
8.2 KiB
HTML
202 lines
8.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
|
|
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
|
<title>搜索商品</title>
|
|
<link rel="stylesheet" type="text/css" href="/css/api.css" />
|
|
<link rel="stylesheet" type="text/css" href="/css/content.css" />
|
|
<script type="text/javascript" src="/scripts/jquery-2.0.2.min.js"></script>
|
|
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
|
|
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
|
|
<script type="text/javascript" src="/script/main.js?t=0"></script>
|
|
<script type="text/javascript" src="/layer/layer.js"></script>
|
|
<script type="text/javascript" src="/Scripts/long.js"></script>
|
|
<script type="text/javascript" src="/script/moment.js"></script>
|
|
<script type="text/javascript" src="/Scripts/TouchSlide.1.1.js"></script>
|
|
<script type="text/javascript" src="/script/api.js"></script>
|
|
<style type="text/css">
|
|
html, body {
|
|
overflow: hidden;
|
|
}
|
|
|
|
#wrapper {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
.floor-product-item .product-item-cont {
|
|
margin-top: 0.8em;
|
|
}
|
|
|
|
.floor-product-item .product-item-cont .product-cont {
|
|
padding-left: 0em;
|
|
}
|
|
|
|
.floor-product-item .product-item-cont .product-cont.product-cont0 {
|
|
padding-right: 0em;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
var userId = null;
|
|
var LoginId = null;
|
|
var CartId = null;
|
|
var search_keyword = null;
|
|
var pullDown = 1; // 下拉刷新避免多次执行
|
|
var pullUp = 1; // 上拉加载避免多次执行
|
|
var downHeight = 0;
|
|
var upHeight = 0;
|
|
var isload = true;//设置是否终止滚动加载
|
|
var curScrollHeight = 0;//当前滚动位置
|
|
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
|
$(document).ready(function () {
|
|
userId = getlocalStorage("userId");
|
|
LoginId = getlocalStorage("LoginId");
|
|
CartId = getlocalStorage("CartId");
|
|
search_keyword = getlocalStorage("search_keyword");
|
|
$("#keyword").val(search_keyword);
|
|
rdata(1);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
function onScroll0() {
|
|
isload = true;//设置是否终止滚动加载
|
|
curScrollHeight = 0;//当前滚动位置
|
|
curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
|
$("#wrapper").scroll(function () {
|
|
var pageHeight = $("#sysnew").height();
|
|
var showHeight = $("#wrapper").height();
|
|
var scrollHeight = $("#wrapper").scrollTop();
|
|
|
|
if (curScrollHeight - scrollHeight < 10 && curScrollHeight > 0) {
|
|
if (curCount == 1 && isload) {
|
|
|
|
rdata(0);
|
|
}
|
|
curCount++; //加载下一页后计数器+1
|
|
}
|
|
if (curScrollHeight < scrollHeight) {
|
|
curScrollHeight = pageHeight - showHeight;//滚动到页面底部时,重设当前滚动位置
|
|
curCount = 1;
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function rdata(ag) {
|
|
var keyword = fTrim($("#keyword").val());
|
|
if (keyword == "") {
|
|
$("#keyword").focus();
|
|
tishi3('关键字不能为空!');
|
|
} else {
|
|
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: "/apiajax.ashx",
|
|
data: "&action=getshopsearch&ifweb=1&key=" + search_keyword + "&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
|
|
dataType: "JSON",
|
|
error: function (xhr, type) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data) {
|
|
|
|
|
|
if (data) {
|
|
if (data.status == 1) {
|
|
var html = "";
|
|
if (data.productlist.length > 0) {
|
|
var list = data.productlist;
|
|
html += "<div class=\"floor-product-item\">";
|
|
html += "<div class=\"product-item-cont\">";
|
|
for (j = 0; j < list.length; j++) {
|
|
|
|
html += "<div class=\"product-cont" + (j % 2 == 0 ? "" : " product-cont0") + " databox_" + list[j]._id + "\">";
|
|
html += "<div onclick=\"ondetail(" + list[j]._id + ")\" class=\"product-cont-box\">";
|
|
html += "<img src=\"" + list[j].image + "\" />";
|
|
html += "<span class=\"txt\">" + list[j].name + "</span>";
|
|
html += "<span class=\"rmb\">零售价:<del>¥" + list[j].scje + "</del></span>";
|
|
html += "<span class=\"rmb\">会员价:<span class=\"hyje\">¥" + list[j].hyje + "</span></span>";
|
|
//html += "<span class=\"rmb\">增值积分:<span class=\"hyje\">" + list[j].zzjf + "</span></span>";
|
|
html += "</div>";
|
|
html += "</div>";
|
|
}
|
|
html += "</div>";
|
|
html += "</div>";
|
|
}
|
|
$(".floor-product").html(html);
|
|
$(".productcount").html("搜索结果:共找到 " + data.productcount + " 条信息");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
} else {
|
|
|
|
tishi3(data.msg);
|
|
$(".ajaxLoader").addClass("uhide");
|
|
if (data.msg == "您未登录") {
|
|
onlink("/");
|
|
}
|
|
}
|
|
} else {
|
|
tishi3("网络错误!");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function ondetail(id) {
|
|
onlink("shop_view.html?id=" + id);
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="wrap">
|
|
<header>
|
|
<div class="ub">
|
|
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin()">
|
|
|
|
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
|
|
|
|
|
|
</div>
|
|
<h1 class="ub-f1">
|
|
搜索商品
|
|
</h1>
|
|
<div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:3em; ">
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<section class="ub-f1" id="wrapper">
|
|
|
|
<div style="padding:0 0.8em;">
|
|
|
|
<div class="searchbox">
|
|
<div class="inpubox">
|
|
<input id="keyword" />
|
|
</div><div class="icobox" onclick="rdata()"><img src="../image/searchto2.png" style="width: 1.6em;margin-top: .5em; margin-left: 1.5em;" /></div>
|
|
</div>
|
|
<div style=" clear: both; height:0;"></div>
|
|
<div class="productcount"></div>
|
|
<div class="floor-product">
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
<div class="more_box"></div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
|
|
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|