coupon.index.js 12.2 KB
webpackJsonp([18],[function(e,n,o){var t,i,s=o(1),a=s("#orderCode").html(),d=s("#oldUserCouponPic").html(),r=s("#newUserCouponPic").html(),l=s("#tipMessage").html(),c=s("#activityID").html(),h="http://www.yohoshow.com/api/wechat/getSignPackage",u=s("#shareTitle").val(),m=s("#shareImg").val(),p=s("#shareDesc").val(),g=s("#shareLink").val(),v=window.wx;o(3),s("#phone").bind("input propertychange",function(){11===s(this).val().length?s(".input-content div").eq("0").addClass("verification-code"):(s(".input-content div").eq("0").removeClass(),s(this).val().length>=1?s(".input-content i").eq("0").removeClass("hidden"):s(".input-content i").eq("0").addClass("hidden"))}),s("#verification").bind("input propertychange",function(){4===s(this).val().length?s(".input-content div").eq("1").addClass("get"):(s(".input-content div").eq("1").removeClass(),s(this).val().length>=1?s(".input-content i").eq("1").removeClass("hidden"):s(".input-content i").eq("1").addClass("hidden"))}),s("#activityEnded").html()&&(s(".tip-wrap").removeClass("hidden"),s(".tip-wrap .title").html(l)),s("#newUser").html()||s(".gain-coupon-centent .coupon img").attr("src",d),"undefined"!=typeof v&&(s.getJSON(h+"?pageurl="+encodeURIComponent(location.href.split("#")[0])+"&callback=?",function(e){var n,o,t,i;e&&(n=e.appId.toString(),o=e.timestamp,t=e.nonceStr.toString(),i=e.signature.toString(),v.config({debug:!1,appId:n,timestamp:o,nonceStr:t,signature:i,jsApiList:["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","translateVoice","startRecord","stopRecord","onRecordEnd","playVoice","pauseVoice","stopVoice","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getNetworkType","openLocation","getLocation","hideOptionMenu","showOptionMenu","closeWindow","scanQRCode","chooseWXPay","openProductSpecificView","addCard","chooseCard","openCard"]}))}),v.ready(function(){var e={title:u,desc:p,imgUrl:m,link:g};v.onMenuShareAppMessage(e),v.onMenuShareTimeline(e),v.onMenuShareQQ(e),v.onMenuShareWeibo(e)})),s(".phone-input-content  div").on("click",function(){return t=s(this).siblings("input").val(),i=/[0-9]{11}/,i.test(t)?void s.ajax({url:"/activity/coupon/phone",data:{mobile:s("#phone").val(),ordercode:a},success:function(e){if(200===e.result.code)if(window._yas&&window._yas.sendCustomInfo({activityID:c,returnCode:e.result.returnCode},!1),e.result.newUser?s(".gain-coupon-centent .coupon img").attr("src",r):s(".gain-coupon-centent .coupon img").attr("src",d),e.result.ended)s(".tip-wrap").removeClass("hidden"),s(".tip-wrap .title").html(e.result.message);else if(e.result.geted)s(".page .gain-coupon-centent").removeClass("hidden"),s(".page .coupon-centent").addClass("hidden"),s("#mobile").html("优惠券已放至账户"+e.result.mobile);else if(e.result.newUser)s(".coupon-centent .phone-input-content").addClass("hidden"),s(".coupon-centent .vertify-input-content").removeClass("hidden");else{if(e.result.wrongNumb)return s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400);if(e.result.oldUserAskCouponOnceMore)return s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">您今天已经领过咯,速度去有货购潮流!<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" "),s(".page .gain-coupon-centent").removeClass("hidden"),s(".page .coupon-centent").addClass("hidden"),s("#mobile").html("优惠券已放至账户"+e.result.mobile)},2500)}else s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">网络错误<p>'),setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400)},error:function(){s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">网络错误,稍后再试!<p>'),setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400)}}):(s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400))}),s(".vertify-input-content").on("click",".get",function(){s(".input-content div").eq("1").removeClass("get"),4===s(this).siblings("input").val().length?s.ajax({url:"/activity/coupon/verify",data:{identifycode:s("#verification").val(),mobile:s("#phone").val(),ordercode:a},dataType:"json",success:function(e){if(200===e.result.code)if(window._yas&&window._yas.sendCustomInfo({activityID:c,returnCode:e.result.returnCode},!1),e.result.newUser?s(".gain-coupon-centent .coupon img").attr("src",r):s(".gain-coupon-centent .coupon img").attr("src",d),e.result.ended)s(".tip-wrap").removeClass("hidden"),s(".tip-wrap .title").html(e.result.message);else if(e.result.geted)s(".page .gain-coupon-centent").removeClass("hidden"),s(".page .coupon-centent").addClass("hidden"),s("#mobile").html("优惠券已放至账户"+e.result.mobile);else if(e.result.newUser)s(".coupon-centent .phone-input-content").addClass("hidden"),s(".coupon-centent .vertify-input-content").removeClass("hidden");else{if(e.result.wrongNumb)return s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400);if(e.result.vertifyWrong)return s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">验证码错误,请重新输入。<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400);if(e.result.oldUserAskCouponOnceMore)return s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">您今天已经领过咯,速度去有货购潮流!<p>'),void setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" "),s(".page .gain-coupon-centent").removeClass("hidden"),s(".page .coupon-centent").addClass("hidden"),s("#mobile").html("优惠券已放至账户"+e.result.mobile)},2500)}else s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">'+e.result.message+"<p>"),setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400)},error:function(){s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">网络错误,稍后再试!<p>'),setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400)}}):(s("#dialog").removeClass("hidden"),s(".mask").removeClass("hidden"),s("#dialog .content").html('<p class="phone-error">验证码错误,请重新输入。<p>'),setTimeout(function(){s(".messages").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")},1400))}),s(".close").on("click",function(){s(".dialog").addClass("hidden"),s(".mask").addClass("hidden"),s("#dialog .content").html(" ")}),s(".coupon-description span").on("click",function(){s("#message").removeClass("hidden"),s(".mask").removeClass("hidden")}),s(".description").on("click",function(){s("#message").removeClass("hidden"),s(".mask").removeClass("hidden")}),s(".use-coupon-btn").on("click",function(){window._yas&&window._yas.sendCustomInfo({activityID:c},!0)}),s(".input-content .clear-mobile").on("click",function(){s(".input-content input").eq("0").val(""),s(this).addClass("hidden"),s(".input-content div").eq("0").removeClass()}),s(".input-content .clear-verify").on("click",function(){s(".input-content input").eq("1").val(""),s(this).addClass("hidden"),s(".input-content div").eq("1").removeClass()})},,,function(e,n,o){function t(e){var n,o,t=document.cookie;return document.cookie&&""!==document.cookie&&(o=t.indexOf(e+"="),o>-1&&(o+=e.length+1,n=decodeURIComponent(m.trim(t.substring(o,t.indexOf(";",o)))))),n}function i(e,n,o){var t,i,s,a,d="";"undefined"!=typeof n&&(o=o||{},null===n&&(n="",o.expires=-1),o.expires&&("number"==typeof o.expires||o.expires.toUTCString)&&("number"==typeof o.expires?(a=new Date,a.setTime(a.getTime()+24*o.expires*60*60*1e3)):a=o.expires,d="; expires="+a.toUTCString()),t=o.path?"; path="+o.path:"",i=o.domain?"; domain="+o.domain:"",s=o.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(n),d,t,i,s].join(""))}function s(){var e=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!==document.cookie.indexOf("testcookie")),e}function a(){var e,n=t("_UID");return"undefined"==typeof n?0:(e=n.split("::"),"undefined"==typeof e||e.length<4?0:e)}function d(){var e=a();return 0===e?0:e[1]}function r(){var e=t("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function l(){var e;0!==g.length&&(e=Math.min(m(window).height(),window.screen.availHeight),m("body").height()<=e-parseInt(g.css("height"),0)?g.addClass("bottom"):g.removeClass("bottom"))}function c(e){var n=m(e).outerHeight();e&&g.css("margin-bottom",n+"px")}function h(){var e,n,o=[],t=window.location.search.slice(1).split("&");for(n=0;n<t.length;n++)e=t[n].split("="),o.push(e[0]),o[e[0]]=e[1];return o}function u(e){return e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var m=o(1),p=o(4),g=m("#yoho-footer"),v=m(".yoho-page"),f=m(".yoho-header");!function(){var e,n=g.children(".op-row"),o=m(".back-to-top"),t=a();l(),0===t?n.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):n.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+t[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index">退出</a>'),o.length>0&&(e=new p(o[0]),e.on("tap",function(e){return m(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),g.removeClass("hide")}(),function(e,n,o,t,i){var s=n.createElement(o),a=n.getElementsByTagName(o)[0];e.YohoAcquisitionObject=i,e[i]=function(){e[i].p=arguments},s.async=1,s.src=t,a.parentNode.insertBefore(s,a)}(window,document,"script",("https:"===document.location.protocol?"https":"http")+"://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js","_yas"),function(){var e=d();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.17","yohobuy_m",e,"","")}(),f.on("touchstart","a",function(){f.find("a").removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel","a",function(){m(this).removeClass("highlight")}),v.on("touchstart",".tap-hightlight",function(){m(this).siblings(".tap-hightlight").removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){m(this).removeClass("highlight")}),m(".nav-home").on("touchstart",function(){m(".homebuttom").toggleClass("hide")}),function(){var e,n,o=0,t="webkit moz ms o".split(" "),i=window.requestAnimationFrame,s=window.cancelAnimationFrame;for(n=0;n<t.length&&(!i||!s);n++)e=t[n],i=i||window[e+"RequestAnimationFrame"],s=s||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];i&&s||(i=function(e){var n=(new Date).getTime(),t=Math.max(0,16-(n-o)),i=window.setTimeout(function(){e(n+t)},t);return o=n+t,i},s=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=i,window.cancelAnimationFrame=s}(),m.extend({queryString:h}),11===g.find(".user-name").text().length&&g.find(".user-name").html(u(g.find(".user-name").text())),window.cookie=t,window.setCookie=i,window.isCookiesEnabled=s,window.getUser=a,window.getUid=d,window.getShoppingKey=r,window.rePosFooter=l,window.reMarginFooter=c,window.queryString=h()}]);