welfare-service-hundred.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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/main.css" />
  12. <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  13. <script type="text/javascript">
  14. // 屏蔽分享
  15. window.hiddenAllWechatMenu = true;
  16. </script>
  17. </head>
  18. <body>
  19. <div class="mui-content">
  20. <img src="images/coupon_hunderd.jpg" style="margin: 5%;width: 90%;"/>
  21. <div style="text-align: center; margin-bottom: 20px;">
  22. <button type="button" class="my-btn-receive fulishe" style="width: 168px;height: 38px;padding: 0px;">立即领取</button>
  23. <!--<div class="mui-content-padded">
  24. <h6>你的笑容,我来守护右上角点击,分享给好友,守护他/她的笑容</h6>
  25. </div>-->
  26. </div>
  27. </div>
  28. <!-- 加载ing begin-->
  29. <div class="loading covers">
  30. <div class="loading-bj"></div>
  31. <p>正在加载...</p>
  32. </div>
  33. <!-- 加载ing end -->
  34. <script type="text/javascript" src="js/mui.min.js"></script>
  35. <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  36. <script type="text/javascript" src="js/main.js"></script>
  37. <script type="text/javascript" src="js/wechat-utils-1.0.js"></script>
  38. <script type="text/javascript">
  39. window.addEventListener('pageshow', function(e) {
  40. // 通过persisted属性判断是否存在 BF Cache
  41. if(e.persisted) {
  42. location.reload();
  43. }
  44. });
  45. var notReceive=null; //先判断是否领取过
  46. mui.ready(function(){
  47. var newDate = new Date();
  48. var limitedDate = new Date(2018, 3, 23, 0, 0, 0, 0); //2018.4.23
  49. if(newDate > limitedDate){
  50. mui.alert("活动已过期!", function() {
  51. location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
  52. });
  53. return false;
  54. }
  55. console.log("页面加载完毕");
  56. $(".loading").hide().css("opacity", "0");//隐藏(正在加载...)
  57. // var src = location.href;
  58. // src = "https://s.iamberry.com/soodo/wechat/welfare-service.html";
  59. // window.wxFriend = {
  60. // "appId": "",
  61. // "imgUrl": 'https://s.iamberry.com/soodo/wechat/images/indexShare.jpg',
  62. // "link": src,
  63. // "desc": '让你的齿龄停留在18岁',
  64. // "title": "【soodo上朵】柔性声波电动牙刷,赠送您100元现金券",
  65. // "netError": "您的网络异常,请刷新重试!如多次刷新无效,请向我们反应 ~",
  66. // "shareTimeSuccess": "分享成功",
  67. // "shareTimeCancel": "已取消分享",
  68. // "shareAppSuccess": "分享成功!",
  69. // "shareAppCancel": "已取消分享"
  70. // };
  71. //
  72. });
  73. mui('body').on('tap', '.fulishe', function(event) {
  74. if(notReceive){
  75. addAewPeople();
  76. }else{
  77. mui.openWindow({
  78. url: 'pro-list.html'
  79. });
  80. }
  81. });
  82. mui('body').on('tap', '.goToShopping', function(event) {
  83. location.href="pro-details.html?colorId=44";
  84. });
  85. $.ajax(base_path + '/wechat/coupon/isReceive?dates=' + new Date().getTime(), {
  86. data: {
  87. couponId : 30000 //优惠券类型id
  88. },// 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. notReceive=1;
  102. } else {
  103. if(dt.resultCode == "501"){
  104. mui.alert("活动已过期!", function() {
  105. location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
  106. });
  107. return false;
  108. }else{
  109. $(".fulishe").text("已领取 去下单");
  110. }
  111. }
  112. }
  113. },
  114. error: function(xhr, type, errorThrown) {
  115. console.log(xhr);
  116. mui.alert("领取现金券失败!网络错误");
  117. }
  118. });
  119. //领取新人现金券
  120. function addAewPeople(){
  121. if(notReceive){
  122. $.ajax(base_path + '/wechat/coupon/receive_coupon?dates=' + new Date().getTime(), {
  123. data: {
  124. couponId : 30000 //优惠券类型id
  125. },// ajax参数 没有则不写
  126. dataType: 'json',
  127. xhrFields: {
  128. withCredentials: true
  129. },
  130. crossDomain: true,
  131. type: 'get',
  132. timeout: 15000,
  133. success: function(dt) {
  134. if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
  135. location.href = dt.redirectURL;
  136. } else {
  137. if(dt.status) {//判断接口返回状态status
  138. mui.alert("领取成功!");
  139. notReceive=null;
  140. $(".fulishe").text("已领取 去下单");
  141. } else {
  142. if(dt.resultCode == "501"){
  143. mui.alert("活动已过期!", function() {
  144. location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
  145. });
  146. return false;
  147. }else{
  148. mui.alert("领取失败!");
  149. }
  150. }
  151. }
  152. },
  153. error: function(xhr, type, errorThrown) {
  154. console.log(xhr);
  155. mui.alert("领取新人现金券失败!网络错误");
  156. }
  157. });
  158. }
  159. }
  160. </script>
  161. </body>
  162. </html>