coupon_bag.html 11 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.iamberry.com/wateroPF/css/mui.min.css">
  10. <link rel="stylesheet" type="text/css" href="//css.iamberry.com/wateroPF/css/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="//css.iamberry.com/wateroPF/css/style.css" />
  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: #f44f80;}
  22. .my-yhq-list .left-cell .time{color: #f44f80;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: 35px;}
  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:60px;}
  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. </style>
  51. <script type="text/javascript">
  52. // 屏蔽分享
  53. window.hiddenAllWechatMenu = true;
  54. </script>
  55. </head>
  56. <body>
  57. <div class="loading-bg">
  58. <div class="mui-loading">
  59. <div class="mui-spinner">
  60. </div>
  61. &nbsp;&nbsp;加载中...
  62. </div>
  63. </div>
  64. <nav class="mui-bar mui-bar-tab" id="footer-bar">
  65. <a class="mui-tab-item" >
  66. <div class="iconfont icon-home"></div>
  67. <span class="mui-tab-label">首页</span>
  68. </a>
  69. <a class="mui-tab-item">
  70. <div class="iconfont icon-gouwuche"><span class="mui-badge">0</span></div>
  71. <span class="mui-tab-label">购物车</span>
  72. </a>
  73. <a class="mui-tab-item">
  74. <div class="iconfont icon-dingdan"></div>
  75. <span class="mui-tab-label">我的订单</span>
  76. </a>
  77. <a class="mui-tab-item mui-active">
  78. <div class="iconfont icon-vip"></div>
  79. <span class="mui-tab-label">会员中心</span>
  80. </a>
  81. </nav>
  82. <div class="mui-content">
  83. <div class="mui-segmented-control tab-yhq-list">
  84. <a class="mui-control-item icon-all mui-active" tabindex="1" href="#item1mobile">
  85. <span class="iconfont icon-youhuiquan"></span>
  86. <span class="mui-tab-label">优惠券</span>
  87. </a>
  88. <!--<a class="mui-control-item icon-noused" tabindex="2" href="#item2mobile">
  89. <span class="iconfont icon-tiququan"></span>
  90. <span class="mui-tab-label">押金提取券</span>
  91. </a>
  92. <a class="mui-control-item icon-used" tabindex="3" href="#item3mobile">
  93. <span class="iconfont icon-dikouquan"></span>
  94. <span class="mui-tab-label">服务费抵扣券</span>
  95. </a>-->
  96. </div>
  97. <!--下拉刷新容器-->
  98. <div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper">
  99. <div class="mui-scroll">
  100. <!--数据列表-->
  101. <ul class="my-yhq-list">
  102. </ul>
  103. </div>
  104. </div>
  105. </div>
  106. <script type="text/javascript" src="//s.iamberry.com/wateroPF/js/mui.min.js"></script>
  107. <script type="text/javascript" src="//s.iamberry.com/wateroPF/js/jquery-2.1.1.min.js"></script>
  108. <script type="text/javascript" src="//s.iamberry.com/wateroPF/js/shop/main.js"></script>
  109. <script>
  110. var tabindex=0,pageNumber=0,pagesize=10;
  111. var tabindex=$('.tab-yhq-list .mui-active').prop('tabindex');
  112. mui.init({
  113. pullRefresh: {
  114. container: '#pullrefresh_yhq_list',
  115. down: {
  116. //callback: pulldownRefresh
  117. },
  118. up: {
  119. contentrefresh: '正在加载...',
  120. callback: pullupRefresh
  121. }
  122. }
  123. });
  124. /**
  125. * 上拉加载具体业务实现
  126. */
  127. function pullupRefresh() {
  128. ++pageNumber;
  129. var btnArray = ['否', '是'];
  130. var src='',coupon_name='优惠券';
  131. if(tabindex==1){
  132. src='/wateroPF/wechat/coupon/couponItemList?useStatus=0';
  133. }else if(tabindex==2){
  134. coupon_name='watero净水机押金提取券';
  135. src='/wateroPF/wechat/rent_coupon/select_pledge_coupon_list';
  136. }else{
  137. coupon_name='watero净水机服务费抵扣券';
  138. src='/wateroPF/wechat/rent_coupon/select_service_coupon_list';
  139. }
  140. mui.ajax(src, {
  141. data: {},
  142. dataType: 'json',
  143. type: 'post',
  144. timeout: 15000,
  145. success: function(dt) {
  146. if(dt.status) {
  147. var coupon_data = [];
  148. if(tabindex==1){
  149. coupon_data = dt.data.itemList;
  150. }else{
  151. coupon_data = dt.data;
  152. }
  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='//s.iamberry.com/wateroPF/images/shop/bg_quan_02.jpg';
  159. if(tabindex==1){
  160. var ptrice;
  161. if(this.couponType == 1) { ptrice = accDiv(this.couponReduce, 100) + '元' } else { ptrice = "-" + (100 - this.couponReduce) + "%" }
  162. if(this.couponUseStatus == 1 && tabindex <= 1 && this.couponItemRemark == "normal") {
  163. li.innerHTML = '<img width="100%" src="/wateroPF/common/shop/images/yhq_used_bg.png" /><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">满' + accDiv(this.couponConsumeEnough, 100) + '元可使用</span></div><div class="right-cell"><div class="money"><span>' + ptrice + '</span></div><span class="my-btn go_web_shop">立即使用</span></div></div></div'
  164. } else {
  165. li.innerHTML = '<img width="100%" src="/wateroPF/common/shop/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==2){
  168. if(this.pledgeStatus=='2'){
  169. sa='已使用'
  170. src='//s.iamberry.com/wateroPF/images/shop/bg_quan_01.jpg';
  171. }
  172. li.setAttribute("name",this.pledgeId);
  173. li.innerHTML = '<img width="100%" src="'+src+'" /><div class="fixed-box"><div class="table"><div class="middle-center">'+coupon_name+'<br/>¥' + accDiv(this.pledgeMoney, 100) + '</div><span class="right-bottom">'+sa+'</span></div></div';
  174. mui.each(document.querySelectorAll('.my-yhq-list .my-yhq-cell'), function(index, el) {
  175. var th=this;
  176. el.addEventListener('tap', function() {
  177. mui.openWindow({
  178. url: "/wateroPF/view/deposit_coupon.html?pledgeId="+this.getAttribute("name",this.pledgeId)
  179. });
  180. }, false)
  181. });
  182. }else{
  183. if(this.serviceStatus=='2'){
  184. sa='使用中';
  185. } else if(this.serviceStatus=='3'){
  186. sa='已使用';
  187. src='//s.iamberry.com/wateroPF/images/shop/bg_quan_01.jpg';
  188. }
  189. li.innerHTML = '<img width="100%" src="'+src+'" /><div class="fixed-box"><div class="table"><div class="middle-center">'+coupon_name+'<br/>¥' + accDiv(this.serviceMoney, 100) + '</div><span class="right-bottom">'+sa+'</span></div></div';
  190. }
  191. table.appendChild(li)
  192. })
  193. } else {
  194. mui.confirm(dt.message + '是否重新加载页面?', '水时代-提示', btnArray, function(e) {
  195. if(e.index == 1) {} }
  196. )
  197. }
  198. },
  199. error: function(xhr, type, errorThrown) { console.log(xhr) }
  200. })
  201. }
  202. mui.ready(function() {
  203. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  204. console.log("页面加载完毕")
  205. document.querySelector('.loading-bg').style.display = 'none';
  206. });
  207. mui.each(document.querySelectorAll('.tab-yhq-list .mui-control-item'), function(index, el) {
  208. el.addEventListener('tap', function() {
  209. pageNumber = 0;
  210. switch (index) {
  211. case 0:
  212. tabindex = 1;
  213. break;
  214. case 1:
  215. tabindex = 2;
  216. break;
  217. default:
  218. tabindex = 3;
  219. break;
  220. }
  221. $('.my-yhq-list').empty();
  222. mui('#pullrefresh_yhq_list').pullRefresh().refresh(true);
  223. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  224. }, false);
  225. });
  226. </script>
  227. </body>
  228. </html>