coupon_list.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>优惠券</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
  10. <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="css/main.css" />
  12. <style>
  13. .mui-content{background-color: #f1f1f1;}
  14. .my-yhq-list{background-color:#f1f1f1;padding:0 15px;}
  15. .my-yhq-list:before,.my-yhq-list:after{display: none;}
  16. .my-yhq-list .my-yhq-cell{margin: 15px 0;position: relative;}
  17. .my-yhq-list .my-yhq-cell:last-child{margin-bottom: 0;}
  18. .my-yhq-list .fixed-box{position: absolute;left: 0;top: 0;width: 100%;height: 100%;}
  19. .my-yhq-list .table{display: table;height: 100%;width: 100%;}
  20. .my-yhq-list .left-cell{display: table-cell;width: 69%;height: 100%;padding: 10px;}
  21. .my-yhq-list .right-cell{display: table-cell;width: 31%;height: 100%;text-align: center;vertical-align: middle;}
  22. .my-yhq-list .left-cell .tit{font-size: 20px;color: #f44f80;}
  23. .my-yhq-list .left-cell .time{color: #f44f80;font-size: 12px;}
  24. .my-yhq-list .left-cell .condition{position: absolute;left: 10px;bottom: 15px;font-size: 12px;color: #807f80;}
  25. .my-yhq-list .right-cell .money{color: #333;margin: 5px 0;}
  26. .my-yhq-list .right-cell .money>span{font-size: 35px;}
  27. .my-yhq-list .right-cell .my-btn{color: #fff;padding:8px 10px;font-size: 14px;border-radius: 5px;}
  28. .my-yhq-list .right-cell .my-btn:active{background-color: rgba(0,0,0,.5);}
  29. .grayscale{color: #807f80 !important;}
  30. .my-yhq-list .right-cell .my-btn.grayscale{opacity: 0;}
  31. .mui-table-view-chevron .mui-table-view-cell {padding-right: 15px;}
  32. .mui-segmented-control .mui-control-item.mui-active{background-color: transparent !important;border-bottom: 2px solid #fa4b4f !important;}
  33. .mui-segmented-control .mui-control-item{line-height: 1;height: 50px;vertical-align: bottom;border: 0;border-bottom: 2px solid transparent;color: #444;background-color: transparent !important;padding-bottom: 3px;}
  34. .tab-yhq-list{background: #fff;border: 0;position: fixed;left: 0;top: 0;width: 100%;z-index: 10;}
  35. .tab-yhq-list .mui-control-item{position: relative;}
  36. .mui-control-item.mui-active .mui-tab-label{color: #f44f80;}
  37. .tab-yhq-list .mui-control-item{color: #a1a1a1;}
  38. .mui-control-content{margin-top: 70px;}
  39. .tab-yhq-list .mui-control-item.mui-active {color: #f44f80 !important;border-bottom: 2px solid #f44f80;}
  40. .icon-all>span:first-child {background: url(images/all_icon.png) center bottom no-repeat;min-width: 28px;min-height: 25px;background-size: 100%;position: absolute;top: 2px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  41. .icon-all.mui-active>span:first-child {background: url(images/all1_icon.png) center bottom no-repeat;background-size: 100%;}
  42. .icon-noused>span:first-child {background: url(images/noused_icon.png) center bottom no-repeat;min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 2px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  43. .icon-noused.mui-active>span:first-child {background: url(images/noused1_icon.png) center bottom no-repeat;background-size: 100%;}
  44. .icon-used>span:first-child {background: url(images/used_icon.png) center bottom no-repeat;min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 2px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  45. .icon-used.mui-active>span:first-child {background: url(images/used1_icon.png) center bottom no-repeat;background-size: 100%;}
  46. .icon-overdue>span:first-child {background: url(images/overdue_icon.png) center bottom no-repeat;min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 2px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  47. .icon-overdue.mui-active>span:first-child {background: url(images/overdue1_icon.png) center bottom no-repeat;background-size: 100%;}
  48. .mui-popup.mui-popup-in{height: 360px;background: url(images/yhq_dlg_bg.png) center top /100% no-repeat;}
  49. .mui-popup-inner{background-color: transparent;margin-top: 80px;padding: 15px 15px 5px 15px;position: static;}
  50. .mui-popup-title{font-size: 16px;color: #939393;}
  51. .mui-popup-title+.mui-popup-text{margin-top: 15px;}
  52. .mui-popup-text strong{color: #fc5b8b;}
  53. .mui-popup-text span{color: #fc5b8b;font-size: 35px;}
  54. .mui-popup-button{background-color: transparent;}
  55. .mui-popup-button:after,.mui-popup-inner:after{display: none;}
  56. .mui-popup-button:first-child{border-radius: 25px;background: #f44f80;height: 38px;line-height: 40px;font-weight: 100;color: #fff;width: 50%;margin: 10px auto;}
  57. .mui-popup-button:first-child:active{background: #fc5b8b;}
  58. .mui-popup-button:last-child{border-radius: 25px;background: #dcdcdc;height: 38px;line-height: 40px;font-weight: 100;color: #fff;width: 50%;margin: 10px auto;}
  59. .mui-popup-button:last-child:active{background: #c9c9c9;}
  60. .mui-popup-buttons{display: block;}
  61. .x-close{position: absolute;right:32px;top: 0;width:20px;}
  62. .mui-popup.mui-popup-out{-webkit-transition-duration: 0ms;transition-duration: 0ms;}
  63. .mui-scroll-wrapper{top:0;bottom:50px;}
  64. </style>
  65. <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  66. <script>
  67. //屏蔽分享
  68. document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  69. WeixinJSBridge.call('hideOptionMenu');
  70. });
  71. </script>
  72. </head>
  73. <body>
  74. <div class="loading-bg">
  75. <div class="mui-loading">
  76. <div class="mui-spinner">
  77. </div>
  78. &nbsp;&nbsp;加载中...
  79. </div>
  80. </div>
  81. <footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
  82. <a class="mui-tab-item mui-active">
  83. <span class="iconfont icon-shouye"></span>
  84. <span class="mui-tab-label">首页</span>
  85. </a>
  86. <a class="mui-tab-item">
  87. <span class="iconfont icon-gouwuche"></span>
  88. <span class="mui-tab-label">购物车</span>
  89. </a>
  90. <a class="mui-tab-item">
  91. <span class="iconfont icon-dingdan"></span>
  92. <span class="mui-tab-label">订单</span>
  93. </a>
  94. <a class="mui-tab-item">
  95. <span class="iconfont icon-wode"></span>
  96. <span class="mui-tab-label">我的</span>
  97. </a>
  98. </footer>
  99. <div class="mui-content">
  100. <!--下拉刷新容器-->
  101. <div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper">
  102. <div class="mui-scroll">
  103. <!--数据列表-->
  104. <ul class="my-yhq-list">
  105. </ul>
  106. </div>
  107. </div>
  108. </div>
  109. <script type="text/javascript" src="js/mui.min.js"></script>
  110. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  111. <script type="text/javascript" src="js/main.js"></script>
  112. <script>
  113. var tabindex = 1,pageNumber = 0,pagesize = 10;
  114. var tabindex=$('.tab-yhq-list .mui-active').prop('tabindex');
  115. var count = 0;
  116. /**
  117. * 上拉加载具体业务实现
  118. */
  119. function pullupRefresh() {
  120. ++pageNumber;
  121. $.ajax( base_path + '/wechat/coupon/couponItemList?dates=' + new Date().getTime(),{
  122. data :{
  123. pageNO : pageNumber
  124. },
  125. dataType:'json',
  126. type:'post',
  127. xhrFields: {
  128. withCredentials: true
  129. },
  130. crossDomain: true,
  131. timeout:15000,
  132. success:function(dt){
  133. if(dt.isRedirect) {
  134. location.href = dt.redirectURL;
  135. } else {
  136. var data = dt.data.itemList;
  137. mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
  138. var table = document.body.querySelector('.my-yhq-list');
  139. mui(data).each(function(index) {
  140. var li = document.createElement('li');
  141. var src = 'images/yhq-1.png';
  142. if(new Date(this.couponUseEndDate) >= new Date){
  143. li.className = 'my-yhq-cell';
  144. }else{
  145. li.className = 'my-yhq-cell active';
  146. src = 'images/yhq-2.png';
  147. }
  148. var couponReduceHtml = '';
  149. var couponReduceTypeHtml = '';
  150. if(this.couponType == 1){ //减免金额
  151. couponReduceHtml += this.couponReduce/100;
  152. couponReduceTypeHtml = '¥'
  153. }else if(this.couponType == 2){ //减免率
  154. couponReduceHtml += this.couponReduce/100 + "折" ;
  155. couponReduceTypeHtml = '';
  156. }
  157. 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.couponUseEndDate +'</p><span class="condition">无使用限制条件</span></div><div class="right-cell"><div class="money"><strong>'+ couponReduceTypeHtml +'</strong><span>'+ couponReduceHtml +'</span></div><span class="my-btn"></span></div></div></div';
  158. //li.innerHTML = '<img width="100%" src="images/yhq_overdue_bg.png" /><div class="fixed-box grayscale"><div class="table"><div class="left-cell"><span class="tit grayscale">优惠券</span><p class="time grayscale">有效期至2016年12月12日</p><span class="condition">无使用限制条件</span></div><div class="right-cell"><div class="money grayscale"><strong>¥</strong><span>50</span></div><span class="my-btn grayscale">立即领取</span></div></div></div>';
  159. table.appendChild(li);
  160. });
  161. mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh(false);
  162. }
  163. },
  164. error:function(xhr,type,errorThrown){
  165. //异常处理;
  166. console.log(xhr);
  167. }
  168. });
  169. }
  170. mui.ready(function() {
  171. mui.init({
  172. pullRefresh: {
  173. container: '#pullrefresh_yhq_list',
  174. down: {
  175. },
  176. up: {
  177. contentrefresh: '正在加载...',
  178. callback: pullupRefresh
  179. }
  180. }
  181. });
  182. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  183. console.log("页面加载完毕")
  184. document.querySelector('.loading-bg').style.display = 'none';
  185. });
  186. </script>
  187. </body>
  188. </html>