integral-center.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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/style.css" />
  12. <style>
  13. .mui-content{background: #fff;}
  14. .jifen-top{position: relative;border-bottom: 10px solid #f2f2f2;}
  15. .jifen-top img{
  16. display: block;
  17. width: 100%;
  18. }
  19. .jifen-middle{position: absolute;top: 50%;left: 40px;right: 40px;height: 24px;margin-top: -12px;color: #74c7dd;}
  20. .jifen-middle .mui-table-cell{vertical-align: middle;}
  21. .jifen-middle strong{font-size: 26px;}
  22. .jifen-middle .mui-btn{border-radius: 25px;border: 0;padding: 3px 10px 3px 10px;color: #fff;font-size: 12px;background: #74c7dd;}
  23. .jifen-middle .mui-btn:active{background: #74c7dd !important;}
  24. .jifen-title{color: #243052;font-size: 17px;font-weight: bold;margin-bottom: 15px;}
  25. .jifen-box{padding:28px 16px;border-bottom: 10px solid #f2f2f2;}
  26. .btn-go-shop{border-radius: 25px;padding:3px 16px 3px 16px;color: #243052;border: 1px solid rgba(36,48,82,.5);font-size: 12px;}
  27. .btn-go-shop:active{background: #fff !important;color: #243052 !important;border: 1px solid rgba(36,48,82,.5);}
  28. .date-yuan{width: 39px;border: 1px solid rgba(51,51,51,.1);border-radius: 40px;text-align: center;padding: 8px 0;font-size: 12px;color: #666;}
  29. .table-yuan{border-radius: 25px;border: 1px solid rgba(51,51,51,.1);padding: 7px 16px;font-size: 14px;}
  30. .jifen-list>li{margin: 15px 0;color: #333;}
  31. .jifen-list>li>.mui-table{
  32. margin: 10px 0;
  33. }
  34. .jifen-list i{color: #74c7dd;font-style: normal;}
  35. .jifen-list i.mui-h5{color: #333;}
  36. .mui-col-xs-10{vertical-align: middle;}
  37. .mui-pull-bottom-pocket{height: 0px;}
  38. </style>
  39. <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  40. <script>
  41. //屏蔽分享
  42. document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  43. WeixinJSBridge.call('hideOptionMenu');
  44. });
  45. </script>
  46. </head>
  47. <body style="background: #fff;">
  48. <div class="loading-bg">
  49. <div class="mui-loading">
  50. <div class="mui-spinner">
  51. </div>
  52. &nbsp;&nbsp;加载中...
  53. </div>
  54. </div>
  55. <div class="mui-content">
  56. <div class="jifen-top">
  57. <img src="images/jifen-bg.jpg" />
  58. <div class="jifen-middle">
  59. <div class="mui-table">
  60. <div class="mui-table-cell">
  61. <strong class="user-integeal">0</strong> 积分
  62. </div>
  63. <div class="mui-table-cell mui-text-right">
  64. <button type="button" class="mui-btn go-integral-rule">积分规则</button>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="jifen-box">
  70. <div class="jifen-title">积分商城</div>
  71. <img width="62%" src="images/jifen-next.jpg" />
  72. </div>
  73. <div class="jifen-box">
  74. <div class="jifen-title">领积分</div>
  75. <div>
  76. <div class="mui-table">
  77. <div class="mui-table-cell mui-col-xs-2" style="vertical-align: middle;">
  78. <i class="iconfont icon-w-huiyuanjifengouwuche" style="font-size: 36px;color: #57b5f9;margin-left: 5px;"></i>
  79. </div>
  80. <div class="mui-table-cell mui-col-xs-7" style="padding-left: 5px;vertical-align: middle;">
  81. <div>消费领积分</div>
  82. <p class="mui-h6 mui-ellipsis">消费10元,可获得1积分</p>
  83. </div>
  84. <div class="mui-table-cell mui-col-xs-3 mui-text-right" style="vertical-align: middle;">
  85. <button type="button" class="mui-btn btn-go-shop">去下单</button>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="jifen-box" style="border: 0;padding-bottom: 50px;">
  91. <div class="jifen-title">积分明细</div>
  92. <ul class="jifen-list">
  93. <li id="pullrefresh_yhq_list" >
  94. <div></div>
  95. <!-- <div class="mui-table">
  96. <div class="mui-table-cell mui-col-xs-2">
  97. <div class="date-yuan">
  98. 11.14
  99. </div>
  100. </div>
  101. <div class="mui-table-cell mui-col-xs-10">
  102. <div class="mui-table table-yuan">
  103. <div class="mui-table-cell">
  104. 购买滤芯
  105. </div>
  106. <div class="mui-table-cell mui-text-right">
  107. <i>+2699</i>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="mui-table">
  113. <div class="mui-table-cell mui-col-xs-2">
  114. <div class="date-yuan">
  115. 11.14
  116. </div>
  117. </div>
  118. <div class="mui-table-cell mui-col-xs-10">
  119. <div class="mui-table table-yuan">
  120. <div class="mui-table-cell">
  121. 购买滤芯
  122. </div>
  123. <div class="mui-table-cell mui-text-right">
  124. <i>+2699</i>
  125. </div>
  126. </div>
  127. </div>
  128. </div> -->
  129. </li>
  130. <!-- <li>
  131. <div>2018年</div>
  132. <div class="mui-table">
  133. <div class="mui-table-cell mui-col-xs-2">
  134. <div class="date-yuan">
  135. 11.14
  136. </div>
  137. </div>
  138. <div class="mui-table-cell mui-col-xs-10">
  139. <div class="mui-table table-yuan">
  140. <div class="mui-table-cell">
  141. 购买滤芯
  142. </div>
  143. <div class="mui-table-cell mui-text-right">
  144. <i>+2699</i>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="mui-table">
  150. <div class="mui-table-cell mui-col-xs-2">
  151. <div class="date-yuan">
  152. 11.14
  153. </div>
  154. </div>
  155. <div class="mui-table-cell mui-col-xs-10">
  156. <div class="mui-table table-yuan">
  157. <div class="mui-table-cell">
  158. 购买滤芯
  159. </div>
  160. <div class="mui-table-cell mui-text-right">
  161. <i class="mui-h5">-2699</i>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. </li> -->
  167. </ul>
  168. </div>
  169. </div>
  170. <script type="text/javascript" src="js/mui.min.js"></script>
  171. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  172. <script type="text/javascript" src="js/main.js"></script>
  173. <script type="text/javascript">
  174. window.addEventListener('pageshow', function(e) {
  175. // 通过persisted属性判断是否存在 BF Cache
  176. if(e.persisted) {
  177. location.reload();
  178. }
  179. });
  180. var pageNO = 0,
  181. pageSize = 10;
  182. mui.init({
  183. pullRefresh: {
  184. container: '#pullrefresh_yhq_list',
  185. down: {
  186. height: 0,
  187. //callback: pulldownRefresh
  188. },
  189. up: {
  190. contentdown: '',
  191. contentrefresh: '正在加载...',
  192. contentnomore: '',
  193. callback: pullupRefresh
  194. }
  195. // down: {
  196. // height: 75,
  197. // callback: false,
  198. // },
  199. // up: {
  200. // auto: false,
  201. // offset: 100, //距离底部高度(到达该高度即触发)
  202. // show: true,
  203. // contentdown: '',
  204. // contentrefresh: '正在加载...',
  205. // contentnomore: '',
  206. // callback: pullupRefresh
  207. // },
  208. }
  209. });
  210. /**
  211. * 上拉加载具体业务实现
  212. */
  213. function pullupRefresh() {
  214. ++pageNO; //每次上拉页数+1
  215. $.ajax(base_path + '/integralLog/getIntegral?dates=' + new Date().getTime(), {
  216. data: {
  217. pageSize:pageSize,
  218. pageNO:pageNO
  219. },
  220. dataType: 'json',
  221. type: 'post',
  222. timeout: 15000,
  223. xhrFields: {
  224. withCredentials: true
  225. },
  226. crossDomain: true,
  227. success: function(dt) {
  228. console.log(dt);
  229. if(dt.isRedirect) {
  230. location.href = dt.redirectURL;
  231. }else{
  232. mui('#pullrefresh_yhq_list').pullRefresh().endPullupToRefresh(dt.data.list.length < pageSize); //endPullupToRefresh(ture)表示没有更多数据了,停止上拉加载
  233. var html='';
  234. for(var i=0;i<dt.data.list.length;i++){
  235. var item = dt.data.list[i];
  236. var newDate = new Date(item.inteLogCreateTime);
  237. var year = newDate.getFullYear();
  238. var month = newDate.getMonth() + 1;
  239. var date = newDate.getDate();
  240. html+='<div class="mui-table integral-li" year="'+ year +'">'
  241. html+='<div class="mui-table-cell mui-col-xs-2"><div class="date-yuan">'+ month +'.'+ date +'</div></div>'
  242. html+='<div class="mui-table-cell mui-col-xs-10">'
  243. html+='<div class="mui-table table-yuan">'
  244. html+='<div class="mui-table-cell">'+ item.inteConfName +'</div>'
  245. if(item.inteLogType == 1){
  246. html+='<div class="mui-table-cell mui-text-right"><i>+'+ item.inteLogChangeNum +'</i></div>'
  247. }else if(item.inteLogType == 2){
  248. html+='<div class="mui-table-cell mui-text-right"><i>-'+ item.inteLogChangeNum +'</i></div>'
  249. }
  250. html+='</div>'
  251. html+='</div>'
  252. html+='</div>'
  253. }
  254. $('#pullrefresh_yhq_list').append(html);
  255. setYear();
  256. }
  257. },
  258. error: function(xhr, type, errorThrown) {
  259. errorfn(xhr)
  260. }
  261. });
  262. }
  263. mui.ready(function() {
  264. document.querySelector('.loading-bg').style.display = 'none';
  265. mui('#pullrefresh_yhq_list').pullRefresh().pullupLoading(); //首次加载
  266. $.ajax(base_path + '/user/member?dates=' + new Date().getTime(), {
  267. dataType: 'json',
  268. type: 'post',
  269. timeout: 15000,
  270. xhrFields: {
  271. withCredentials: true
  272. },
  273. crossDomain: true,
  274. success: function(dt) {
  275. if(dt.isRedirect) {
  276. location.href = dt.redirectURL;
  277. } else {
  278. var data = dt.data;
  279. if(dt.status) {
  280. $(".user-integeal").html(data.userSurplusIntegral);
  281. }
  282. }
  283. },
  284. error: function(xhr, type, errorThrown) {
  285. console.log(xhr)
  286. }
  287. });
  288. });
  289. $(document).on('tap', '.go-integral-rule', function() {
  290. location.href='integral-rule.html';
  291. });
  292. $(document).on('tap', '.btn-go-shop', function() {
  293. location.href='chanpin_list.html';
  294. });
  295. function setYear(){
  296. var oldyear = '';
  297. $("#pullrefresh_yhq_list").find(".integral-li").each(function(){
  298. var year = $(this).attr('year')+'年';
  299. if(oldyear != year){
  300. oldyear = year;
  301. var $prevNode = $(this).prev() //返回上一个兄弟节点
  302. var yearVal = '';
  303. if($prevNode != null){
  304. yearVal = $prevNode.html();
  305. }
  306. if(yearVal != year){
  307. $(this).before("<div>"+ year +"</div>");
  308. }
  309. }
  310. })
  311. }
  312. </script>
  313. </body>
  314. </html>