| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 | 
							- <!DOCTYPE html>
 
- <html>
 
- 	<head>
 
- 		<meta charset="UTF-8">
 
- 		<title>我的券包</title>
 
- 		<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">
 
- 		<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">
 
- 			// 屏蔽分享
 
- 			window.hiddenAllWechatMenu = true;
 
- 		</script>
 
- 	</head>
 
- 	<body>
 
- 		<!--下拉刷新容器-->
 
- 		<div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper">
 
- 			<div class="mui-scroll">
 
- 				<!--现金券列表-->
 
- 				<ul class="my-yhq-list">
 
- 				</ul>
 
- 			</div>
 
- 		</div>
 
- 		<script type="text/javascript" src="js/mui.min.js"></script>
 
- 		<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
 
- 		<script type="text/javascript" src="js/main.js"></script>
 
- 		<script type="text/javascript" src="js/wechat-utils-1.0.js"></script>
 
- 		<script>
 
- 			window.addEventListener('pageshow', function(e) {
 
- 				// 通过persisted属性判断是否存在 BF Cache
 
- 				if(e.persisted) {
 
- 					location.reload();
 
- 				}
 
- 			});
 
- 			var pageNumber = 0,
 
- 				pagesize = 10;
 
- 			mui.init({
 
- 				pullRefresh: {
 
- 					container: '#pullrefresh_yhq_list',
 
- 					down: {
 
- 						//callback: pulldownRefresh
 
- 					},
 
- 					up: {
 
- 						contentrefresh: '正在加载...',
 
- 						callback: pullupRefresh
 
- 					}
 
- 				}
 
- 			});
 
- 			/**
 
- 			 * 上拉加载具体业务实现
 
- 			 */
 
- 			function pullupRefresh() {
 
- 				++pageNumber; //每次上拉页数+1
 
- 				$.ajax(base_path + '/wechat/coupon/couponItemList?dates=' + new Date().getTime(), {
 
- 					data: {
 
- 						"pageNo": pageNumber, //pageNo第几页
 
- 						"pageSize": pagesize //pageSize每页条数
 
- 					},
 
- 					dataType: 'json',
 
- 					xhrFields: {
 
- 						withCredentials: true
 
- 					},
 
- 					crossDomain: true,
 
- 					type: 'get',
 
- 					timeout: 15000,
 
- 					success: function(dt) {
 
- 						if(dt.isRedirect) {
 
- 							location.href = dt.redirectURL;
 
- 						} else {
 
- 							console.log(dt)
 
- 							if(dt.status) { //判断接口返回状态status
 
- 								var table = document.body.querySelector('.my-yhq-list');
 
- 								var data = dt.data.itemList;
 
- 								mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh(dt.data.itemList.length < pagesize); //endPullupToRefresh(ture)表示没有更多数据了,停止上拉加载
 
- 								mui.each(data, function(index) {
 
- 									var li = document.createElement('li'); //创建li标签
 
- 									var src = 'images/yhq-1.png';
 
- 									if(new Date(this.couponUseEndDate) >= new Date) {
 
- 										li.className = 'my-yhq-cell';
 
- 									} else {
 
- 										li.className = 'my-yhq-cell active';
 
- 										src = 'images/yhq-2.png';
 
- 									}
 
- 									var couponReduceHtml = '';
 
- 									if(this.couponType == 1) { //减免金额
 
- 										couponReduceHtml += '<span>' + (this.couponReduce / 100).toFixed(0) + '</span>元';
 
- 									} else if(this.couponType == 2) { //减免率
 
- 										couponReduceHtml += '<span>' + (this.couponReduce / 100).toFixed(1) + '</span>折';
 
- 									}
 
- 									li.innerHTML = '<img width="100%" src="' + src + '" /><div class="fixed-box"><div class="table"><div class="left-cell"><span class="tit">' + this.couponName + '</span><p class="time">使用条件:满' + (this.couponConsumeEnough / 100).toFixed(0) + '元可用</p><span class="condition">有效期至:' + this.couponUseEndDate + '</span></div><div class="right-cell"><div class="money">' + couponReduceHtml + '</div></div></div></div';
 
- 									table.appendChild(li);
 
- 								});
 
- 							} else {
 
- 								mui.alert("获取现金券列表失败!");
 
- 							}
 
- 						}
 
- 					},
 
- 					error: function(xhr, type, errorThrown) {
 
- 						console.log(xhr);
 
- 						mui.alert("获取现金券列表失败!网络错误");
 
- 					}
 
- 				});
 
- 			}
 
- 			mui.ready(function() {
 
- 				mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading(); //首次加载
 
- 			});
 
- 		</script>
 
- 	</body>
 
- </html>
 
 
  |