You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
5.4 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  2. <title>领券中心</title><meta name="keywords" content=""><meta name="description" content=""><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
  3. <link href="<?php echo env('APP_URL'); ?>/css/weixin/style.css" type="text/css" rel="stylesheet">
  4. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/jquery.min.js"></script>
  5. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/weixin/mobile.js"></script></head><body style="background-color:#f1f1f1;">
  6. <div class="classreturn loginsignup">
  7. <div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
  8. <div class="ds-in-bl tit center"><span>领券中心</span></div>
  9. <?php if(isset($_SESSION['weixin_user_info']['access_token'])){ ?><div class="ds-in-bl nav_menu"><a href="<?php echo route('weixin_user_bonus_list'); ?>" style="color:#999;">我的优惠券</a></div><?php } ?>
  10. </div>
  11. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
  12. <style>
  13. .bonus_list .flow-have-adr{padding:10px;margin:10px;background-color:#fff;}
  14. .bonus_list .f-h-adr-title .ect-colory{color:#f45239;font-size:32px;}
  15. .bonus_list .f-h-adr-title label{font-size:18px;color:#2e2e2e;margin-right:5px;}
  16. .bonus_list .f-h-adr-con{color:#616161;margin-top:5px;margin-bottom:5px;font-size:14px;}
  17. .bonus_list .adr-edit-del{margin-top:10px;padding-top:8px;border-top:1px dashed #ddd;line-height:22px;color:#a0a0a0;font-size:14px;}
  18. </style>
  19. <div class="bonus_list">
  20. <?php if($list){foreach($list as $k=>$v){ ?>
  21. <a href="javascript:;" onclick="getbonus(<?php echo $v['id']; ?>)">
  22. <div class="flow-have-adr">
  23. <p class="f-h-adr-title"><label><?php echo $v['name']; ?></label><span class="ect-colory fr"><small>¥</small><?php echo $v['money']; ?></span><div class="cl"></div></p>
  24. <p class="f-h-adr-con">有效期至<?php echo $v['end_time']; ?> <span class="fr">满<?php echo $v['min_amount']; ?>可用</span></p>
  25. <!-- <div class="adr-edit-del">说明</div> -->
  26. </div>
  27. </a>
  28. <?php }}else{ ?>
  29. <div style="text-align:center;line-height:40px;color:#999;">暂无记录</div>
  30. <?php } ?>
  31. </div>
  32. <script>
  33. $(function(){
  34. var ajaxload = false;
  35. var maxpage = false;
  36. var startpage = 1;
  37. var totalpage = <?php echo $totalpage; ?>;
  38. var tmp_url = window.location.href;
  39. msg = tmp_url.split("#");
  40. tmp_url = msg[0];
  41. $(window).scroll(function ()
  42. {
  43. var listheight = $(".bonus_list").outerHeight();
  44. if ($(document).scrollTop() + $(window).height() >= listheight)
  45. {
  46. if(startpage >= totalpage)
  47. {
  48. //$("#submit_bt_one").html("已是最后一页,没有更多数据!");
  49. return false;
  50. }
  51. if(!ajaxload && !maxpage)
  52. {
  53. ajaxload = true;
  54. //$("#submit_bt_one").html("努力加载中...");
  55. var url = tmp_url;
  56. var nextpage = startpage+1;
  57. $.get(url,{page_ajax:1,page:nextpage},function(res)
  58. {
  59. if(res)
  60. {
  61. $(".bonus_list").append(res);
  62. startpage++;
  63. if(startpage >= totalpage)
  64. {
  65. maxpage = true;
  66. //$("#submit_bt_one").html("已是最后一页,没有更多数据!");
  67. }
  68. else
  69. {
  70. //$("#submit_bt_one").html("点击加载更多");
  71. }
  72. ajaxload = false;
  73. }
  74. else
  75. {
  76. //$("#submit_bt_one").html("请求失败,请稍候再试!");
  77. ajaxload = false;
  78. }
  79. },'json');
  80. }
  81. }
  82. });
  83. });
  84. function getbonus(bonus_id)
  85. {
  86. var url = '<?php echo env('APP_API_URL').'/user_bonus_add'; ?>';
  87. var access_token = '<?php if(isset($_SESSION['weixin_user_info']['access_token'])){echo $_SESSION['weixin_user_info']['access_token'];} ?>';
  88. if(access_token=='')
  89. {
  90. //提示
  91. layer.open({
  92. content: '请先登录'
  93. ,skin: 'msg'
  94. ,time: 2 //2秒后自动关闭
  95. });
  96. setTimeout("location.href = '<?php echo route('weixin_login',array('return_url'=>route('weixin_bonus_list'))); ?>'",1000);
  97. return false;
  98. }
  99. $.post(url,{bonus_id:bonus_id,access_token:access_token},function(res)
  100. {
  101. if(res.code==0)
  102. {
  103. //提示
  104. layer.open({
  105. content: '获取成功'
  106. ,skin: 'msg'
  107. ,time: 2 //2秒后自动关闭
  108. });
  109. location.href = '<?php echo route('weixin_user_bonus_list'); ?>';
  110. }
  111. else
  112. {
  113. layer.open({
  114. content: res.msg
  115. ,skin: 'msg'
  116. ,time: 2 //2秒后自动关闭
  117. });
  118. }
  119. },'json');
  120. }
  121. </script>
  122. @include('weixin.common.footer')
  123. </body></html>