coupon_bag.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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;font-weight: bold;}
  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;color: #63ccde;}
  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{line-height: 1;height: 50px;vertical-align: bottom;border: 0;border-bottom: 0;color: #444;background-color: transparent !important;padding-bottom: 3px;}
  32. .mui-segmented-control .mui-control-item.mui-active{background-color: transparent !important;border-bottom: 0;}
  33. .mui-segmented-control .mui-control-item.mui-active:after{content: '';width: 70px;height: 2px;background: #63CCDE;position: absolute;left: 50%;bottom: 0;margin-left: -35px;}
  34. .tab-yhq-list .mui-control-item.mui-active {color: #1cc9f4 !important;border-bottom: 0;}
  35. .tab-yhq-list{background: #fff;border: 0;border-bottom: 1px solid rgba(0,0,0,.1);position: fixed;left: 0;top: 0;width: 100%;z-index: 10;}
  36. .tab-yhq-list .mui-control-item{position: relative;}
  37. .mui-control-item.mui-active .mui-tab-label{color: #1cc9f4;}
  38. .tab-yhq-list .mui-control-item{color: #a1a1a1;}
  39. .mui-control-content{margin-top: 70px;}
  40. .icon-all>span:first-child {min-width: 28px;min-height: 25px;background-size: 100%;position: absolute;top: 16px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  41. .icon-all.mui-active>span:first-child {}
  42. .icon-noused>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 16px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  43. .icon-noused.mui-active>span:first-child {}
  44. .icon-used>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 16px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  45. .icon-used.mui-active>span:first-child {}
  46. .icon-overdue>span:first-child {min-width: 25px;min-height: 25px;background-size: 100%;position: absolute;top: 16px;left:50%;-webkit-transform: translateX(-50%);transform: translateX(-50%);}
  47. .icon-overdue.mui-active>span:first-child {}
  48. .mui-scroll-wrapper{top: 50px;bottom:100px;}
  49. .middle-center{display: table-cell;text-align: center;vertical-align: middle;color: #fff;}
  50. .right-bottom{position: absolute;right: 15px;bottom: 15px;color: #fff;}
  51. .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;}
  52. </style>
  53. <script type="text/javascript">
  54. // 屏蔽分享
  55. window.hiddenAllWechatMenu = true;
  56. </script>
  57. </head>
  58. <body style="background: #fff;">
  59. <div class="loading-bg">
  60. <div class="mui-loading">
  61. <div class="mui-spinner">
  62. </div>
  63. &nbsp;&nbsp;加载中...
  64. </div>
  65. </div>
  66. <nav class="mui-bar mui-bar-tab" id="footer-bar">
  67. <a class="mui-tab-item" >
  68. <div class="iconfont icon-shouye"></div>
  69. <span class="mui-tab-label">首页</span>
  70. </a>
  71. <a class="mui-tab-item">
  72. <div class="iconfont icon-gouwuche"><span class="mui-badge">0</span></div>
  73. <span class="mui-tab-label">购物车</span>
  74. </a>
  75. <a class="mui-tab-item">
  76. <div class="iconfont icon-dingdan"></div>
  77. <span class="mui-tab-label">订单</span>
  78. </a>
  79. <a class="mui-tab-item mui-active">
  80. <div class="iconfont icon-wode"></div>
  81. <span class="mui-tab-label">我的</span>
  82. </a>
  83. </nav>
  84. <div class="mui-content" >
  85. <div class="mui-segmented-control tab-yhq-list">
  86. <a class="mui-control-item icon-all " tabindex="10" href="#item1mobile">
  87. <!--<span class="iconfont icon-youhuiquan"></span>-->
  88. <span class="mui-tab-label">优惠券</span>
  89. </a>
  90. <a class="mui-control-item icon-noused mui-active" tabindex="11" href="#item2mobile">
  91. <!--<span class="iconfont icon-tiququan"></span>-->
  92. <span class="mui-tab-label">兑换券</span>
  93. </a>
  94. </div>
  95. <!--下拉刷新容器-->
  96. <div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper" style="background: #fff;">
  97. <div class="mui-scroll">
  98. <!--数据列表-->
  99. <ul class="my-yhq-list">
  100. </ul>
  101. </div>
  102. </div>
  103. </div>
  104. <!--<div class="coupon-href">兑换券使用流程</div>-->
  105. <script type="text/javascript" src="js/mui.min.js"></script>
  106. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  107. <script type="text/javascript" src="js/main.js"></script>
  108. <script>
  109. var tabindex=10,pageNumber=0,pagesize=10;
  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. var url='chanpin_list.html';
  164. if(this.couponId==10002){
  165. url='20190618.html';
  166. }
  167. li.innerHTML = '<img width="100%" src="images/yhq_used_bg.png" /><div class="fixed-box"><div class="table go_web_link" url="'+url+'"><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></div></div></div'
  168. } else {
  169. 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>'
  170. }
  171. }else if(tabindex==11){
  172. if(this.pledgeStatus=='2'){
  173. sa='已使用'
  174. src='//s.iamberry.com/watero/images/shop/bg_quan_01.jpg';
  175. }
  176. var tips='';
  177. if(this.couponId==10000){
  178. tips='与其他产品一起下单时方可使用';
  179. }else if(this.couponId==10001){
  180. tips='仅限购买WaterO滤芯T1/T2一支抵扣使用';
  181. }
  182. if(this.couponUseStatus == 1 && this.couponItemRemark == "normal") {
  183. console.log(this.couponUseEndDate)
  184. li.innerHTML = '<img width="100%" src="images/yhq_used_bg.png" /><div class="fixed-box"><div class="table go_web_link" url="chanpin_list.html?proType=2"><div class="left-cell"><span class="tit">' + coupon_name + '</span><p class="time">有效期至' + this.couponUseEndDate + '</p><span class="condition">'+tips+'</span></div><div class="right-cell"><div class="money"><span>'+this.exchange.exchangeName+'</span></div></div></div></div'
  185. } else {
  186. 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">'+tips+'</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>'
  187. }
  188. console.log("1")
  189. }
  190. table.appendChild(li);
  191. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  192. });
  193. if(coupon_data.length==0){
  194. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  195. var li = document.createElement('li');
  196. li.className = 'my-yhq-cell';
  197. li.innerHTML='<img style="width:100px;display:block;margin:60px auto 20px auto;" src="images/null-3.png" /><h6 class="mui-text-center">暂无任何优惠券哟!</h6>';
  198. table.appendChild(li);
  199. }
  200. } else {
  201. mui.confirm(dt.message + '是否重新加载页面?', '提示', btnArray, function(e) {
  202. if(e.index == 1) {} }
  203. )
  204. }
  205. }
  206. },
  207. error: function(xhr, type, errorThrown) { console.log(xhr) }
  208. })
  209. }
  210. mui.ready(function() {
  211. tabindex=getParam("tabindex");
  212. $('.tab-yhq-list>a').removeClass("mui-active");
  213. $('.tab-yhq-list>a[tabindex='+tabindex+']').addClass("mui-active");
  214. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  215. console.log("页面加载完毕")
  216. document.querySelector('.loading-bg').style.display = 'none';
  217. });
  218. mui.each(document.querySelectorAll('.tab-yhq-list .mui-control-item'), function(index, el) {
  219. el.addEventListener('tap', function() {
  220. pageNumber = 0;
  221. switch (index) {
  222. case 0:
  223. tabindex = 10;
  224. break;
  225. case 1:
  226. tabindex = 11;
  227. break;
  228. default:
  229. tabindex = 10;
  230. break;
  231. }
  232. $('.my-yhq-list').empty();
  233. mui('#pullrefresh_yhq_list').pullRefresh().refresh(true);
  234. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  235. }, false);
  236. });
  237. $(document).on('tap', '.coupon-href', function() {
  238. location.href ='coupon_dec.html';
  239. });
  240. $(document).on('tap', '.go_web_link', function() {
  241. location.href =$(this).attr("url");
  242. });
  243. </script>
  244. </body>
  245. </html>