welfare-service.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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="http://s.iamberry.com/soodo/wechat/css/mui.min.css" />
  10. <link rel="stylesheet" type="text/css" href="http://s.iamberry.com/soodo/wechat/css/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="http://s.iamberry.com/soodo/wechat/css/main.css" />
  12. <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  13. <!--<script>
  14. window.repleFlag = true;
  15. window.repleWxData = {
  16. "imgUrl":'https://w.iamberry.com/tooth/common/images/soodoShare.jpg',
  17. "link":window.location.href.split("#")[0],
  18. "desc":"让你的“笑容停留在18岁”",
  19. "title":"【soodo上朵】柔性声波电动牙刷,赠送您60元现金券",
  20. };
  21. </script>-->
  22. </head>
  23. <body>
  24. <div class="mui-content">
  25. <img width="100%" src="images/youhuiquan-details.jpg" />
  26. <div style="padding: 40px 0;text-align: center;">
  27. <button type="button" class="my-btn-receive">立即领取</button>
  28. <div class="mui-content-padded">
  29. <h6>右上角点击“...”分享给好友哟!</h6>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- 加载ing begin-->
  34. <div class="loading covers">
  35. <div class="loading-bj"></div>
  36. <p>正在加载...</p>
  37. </div>
  38. <!-- 加载ing end -->
  39. <script type="text/javascript" src="js/mui.min.js"></script>
  40. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  41. <script type="text/javascript" src="js/main.js"></script>
  42. <!-- <script type="text/javascript" src="js/wechat-utils-1.0.js"></script>
  43. --> <script type="text/javascript">
  44. mui.ready(function(){
  45. console.log("页面加载完毕");
  46. $(".loading").hide().css("opacity", "0");//隐藏(正在加载...)
  47. });
  48. mui('body').on('tap', '.my-btn-receive', function(event) {
  49. if(notReceive){
  50. addAewPeople();
  51. }else{
  52. mui.openWindow({
  53. url: 'pro-list.html'
  54. });
  55. }
  56. });
  57. var notReceive=null;
  58. //先判断是否领取过
  59. $.ajax(base_path + '/wechat/coupon/getIsReceive?dates=' + new Date().getTime(), {
  60. data: {},// ajax参数 没有则不写
  61. dataType: 'json',
  62. xhrFields: {
  63. withCredentials: true
  64. },
  65. crossDomain: true,
  66. type: 'get',
  67. timeout: 15000,
  68. success: function(dt) {
  69. if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
  70. location.href = dt.redirectURL;
  71. } else {
  72. if(dt.status) {//判断接口返回状态status
  73. notReceive=1;
  74. } else {
  75. $("button").text("已领取 去下单");
  76. }
  77. }
  78. },
  79. error: function(xhr, type, errorThrown) {
  80. console.log(xhr);
  81. mui.alert("领取优惠券失败!网络错误");
  82. }
  83. });
  84. //领取新人优惠券
  85. function addAewPeople(){
  86. if(notReceive){
  87. $.ajax(base_path + '/wechat/coupon/addAewPeople?dates=' + new Date().getTime(), {
  88. data: {},// ajax参数 没有则不写
  89. dataType: 'json',
  90. xhrFields: {
  91. withCredentials: true
  92. },
  93. crossDomain: true,
  94. type: 'get',
  95. timeout: 15000,
  96. success: function(dt) {
  97. if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
  98. location.href = dt.redirectURL;
  99. } else {
  100. if(dt.status) {//判断接口返回状态status
  101. mui.alert("领取成功!");
  102. notReceive=null;
  103. $("button").text("已领取 去下单");
  104. } else {
  105. mui.alert("领取失败!");
  106. }
  107. }
  108. },
  109. error: function(xhr, type, errorThrown) {
  110. console.log(xhr);
  111. mui.alert("领取新人优惠券失败!网络错误");
  112. }
  113. });
  114. }
  115. }
  116. </script>
  117. </body>
  118. </html>