coupon_bag.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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?v=2018111001" />
  10. <link rel="stylesheet" type="text/css" href="css/iconfont.css?v=2018111001" />
  11. <link rel="stylesheet" type="text/css" href="css/style.css?v=2018111001" />
  12. <style>
  13. .my-yhq-list{background-color: transparent;padding:0 15px;}
  14. .my-yhq-list:before,.my-yhq-list:after{display: none;}
  15. .my-yhq-list .my-yhq-cell{margin: 13px 0;position: relative;}
  16. .my-yhq-list .my-yhq-cell:last-child{margin-bottom: 0;}
  17. .my-yhq-list .fixed-box{position: absolute;left: 0;top: 0;width: 100%;height: 100%;}
  18. .my-yhq-list .table{display: table;height: 100%;width: 100%;}
  19. .my-yhq-list .left-cell{display: table-cell;width: 69%;height: 100%;padding: 10px;}
  20. .my-yhq-list .right-cell{display: table-cell;width: 31%;height: 100%;text-align: center;vertical-align: middle;}
  21. .my-yhq-list .left-cell .tit{font-size: 20px;color: #61c6e5;}
  22. .my-yhq-list .left-cell .time{font-size: 12px;}
  23. .my-yhq-list .left-cell .condition{position: absolute;left: 10px;bottom: 15px;font-size: 12px;color: #807f80;}
  24. .my-yhq-list .right-cell .money{color: #fff;margin: 5px 0;}
  25. .my-yhq-list .right-cell .money>span{font-size: 25px;}
  26. .my-yhq-list .right-cell .my-btn{color: #fff;padding:8px 10px;font-size: 14px;border-radius: 5px;}
  27. .my-yhq-list .right-cell .my-btn:active{background-color: rgba(0,0,0,.5);}
  28. .grayscale{color: #807f80 !important;}
  29. .my-yhq-list .right-cell .my-btn.grayscale{opacity: 0;}
  30. .mui-table-view-chevron .mui-table-view-cell {padding-right: 15px;}
  31. .mui-segmented-control .mui-control-item.mui-active{background-color: transparent !important;border-bottom: 2px solid #1cc9f4 !important;}
  32. .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;}
  33. .tab-yhq-list{background: #fff;border: 0;position: fixed;left: 0;top: 0;width: 100%;z-index: 10;}
  34. .tab-yhq-list .mui-control-item{position: relative;}
  35. .mui-control-item.mui-active .mui-tab-label{color: #1cc9f4;}
  36. .tab-yhq-list .mui-control-item{color: #a1a1a1;}
  37. .mui-control-content{margin-top: 70px;}
  38. .tab-yhq-list .mui-control-item.mui-active {color: #1cc9f4 !important;border-bottom: 2px solid #1cc9f4;}
  39. .icon-all>span:first-child {min-width: 28px;min-height: 25px;background-size: 100%;position: absolute;top: 4px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  40. .icon-all.mui-active>span:first-child {}
  41. .icon-noused>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 4px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  42. .icon-noused.mui-active>span:first-child {}
  43. .icon-used>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 4px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  44. .icon-used.mui-active>span:first-child {}
  45. .icon-overdue>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 4px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  46. .icon-overdue.mui-active>span:first-child {}
  47. .mui-scroll-wrapper{top: 50px;bottom:100px;}
  48. .middle-center{display: table-cell;text-align: center;vertical-align: middle;color: #fff;}
  49. .right-bottom{position: absolute;right: 15px;bottom: 15px;color: #fff;}
  50. .coupon-href{text-align: center;width: 120px;margin: 0 auto;position: fixed;bottom: 80px;left: 50%;margin-left: -60px; text-decoration: underline;font-size: 12px;color: #666;}
  51. </style>
  52. <script type="text/javascript">
  53. // 屏蔽分享
  54. window.hiddenAllWechatMenu = true;
  55. </script>
  56. </head>
  57. <body>
  58. <div class="loading-bg">
  59. <div class="mui-loading">
  60. <div class="mui-spinner">
  61. </div>
  62. &nbsp;&nbsp;加载中...
  63. </div>
  64. </div>
  65. <nav class="mui-bar mui-bar-tab" id="footer-bar">
  66. <a class="mui-tab-item" >
  67. <div class="iconfont icon-home"></div>
  68. <span class="mui-tab-label">首页</span>
  69. </a>
  70. <a class="mui-tab-item">
  71. <div class="iconfont icon-gouwuche"><span class="mui-badge">0</span></div>
  72. <span class="mui-tab-label">购物车</span>
  73. </a>
  74. <a class="mui-tab-item">
  75. <div class="iconfont icon-dingdan"></div>
  76. <span class="mui-tab-label">我的订单</span>
  77. </a>
  78. <a class="mui-tab-item mui-active">
  79. <div class="iconfont icon-vip"></div>
  80. <span class="mui-tab-label">会员中心</span>
  81. </a>
  82. </nav>
  83. <div class="mui-content" >
  84. <div class="mui-segmented-control tab-yhq-list">
  85. <a class="mui-control-item icon-all " tabindex="10" href="#item1mobile">
  86. <span class="iconfont icon-youhuiquan"></span>
  87. <span class="mui-tab-label">优惠券</span>
  88. </a>
  89. <a class="mui-control-item icon-noused mui-active" tabindex="11" href="#item2mobile">
  90. <span class="iconfont icon-tiququan"></span>
  91. <span class="mui-tab-label">兑换券</span>
  92. </a>
  93. </div>
  94. <!--下拉刷新容器-->
  95. <div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper">
  96. <div class="mui-scroll">
  97. <!--数据列表-->
  98. <ul class="my-yhq-list">
  99. </ul>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="coupon-href">兑换券使用流程</div>
  104. <script type="text/javascript" src="js/mui.min.js"></script>
  105. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  106. <script type="text/javascript" src="js/main.js"></script>
  107. <script>
  108. var tabindex=10,pageNumber=0,pagesize=10;
  109. var tabindex=$('.tab-yhq-list .mui-active').prop('tabindex');
  110. mui.init({
  111. pullRefresh: {
  112. container: '#pullrefresh_yhq_list',
  113. down: {
  114. //callback: pulldownRefresh
  115. },
  116. up: {
  117. contentrefresh: '正在加载...',
  118. contentnomore:'没有更多数据了!',
  119. callback: pullupRefresh
  120. }
  121. }
  122. });
  123. /**
  124. * 上拉加载具体业务实现
  125. */
  126. function pullupRefresh() {
  127. ++pageNumber;
  128. var btnArray = ['否', '是'];
  129. var src='',coupon_name='优惠券';
  130. if(tabindex==10){
  131. src=base_path+'/coupon/couponItemList?useStatus=10';
  132. }else{
  133. coupon_name='兑换券<span class="mui-h6">(可换T1或t2滤芯一支)</span>';
  134. src=base_path+'/coupon/couponItemList?useStatus=11';
  135. }
  136. $.ajax(src, {
  137. data: {},
  138. dataType: 'json',
  139. type: 'post',
  140. timeout: 15000,
  141. xhrFields: {
  142. withCredentials: true
  143. },
  144. crossDomain: true,
  145. success: function(dt) {
  146. if(dt.isRedirect){
  147. location.href = dt.redirectURL;
  148. }else{
  149. if(dt.status) {
  150. console.log(dt)
  151. var coupon_data = [];
  152. coupon_data = dt.data.itemList;
  153. mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh(coupon_data.length < pagesize);
  154. var table = document.body.querySelector('.my-yhq-list');
  155. mui(coupon_data).each(function(index) {
  156. var li = document.createElement('li');
  157. li.className = 'my-yhq-cell';
  158. var sa='未使用',src='images/bg_quan_02.jpg';
  159. if(tabindex==10){
  160. var ptrice;
  161. if(this.couponType == 1) { ptrice = accDiv(this.couponReduce, 100) + '元' } else { ptrice = "-" + (100 - this.couponReduce) + "%" }
  162. if(this.couponUseStatus == 1 && this.couponItemRemark == "normal") {
  163. li.innerHTML = '<img width="100%" src="images/yhq_used_bg.png" /><div class="fixed-box"><div class="table go_web_shop"><div class="left-cell"><span class="tit">' + this.couponName + '</span><p class="time">有效期至' + this.couponUseEndDate + '</p><span class="condition">满' + accDiv(this.couponConsumeEnough, 100) + '元可使用</span></div><div class="right-cell"><div class="money"><span>' + ptrice + '</span></div><span class="my-btn">立即使用</span></div></div></div'
  164. } else {
  165. 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">' + this.couponName + '</span><p class="time grayscale">有效期至' + this.couponUseEndDate + '</p><span class="condition">满' + accDiv(this.couponConsumeEnough, 100) + '元可使用</span></div><div class="right-cell"><div class="money grayscale"><span>' + ptrice + '</span></div><span class="my-btn grayscale">立即领取</span></div></div></div>'
  166. }
  167. }else if(tabindex==11){
  168. if(this.pledgeStatus=='2'){
  169. sa='已使用'
  170. src='//s.iamberry.com/watero/images/shop/bg_quan_01.jpg';
  171. }
  172. if(this.couponUseStatus == 1 && this.couponItemRemark == "normal") {
  173. console.log(this.couponUseEndDate)
  174. li.innerHTML = '<img width="100%" src="images/yhq_used_bg.png" /><div class="fixed-box"><div class="table go_web_shop"><div class="left-cell"><span class="tit">' + coupon_name + '</span><p class="time">有效期至' + this.couponUseEndDate + '</p><span class="condition">与其他产品一起下单时方可使用</span></div><div class="right-cell"><div class="money"><span>'+this.exchange.exchangeName+'</span></div><span class="my-btn">立即使用</span></div></div></div'
  175. } else {
  176. 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">' + coupon_name + '</span><p class="time grayscale">有效期至' + this.couponUseEndDate + '</p><span class="condition">与其他产品一起下单时方可使用</span></div><div class="right-cell"><div class="money grayscale"><span>'+this.exchange.exchangeName+'</span></div><span class="my-btn grayscale">立即领取</span></div></div></div>'
  177. }
  178. }
  179. table.appendChild(li);
  180. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  181. });
  182. if(coupon_data.length==0){
  183. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  184. var li = document.createElement('li');
  185. li.className = 'my-yhq-cell';
  186. li.innerHTML='<img style="width:100px;display:block;margin:40px auto 0 auto;" src="images/null-3.png" /><h6 class="mui-text-center">暂无优惠券</h6>';
  187. table.appendChild(li);
  188. }
  189. } else {
  190. mui.confirm(dt.message + '是否重新加载页面?', '水时代-提示', btnArray, function(e) {
  191. if(e.index == 1) {} }
  192. )
  193. }
  194. }
  195. },
  196. error: function(xhr, type, errorThrown) { console.log(xhr) }
  197. })
  198. }
  199. mui.ready(function() {
  200. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  201. console.log("页面加载完毕")
  202. document.querySelector('.loading-bg').style.display = 'none';
  203. });
  204. mui.each(document.querySelectorAll('.tab-yhq-list .mui-control-item'), function(index, el) {
  205. el.addEventListener('tap', function() {
  206. pageNumber = 0;
  207. switch (index) {
  208. case 0:
  209. tabindex = 10;
  210. break;
  211. case 1:
  212. tabindex = 11;
  213. break;
  214. default:
  215. tabindex = 10;
  216. break;
  217. }
  218. $('.my-yhq-list').empty();
  219. mui('#pullrefresh_yhq_list').pullRefresh().refresh(true);
  220. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  221. }, false);
  222. });
  223. $(document).on('tap', '.coupon-href', function() {
  224. location.href ='coupon_dec.html';
  225. });
  226. </script>
  227. </body>
  228. </html>