|
@@ -13,9 +13,9 @@
|
|
|
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
|
|
|
<script>
|
|
|
//屏蔽分享
|
|
|
- // document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
|
|
|
- // WeixinJSBridge.call('hideOptionMenu');
|
|
|
- // });
|
|
|
+// document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
|
|
|
+// WeixinJSBridge.call('hideOptionMenu');
|
|
|
+// });
|
|
|
</script>
|
|
|
</head>
|
|
|
|
|
@@ -24,7 +24,7 @@
|
|
|
<!--头部搜索框-->
|
|
|
<div class="search-cotainer">
|
|
|
<div class="mui-input-row mui-search">
|
|
|
- <input id="search" name="search" class="my-search-ipt" type="text" placeholder='大家都在搜电动牙刷刷头""'>
|
|
|
+ <input id="search" name="search" class="my-search-ipt" type="text" placeholder='大家都在搜"电动牙刷刷头"'>
|
|
|
</div>
|
|
|
<span class="iconfont icon-caidan"></span>
|
|
|
<span class="my-btn-cancel">取消</span>
|
|
@@ -36,7 +36,7 @@
|
|
|
<button type="button" class="mui-btn">冲奶机</button>
|
|
|
<button type="button" class="mui-btn">电动牙刷</button>-->
|
|
|
</div>
|
|
|
- <div class="search-cotainer line-25">
|
|
|
+ <!--<div class="search-cotainer line-25">
|
|
|
<p>热门搜索</p>
|
|
|
<button type="button" class="mui-btn">滤芯</button>
|
|
|
<button type="button" class="mui-btn">奶粉罐</button>
|
|
@@ -44,7 +44,7 @@
|
|
|
<button type="button" class="mui-btn">水箱</button>
|
|
|
<button type="button" class="mui-btn">接水台</button>
|
|
|
<button type="button" class="mui-btn">加湿器</button>
|
|
|
- </div>
|
|
|
+ </div>-->
|
|
|
</div>
|
|
|
</header>
|
|
|
<footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
|
|
@@ -147,9 +147,9 @@
|
|
|
for(i = 0; i < str.length; i++) {
|
|
|
var childTypeId = ''
|
|
|
if(typeof(str[i].childTypeId) != "undefined") {
|
|
|
- childTypeId = 'childTypeId=' + str[i].childTypeId;
|
|
|
+ childTypeId = 'childTypeid=' + str[i].childTypeId;
|
|
|
}
|
|
|
- $("#history").append('<button type="button" class="mui-btn" name="' + str[i].id + '" typeId="' + str[i].typeId + '" ' + childTypeId + '>' + str[i].label + '</button>');
|
|
|
+ $("#history").append('<button type="button" class="mui-btn" name="' + str[i].id + '" typeid="' + str[i].typeId + '" ' + childTypeId + '>' + str[i].label + '</button>');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -236,7 +236,7 @@
|
|
|
var li = document.createElement('li');
|
|
|
li.className = 'mui-table-view-cell mui-media mui-col-xs-12';
|
|
|
console.log(this.productColorList[0].colorDiscount)
|
|
|
- li.innerHTML = '<a name="' + this.productId + '"><img class="mui-media-object" src="' + this.productChoicenessIm + '"><div class="index-pro-tit">' + this.productName + '</div><p class="mui-text-left">' + this.productColorDes + '<span class="f-price">¥' + (this.productColorList[0].colorDiscount / 100).toFixed(2) + '</span></p></a>';
|
|
|
+ li.innerHTML = '<a name="' + this.productId + '"><img class="mui-media-object" src="' + this.productChoicenessIm + '"><div class="index-pro-tit">' + this.productName + '</div><p class="mui-text-left">' + this.productColorDes + '<span class="f-price">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</span></p></a>';
|
|
|
table.appendChild(li);
|
|
|
});
|
|
|
|
|
@@ -245,7 +245,7 @@
|
|
|
mui(jingxuan2).each(function(index) {
|
|
|
var li = document.createElement('li');
|
|
|
li.className = 'mui-table-view-cell mui-media mui-col-xs-6';
|
|
|
- li.innerHTML = '<a name="' + this.productId + '"><img class="mui-media-object" src="' + this.productChoicenessIm + '"><div class="index-pro-tit">' + this.productName + '</div><p class="mui-text-left">' + this.productRemark + '</p><p class="l-price">¥' + (this.productColorList[0].colorDiscount / 100).toFixed(2) + '</p></a>';
|
|
|
+ li.innerHTML = '<a name="' + this.productId + '"><img class="mui-media-object" src="' + this.productChoicenessIm + '"><div class="index-pro-tit">' + this.productName + '</div><p class="mui-text-left">' + this.productRemark + '</p><p class="l-price">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</p></a>';
|
|
|
table.appendChild(li);
|
|
|
});
|
|
|
|
|
@@ -327,32 +327,6 @@
|
|
|
mui.alert("获取数据失败!网络错误");
|
|
|
}
|
|
|
});
|
|
|
- // $.ajax(base_path + '/wechat/product/selectProductType?dates=' + new Date().getTime(), {
|
|
|
- // data: {},
|
|
|
- // dataType: 'json',
|
|
|
- // xhrFields: {
|
|
|
- // withCredentials: true
|
|
|
- // },
|
|
|
- // crossDomain: true,
|
|
|
- // type: 'post',
|
|
|
- // timeout: 15000,
|
|
|
- // success: function(dt) {
|
|
|
- // if(dt.isRedirect) {
|
|
|
- // location.href = dt.redirectURL;
|
|
|
- // } else {
|
|
|
- // if(dt.status) {
|
|
|
- // console.log(dt)
|
|
|
- //
|
|
|
- // } else {
|
|
|
- // mui.alert("获取数据失败!");
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // error: function(xhr, type, errorThrown) {
|
|
|
- // console.log(xhr);
|
|
|
- // mui.alert("获取数据失败!网络错误");
|
|
|
- // }
|
|
|
- // });
|
|
|
|
|
|
//搜索框焦点事件
|
|
|
$('#search').on('focus', function(e) {
|
|
@@ -363,29 +337,42 @@
|
|
|
$('#search-hot').hide();
|
|
|
$(".autocompleter-list").css("height", $(document).height())
|
|
|
} else {
|
|
|
- $('#search-hot').show();
|
|
|
+ $("#search-hot").css("height",$(document.body).height()).show();
|
|
|
}
|
|
|
});
|
|
|
//搜索框失去焦点事件
|
|
|
$('#search').on('blur', function(e) {
|
|
|
- $('#search-hot,.my-btn-cancel').hide();
|
|
|
- $(".icon-caidan").show();
|
|
|
+ setTimeout(function(){
|
|
|
+ $('#search-hot,.my-btn-cancel').hide();
|
|
|
+ $(".icon-caidan").show();
|
|
|
+ },700);
|
|
|
+
|
|
|
});
|
|
|
//点击后把text赋值到搜索框
|
|
|
- $(document).on('tap', '.search-cotainer button', function() {
|
|
|
+ $(document).on('tap', '#history button', function() {
|
|
|
$('#search').val($(this).text());
|
|
|
console.log($(this).text())
|
|
|
$('#search-hot').hide();
|
|
|
var parameter = {};
|
|
|
parameter["id"] = $(this).attr("name");
|
|
|
parameter["label"] = $(this).text();
|
|
|
- parameter["typeId"] = $(this).attr("typeId");
|
|
|
- if(typeof($(this).attr("childTypeId")) != "undefined") {
|
|
|
- parameter["childTypeId"] = $(this).attr("childTypeId");
|
|
|
+ parameter["typeId"] = $(this).attr("typeid");
|
|
|
+ if(typeof($(this).attr("childtypeId")) != "undefined") {
|
|
|
+ parameter["childTypeId"] = $(this).attr("childtypeid");
|
|
|
}
|
|
|
search(parameter);
|
|
|
});
|
|
|
-
|
|
|
+ //点击历史记录跳转
|
|
|
+// $(document).on('tap', '#history button', function() {
|
|
|
+// var parameter = {};
|
|
|
+// parameter["id"] = $(this).attr("name");
|
|
|
+// parameter["label"] = $(this).text();
|
|
|
+// parameter["typeId"] = $(this).attr("typeid");
|
|
|
+// if(typeof($(this).attr("childtypeid")) != "undefined") {
|
|
|
+// parameter["childTypeId"] = $(this).attr("childtypeid");
|
|
|
+// }
|
|
|
+// search(parameter);
|
|
|
+// });
|
|
|
//搜索框本地缓存
|
|
|
function search(selected) {
|
|
|
if(!window.localStorage) {
|
|
@@ -414,7 +401,10 @@
|
|
|
//json格式化插入
|
|
|
localStorage.setItem('search_histoty', JSON.stringify(obj));
|
|
|
sessionStorage.setItem('search_data', JSON.stringify(searchobj));
|
|
|
- location.href = 'pro-list.html?typeId=' + selected.typeId;
|
|
|
+ console.log(obj)
|
|
|
+ mui.openWindow({
|
|
|
+ url: 'pro-list.html?productId=' + selected.typeId
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
//监听搜索框值改变事件
|
|
@@ -455,8 +445,20 @@
|
|
|
});
|
|
|
//产品详情-配件
|
|
|
$(document).on('tap', '#index-pro-items>.mui-control-item', function() {
|
|
|
- location.href = 'pro-details.html?productId=' + + selected.typeId
|
|
|
+ location.href = 'pro-list.html?productId=' +$(this).attr("name")+'&childTypeId='+$(this).attr("item");
|
|
|
});
|
|
|
+ //more更多产品
|
|
|
+ $(document).on('tap', '.go_pro_list', function() {
|
|
|
+ if(typeof($(this).attr("pos"))!="undefined"){
|
|
|
+ location.href="pro-list.html?productId=5";
|
|
|
+ }else{
|
|
|
+ location.href="pro-list.html";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //菜单跳转
|
|
|
+ $(document).on('tap', '#menu>.line>a', function() {
|
|
|
+ location.href='pro-list.html?productId='+$(this).attr("name")+'&childTypeId='+$(this).attr("item");
|
|
|
+ });
|
|
|
</script>
|
|
|
</body>
|
|
|
|