coupon_bag.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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 {
  14. background-color: transparent;
  15. padding: 0 15px;
  16. }
  17. .my-yhq-list:before,
  18. .my-yhq-list:after {
  19. display: none;
  20. }
  21. .my-yhq-list .my-yhq-cell {
  22. margin: 13px 0;
  23. position: relative;
  24. }
  25. .my-yhq-list .my-yhq-cell:last-child {
  26. margin-bottom: 0;
  27. }
  28. .my-yhq-list .fixed-box {
  29. position: absolute;
  30. left: 0;
  31. top: 0;
  32. width: 100%;
  33. height: 100%;
  34. }
  35. .my-yhq-list .table {
  36. display: table;
  37. height: 100%;
  38. width: 100%;
  39. }
  40. .my-yhq-list .left-cell {
  41. display: table-cell;
  42. width: 69%;
  43. height: 100%;
  44. padding: 10px;
  45. }
  46. .my-yhq-list .right-cell {
  47. display: table-cell;
  48. width: 31%;
  49. height: 100%;
  50. text-align: center;
  51. vertical-align: middle;
  52. }
  53. .my-yhq-list .left-cell .tit {
  54. font-size: 20px;
  55. font-weight: bold;
  56. }
  57. .my-yhq-list .left-cell .time {
  58. font-size: 12px;
  59. }
  60. .my-yhq-list .left-cell .condition {
  61. position: absolute;
  62. left: 10px;
  63. bottom: 15px;
  64. font-size: 12px;
  65. color: #807f80;
  66. }
  67. .my-yhq-list .right-cell .money {
  68. color: #fff;
  69. margin: 5px 0;
  70. }
  71. .my-yhq-list .right-cell .money>span {
  72. font-size: 25px;
  73. color: #63ccde;
  74. }
  75. .my-yhq-list .right-cell .my-btn {
  76. color: #fff;
  77. padding: 8px 10px;
  78. font-size: 14px;
  79. border-radius: 5px;
  80. }
  81. .my-yhq-list .right-cell .my-btn:active {
  82. background-color: rgba(0, 0, 0, .5);
  83. }
  84. .grayscale {
  85. color: #807f80 !important;
  86. }
  87. .my-yhq-list .right-cell .my-btn.grayscale {
  88. opacity: 0;
  89. }
  90. .mui-table-view-chevron .mui-table-view-cell {
  91. padding-right: 15px;
  92. }
  93. .mui-segmented-control .mui-control-item {
  94. line-height: 1;
  95. height: 50px;
  96. vertical-align: bottom;
  97. border: 0;
  98. border-bottom: 0;
  99. color: #444;
  100. background-color: transparent !important;
  101. padding-bottom: 3px;
  102. }
  103. .mui-segmented-control .mui-control-item.mui-active {
  104. background-color: transparent !important;
  105. border-bottom: 0;
  106. }
  107. .mui-segmented-control .mui-control-item.mui-active:after {
  108. content: '';
  109. width: 70px;
  110. height: 2px;
  111. background: #63CCDE;
  112. position: absolute;
  113. left: 50%;
  114. bottom: 0;
  115. margin-left: -35px;
  116. }
  117. .tab-yhq-list .mui-control-item.mui-active {
  118. color: #1cc9f4 !important;
  119. border-bottom: 0;
  120. }
  121. .tab-yhq-list {
  122. background: #fff;
  123. border: 0;
  124. border-bottom: 1px solid rgba(0, 0, 0, .1);
  125. position: fixed;
  126. left: 0;
  127. top: 0;
  128. width: 100%;
  129. z-index: 10;
  130. }
  131. .tab-yhq-list .mui-control-item {
  132. position: relative;
  133. }
  134. .mui-control-item.mui-active .mui-tab-label {
  135. color: #1cc9f4;
  136. }
  137. .tab-yhq-list .mui-control-item {
  138. color: #a1a1a1;
  139. }
  140. .mui-control-content {
  141. margin-top: 70px;
  142. }
  143. .icon-all>span:first-child {
  144. min-width: 28px;
  145. min-height: 25px;
  146. background-size: 100%;
  147. position: absolute;
  148. top: 16px;
  149. left: 50%;
  150. -webkit-transform: translateX(-50%);
  151. transform: translateX(-50%);
  152. }
  153. .icon-all.mui-active>span:first-child {}
  154. .icon-noused>span:first-child {
  155. min-width: 25px;
  156. min-height: 25px;
  157. background-size: 100%;
  158. position: absolute;
  159. top: 16px;
  160. left: 50%;
  161. -webkit-transform: translateX(-50%);
  162. transform: translateX(-50%);
  163. }
  164. .icon-noused.mui-active>span:first-child {}
  165. .icon-used>span:first-child {
  166. min-width: 25px;
  167. min-height: 25px;
  168. background-size: 100%;
  169. position: absolute;
  170. top: 16px;
  171. left: 50%;
  172. -webkit-transform: translateX(-50%);
  173. transform: translateX(-50%);
  174. }
  175. .icon-used.mui-active>span:first-child {}
  176. .icon-overdue>span:first-child {
  177. min-width: 25px;
  178. min-height: 25px;
  179. background-size: 100%;
  180. position: absolute;
  181. top: 16px;
  182. left: 50%;
  183. -webkit-transform: translateX(-50%);
  184. transform: translateX(-50%);
  185. }
  186. .icon-overdue.mui-active>span:first-child {}
  187. .mui-scroll-wrapper {
  188. top: 50px;
  189. bottom: 100px;
  190. }
  191. .middle-center {
  192. display: table-cell;
  193. text-align: center;
  194. vertical-align: middle;
  195. color: #fff;
  196. }
  197. .right-bottom {
  198. position: absolute;
  199. right: 15px;
  200. bottom: 15px;
  201. color: #fff;
  202. }
  203. .coupon-href {
  204. text-align: center;
  205. width: 120px;
  206. margin: 0 auto;
  207. position: fixed;
  208. bottom: 80px;
  209. left: 50%;
  210. margin-left: -60px;
  211. text-decoration: underline;
  212. font-size: 12px;
  213. color: #666;
  214. }
  215. </style>
  216. <script type="text/javascript">
  217. // 屏蔽分享
  218. window.hiddenAllWechatMenu = true;
  219. </script>
  220. </head>
  221. <body style="background: #fff;">
  222. <div class="loading-bg">
  223. <div class="mui-loading">
  224. <div class="mui-spinner">
  225. </div>
  226. &nbsp;&nbsp;加载中...
  227. </div>
  228. </div>
  229. <nav class="mui-bar mui-bar-tab" id="footer-bar">
  230. <a class="mui-tab-item">
  231. <div class="iconfont icon-shouye"></div>
  232. <span class="mui-tab-label">首页</span>
  233. </a>
  234. <a class="mui-tab-item">
  235. <div class="iconfont icon-gouwuche"><span class="mui-badge">0</span></div>
  236. <span class="mui-tab-label">购物车</span>
  237. </a>
  238. <a class="mui-tab-item">
  239. <div class="iconfont icon-dingdan"></div>
  240. <span class="mui-tab-label">订单</span>
  241. </a>
  242. <a class="mui-tab-item mui-active">
  243. <div class="iconfont icon-wode"></div>
  244. <span class="mui-tab-label">我的</span>
  245. </a>
  246. </nav>
  247. <div class="mui-content">
  248. <div class="mui-segmented-control tab-yhq-list">
  249. <a class="mui-control-item icon-all " tabindex="10" href="#item1mobile">
  250. <!--<span class="iconfont icon-youhuiquan"></span>-->
  251. <span class="mui-tab-label">优惠券</span>
  252. </a>
  253. <a class="mui-control-item icon-noused mui-active" tabindex="11" href="#item2mobile">
  254. <!--<span class="iconfont icon-tiququan"></span>-->
  255. <span class="mui-tab-label">兑换券</span>
  256. </a>
  257. </div>
  258. <!--下拉刷新容器-->
  259. <div id="pullrefresh_yhq_list" class="mui-content mui-scroll-wrapper" style="background: #fff;">
  260. <div class="mui-scroll">
  261. <!--数据列表-->
  262. <ul class="my-yhq-list">
  263. <li class="my-yhq-cell">
  264. <img width="100%" src="images/yhq_used_bg.png" />
  265. <div class="fixed-box">
  266. <div class="table go_web_link" url="#">
  267. <div class="left-cell">
  268. <span class="tit">优惠券</span>
  269. <p class="time">满2000元可使用</p>
  270. <span class="condition">有效期至2019-11-24</span>
  271. </div>
  272. <div class="right-cell">
  273. <div class="money">
  274. <span>¥100</span>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. </li>
  280. <li class="my-yhq-cell">
  281. <img width="100%" src="images/yhq_used_bg.png" />
  282. <div class="fixed-box">
  283. <div class="table go_web_link" url="#">
  284. <div class="left-cell">
  285. <span class="tit">用户关注券</span>
  286. <p class="time">仅部分产品可用<u class="see-details">查看详情</u></p>
  287. <span class="condition">有效期至2019-11-24</span>
  288. </div>
  289. <div class="right-cell">
  290. <div class="money">
  291. <span>¥500</span>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. </li>
  297. </ul>
  298. </div>
  299. </div>
  300. </div>
  301. <!--<div class="coupon-href">兑换券使用流程</div>-->
  302. <script type="text/javascript" src="js/mui.min.js"></script>
  303. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  304. <script type="text/javascript" src="js/main.js"></script>
  305. <script>
  306. var tabindex = 10,
  307. pageNumber = 0,
  308. pagesize = 10;
  309. mui.init({
  310. pullRefresh: {
  311. container: '#pullrefresh_yhq_list',
  312. down: {
  313. //callback: pulldownRefresh
  314. },
  315. up: {
  316. contentrefresh: '正在加载...',
  317. contentnomore: '没有更多数据了!',
  318. callback: pullupRefresh
  319. }
  320. }
  321. });
  322. /**
  323. * 上拉加载具体业务实现
  324. */
  325. function pullupRefresh() {
  326. ++pageNumber;
  327. var btnArray = ['否', '是'];
  328. var src = '',
  329. coupon_name = '优惠券';
  330. if(tabindex == 10) {
  331. src = base_path + '/coupon/couponItemList?useStatus=10';
  332. } else {
  333. coupon_name = '兑换券<span class="mui-h6">(可换T1或t2滤芯一支)</span>';
  334. src = base_path + '/coupon/couponItemList?useStatus=11';
  335. }
  336. $.ajax(src, {
  337. data: {},
  338. dataType: 'json',
  339. type: 'post',
  340. timeout: 15000,
  341. xhrFields: {
  342. withCredentials: true
  343. },
  344. crossDomain: true,
  345. success: function(dt) {
  346. if(dt.isRedirect) {
  347. location.href = dt.redirectURL;
  348. } else {
  349. if(dt.status) {
  350. console.log(dt)
  351. var coupon_data = [];
  352. coupon_data = dt.data.itemList;
  353. mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh(coupon_data.length < pagesize);
  354. var table = document.body.querySelector('.my-yhq-list');
  355. mui(coupon_data).each(function(index) {
  356. var li = document.createElement('li');
  357. li.className = 'my-yhq-cell';
  358. var sa = '未使用',
  359. src = 'images/bg_quan_02.jpg';
  360. if(tabindex == 10) {
  361. var ptrice;
  362. if(this.couponType == 1) {
  363. ptrice = accDiv(this.couponReduce, 100) + '元'
  364. } else {
  365. ptrice = "-" + (100 - this.couponReduce) + "%"
  366. }
  367. if(this.couponUseStatus == 1 && this.couponItemRemark == "normal") {
  368. var url = 'chanpin_list.html';
  369. if(this.couponId == 10002) {
  370. url = '20190618.html';
  371. }
  372. 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'
  373. } else {
  374. 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>'
  375. }
  376. } else if(tabindex == 11) {
  377. if(this.pledgeStatus == '2') {
  378. sa = '已使用'
  379. src = '//s.iamberry.com/watero/images/shop/bg_quan_01.jpg';
  380. }
  381. var tips = '';
  382. if(this.couponId == 10000) {
  383. tips = '与其他产品一起下单时方可使用';
  384. } else if(this.couponId == 10001) {
  385. tips = '仅限购买WaterO滤芯T1/T2一支抵扣使用';
  386. }
  387. if(this.couponUseStatus == 1 && this.couponItemRemark == "normal") {
  388. console.log(this.couponUseEndDate)
  389. 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'
  390. } else {
  391. 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>'
  392. }
  393. console.log("1")
  394. }
  395. table.appendChild(li);
  396. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  397. });
  398. if(coupon_data.length == 0) {
  399. mui('#pullrefresh_yhq_list').pullRefresh().disablePullupToRefresh();
  400. var li = document.createElement('li');
  401. li.className = 'my-yhq-cell';
  402. li.innerHTML = '<img style="width:100px;display:block;margin:60px auto 20px auto;" src="images/null-3.png" /><h6 class="mui-text-center">暂无任何优惠券哟!</h6>';
  403. table.appendChild(li);
  404. }
  405. } else {
  406. mui.confirm(dt.message + '是否重新加载页面?', '提示', btnArray, function(e) {
  407. if(e.index == 1) {}
  408. })
  409. }
  410. }
  411. },
  412. error: function(xhr, type, errorThrown) {
  413. console.log(xhr)
  414. }
  415. })
  416. }
  417. mui.ready(function() {
  418. tabindex = getParam("tabindex");
  419. $('.tab-yhq-list>a').removeClass("mui-active");
  420. $('.tab-yhq-list>a[tabindex=' + tabindex + ']').addClass("mui-active");
  421. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  422. console.log("页面加载完毕")
  423. document.querySelector('.loading-bg').style.display = 'none';
  424. });
  425. mui.each(document.querySelectorAll('.tab-yhq-list .mui-control-item'), function(index, el) {
  426. el.addEventListener('tap', function() {
  427. pageNumber = 0;
  428. switch(index) {
  429. case 0:
  430. tabindex = 10;
  431. break;
  432. case 1:
  433. tabindex = 11;
  434. break;
  435. default:
  436. tabindex = 10;
  437. break;
  438. }
  439. $('.my-yhq-list').empty();
  440. mui('#pullrefresh_yhq_list').pullRefresh().refresh(true);
  441. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading();
  442. }, false);
  443. });
  444. $(document).on('tap', '.coupon-href', function() {
  445. location.href = 'coupon_dec.html';
  446. });
  447. $(document).on('tap', '.go_web_link', function() {
  448. location.href = $(this).attr("url");
  449. });
  450. </script>
  451. </body>
  452. </html>