coupon.index.js
8.37 KB
webpackJsonp([18],[function(e,n,o){var t,s,i=o(1),d=i("#orderCode").html(),a=i("#oldUserCouponPic").html(),l=i("#newUserCouponPic").html(),r=i("#tipMessage").html(),c=i("#activityID").html(),m=(i("#pageInfo").html(),"http://www.yohoshow.com/api/wechat/getSignPackage"),h=i("#shareTitle").val(),u=i("#shareImg").val(),p=i("#shareDesc").val(),g=i("#shareLink").val(),C=window.wx;i("#phone").bind("input propertychange",function(){11===i(this).val().length?i(".input-content div").eq("0").addClass("verification-code"):(i(".input-content div").eq("0").removeClass(),i(this).val().length>=1?i(".input-content i").eq("0").removeClass("hidden"):i(".input-content i").eq("0").addClass("hidden"))}),i("#verification").bind("input propertychange",function(){4===i(this).val().length?i(".input-content div").eq("1").addClass("get"):(i(".input-content div").eq("1").removeClass(),i(this).val().length>=1?i(".input-content i").eq("1").removeClass("hidden"):i(".input-content i").eq("1").addClass("hidden"))}),i("#activityEnded").html()&&(i(".tip-wrap").removeClass("hidden"),i(".tip-wrap .title").html(r)),i("#newUser").html()||i(".gain-coupon-centent .coupon img").attr("src",a),"undefined"!=typeof C&&(i.getJSON(m+"?pageurl="+encodeURIComponent(location.href.split("#")[0])+"&callback=?",function(e){var n,o,t,s;e&&(n=e.appId.toString(),o=e.timestamp,t=e.nonceStr.toString(),s=e.signature.toString(),C.config({debug:!1,appId:n,timestamp:o,nonceStr:t,signature:s,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"]}))}),C.ready(function(){var e={title:h,desc:p,imgUrl:u,link:g};C.onMenuShareAppMessage(e),C.onMenuShareTimeline(e),C.onMenuShareQQ(e),C.onMenuShareWeibo(e)})),i(".input-content div").on("click",function(){return t=i(this).siblings("input").val(),s=/[0-9]{11}/,s.test(t)?void i.ajax({url:"/activity/coupon/phone",data:{mobile:i("#phone").val(),ordercode:d},success:function(e){if(200===e.result.code)if(window._yas&&window._yas.sendCustomInfo({activityID:c,returnCode:e.result.returnCode},!1),e.result.newUser?i(".gain-coupon-centent .coupon img").attr("src",l):i(".gain-coupon-centent .coupon img").attr("src",a),e.result.ended)i(".tip-wrap").removeClass("hidden"),i(".tip-wrap .title").html(e.result.message);else if(e.result.geted)i(".page .gain-coupon-centent").removeClass("hidden"),i(".page .coupon-centent").addClass("hidden"),i("#mobile").html("优惠券已放至"+e.result.mobile);else if(e.result.newUser)i(".coupon-centent .phone-input-content").addClass("hidden"),i(".coupon-centent .vertify-input-content").removeClass("hidden");else{if(e.result.wrongNumb)return i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400);if(e.result.oldUserAskCouponOnceMore)return i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">您今天已经领过咯,速度去有货购潮流!<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" "),i(".page .gain-coupon-centent").removeClass("hidden"),i(".page .coupon-centent").addClass("hidden"),i("#mobile").html("优惠券已放至"+e.result.mobile)},2500)}else i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">网络错误<p>'),setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400)},error:function(){i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">网络错误,稍后再试!<p>'),setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400)}}):(i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400))}),i(".input-content").on("click",".get",function(){i(".input-content div").eq("1").removeClass("get"),4===i(this).siblings("input").val().length?i.ajax({url:"/activity/coupon/verify",data:{identifycode:i("#verification").val(),mobile:i("#phone").val(),ordercode:d},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?i(".gain-coupon-centent .coupon img").attr("src",l):i(".gain-coupon-centent .coupon img").attr("src",a),e.result.ended)i(".tip-wrap").removeClass("hidden"),i(".tip-wrap .title").html(e.result.message);else if(e.result.geted)i(".page .gain-coupon-centent").removeClass("hidden"),i(".page .coupon-centent").addClass("hidden"),i("#mobile").html("优惠券已发放至账户"+e.result.mobile);else if(e.result.newUser)i(".coupon-centent .phone-input-content").addClass("hidden"),i(".coupon-centent .vertify-input-content").removeClass("hidden");else{if(e.result.wrongNumb)return i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">手机号错误,请重新输入。<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400);if(e.result.vertifyWrong)return i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">验证码错误,请重新输入。<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400);if(e.result.oldUserAskCouponOnceMore)return i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">您今天已经领过咯,速度去有货购潮流!<p>'),void setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" "),i(".page .gain-coupon-centent").removeClass("hidden"),i(".page .coupon-centent").addClass("hidden"),i("#mobile").html("优惠券已发放至账户"+e.result.mobile)},2500)}else i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">'+e.result.message+"<p>"),setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400)},error:function(){i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">网络错误,稍后再试!<p>'),setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400)}}):(i("#dialog").removeClass("hidden"),i(".mask").removeClass("hidden"),i("#dialog .content").html('<p class="phone-error">验证码错误,请重新输入。<p>'),setTimeout(function(){i(".messages").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")},1400))}),i(".close").on("click",function(){i(".dialog").addClass("hidden"),i(".mask").addClass("hidden"),i("#dialog .content").html(" ")}),i(".coupon-description span").on("click",function(){i("#message").removeClass("hidden"),i(".mask").removeClass("hidden")}),i(".description").on("click",function(){i("#message").removeClass("hidden"),i(".mask").removeClass("hidden")}),i(".use-coupon-btn").on("click",function(){window._yas&&window._yas.sendCustomInfo({activityID:c},!0)}),i(".input-content .clear-mobile").on("click",function(){i(".input-content input").eq("0").val(""),i(this).addClass("hidden"),i(".input-content div").eq("0").removeClass()}),i(".input-content .clear-verify").on("click",function(){i(".input-content input").eq("1").val(""),i(this).addClass("hidden"),i(".input-content div").eq("1").removeClass()})}]);