|
@@ -0,0 +1,118 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <title>领取优惠券</title>
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
|
|
|
+ <meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
+ <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="css/main.css" />
|
|
|
+ <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ // 屏蔽分享
|
|
|
+ window.hiddenAllWechatMenu = true;
|
|
|
+ </script>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <!--<div class="mui-content">
|
|
|
+ <img src="images/coupon_hunderd.jpg" style="margin: 5%;width: 90%;"/>
|
|
|
+ <div style="text-align: center; margin-bottom: 20px;">
|
|
|
+ <button type="button" class="my-btn-receive fulishe" style="width: 168px;height: 38px;padding: 0px;">立即领取</button>
|
|
|
+ </div>
|
|
|
+ </div>-->
|
|
|
+ <!-- 加载ing begin-->
|
|
|
+ <div class="loading covers">
|
|
|
+ <div class="loading-bj"></div>
|
|
|
+ <p>正在加载...</p>
|
|
|
+ </div>
|
|
|
+ <!-- 加载ing end -->
|
|
|
+ <script type="text/javascript" src="js/mui.min.js"></script>
|
|
|
+ <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
|
|
|
+ <script type="text/javascript" src="js/main.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+
|
|
|
+ window.addEventListener('pageshow', function(e) {
|
|
|
+ // 通过persisted属性判断是否存在 BF Cache
|
|
|
+ if(e.persisted) {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var notReceive=null; //先判断是否领取过
|
|
|
+
|
|
|
+ var couponId = getParam("couponId");//从URL带过来的优惠券id
|
|
|
+ var isFirst = getParam("isFirst");//1
|
|
|
+
|
|
|
+ mui.ready(function(){
|
|
|
+ if(isFirst != 1 ){
|
|
|
+ location.href = "welfare-receive-coupon.html?couponId="+ couponId +"&isFirst="+ 1 +"&dates=" + new Date().getTime(); // 前往首页
|
|
|
+ }
|
|
|
+
|
|
|
+ var newDate = new Date();
|
|
|
+ var limitedDate = new Date(2018, 6, 9, 0, 0, 0, 0);
|
|
|
+ if(newDate > limitedDate){
|
|
|
+ mui.alert("活动已过期!", function() {
|
|
|
+ WeixinJSBridge.call('closeWindow');
|
|
|
+ wx.closeWindow();
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("页面加载完毕");
|
|
|
+ $(".loading").hide().css("opacity", "0");//隐藏(正在加载...)
|
|
|
+
|
|
|
+ receiceCoupon();
|
|
|
+ });
|
|
|
+
|
|
|
+ //领取新人现金券
|
|
|
+ function receiceCoupon(){
|
|
|
+ $.ajax(base_path + '/wechat/coupon/re_coupon?dates=' + new Date().getTime(), {
|
|
|
+ data: {
|
|
|
+ couponId : couponId //优惠券类型id
|
|
|
+ },// ajax参数 没有则不写
|
|
|
+ dataType: 'json',
|
|
|
+ xhrFields: {
|
|
|
+ withCredentials: true
|
|
|
+ },
|
|
|
+ crossDomain: true,
|
|
|
+ type: 'get',
|
|
|
+ timeout: 15000,
|
|
|
+ success: function(dt) {
|
|
|
+ if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
|
|
|
+ location.href = dt.redirectURL;
|
|
|
+ } else {
|
|
|
+ if(dt.status) {//判断接口返回状态status
|
|
|
+ mui.alert("领取成功!", function() {
|
|
|
+ location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ if(dt.resultCode == "500" || dt.resultCode == "502" || dt.resultCode == "503"){
|
|
|
+ mui.alert(dt.message, function() {
|
|
|
+ //刷新
|
|
|
+ WeixinJSBridge.call('closeWindow');
|
|
|
+ wx.closeWindow();
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ var myjson = JSON.stringify(dt);
|
|
|
+ mui.alert("领取失败!" + myjson);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(xhr, type, errorThrown) {
|
|
|
+ console.log(xhr);
|
|
|
+ mui.alert("领取优惠券失败!网络错误");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|