Преглед на файлове

解决冲突
Merge branch 'master' of http://git.iamberry.com/liujiankang/static

# Conflicts:
# aiberle/my-center.html

wangxiaoming преди 7 години
родител
ревизия
54d5e851ba
променени са 4 файла, в които са добавени 1432 реда и са изтрити 1324 реда
  1. 459 464
      aiberle/index.html
  2. 484 399
      aiberle/js/main.js
  3. 5 5
      aiberle/my-center.html
  4. 484 456
      aiberle/pro-list.html

+ 459 - 464
aiberle/index.html

@@ -1,465 +1,460 @@
-<!DOCTYPE html>
-<html>
-
-	<head>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
-		<meta name="apple-mobile-web-app-capable" content="yes">
-		<meta name="apple-mobile-web-app-status-bar-style" content="black">
-		<title>Aiberle官方商城</title>
-		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
-		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
-		<link rel="stylesheet" type="text/css" href="css/main.css" />
-		<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');
-//			});
-		</script>
-	</head>
-
-	<body>
-		<header class="mui-bar mui-bar-nav">
-			<!--头部搜索框-->
-			<div class="search-cotainer">
-				<div class="mui-input-row mui-search">
-					<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>
-			</div>
-			<div id="search-hot" style="display: none;">
-				<div class="search-cotainer line-25" id="history">
-					<p>历史搜索</p>
-					<!--<button type="button" class="mui-btn">净水机</button>
-					<button type="button" class="mui-btn">冲奶机</button>
-					<button type="button" class="mui-btn">电动牙刷</button>-->
-				</div>
-				<!--<div class="search-cotainer line-25">
-					<p>热门搜索</p>
-					<button type="button" class="mui-btn">滤芯</button>
-					<button type="button" class="mui-btn">奶粉罐</button>
-					<button type="button" class="mui-btn">牙刷头</button>
-					<button type="button" class="mui-btn">水箱</button>
-					<button type="button" class="mui-btn">接水台</button>
-					<button type="button" class="mui-btn">加湿器</button>
-				</div>-->
-			</div>
-		</header>
-		<footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
-			<a class="mui-tab-item mui-active">
-				<span class="iconfont icon-shouye"></span>
-				<span class="mui-tab-label">首页</span>
-			</a>
-			<a class="mui-tab-item">
-				<span class="iconfont icon-gouwuche"></span>
-				<span class="mui-tab-label">购物车</span>
-			</a>
-			<a class="mui-tab-item">
-				<span class="iconfont icon-dingdan"></span>
-				<span class="mui-tab-label">订单</span>
-			</a>
-			<a class="mui-tab-item">
-				<span class="iconfont icon-wode"></span>
-				<span class="mui-tab-label">我的</span>
-			</a>
-		</footer>
-		<div class="mui-content">
-			<div class="banner-box">
-				<!--banner位置-->
-				<div class="index-banner" style="display: none;"></div>
-			</div>
-			<div class="index-title">
-				<strong>精选产品</strong><span class="mui-pull-right go_pro_list"><font>More</font><span class="mui-icon mui-icon-arrowright"></span></span>
-			</div>
-			<ul class="mui-table-view mui-grid-view my-view-no" id="index-pro-list" style="padding-bottom: 0;">
-				<!--<li class="mui-table-view-cell mui-media mui-col-xs-12">
-		            <a>
-		                <img class="mui-media-object" src="images/index-1.jpg">
-		                <div class="index-pro-tit">[精选] Aiberle美国智能净饮水一体机</div>
-		                <p class="mui-text-left">4级ro净化、10s加热、3s出水<span class="f-price">¥2999.00</span></p>
-		            </a>
-		        </li>
-		         <li class="mui-table-view-cell mui-media mui-col-xs-12">
-		            <a>
-		                <img class="mui-media-object" src="images/index-1.jpg">
-		                <div class="index-pro-tit">[精选] Aiberle美国智能净饮水一体机</div>
-		                <p class="mui-text-left">4级ro净化、10s加热、3s出水<span class="f-price">¥2999.00</span></p>
-		            </a>
-		        </li>
-		        <li class="mui-table-view-cell mui-media mui-col-xs-6">
-		            <a><img class="mui-media-object" src="images/index-2.jpg">
-		               <div class="index-pro-tit">[育儿] Aiberle冲奶机</div>
-		                <p class="mui-text-left">一键操作、8s冲好一瓶奶x</p>
-		                <p class="l-price">¥799.00</p>
-		            </a>
-		        </li>
-		        <li class="mui-table-view-cell mui-media mui-col-xs-6">
-		            <a>
-		                <img class="mui-media-object" src="images/index-3.jpg">
-		                <div class="index-pro-tit">[宝妈] Aiberle电动牙刷</div>
-		                <p class="mui-text-left">智慧科技、呵护妈妈口腔</p>
-		                <p class="l-price">¥299.00</p>
-		            </a>
-		        </li>-->
-			</ul>
-			<div class="index-title">
-				<strong>产品配件</strong><span class="mui-pull-right go_pro_list" pos="bottom"><font>More</font><span class="mui-icon mui-icon-arrowright"></span></span>
-			</div>
-			<div style="margin:8px 14px 30px 14px;">
-				<div id="index-pro-items" class="mui-segmented-control">
-					<!--<a class="mui-control-item" href="#item1">净水机配件</a>
-					<a class="mui-control-item" href="#item2">冲奶机配件</a>
-					<a class="mui-control-item" href="#item3">电动牙刷配件</a>-->
-				</div>
-			</div>
-		</div>
-		<ul id="menu">
-			<li><span class="iconfont icon-guanbi"></span></li>
-			<!--<li><label><div>净水机</div></label></li>
-	<li class="line"><a href="javascript:;"><div>智能净水机</div></a></li>
-	<li class="line"><a href="javascript:;"><div>智能净水机配件</div></a></li>
-	<li><label><div>冲奶机</div></label></li>
-	<li class="line"><a href="javascript:;"><div>智能冲奶机</div></a></li>
-	<li class="line"><a href="javascript:;"><div>智能冲奶机配件</div></a></li>
-	<li><label><div>电动牙刷</div></label></li>
-	<li class="line"><a><div>声波女式电动牙刷</div></a></li>
-	<li class="line"><a href="javascript:;"><div>声波女式电动牙刷配件</div></a></li>-->
-		</ul>
-		<!-- 加载ing -->
-		<div class="loading covers">
-			<div class="loading-bj"></div>
-			<p>正在加载...</p>
-		</div>
-		<!-- 加载ing END -->
-		<script src="js/mui.min.js"></script>
-		<script src="js/jquery-2.1.1.min.js"></script>
-		<script src="js/jquery.autocompleter.js"></script>
-		<script src="js/main.js"></script>
-		<script>
-			// 读取值
-			var colors = [];
-			var histoty = JSON.parse(localStorage.getItem('search_histoty'));
-			console.log(histoty)
-			if(histoty != null) {
-				var str = histoty.text;
-				for(i = 0; i < str.length; i++) {
-					var childTypeId = ''
-					if(typeof(str[i].childTypeId) != "undefined") {
-						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>');
-				}
-			}
-
-			/**
-			 *搜索框自动补全参数
-			 */
-			//var colors = [{
-			//	"id": "1",
-			//	"label": "冲奶机"
-			//}, {
-			//	"id": "2",
-			//	"label": "净水机"
-			//}, {
-			//	"id": "3",
-			//	"label": "电动牙刷"
-			//}, {
-			//	"id": "4",
-			//	"name":"lvxin",
-			//	"label": "滤芯"
-			//}, {
-			//	"id": "5",
-			//	"label": "奶粉罐"
-			//}, {
-			//	"id": "6",
-			//	"label": "牙刷头"
-			//}, {
-			//	"id": "7",
-			//	"label": "水箱"
-			//}, {
-			//	"id": "8",
-			//	"label": "接水台"
-			//}, {
-			//	"id": "9",
-			//	"label": "加湿器"
-			//}];
-			mui.ready(function() {
-				$.ajax(base_path + '/wechat/indexData?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 {
-							console.log(dt)
-							if(dt.status) {
-
-								//遍历banner
-								var bannerstr = "",
-									dian = "";
-								var banner_data = dt.data.banners;
-								mui(banner_data).each(function(index) {
-									if(index == 0) {
-										bannerstr += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + banner_data[banner_data.length - 1].bannerImageCheckOutUrl + '"><img src="' + (banner_data[banner_data.length - 1].bannerImageUrl) + '"></a></div><div class="mui-slider-item mui-active"><a href="' + this.bannerImageCheckOutUrl + '"><img src="' + (this.bannerImageUrl) + '"></a></div>';
-										dian += '<div class="mui-indicator mui-active"></div>'
-									} else {
-										bannerstr += '<div class="mui-slider-item"><a href="' + this.bannerImageCheckOutUrl + '"><img src="' + (this.bannerImageUrl) + '"></a></div>';
-										dian += '<div class="mui-indicator"></div>'
-									}
-									if(index == (banner_data.length - 1) || (banner_data.length - 1) == 0) {
-										bannerstr += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + banner_data[0].bannerImageCheckOutUrl + '"><img src="' + (banner_data[0].bannerImageUrl) + '"></a></div>'
-									}
-								});
-								dc('mui-slider-loop').innerHTML = bannerstr;
-								dc('my-slider-indicator').innerHTML = dian;
-								$("<div id='slider' class='mui-slider'><div class='mui-slider-group mui-slider-loop' id='mui-slider-loop'>" + bannerstr + "</div><div id='my-slider-indicator' class='mui-slider-indicator my-slider-indicator'>" + dian + "</div></div>").insertBefore(".index-banner");
-
-								//初始化banner自动轮播(interval:0为不自动轮播)单位ms
-								var banner = mui('#slider');
-								banner.slider({
-									interval: 5000
-								});
-
-								//遍历精选置顶产品(100%宽度)
-								var jingxuan1 = dt.data.selectProductTopper;
-								var table = document.body.querySelector("#index-pro-list");
-								mui(jingxuan1).each(function(index) {
-									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">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</span></p></a>';
-									table.appendChild(li);
-								});
-
-								//遍历精选产品(50%宽度)
-								var jingxuan2 = dt.data.selectProduct;
-								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">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</p></a>';
-									table.appendChild(li);
-								});
-
-								//遍历菜单
-								var caidanData = dt.data.productTypeList;
-								var caidan = document.body.querySelector("#menu");
-								mui(caidanData).each(function(index) {
-									var li = document.createElement("li");
-									li.innerHTML = '<label name="' + this.typeId + '"><div>' + this.typeName + '</div></label>';
-									caidan.appendChild(li);
-									colors.push({
-										"id": colors.length + 1,
-										"typeId": this.typeId,
-										"label": this.typeName
-									});
-									$.each(this.childTypeList, function() {
-										
-											var li = document.createElement("li");
-											li.className = 'line';
-											li.innerHTML = '<a name="' + this.typeId + '" item="' + this.childTypeId + '"><div>' + this.childTypeName + '</div></a>';
-											caidan.appendChild(li);
-											colors.push({
-												"id": colors.length + 1,
-												"typeId": this.typeId,
-												"label": this.childTypeName,
-												"childTypeId": this.childTypeId
-											});
-										
-										
-									});
-									//遍历产品配件
-									if(this.typeId == 5) {
-										console.log(this.childTypeList)
-										var peijian = document.body.querySelector("#index-pro-items");
-										peijian.innerHTML = '';
-										$.each(this.childTypeList, function() {
-											var a = document.createElement("a");
-											a.className = 'mui-control-item';
-											a.setAttribute("name", this.typeId);
-											a.setAttribute("item", this.childTypeId);
-											a.innerHTML = this.childTypeName;
-											peijian.appendChild(a);
-										});
-									}
-								});
-								console.log(colors)
-								//绑定搜索框自动补全
-								$('#search').autocompleter({
-									// marker for autocomplete matches
-									highlightMatches: true,
-
-									// object to local or url to remote search
-									source: colors,
-
-									// custom template 对应 自动补全参数
-									template: '<span>{{ label }}</span>',
-
-									// show hint
-									hint: true,
-
-									// abort source if empty field
-									empty: false,
-
-									// max results
-									limit: 10,
-									callback: function(value, index, selected) {
-										//selected 包含 (id,label)
-										console.log(selected)
-										search(selected);
-									}
-								});
-							} else {
-								mui.alert("获取数据失败!");
-							}
-						}
-					},
-					error: function(xhr, type, errorThrown) {
-						console.log(xhr);
-						mui.alert("获取数据失败!网络错误");
-					}
-				});
-
-				//搜索框焦点事件
-				$('#search').on('focus', function(e) {
-					window.scrollTo(0, 0, 500);
-					$(".icon-caidan").hide();
-					$('.my-btn-cancel').show();
-					if($(this).val().length > 0) {
-						$('#search-hot').hide();
-						$(".autocompleter-list").css("height", $(document).height())
-					} else {
-						$("#search-hot").css("height",$(document.body).height()).show();
-					}
-				});
-				//搜索框失去焦点事件
-				$('#search').on('blur', function(e) {
-					setTimeout(function(){
-						$('#search-hot,.my-btn-cancel').hide();
-						$(".icon-caidan").show();
-					},700);
-					
-				});
-				//点击后把text赋值到搜索框
-				$(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");
-					}
-					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) {
-						mui.alert("您的浏览器不支持localStorage");
-					} else {
-						//自定义json数据
-						var obj = {},
-							searchobj = {};
-						if(histoty != null) {
-							var str = histoty.text;
-							if(str.length > 2) {
-								str.splice(2, 1)
-							}
-							str.splice(0, 0, selected)
-							obj = {
-								text: str
-							}
-						} else {
-							obj = {
-								text: [selected]
-							};
-						}
-						searchobj = {
-							text: [selected]
-						}
-						//json格式化插入    
-						localStorage.setItem('search_histoty', JSON.stringify(obj));
-						sessionStorage.setItem('search_data', JSON.stringify(searchobj));
-						console.log(obj)
-						mui.openWindow({
-							url: 'pro-list.html?productId=' + selected.typeId
-						});
-					}
-				}
-				//监听搜索框值改变事件
-				$('#search').on('input', function(e) {
-					if($(this).val().length > 0) {
-						$('#search-hot').hide();
-						$(".autocompleter-list").css("height", $(document).height());
-					} else {
-						$('#search-hot').show();
-						$(".autocompleter-list").css("height", "auto");
-					}
-				});
-				$(".loading").hide().css("opacity", "0");
-			});
-
-			//取消搜索
-			$(document).on('tap', '.my-btn-cancel', function() {
-				$(this).hide();
-				$('#search-hot').hide();
-				$('#search').autocompleter("close");
-				$(".autocompleter-list").empty().css("height", "auto");
-				$('.autocompleter-hint').removeClass('autocompleter-hint-show').empty();
-				$(".icon-caidan").show();
-			});
-			//打开菜单
-			$(document).on('tap', '.icon-caidan', function() {
-				$("#menu").css("height", $(window).height());
-				$("#menu>li").addClass("active");
-			});
-			//关闭菜单
-			$(document).on('tap', '.icon-guanbi', function() {
-				$("#menu>li").removeClass("active");
-				$("#menu").css("height", "0px");
-			});
-			//精选产品详情
-			$(document).on('tap', '#index-pro-list .mui-table-view-cell>a', function() {
-				location.href = 'pro-details.html?productId=' + $(this).attr("name")
-			});
-			//产品详情-配件
-			$(document).on('tap', '#index-pro-items>.mui-control-item', function() {
-				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>
-
+<!DOCTYPE html>
+<html>
+
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="apple-mobile-web-app-status-bar-style" content="black">
+		<title>Aiberle官方商城</title>
+		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
+		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
+		<link rel="stylesheet" type="text/css" href="css/main.css" />
+		<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');
+//			});
+		</script>
+	</head>
+
+	<body>
+		<header class="mui-bar mui-bar-nav">
+			<!--头部搜索框-->
+			<div class="search-cotainer">
+				<div class="mui-input-row mui-search">
+					<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>
+			</div>
+			<div id="search-hot" style="display: none;">
+				<div class="search-cotainer line-25" id="history">
+					<p>历史搜索</p>
+					<!--<button type="button" class="mui-btn">净水机</button>
+					<button type="button" class="mui-btn">冲奶机</button>
+					<button type="button" class="mui-btn">电动牙刷</button>-->
+				</div>
+				<!--<div class="search-cotainer line-25">
+					<p>热门搜索</p>
+					<button type="button" class="mui-btn">滤芯</button>
+					<button type="button" class="mui-btn">奶粉罐</button>
+					<button type="button" class="mui-btn">牙刷头</button>
+					<button type="button" class="mui-btn">水箱</button>
+					<button type="button" class="mui-btn">接水台</button>
+					<button type="button" class="mui-btn">加湿器</button>
+				</div>-->
+			</div>
+		</header>
+		<footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
+			<a class="mui-tab-item mui-active">
+				<span class="iconfont icon-shouye"></span>
+				<span class="mui-tab-label">首页</span>
+			</a>
+			<a class="mui-tab-item">
+				<span class="iconfont icon-gouwuche"></span>
+				<span class="mui-tab-label">购物车</span>
+			</a>
+			<a class="mui-tab-item">
+				<span class="iconfont icon-dingdan"></span>
+				<span class="mui-tab-label">订单</span>
+			</a>
+			<a class="mui-tab-item">
+				<span class="iconfont icon-wode"></span>
+				<span class="mui-tab-label">我的</span>
+			</a>
+		</footer>
+		<div class="mui-content">
+			<div class="banner-box">
+				<!--banner位置-->
+				<div class="index-banner" style="display: none;"></div>
+			</div>
+			<div class="index-title">
+				<strong>精选产品</strong><span class="mui-pull-right go_pro_list"><font>More</font><span class="mui-icon mui-icon-arrowright"></span></span>
+			</div>
+			<ul class="mui-table-view mui-grid-view my-view-no" id="index-pro-list" style="padding-bottom: 0;">
+				<!--<li class="mui-table-view-cell mui-media mui-col-xs-12">
+		            <a>
+		                <img class="mui-media-object" src="images/index-1.jpg">
+		                <div class="index-pro-tit">[精选] Aiberle美国智能净饮水一体机</div>
+		                <p class="mui-text-left">4级ro净化、10s加热、3s出水<span class="f-price">¥2999.00</span></p>
+		            </a>
+		        </li>
+		         <li class="mui-table-view-cell mui-media mui-col-xs-12">
+		            <a>
+		                <img class="mui-media-object" src="images/index-1.jpg">
+		                <div class="index-pro-tit">[精选] Aiberle美国智能净饮水一体机</div>
+		                <p class="mui-text-left">4级ro净化、10s加热、3s出水<span class="f-price">¥2999.00</span></p>
+		            </a>
+		        </li>
+		        <li class="mui-table-view-cell mui-media mui-col-xs-6">
+		            <a><img class="mui-media-object" src="images/index-2.jpg">
+		               <div class="index-pro-tit">[育儿] Aiberle冲奶机</div>
+		                <p class="mui-text-left">一键操作、8s冲好一瓶奶x</p>
+		                <p class="l-price">¥799.00</p>
+		            </a>
+		        </li>
+		        <li class="mui-table-view-cell mui-media mui-col-xs-6">
+		            <a>
+		                <img class="mui-media-object" src="images/index-3.jpg">
+		                <div class="index-pro-tit">[宝妈] Aiberle电动牙刷</div>
+		                <p class="mui-text-left">智慧科技、呵护妈妈口腔</p>
+		                <p class="l-price">¥299.00</p>
+		            </a>
+		        </li>-->
+			</ul>
+			<div class="index-title">
+				<strong>产品配件</strong><span class="mui-pull-right go_pro_list" pos="bottom"><font>More</font><span class="mui-icon mui-icon-arrowright"></span></span>
+			</div>
+			<div style="margin:8px 14px 30px 14px;">
+				<div id="index-pro-items" class="mui-segmented-control">
+					<!--<a class="mui-control-item" href="#item1">净水机配件</a>
+					<a class="mui-control-item" href="#item2">冲奶机配件</a>
+					<a class="mui-control-item" href="#item3">电动牙刷配件</a>-->
+				</div>
+			</div>
+		</div>
+		<ul id="menu">
+			<li><span class="iconfont icon-guanbi"></span></li>
+			<!--<li><label><div>净水机</div></label></li>
+	<li class="line"><a href="javascript:;"><div>智能净水机</div></a></li>
+	<li class="line"><a href="javascript:;"><div>智能净水机配件</div></a></li>
+	<li><label><div>冲奶机</div></label></li>
+	<li class="line"><a href="javascript:;"><div>智能冲奶机</div></a></li>
+	<li class="line"><a href="javascript:;"><div>智能冲奶机配件</div></a></li>
+	<li><label><div>电动牙刷</div></label></li>
+	<li class="line"><a><div>声波女式电动牙刷</div></a></li>
+	<li class="line"><a href="javascript:;"><div>声波女式电动牙刷配件</div></a></li>-->
+		</ul>
+		<!-- 加载ing -->
+		<div class="loading covers">
+			<div class="loading-bj"></div>
+			<p>正在加载...</p>
+		</div>
+		<!-- 加载ing END -->
+		<script src="js/mui.min.js"></script>
+		<script src="js/jquery-2.1.1.min.js"></script>
+		<script src="js/jquery.autocompleter.js"></script>
+		<script src="js/main.js"></script>
+		<script>
+			// 读取值
+			var colors = [];
+			var histoty = JSON.parse(localStorage.getItem('search_histoty'));
+			console.log(histoty)
+			if(histoty != null) {
+				var str = histoty.text;
+				for(i = 0; i < str.length; i++) {
+					var childTypeId = ''
+					if(typeof(str[i].childTypeId) != "undefined") {
+						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>');
+				}
+			}
+
+			/**
+			 *搜索框自动补全参数
+			 */
+			//var colors = [{
+			//	"id": "1",
+			//	"label": "冲奶机"
+			//}, {
+			//	"id": "2",
+			//	"label": "净水机"
+			//}, {
+			//	"id": "3",
+			//	"label": "电动牙刷"
+			//}, {
+			//	"id": "4",
+			//	"name":"lvxin",
+			//	"label": "滤芯"
+			//}, {
+			//	"id": "5",
+			//	"label": "奶粉罐"
+			//}, {
+			//	"id": "6",
+			//	"label": "牙刷头"
+			//}, {
+			//	"id": "7",
+			//	"label": "水箱"
+			//}, {
+			//	"id": "8",
+			//	"label": "接水台"
+			//}, {
+			//	"id": "9",
+			//	"label": "加湿器"
+			//}];
+			mui.ready(function() {
+				$.ajax(base_path + '/wechat/indexData?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 {
+							console.log(dt)
+							if(dt.status) {
+								//遍历banner
+								var bannerstr = "",
+									dian = "";
+								var banner_data = dt.data.banners;
+								mui(banner_data).each(function(index) {
+									if(index == 0) {
+										bannerstr += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + banner_data[banner_data.length - 1].bannerImageCheckOutUrl + '"><img src="' + (banner_data[banner_data.length - 1].bannerImageUrl) + '"></a></div><div class="mui-slider-item mui-active"><a href="' + this.bannerImageCheckOutUrl + '"><img src="' + (this.bannerImageUrl) + '"></a></div>';
+										dian += '<div class="mui-indicator mui-active"></div>'
+									} else {
+										bannerstr += '<div class="mui-slider-item"><a href="' + this.bannerImageCheckOutUrl + '"><img src="' + (this.bannerImageUrl) + '"></a></div>';
+										dian += '<div class="mui-indicator"></div>'
+									}
+									if(index == (banner_data.length - 1) || (banner_data.length - 1) == 0) {
+										bannerstr += '<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + banner_data[0].bannerImageCheckOutUrl + '"><img src="' + (banner_data[0].bannerImageUrl) + '"></a></div>'
+									}
+								});
+								dc('mui-slider-loop').innerHTML = bannerstr;
+								dc('my-slider-indicator').innerHTML = dian;
+								$("<div id='slider' class='mui-slider'><div class='mui-slider-group mui-slider-loop' id='mui-slider-loop'>" + bannerstr + "</div><div id='my-slider-indicator' class='mui-slider-indicator my-slider-indicator'>" + dian + "</div></div>").insertBefore(".index-banner");
+
+								//初始化banner自动轮播(interval:0为不自动轮播)单位ms
+								var banner = mui('#slider');
+								banner.slider({
+									interval: 5000
+								});
+
+								//遍历精选置顶产品(100%宽度)
+								var jingxuan1 = dt.data.selectProductTopper;
+								var table = document.body.querySelector("#index-pro-list");
+								mui(jingxuan1).each(function(index) {
+									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">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</span></p></a>';
+									table.appendChild(li);
+								});
+
+								//遍历精选产品(50%宽度)
+								var jingxuan2 = dt.data.selectProduct;
+								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">¥' + accDiv(this.productColorList[0].colorDiscount , 100) + '</p></a>';
+									table.appendChild(li);
+								});
+
+								//遍历菜单
+								var caidanData = dt.data.productTypeList;
+								var caidan = document.body.querySelector("#menu");
+								mui(caidanData).each(function(index) {
+									var li = document.createElement("li");
+									li.innerHTML = '<label name="' + this.typeId + '"><div>' + this.typeName + '</div></label>';
+									caidan.appendChild(li);
+									colors.push({
+										"id": colors.length + 1,
+										"typeId": this.typeId,
+										"label": this.typeName,
+										"url":"1"
+									});
+									$.each(this.childTypeList, function() {
+										
+											var li = document.createElement("li");
+											li.className = 'line';
+											li.innerHTML = '<a name="' + this.typeId + '" item="' + this.childTypeId + '"><div>' + this.childTypeName + '</div></a>';
+											caidan.appendChild(li);
+											colors.push({
+												"id": colors.length + 1,
+												"typeId": this.typeId,
+												"label": this.childTypeName,
+												"childTypeId": this.childTypeId,
+												"url":"1"
+											});
+										
+										
+									});
+									//遍历产品配件
+									if(this.typeId == 5) {
+										console.log(this.childTypeList)
+										var peijian = document.body.querySelector("#index-pro-items");
+										peijian.innerHTML = '';
+										$.each(this.childTypeList, function() {
+											var a = document.createElement("a");
+											a.className = 'mui-control-item';
+											a.setAttribute("name", this.typeId);
+											a.setAttribute("item", this.childTypeId);
+											a.innerHTML = this.childTypeName;
+											peijian.appendChild(a);
+										});
+									}
+								});
+								console.log(colors)
+								//绑定搜索框自动补全
+								$('#search').autocompleter({
+									// marker for autocomplete matches
+									highlightMatches: true,
+
+									// object to local or url to remote search
+									source: colors,
+
+									// custom template 对应 自动补全参数
+									template: '<span>{{ label }}</span>',
+
+									// show hint
+									hint: true,
+
+									// abort source if empty field
+									empty: false,
+
+									// max results
+									limit: 10,
+									callback: function(value, index, selected) {
+										//selected 包含 (id,label)
+										console.log(selected)
+										search(selected);
+									}
+								});
+							} else {
+								mui.alert("获取数据失败!");
+							}
+						}
+					},
+					error: function(xhr, type, errorThrown) {
+						console.log(xhr);
+						mui.alert("获取数据失败!网络错误");
+					}
+				});
+
+				//搜索框焦点事件
+				$('#search').on('focus', function(e) {
+					window.scrollTo(0, 0, 500);
+					$(".icon-caidan").hide();
+					$('.my-btn-cancel').show();
+					if($(this).val().length > 0) {
+						$('#search-hot').hide(500);
+						$(".autocompleter-list").css("height", $(document).height())
+					} else {
+						$("#search-hot").css("height",$(document.body).height()).show();
+						$("body").css("overflow","hidden");
+					}
+				});
+				//搜索框失去焦点事件
+				$('#search').on('blur', function(e) {
+					setTimeout(function(){
+						$('#search-hot,.my-btn-cancel').hide();
+						$("body").css("overflow","auto");
+						$(".icon-caidan").show();
+					},700);
+					
+				});
+				//点击后把text赋值到搜索框
+				$(document).on('tap', '#history button', function() {
+					$('#search').val($(this).text());
+					console.log($(this).text())
+					$('#search-hot').hide();
+					$("body").css("overflow","auto");
+					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) {
+						mui.alert("您的浏览器不支持localStorage");
+					} else {
+						//自定义json数据
+						var obj = {},
+							searchobj = {};
+						if(histoty != null) {
+							var str = histoty.text;
+							if(str.length > 2) {
+								str.splice(2, 1)
+							}
+							str.splice(0, 0, selected)
+							obj = {
+								text: str
+							}
+						} else {
+							obj = {
+								text: [selected]
+							};
+						}
+						searchobj = {
+							text: [selected]
+						}
+						//json格式化插入    
+						localStorage.setItem('search_histoty', JSON.stringify(obj));
+						sessionStorage.setItem('search_data', JSON.stringify(searchobj));
+						console.log("999999999999")
+						mui.openWindow({
+							url: 'pro-list.html?productId=' + selected.typeId
+						});
+					}
+				}
+				//监听搜索框值改变事件
+				$('#search').on('input', function(e) {
+					if($(this).val().length > 0) {
+						$('#search-hot').hide();
+						$(".autocompleter-list").css("height", $(document).height());
+					} else {
+						$('#search-hot').show();
+						$("body").css("overflow","hidden");
+						$(".autocompleter-list").css("height", "auto");
+					}
+				});
+				$(".loading").hide().css("opacity", "0");
+			});
+
+			//取消搜索
+			$(document).on('tap', '.my-btn-cancel', function() {
+				$(this).hide();
+				$('#search-hot').hide();
+				$("body").css("overflow","auto");
+				$('#search').autocompleter("close");
+				$(".autocompleter-list").empty().css("height", "auto");
+				$('.autocompleter-hint').removeClass('autocompleter-hint-show').empty();
+				$(".icon-caidan").show();
+			});
+			//打开菜单
+			$(document).on('tap', '.icon-caidan', function() {
+				$("#menu").css("height", $(window).height());
+				$("#menu>li").addClass("active");
+			});
+			//关闭菜单
+			$(document).on('tap', '.icon-guanbi', function() {
+				$("#menu>li").removeClass("active");
+				$("#menu").css("height", "0px");
+			});
+			//精选产品详情
+			$(document).on('tap', '#index-pro-list .mui-table-view-cell>a', function() {
+				location.href = 'pro-details.html?productId=' + $(this).attr("name")
+			});
+			//产品详情-配件
+			$(document).on('tap', '#index-pro-items>.mui-control-item', function() {
+				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>
+
 </html>

+ 484 - 399
aiberle/js/main.js

@@ -1,400 +1,485 @@
-window.addEventListener('pageshow', function(e) {
-	// 通过persisted属性判断是否存在 BF Cache
-	if(e.persisted) {
-		location.reload();
-	}
-});
-var domanUrl = "//" + window.location.host;
-var base_path = "//h5.iamberry.com/iamberry";
-//var base_path = "/iamberry";
-
-//ajax loading
-$(window).ajaxStart(function(){
-    $(".covers").show();
-});
-$(window).ajaxStop(function(){
-    $(".covers").hide();
-});
-
-mui.each(document.querySelectorAll('#footer-bar-tab .mui-tab-item'), function(index, el) {
-					el.addEventListener('tap', function() {
-						switch(index) {
-							case 0:
-								mui.openWindow({
-									url: 'index.html'
-								});
-								break;
-							case 1:
-								mui.openWindow({
-									url: 'shopping-cart.html'
-								});
-								break;
-							case 2:
-								mui.openWindow({
-									url: 'order-list.html'
-								});
-								break;
-							case 3:
-								mui.openWindow({
-									url: 'my-center.html'
-								});
-								break;	
-							default:
-								break;
-						}
-					}, false);
-				});
-
-function time_before(t){
-	var minute=1000*60;
-	var hour=minute*60;
-	var day=hour*24;
-	var halfamonth=day*15;
-	var month=day*30;
-	var now=new Date().getTime();
-	var diffValue=now-new Date().setTime(t);
-	var monthC=diffValue/month;
-	var weekC=diffValue/(7*day);
-	var dayC=diffValue/day;
-	var hourC=diffValue/hour;
-	var minC=diffValue/minute;
-	if(monthC>=1){
-		result=""+parseInt(monthC)+"月前";
-	}else if(weekC>=1){
-		result=""+parseInt(weekC)+"周前";
-	}else if(dayC>=1){
-		result=""+parseInt(dayC)+"天前";
-	}else if(hourC>=1){
-		result=""+parseInt(hourC)+"小时前";
-	}else if(minC>=2){
-		result=""+parseInt(minC)+"分钟前";
-	}else{
-		result="刚刚";
-	}
-	return result;
-};
-//封装document.getElementById
-function dc(objectid) {
-	if(document.getElementById && document.getElementById(objectid)) {
-		return document.getElementById(objectid);// w3c dom
-	} else if (document.all && document.all(objectid)) {
-		return document.all(objectid);// msie 4 dom
-	} else if (document.layers && document.layers[objectid]) {
-		return document.layers[objectid];// nn 4 dom.. note: this won't find nested layers
-	} else {
-		return false;
-	}
-};
-//生成随机字符,n长度
-function generateMixed(n) {
-	var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
-     var res = "";
-     for(var i = 0; i < n ; i ++) {
-         var id = Math.ceil(Math.random()*35);
-         res += chars[id];
-     }
-     return res;
-}
-function getParam(paramName) {
-	paramValue = "", isFound = !1;
-	if(this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
-		arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
-		while(i < arrSource.length && !isFound) {
-			arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
-		}
-	}
-	return paramValue == "" && (paramValue = null), paramValue
-};
-function getQueryString(name) { 
-var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
-var r = window.location.search.substr(1).match(reg); 
-if (r != null) return unescape(r[2]); return null; 
-} 
-// 对Date的扩展,将 Date 转化为指定格式的String   
-// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,   
-// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)   
-// 例子:   
-// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423   
-// (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18   
-Date.prototype.format = function(fmt)   
-{ //author: meizz   
-  var o = {   
-    "M+" : this.getMonth()+1,                 //月份   
-    "d+" : this.getDate(),                    //日   
-    "h+" : this.getHours(),                   //小时   
-    "m+" : this.getMinutes(),                 //分   
-    "s+" : this.getSeconds(),                 //秒   
-    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
-    "S"  : this.getMilliseconds()             //毫秒   
-  };   
-  if(/(y+)/.test(fmt))   
-    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
-  for(var k in o)   
-    if(new RegExp("("+ k +")").test(fmt))   
-  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
-  return fmt;   
-}
-//计算月份差
-function getMonthNumber(date1,date2){
-  //默认格式为"2010-01-01",根据自己需要改格式和方法
-  var d1=date1.replaceAll("-",''),d2=date2.replaceAll("-",'');
-
-  var year1 =  d1.substring(0,4);
-  var year2 =  d2.substring(0,4); 
-  var month1 = d1.substring(6,4);
-  var month2 = d2.substring(6,4);
-  var len=parseInt((year2-year1)*12+(month2-month1));
-  return len;
-}
- //替换所有要替换的文字
-String.prototype.replaceAll = function (str1,str2){
-var str = this; 
-var result = str.replace(eval("/"+str1+"/gi"),str2);
-return result;
-}
-/**
- ** 加法函数,用来得到精确的加法结果
- ** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
- ** 调用:accAdd(arg1,arg2)
- ** 返回值:arg1加上arg2的精确结果
- **/
-function accAdd(arg1, arg2) {
-    var r1, r2, m, c;
-    try {
-        r1 = arg1.toString().split(".")[1].length;
-    }
-    catch (e) {
-        r1 = 0;
-    }
-    try {
-        r2 = arg2.toString().split(".")[1].length;
-    }
-    catch (e) {
-        r2 = 0;
-    }
-    c = Math.abs(r1 - r2);
-    m = Math.pow(10, Math.max(r1, r2));
-    if (c > 0) {
-        var cm = Math.pow(10, c);
-        if (r1 > r2) {
-            arg1 = Number(arg1.toString().replace(".", ""));
-            arg2 = Number(arg2.toString().replace(".", "")) * cm;
-        } else {
-            arg1 = Number(arg1.toString().replace(".", "")) * cm;
-            arg2 = Number(arg2.toString().replace(".", ""));
-        }
-    } else {
-        arg1 = Number(arg1.toString().replace(".", ""));
-        arg2 = Number(arg2.toString().replace(".", ""));
-    }
-    return (arg1 + arg2) / m;
-}
-
-//给Number类型增加一个add方法,调用起来更加方便。
-Number.prototype.add = function (arg) {
-    return accAdd(arg, this);
-};
-
-/** 
- ** 除法函数,用来得到精确的除法结果
- ** 说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
- ** 调用:accDiv(arg1,arg2)
- ** 返回值:arg1除以arg2的精确结果
- **/
-function accDiv(arg1, arg2) {
-    var t1 = 0, t2 = 0, r1, r2;
-    try {
-        t1 = arg1.toString().split(".")[1].length;
-    }
-    catch (e) {
-    }
-    try {
-        t2 = arg2.toString().split(".")[1].length;
-    }
-    catch (e) {
-    }
-    with (Math) {
-        r1 = Number((arg1 + "").replace(".", ""));
-        r2 = Number((arg2 + "").replace(".", ""));
-        return (r1 / r2) * pow(10, t2 - t1);
-    }
-}
-//给Number类型增加一个div方法,调用起来更加方便。
-Number.prototype.div = function (arg) {
-  return accDiv(this, arg);
-};
-/**
- ** 乘法函数,用来得到精确的乘法结果
- ** 说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
- ** 调用:accMul(arg1,arg2)
- ** 返回值:arg1乘以 arg2的精确结果
- **/
-function accMul(arg1, arg2) {
-    var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
-    try {
-        m += s1.split(".")[1].length;
-    }
-    catch (e) {
-    }
-    try {
-        m += s2.split(".")[1].length;
-    }
-    catch (e) {
-    }
-    return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
-}
-// 给Number类型增加一个mul方法,调用起来更加方便。
-Number.prototype.mul = function (arg) {
-    return accMul(arg, this);
-};
-function formatDate(now)   {     
-	now = new Date(now);
-    var   year=now.getFullYear();     
-    var   month=now.getMonth()+1;
-    if(month<10){
-    	month="0"+month;
-    }
-    var   date=now.getDate();         
-    return   year+"年"+month+"月"+date+"日";     
-}
-function formatTime(msd) {  
-    var time = parseFloat(msd) /1000;  
-    if (null!= time &&""!= time) {  
-        if (time >60&& time <60*60) {  
-        	 time = parseInt(time /60.0) +"分"; 
-//          time = parseInt(time /60.0) +"分钟"+ parseInt((parseFloat(time /60.0) -  
-//          parseInt(time /60.0)) *60) +"秒";  
-        }else if (time >=60*60&& time <60*60*24) {  
-//          time = parseInt(time /3600.0) +"小时"+ parseInt((parseFloat(time /3600.0) -  
-//          parseInt(time /3600.0)) *60) +"分钟"+
-//          parseInt((parseFloat((parseFloat(time /3600.0) - parseInt(time /3600.0)) *60) -  
-//          parseInt((parseFloat(time /3600.0) - parseInt(time /3600.0)) *60)) *60) +"秒";  
-            time = parseInt(time /3600.0) +"时"+ parseInt((parseFloat(time /3600.0) -  
-            parseInt(time /3600.0)) *60) +"分"; 
-        }else {  
-            time = parseInt(time) +"分";  
-        }  
-    }else{  
-        time = "0分";  
-    }  
-    return time;  
-}
-function formatMinutes(msd) { 
-	// 参数msd (秒)
-    var time = parseFloat(msd);  
-    if (null!= time && ""!= time) {  
-        if (time >0&& time <60*60) {  
-        	 time = parseInt(time /60.0) +"分"; 
-        }else{  
-            time = parseInt(time /3600.0) +"时"+ parseInt((parseFloat(time /3600.0) -  
-            parseInt(time /3600.0)) *60) +"分"; 
-        }
-    }else{  
-        time = "0分"; 
-    }  
-    return time;  
-}
-function formatDay(now)   {     
-	now = new Date(now);    
-    var   month=now.getMonth()+1;  
-    if(month<10){
-    	month="0"+month;
-    }
-    var   date=now.getDate();
-    if(date<10){
-    	date="0"+date;
-    }
-    return month+"-"+date;     
-}
-function formatDateFull(now)   {     
-	now = new Date(now);
-    var   year=now.getFullYear();     
-    var   month=now.getMonth()+1;  
-    if(month<10){
-    	month="0"+month;
-    }
-    var   date=now.getDate();
-    if(date<10){
-    	date="0"+date;
-    }
-    return year+"-"+month+"-"+date;     
-}
-function formatDateMinute(now)   {     
-	now = new Date(now);
-    var   year=now.getFullYear();     
-    var   month=now.getMonth()+1; 
-    if(month<10){
-    	month="0"+month;
-    }
-    var   date=now.getDate();
-    if(date<10){
-    	date="0"+date;
-    }
-    var   hour=now.getHours();
-    if(hour<10){
-    	hour="0"+hour;
-    }
-    var   Minute=now.getMinutes();
-    if(Minute<10){
-    	Minute="0"+Minute;
-    }
-    return year+"-"+month+"-"+date+" "+hour+":"+Minute;     
-}
-function int_for_time(obj){
-	return obj+":00";
-}
-//替换指定传入参数的值,paramName为参数,replaceWith为新值
-function replaceParamVal(paramName,replaceWith) {
-    var oUrl = this.location.href.toString();
-    var re=eval('/('+ paramName+'=)([^&]*)/gi');
-    var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
-    window.history.pushState({},0,nUrl); 
-}
-function isEmptyObject(e) {  
-    var t;  
-    for (t in e)  
-        return !1;  
-    return !0  
-}
-function gotoTop() {
-	mui('.my-scroll-wrapper').scroll().scrollTo(0,0,500);//500毫秒滚动到顶
-	//$(".mui-scroll").css({"transform":"translate3d(0px, 0px, 0px) translateZ(0px)","transition-duration":"100ms"});
-};
-function gotoBottom(){
-	mui('.my-scroll-wrapper').scroll().scrollToBottom();//500毫秒滚动到底部
-}
-$(document).on('tap', '.icon-shouye', function() {
-	location.href="index.html";
-});
-//回到顶部
-function gotoTop(acceleration, stime) {
-	acceleration = acceleration || 0.1;
-	stime = stime || 10;
-	var x1 = 0,
-		y1 = 0,
-		x2 = 0,
-		y2 = 0,
-		x3 = 0,
-		y3 = 0;
-	if (document.documentElement) {
-		x1 = document.documentElement.scrollLeft || 0;
-		y1 = document.documentElement.scrollTop || 0;
-	}
-	if (document.body) {
-		x2 = document.body.scrollLeft || 0;
-		y2 = document.body.scrollTop || 0;
-	}
-	var x3 = window.scrollX || 0;
-	var y3 = window.scrollY || 0;
-
-	var x = Math.max(x1, Math.max(x2, x3));
-	var y = Math.max(y1, Math.max(y2, y3));
-
-	var speeding = 1 + acceleration;
-	window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding));
-
-	if (x > 0 || y > 0) {
-		var run = "gotoTop(" + acceleration + ", " + stime + ")";
-		window.setTimeout(run, stime);
-	}
+window.addEventListener('pageshow', function(e) {
+	// 通过persisted属性判断是否存在 BF Cache
+	if(e.persisted) {
+		location.reload();
+	}
+});
+var domanUrl = "//" + window.location.host;
+var base_path = "//h5.iamberry.com/iamberry";
+//var base_path = "/iamberry";
+
+//ajax loading
+$(window).ajaxStart(function(){
+    $(".covers").show();
+});
+$(window).ajaxStop(function(){
+    $(".covers").hide();
+});
+
+mui.each(document.querySelectorAll('#footer-bar-tab .mui-tab-item'), function(index, el) {
+					el.addEventListener('tap', function() {
+						switch(index) {
+							case 0:
+								mui.openWindow({
+									url: 'index.html'
+								});
+								break;
+							case 1:
+								mui.openWindow({
+									url: 'shopping-cart.html'
+								});
+								break;
+							case 2:
+								mui.openWindow({
+									url: 'order-list.html'
+								});
+								break;
+							case 3:
+								mui.openWindow({
+									url: 'my-center.html'
+								});
+								break;	
+							default:
+								break;
+						}
+					}, false);
+				});
+
+function time_before(t){
+	var minute=1000*60;
+	var hour=minute*60;
+	var day=hour*24;
+	var halfamonth=day*15;
+	var month=day*30;
+	var now=new Date().getTime();
+	var diffValue=now-new Date().setTime(t);
+	var monthC=diffValue/month;
+	var weekC=diffValue/(7*day);
+	var dayC=diffValue/day;
+	var hourC=diffValue/hour;
+	var minC=diffValue/minute;
+	if(monthC>=1){
+		result=""+parseInt(monthC)+"月前";
+	}else if(weekC>=1){
+		result=""+parseInt(weekC)+"周前";
+	}else if(dayC>=1){
+		result=""+parseInt(dayC)+"天前";
+	}else if(hourC>=1){
+		result=""+parseInt(hourC)+"小时前";
+	}else if(minC>=2){
+		result=""+parseInt(minC)+"分钟前";
+	}else{
+		result="刚刚";
+	}
+	return result;
+};
+//封装document.getElementById
+function dc(objectid) {
+	if(document.getElementById && document.getElementById(objectid)) {
+		return document.getElementById(objectid);// w3c dom
+	} else if (document.all && document.all(objectid)) {
+		return document.all(objectid);// msie 4 dom
+	} else if (document.layers && document.layers[objectid]) {
+		return document.layers[objectid];// nn 4 dom.. note: this won't find nested layers
+	} else {
+		return false;
+	}
+};
+//生成随机字符,n长度
+function generateMixed(n) {
+	var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
+     var res = "";
+     for(var i = 0; i < n ; i ++) {
+         var id = Math.ceil(Math.random()*35);
+         res += chars[id];
+     }
+     return res;
+}
+var jsUrlHelper = {
+    getUrlParam : function(url, ref) {
+        var str = "";
+
+        // 如果不包括此参数
+        if (url.indexOf(ref) == -1)
+            return null;
+
+        str = url.substr(url.indexOf('?') + 1);
+
+        arr = str.split('&');
+        for (i in arr) {
+            var paired = arr[i].split('=');
+
+            if (paired[0] == ref) {
+                return paired[1];
+            }
+        }
+
+        return null;
+    },
+    putUrlParam : function(url, ref, value) {
+
+        // 如果没有参数
+        if (url.indexOf('?') == -1)
+            return url + "?" + ref + "=" + value;
+
+        // 如果不包括此参数
+        if (url.indexOf(ref) == -1)
+            return url + "&" + ref + "=" + value;
+
+        var arr_url = url.split('?');
+
+        var base = arr_url[0];
+
+        var arr_param = arr_url[1].split('&');
+
+        for (i = 0; i < arr_param.length; i++) {
+
+            var paired = arr_param[i].split('=');
+
+            if (paired[0] == ref) {
+                paired[1] = value;
+                arr_param[i] = paired.join('=');
+                break;
+            }
+        }
+
+        return base + "?" + arr_param.join('&');
+    },
+    delUrlParam : function(url, ref) {
+
+        // 如果不包括此参数
+        if (url.indexOf(ref) == -1)
+            return url;
+
+        var arr_url = url.split('?');
+
+        var base = arr_url[0];
+
+        var arr_param = arr_url[1].split('&');
+
+        var index = -1;
+
+        for (i = 0; i < arr_param.length; i++) {
+
+            var paired = arr_param[i].split('=');
+
+            if (paired[0] == ref) {
+
+                index = i;
+                break;
+            }
+        }
+
+        if (index == -1) {
+            return url;
+        } else {
+            arr_param.splice(index, 1);
+            return base + "?" + arr_param.join('&');
+        }
+    }
+};
+//获取url参数
+function getParam(paramName) {
+	paramValue = "", isFound = !1;
+	if(this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
+		arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
+		while(i < arrSource.length && !isFound) {
+			arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
+		}
+	}
+	return paramValue == "" && (paramValue = null), paramValue
+};
+//回去url参数
+function getQueryString(name) { 
+var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
+var r = window.location.search.substr(1).match(reg); 
+if (r != null) return unescape(r[2]); return null; 
+} 
+// 对Date的扩展,将 Date 转化为指定格式的String   
+// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,   
+// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)   
+// 例子:   
+// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423   
+// (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18   
+Date.prototype.format = function(fmt)   
+{ //author: meizz   
+  var o = {   
+    "M+" : this.getMonth()+1,                 //月份   
+    "d+" : this.getDate(),                    //日   
+    "h+" : this.getHours(),                   //小时   
+    "m+" : this.getMinutes(),                 //分   
+    "s+" : this.getSeconds(),                 //秒   
+    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
+    "S"  : this.getMilliseconds()             //毫秒   
+  };   
+  if(/(y+)/.test(fmt))   
+    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
+  for(var k in o)   
+    if(new RegExp("("+ k +")").test(fmt))   
+  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
+  return fmt;   
+}
+//计算月份差
+function getMonthNumber(date1,date2){
+  //默认格式为"2010-01-01",根据自己需要改格式和方法
+  var d1=date1.replaceAll("-",''),d2=date2.replaceAll("-",'');
+
+  var year1 =  d1.substring(0,4);
+  var year2 =  d2.substring(0,4); 
+  var month1 = d1.substring(6,4);
+  var month2 = d2.substring(6,4);
+  var len=parseInt((year2-year1)*12+(month2-month1));
+  return len;
+}
+ //替换所有要替换的文字
+String.prototype.replaceAll = function (str1,str2){
+var str = this; 
+var result = str.replace(eval("/"+str1+"/gi"),str2);
+return result;
+}
+/**
+ ** 加法函数,用来得到精确的加法结果
+ ** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
+ ** 调用:accAdd(arg1,arg2)
+ ** 返回值:arg1加上arg2的精确结果
+ **/
+function accAdd(arg1, arg2) {
+    var r1, r2, m, c;
+    try {
+        r1 = arg1.toString().split(".")[1].length;
+    }
+    catch (e) {
+        r1 = 0;
+    }
+    try {
+        r2 = arg2.toString().split(".")[1].length;
+    }
+    catch (e) {
+        r2 = 0;
+    }
+    c = Math.abs(r1 - r2);
+    m = Math.pow(10, Math.max(r1, r2));
+    if (c > 0) {
+        var cm = Math.pow(10, c);
+        if (r1 > r2) {
+            arg1 = Number(arg1.toString().replace(".", ""));
+            arg2 = Number(arg2.toString().replace(".", "")) * cm;
+        } else {
+            arg1 = Number(arg1.toString().replace(".", "")) * cm;
+            arg2 = Number(arg2.toString().replace(".", ""));
+        }
+    } else {
+        arg1 = Number(arg1.toString().replace(".", ""));
+        arg2 = Number(arg2.toString().replace(".", ""));
+    }
+    return (arg1 + arg2) / m;
+}
+
+//给Number类型增加一个add方法,调用起来更加方便。
+Number.prototype.add = function (arg) {
+    return accAdd(arg, this);
+};
+
+/** 
+ ** 除法函数,用来得到精确的除法结果
+ ** 说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
+ ** 调用:accDiv(arg1,arg2)
+ ** 返回值:arg1除以arg2的精确结果
+ **/
+function accDiv(arg1, arg2) {
+    var t1 = 0, t2 = 0, r1, r2;
+    try {
+        t1 = arg1.toString().split(".")[1].length;
+    }
+    catch (e) {
+    }
+    try {
+        t2 = arg2.toString().split(".")[1].length;
+    }
+    catch (e) {
+    }
+    with (Math) {
+        r1 = Number((arg1 + "").replace(".", ""));
+        r2 = Number((arg2 + "").replace(".", ""));
+        return (r1 / r2) * pow(10, t2 - t1);
+    }
+}
+//给Number类型增加一个div方法,调用起来更加方便。
+Number.prototype.div = function (arg) {
+  return accDiv(this, arg);
+};
+/**
+ ** 乘法函数,用来得到精确的乘法结果
+ ** 说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
+ ** 调用:accMul(arg1,arg2)
+ ** 返回值:arg1乘以 arg2的精确结果
+ **/
+function accMul(arg1, arg2) {
+    var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
+    try {
+        m += s1.split(".")[1].length;
+    }
+    catch (e) {
+    }
+    try {
+        m += s2.split(".")[1].length;
+    }
+    catch (e) {
+    }
+    return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
+}
+// 给Number类型增加一个mul方法,调用起来更加方便。
+Number.prototype.mul = function (arg) {
+    return accMul(arg, this);
+};
+function formatDate(now)   {     
+	now = new Date(now);
+    var   year=now.getFullYear();     
+    var   month=now.getMonth()+1;
+    if(month<10){
+    	month="0"+month;
+    }
+    var   date=now.getDate();         
+    return   year+"年"+month+"月"+date+"日";     
+}
+function formatTime(msd) {  
+    var time = parseFloat(msd) /1000;  
+    if (null!= time &&""!= time) {  
+        if (time >60&& time <60*60) {  
+        	 time = parseInt(time /60.0) +"分"; 
+//          time = parseInt(time /60.0) +"分钟"+ parseInt((parseFloat(time /60.0) -  
+//          parseInt(time /60.0)) *60) +"秒";  
+        }else if (time >=60*60&& time <60*60*24) {  
+//          time = parseInt(time /3600.0) +"小时"+ parseInt((parseFloat(time /3600.0) -  
+//          parseInt(time /3600.0)) *60) +"分钟"+
+//          parseInt((parseFloat((parseFloat(time /3600.0) - parseInt(time /3600.0)) *60) -  
+//          parseInt((parseFloat(time /3600.0) - parseInt(time /3600.0)) *60)) *60) +"秒";  
+            time = parseInt(time /3600.0) +"时"+ parseInt((parseFloat(time /3600.0) -  
+            parseInt(time /3600.0)) *60) +"分"; 
+        }else {  
+            time = parseInt(time) +"分";  
+        }  
+    }else{  
+        time = "0分";  
+    }  
+    return time;  
+}
+function formatMinutes(msd) { 
+	// 参数msd (秒)
+    var time = parseFloat(msd);  
+    if (null!= time && ""!= time) {  
+        if (time >0&& time <60*60) {  
+        	 time = parseInt(time /60.0) +"分"; 
+        }else{  
+            time = parseInt(time /3600.0) +"时"+ parseInt((parseFloat(time /3600.0) -  
+            parseInt(time /3600.0)) *60) +"分"; 
+        }
+    }else{  
+        time = "0分"; 
+    }  
+    return time;  
+}
+function formatDay(now)   {     
+	now = new Date(now);    
+    var   month=now.getMonth()+1;  
+    if(month<10){
+    	month="0"+month;
+    }
+    var   date=now.getDate();
+    if(date<10){
+    	date="0"+date;
+    }
+    return month+"-"+date;     
+}
+function formatDateFull(now)   {     
+	now = new Date(now);
+    var   year=now.getFullYear();     
+    var   month=now.getMonth()+1;  
+    if(month<10){
+    	month="0"+month;
+    }
+    var   date=now.getDate();
+    if(date<10){
+    	date="0"+date;
+    }
+    return year+"-"+month+"-"+date;     
+}
+function formatDateMinute(now)   {     
+	now = new Date(now);
+    var   year=now.getFullYear();     
+    var   month=now.getMonth()+1; 
+    if(month<10){
+    	month="0"+month;
+    }
+    var   date=now.getDate();
+    if(date<10){
+    	date="0"+date;
+    }
+    var   hour=now.getHours();
+    if(hour<10){
+    	hour="0"+hour;
+    }
+    var   Minute=now.getMinutes();
+    if(Minute<10){
+    	Minute="0"+Minute;
+    }
+    return year+"-"+month+"-"+date+" "+hour+":"+Minute;     
+}
+function int_for_time(obj){
+	return obj+":00";
+}
+//替换指定传入参数的值,paramName为参数,replaceWith为新值
+function replaceParamVal(paramName,replaceWith) {
+    var oUrl = this.location.href.toString();
+    var re=eval('/('+ paramName+'=)([^&]*)/gi');
+    var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
+    window.history.pushState({},0,nUrl); 
+}
+function isEmptyObject(e) {  
+    var t;  
+    for (t in e)  
+        return !1;  
+    return !0  
+}
+function gotoTop() {
+	mui('.my-scroll-wrapper').scroll().scrollTo(0,0,500);//500毫秒滚动到顶
+	//$(".mui-scroll").css({"transform":"translate3d(0px, 0px, 0px) translateZ(0px)","transition-duration":"100ms"});
+};
+function gotoBottom(){
+	mui('.my-scroll-wrapper').scroll().scrollToBottom();//500毫秒滚动到底部
+}
+$(document).on('tap', '.icon-shouye', function() {
+	location.href="index.html";
+});
+//回到顶部
+function gotoTop(acceleration, stime) {
+	acceleration = acceleration || 0.1;
+	stime = stime || 10;
+	var x1 = 0,
+		y1 = 0,
+		x2 = 0,
+		y2 = 0,
+		x3 = 0,
+		y3 = 0;
+	if (document.documentElement) {
+		x1 = document.documentElement.scrollLeft || 0;
+		y1 = document.documentElement.scrollTop || 0;
+	}
+	if (document.body) {
+		x2 = document.body.scrollLeft || 0;
+		y2 = document.body.scrollTop || 0;
+	}
+	var x3 = window.scrollX || 0;
+	var y3 = window.scrollY || 0;
+
+	var x = Math.max(x1, Math.max(x2, x3));
+	var y = Math.max(y1, Math.max(y2, y3));
+
+	var speeding = 1 + acceleration;
+	window.scrollTo(Math.floor(x / speeding), Math.floor(y / speeding));
+
+	if (x > 0 || y > 0) {
+		var run = "gotoTop(" + acceleration + ", " + stime + ")";
+		window.setTimeout(run, stime);
+	}
 }

+ 5 - 5
aiberle/my-center.html

@@ -21,7 +21,7 @@
 
 	<body>
 		<footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
-			<a class="mui-tab-item ">
+			<a class="mui-tab-item">
 				<span class="iconfont icon-shouye"></span>
 				<span class="mui-tab-label">首页</span>
 			</a>
@@ -56,10 +56,10 @@
 						</div>
 						券包
 					</a>
-					<a class="mui-control-item">
+					<!--<a class="mui-control-item">
 						<div class="iconfont icon-zhibaoqia"></div>
 						质保卡
-					</a>
+					</a>-->
 					<a class="mui-control-item" href="order-list.html">
 						<div class="iconfont icon-dingdan"></div>
 						订单
@@ -107,7 +107,7 @@
 						</div>
 					</div>
 				</li>
-				<li class="mui-table-view-cell" href="understanding-brands.html">
+				<!--<li class="mui-table-view-cell" href="understanding-brands.html">
 					<div class="mui-table">
 						<div class="mui-table-cell mui-col-xs-5">
 							<span class="iconfont icon-dansheng"></span>Aiberle诞生
@@ -136,7 +136,7 @@
 							<span class="mui-icon mui-icon-arrowright"></span>
 						</div>
 					</div>
-				</li>
+				</li>-->
 			</ul>
 			<br />
 		</div>

Файловите разлики са ограничени, защото са твърде много
+ 484 - 456
aiberle/pro-list.html