index.js 174 KB
define("index",["jquery","handlebars","source-map","index","lazyload","dot","jquery.placeholder"],function(e,t,a){var i;e("js/common"),e("js/header"),e("js/simple-header"),e("js/product/entry"),e("js/index/index"),e("js/brand/index"),e("js/passport/entry"),e("js/cart/cart"),e("js/home/entry"),e("js/order/ensure"),a.exports=i}),define("js/common",["jquery"],function(e,t,a){function i(e){var t=new RegExp(e+"=([^;$]*)","i"),a="$1";return t.test(decodeURIComponent(document.cookie))?RegExp[a]:""}function n(e,t,a){var i,n,o,s,r="";"undefined"!=typeof t&&(a=a||{},null===t&&(t="",a.expires=-1),a.expires&&("number"==typeof a.expires||a.expires.toUTCString)&&("number"==typeof a.expires?(s=new Date,s.setTime(s.getTime()+24*a.expires*60*60*1e3)):s=a.expires,r="; expires="+s.toUTCString()),i=a.path?"; path="+a.path:"",n=a.domain?"; domain="+a.domain:"",o=a.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,i,n,o].join(""))}function o(){var e,t=i("_UID");return"undefined"==typeof t?0:(e=t.split("::"),"undefined"==typeof e||e.length<4?0:e)}function s(){var e=o();return 0===e?0:e[1]}function r(){var e=i("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function d(){var e,t,a={},i=window.location.search,n=i?decodeURIComponent(i).slice(1).split("&"):[];for(t=0;t<n.length;t++)e=n[t].split("="),a[e[0]]=e[1];return a}var l=e("jquery"),c=l("body");e("js/footer"),function(e,t,a,i,n){var o=t.createElement(a),s=t.getElementsByTagName(a)[0];e.YohoAcquisitionObject=n,e[n]=function(){e[n].p=arguments},o.async=1,o.src=i,s.parentNode.insertBefore(o,s)}(window,document,"script","http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js","_yas"),function(){var e=s();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.14","yohobuy_web",e,"","")}(),l(window).on("resize",function(){var e=l(this).width();1360>e?l(".return-top").addClass("min"):l(".return-top").removeClass("min"),1180>e?c.addClass("min-screen"):c.removeClass("min-screen")}).trigger("resize"),function(){l(window).load(function(){var e,t=document.getElementById("user-thumb");t&&(e=new Image,e.src=t.src,e.onerror=function(){l(t).parent().append('<div class="default-user-thumb"></div>').end().remove()})})}(),window.cookie=i,window.setCookie=n,window.getUser=o,window.getUid=s,window.getShoppingKey=r,window.queryString=d}),define("js/footer",["jquery"],function(e,t,a){function i(){var e=s("#subscriber-box"),t=s("#subscriber-btn"),a=/^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/,i={mail:"&#xe61b;",tick:"&#xe61a"};e.focus(function(){s(this).val("").css("color",""),t.removeClass("done").html(i.mail)}),t.click(function(){var n=s.trim(e.val());if(""!==n&&a.test(n))try{s.ajax({url:"http://new.yohobuy.com/common/emailsubscriber",dataType:"jsonp",data:{email:n,tmp:Math.random(),uid:window.getUid()},success:function(a){1===a.data.result?(e.val("已订阅到:"+n),t.addClass("done").html(i.tick)):e.css("color","red")}})}catch(o){console.log(o.message)}else e.css("color","red")})}function n(){var e=s(".vote"),t=s("#feed-back-page"),a=e.children("li").length;t.on("click","span",function(){var t=s(this);t.hasClass("cur")||(t.siblings(".cur").removeClass("cur"),t.addClass("cur"),e.children().not(".hide").addClass("hide").end().eq(t.index()).removeClass("hide"))}),e.on("click",".feed-back-btn",function(){var i=s(this),n=i.closest("li"),o=n.index(),r=[],d=n.find(".feedback-answer").val(),l=n.find(".feedback-id").val(),c=n.find(".question-id").val();n.find(":checked").each(function(){r.push(s(this).val())}),s.ajax({url:"http://new.yohobuy.com/common/suggestfeedback",dataType:"jsonp",data:{feedback_id:l||0,question_id:c||0,answer:d||"",solution:r.join(",")},success:function(i){var s=o+1;if(1===~~i.data.result){if(o===a-1)return void alert("感谢您的参与!");n.addClass("hide"),e.children(":eq("+(o+1)+")").removeClass("hide"),t.children(".cur").removeClass("cur"),t.children(":eq("+s+")").addClass("cur")}}})})}function o(){s(window).height()>s(document).height()&&r.addClass("hide")}var s=e("jquery"),r=s(".return-top");r.click(function(){s("html,body").animate({scrollTop:0},500)}),s(window).scroll(function(){0===s(window).scrollTop()?r.addClass("hide"):r.removeClass("hide")}),r.hasClass("hide")&&s("img").load(o),i(),n(),window.rePosReturnTop=o}),define("js/header",["jquery","handlebars","source-map","index"],function(e,t,a){function i(e,t,a){try{te.push({louceng:e,weizhi:t,event:a})}catch(i){}}function n(){var e=G("#nav_keyword").text(),t="vans",a=G("#query_key");""!==e?(a.css({color:"#000"}),a.val(e)):(a.css({color:"#e0e0e0"}),a.val(t),a.on("focus",function(e){a.css({color:"#000"}),a.val("")}))}function o(){var e={cookie:"_g",cartNum:""},t="",a="",i=0,n=0,o=0,s=0,r="";G.fn.miniCart=function(i){if(t=G.extend(e,i),"undefined"==typeof window.cookie(t.cookie))a=null;else if(t.cookie)try{a=Z.parse(window.cookie(t.cookie))}catch(n){}null!==a&&""!==a&&(s=parseInt(a._nac)+parseInt(a._ac),0===s?G("#icart-num").attr("class","icart-num icart-none"):G("#icart-num").attr("class","icart-num"),G(t.cartNum).html(s))},G.fn.search=function(e){function t(t){var a=G.trim(G(t).val());return a=a.replace(new RegExp("'","gm"),""),""===a?(G(".search-list").hide(),!1):(a=encodeURI(a),void G.get(e+"?query="+a,function(e){G(".search-list").html(e.data),i=G(".search-list").children("li").length,n=-1,i>0?G(".search-list").show():G(".search-list").hide(),G(".search-list").find("a").hover(function(){G(this).css("background-color","#eee")},function(){G(this).css("background-color","#fff")})},"jsonp"))}function a(e){G(".search-list li:eq("+o+")").children("a").css("background-color","#fff"),G(".search-list li:eq("+n+")").children("a").css("background-color","#eee"),r=G(".search-list li:eq("+n+")").children("a").attr("title"),G("#query_key").val(r)}return this.each(function(){G(this).keyup(function(e){if(38===e.which){if(0===i)return!1;-1===n&&(n=0),o=n,n=(n-1+i)%i,a(this)}else if(40===e.which){if(0===i)return!1;o=n,n=(n+1)%i,a(this)}else 13===e.which?window.submitSearch():t(this)})})},G.extend({getData:function(e,t,a){var i={page:1,method:"",v:1,return_type:"jsonp",open_key:"12345",tmp:Math.random()},n="";if(void 0===typeof e||""===e)return!1;if(n=G.extend(i,t),n.page=n.page||1,""===n.method)return!1;try{G.getJSON(e+"/?callback=?",n,function(e){return""!==a?("undefined"!=typeof a(e.data)&&Z.parse(a(e.data)),!1):void 0})}catch(o){console.log(o.message)}},getShoppingKey:function(){var e,t=window.cookie("_g"),a=Z.parse(t);return"undefined"==typeof t||null===t?(e=window.cookie("_SPK"),e?e:""):a._k}})}function s(e){var t;200===+e.code&&"object"==typeof e.data&&(t=""!==e.data.url?'<a target="_blank" href="'+e.data.url+'" class="page-top-banner"style="height:36px;border:none;background-image:url('+window.unescape(e.data.src)+');background-position: center;display:block;">&nbsp;</a>':'<div class="noticewrapper"><div class="noticecontainer"><h1 class="noticetitle">关于系统升级的公告</h1><div class="noticecontent"><p class="tips">尊敬的顾客:</p><p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p><p class="detail">系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常</p><p class="detail">使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p></div></div></div>',G("body").prepend(t))}function r(e){var t=document.createElement("script");t.src=le+e+"&client_type=web&callback=JsonPCallBack",document.getElementsByTagName("head")[0].appendChild(t)}function d(e,t){var a,i;G(e).hover(function(e){e.preventDefault(),a=G(this),i=G(t)[0],""===i.style.display?(a.addClass("acttags"),i.style.display="block"):(a.removeClass("acttags"),i.style.display="")})}function l(){var e,t,a=[{sourceClass:".myyoho",targetClass:".myyoho-info"},{sourceClass:".phone",targetClass:".qr"}];for(t=0;t<a.length;t++)e=a[t],d(e.sourceClass,e.targetClass)}function c(){var e;G(".yohogroup").mouseenter(function(){e=G(this),e.text(e.attr("cn"))}),G(".yohogroup").mouseleave(function(){e=G(this),e.text(e.attr("en"))})}function u(){var e,t,a=["webkit","moz","ms"];for(t=0;t<a.length;t++)return e=a[t]+"RequestAnimationFrame",window[e]?!0:!1}function p(){var e=["webkit","moz","ms"],t=e[0]+"RequestAnimationFrame",a=e[1]+"RequestAnimationFrame",i=e[2]+"RequestAnimationFrame";return window[t]?function(e){requestAnimationFrame(e)}:window[a]?function(e){window[a](e)}:window[i]?function(e){window[i](e)}:function(e){window.setTimeout(e,67)}}function h(){ie+=10,ne.css({transform:"rotateX("+ie+"deg)","-webkit-transform":"rotateX("+ie+"deg)","-moz-transform":"rotateX("+ie+"deg)"}),ie/90%2===1&&(oe?(ne.css("background-image","url(http://static.yohobuy.com/newheader/img/logo1.png)"),oe=!1):(ne.css("background-image","url(http://static.yohobuy.com/newheader/img/logo_e.png)"),oe=!0)),ie/90%2===0&&ie%360!==0?window.setTimeout(h,3e3):ie%360===0?window.setTimeout(h,6e4):ae(function(){h()})}function f(){R&&window.clearTimeout(R),ne.fadeOut(se,function(){oe=!1,ne.css("background-image","url(http://static.yohobuy.com/newheader/img/logo.png)"),ne.fadeIn(se,function(){H=window.setTimeout(function(){ne.fadeOut(se,function(){window.clearTimeout(H),oe=!0,ne.css("background-image","url(http://static.yohobuy.com/newheader/img/logo_e.png)"),ne.fadeIn(se,function(){R=window.setTimeout(f,6e4)})})},3e3)})})}function m(){u()?(ae=p(),window.setTimeout(h,3e3)):window.setTimeout(f,3e3)}function v(e){var t=G(e);t.find(".thirdnavbar").each(function(){var e=G(this),t=e.find("a"),a=t.attr("href"),i="hot"===t.attr("hot")?!0:!1,n={};n=e.hasClass("category-title")?{type:"title",height:49,content:e.text(),index:window.valueIndex,href:a,hot:!1}:{type:"catlist",height:36,content:t.text(),index:window.valueIndex,href:a,hot:i},window.valueIndex++,window.newArr.push(n)})}function g(){var e=window.newArr.length,t=0,a=[],i=[],n=[],o=[],s="",r="",d="",l=0,c=0,u=0;for(t;e>t;t++){if(a=window.newArr[t],0===window.gindex&&(window.oh1=window.oh1+a.height,window.oh1>=340&&t!==e-1&&(window.targetArr1=window.newArr.slice(0,a.index+1),window.nowIndex=a.index+1,window.gindex++),t===e-1)){window.targetArr1=window.newArr.slice(0,e+1);break}if(1===window.gindex&&(window.oh2=window.oh2+a.height,window.oh2>=340&&t!==e-1&&(window.targetArr2=window.newArr.slice(window.nowIndex,a.index+1),window.nowIndex=a.index+1,window.gindex++),t===e-1)){window.targetArr2=window.newArr.slice(window.nowIndex,e+1);break}if(2===window.gindex){if(window.oh3=window.oh3+a.height,window.oh3>=340&&t!==e-1){window.targetArr3=window.newArr.slice(window.nowIndex,a.index+1),window.nowIndex=a.index+1,window.gindex++;break}if(t===e-1){window.targetArr3=window.newArr.slice(window.nowIndex,e+1);break}}}for(l;l<window.targetArr1.length;l++)i=window.targetArr1[l]||{},"title"===i.type?window.inner1=window.inner1+'<li class="cattitle"><h3><a  href="'+i.href+'">'+i.content+"</a></h3></li>":i.hot===!0?window.inner1=window.inner1+'<li class="catdetail"><a  class="thirdcatelink hot" href="'+i.href+'">'+i.content+"</a></li>":window.inner1=window.inner1+'<li class="catdetail"><a  class="thirdcatelink" href="'+i.href+'">'+i.content+"</a></li>";for(c;c<window.targetArr2.length;c++)n=window.targetArr2[c]||{},"title"===n.type?window.inner2=window.inner2+'<li class="cattitle"><h3><a  href="'+n.href+'">'+n.content+"</a></h3></li>":n.hot===!0?window.inner2=window.inner2+'<li class="catdetail"><a  class="thirdcatelink hot" href="'+n.href+'">'+n.content+"</a></li>":window.inner2=window.inner2+'<li class="catdetail"><a  class="thirdcatelink" href="'+n.href+'">'+n.content+"</a></li>";for(u;u<window.targetArr3.length;u++)o=window.targetArr3[u]||{},"title"===o.type?window.inner3=window.inner3+'<li class="cattitle"><h3><a  href="'+o.href+'">'+o.content+"</a></h3></li>":o.hot===!0?window.inner3=window.inner3+'<li class="catdetail"><a  class="thirdcatelink hot" href="'+o.href+'">'+o.content+"</a></li>":window.inner3=window.inner3+'<li class="catdetail"><a  class="thirdcatelink" href="'+o.href+'">'+o.content+"</a></li>";""!==window.inner1&&(s='<ul class="cate_row1 cate_row">'+window.inner1+"</ul>"),""!==window.inner2&&(r='<ul class="cate_row2 cate_row">'+window.inner2+"</ul>"),""!==window.inner3&&(d='<ul class="cate_row3 cate_row">'+window.inner3+"</ul>"),window.finalresult=s+r+d,G("#"+window.wrapperindex).empty().append(window.finalresult)}function y(){G(".categorywrapper").each(function(e){window.wrapperindex=G(this).attr("id"),window.newArr=[],window.gindex=0,window.targetArr1=[],window.targetArr2=[],window.targetArr3=[],window.oh1=0,window.oh2=0,window.oh3=0,window.valueIndex=0,window.nowIndex=0,window.inner1="",window.inner2="",window.inner3="",v(G(this).find(".category")),g()})}function w(){var e={},t="",a="",i="",n="",o="";G(document).on("mouseenter",".sub-nav-item",function(){t=G(this).find(".showdetail").attr("data-code"),t&&(e[t]||(e[t]=t,a=G(this).find(".showdetail").find("img"),i=G(this).find(".showdetail").find(".title"),n=G(this).find(".showdetail").find("a"),G.get(le+t+"&width=337&height=250&client_type=web",function(e){a.attr("src",e.data.src),n.attr("href",e.data.url),i.text(e.data.title)},"jsonp")))}),o=G(".cure").find(".name-cn").find("a").attr("href"),G(".main-link").attr("href",o)}function b(){var e=G("#cover");e.remove()}function C(){var e,t=window.cookie("_Gender"),a="",n="",o="",s="";"http://www.yohobuy.com/"!==window.location.href||"undefined"!=typeof t&&""!==t&&null!==t||G.get("http://www.yohobuy.com/index/guide",function(t){a=document.createElement("div"),a.id="cover",a.innerHTML=t,document.body.appendChild(a),n=G(window).height(),o=G(".guide-box").height(),e=n/2-o/2,s=G(".guide-box .clear").find("li").length,G(".guide-box").css({width:200*s+"px",top:e+"px"}),G("#cover").bind("click",function(e){window.setCookie("_Gender","1,3",{path:"/",domain:".yohobuy.com",expires:90}),window.setCookie("_Channel","boys",{path:"/",domain:".yohobuy.com",expires:7}),b()}),G("#cover .guide-box .close").bind("click",function(e){i("弹窗","CLOSE","homepage_man"),window.setCookie("_Gender","1,3",{path:"/",domain:".yohobuy.com",expires:90}),window.setCookie("_Channel","boys",{path:"/",domain:".yohobuy.com",expires:7}),b()}),G(".boys img , .boys .go").bind("click",function(e){i("弹窗","BOYS","homepage_man"),window.setCookie("_Gender","1,3",{path:"/",domain:".yohobuy.com",expires:90}),window.setCookie("_Channel","boys",{path:"/",domain:".yohobuy.com",expires:7}),b()}),G(".girls img, .girls .go").bind("click",function(e){i("弹窗","GIRLS","homepage_woman"),window.setCookie("_Gender","2,3",{path:"/",domain:".yohobuy.com",expires:90}),window.setCookie("_Channel","girls",{path:"/",domain:".yohobuy.com",expires:7})}),G(".lifestyle img, .lifestyle .go").bind("click",function(e){window.setCookie("_Channel","lifestyle",{path:"/",domain:".yohobuy.com",expires:7}),i("弹窗","LIEFSTYLE","homepage_lifestyle")}),G("#cover .guide-box").bind("click",function(e){e.stopPropagation()})})}function n(){var e=G("#nav_keyword").text(),t=G("#defaultsearch").val(),a=G("#query_key");""!==e?(a.css({color:"#000"}),a.val(e)):(a.css({color:"#e0e0e0"}),a.val(t),a.on("focus",function(e){a.css({color:"#000"}),a.val("")}))}function x(){var e=window.cookie("_Gender"),t=G(".cure");"undefined"!=typeof e&&""!==e&&window.setCookie("_Gender",1,{path:"/",domain:".yohobuy.com",expires:7}),"男生"===t.find(".name-cn a").text()&&(window.setCookie("_Gender","1,3",{path:"/",domain:".yohobuy.com",expires:7}),window.setCookie("_Channel","boys",{path:"/",domain:".yohobuy.com",expires:7})),"女生"===t.find(".name-cn a").text()&&window.setCookie("_Gender","2,3",{path:"/",domain:".yohobuy.com",expires:7}),"创意生活"===t.find(".name-cn a").text()&&window.setCookie("_Channel","lifestyle",{path:"/",domain:".yohobuy.com",expires:7}),"潮童"===t.find(".name-cn a").text()&&window.setCookie("_Channel","kids",{path:"/",domain:".yohobuy.com",expires:7})}function k(){G(".first-nav-item").click(function(){var e=window.cookie("_Gender");"undefined"!=typeof e&&""!==e&&window.setCookie("_Gender",1,{path:"/",domain:".yohobuy.com",expires:7}),"男生"===G(this).find(".name-cn a").text()&&(window.setCookie("_Gender","1,3",{path:"/",domain:".yohobuy.com",expires:7}),window.setCookie("_Channel","boys",{path:"/",domain:".yohobuy.com",expires:7})),"女生"===G(this).find(".name-cn a").text()&&(window.setCookie("_Gender","2,3",{path:"/",domain:".yohobuy.com",expires:7}),window.setCookie("_Channel","girls",{path:"/",domain:".yohobuy.com",expires:7})),"创意生活"===G(this).find(".name-cn a").text()&&window.setCookie("_Channel","lifestyle",{path:"/",domain:".yohobuy.com",expires:7}),"潮童"===G(this).find(".name-cn a").text()&&window.setCookie("_Channel","kids",{path:"/",domain:".yohobuy.com",expires:7})})}function j(){var e,t,a,i=document.cookie,n=i.split(";");for(e=0;e<n.length;e++)t=n[e].split("="),"undefined"!=typeof t[0]&&(a=t[0].replace(/\s/g,""),de[a]=t[1])}function _(){G("#miniCartBox").miniCart({cartNum:".ic-infomation"})}function q(){var e,t,a;G.getData(X,{method:"open.Shoppingcart.getCartData",shopping_key:G.getShoppingKey()},function(i){""===J&&(J=Y.compile(G("#mini-cart-tpl").html())),G("#miniCartBox").children(".gobuy-wrapper").html(J({carData:i})),0===parseInt(G(".ic-infomation").html())&&G("#miniCartBox .gobuy-wrapper").html('<div class="gobuy-empty"><h3 class="information">您的购物车暂无商品</h3></div>'),G("#miniCartBox .goods-list li").length<1&&(e=window.cookie("_g"),t=Z.parse(e),null!==t&&(a='{"_k":"'+t._k+'","_nac":0,"_ac":0,"_r":0}',window.setCookie("_g",a,{path:"/",domain:".yohobuy.com"})),G(".ic-infomation").html(0),G("#miniCartBox .gobuy-wrapper").html('<div class="gobuy-empty"><h3 class="information">您的购物车暂无商品</h3></div>'))})}function I(e,t){G.getData(X,{method:"open.Shoppingcart.delone",shopping_key:G.getShoppingKey(),id:e,isreduce:t},function(e){var t=window.cookie("_g"),a=Z.parse(t),i='{"_k":"'+a._k+'","_nac":'+e.total_goods_num+',"_ac":0,"_r":0}';window.setCookie("_g",i,{path:"/",domain:".yohobuy.com"}),q(),_()})}function T(){var e,t,a;G(document).on("click",".goodscardelete",function(i){e=G(this),t=e.attr("goodsid"),a=e.attr("cheapest"),I(t,a)})}function A(){var e;G(document).on("click",".mycart_i_down",function(t){e=G(this),e.toggleClass("mycart_i_up"),G("#mycartmore").slideToggle(300)})}function D(){var e,t="http://www.yohobuy.com/shopping/cart";G("#miniCartBox").on("click",function(a){e=G(a.target),e.hasClass("gobuy")&&(window.location.href=t)})}function S(e){1===e?(G("#miniCartBox").addClass("list-cur"),G(".gobuy-wrapper").show(),0!==parseInt(G(".ic-infomation").html())?(G("#miniCartBox .gobuy-wrapper").html('<div class="gobuy-loading"><h3 class="information">加载中,请稍后</h3></div>'),q()):G("#miniCartBox .gobuy-wrapper").html('<div class="gobuy-empty"><h3 class="information">您的购物车暂无商品</h3></div>')):(G("#miniCartBox").removeClass("list-cur"),G(".gobuy-wrapper").hide())}function E(){var e;G("#miniCartBox").mouseenter(function(t){e=G(t.target),("miniCartBox"===e.attr("id")||"ic-infomation"===e.attr("class"))&&S(1)}),G("#miniCartBox").mouseleave(function(e){S(0)})}function $(){var e,t="indexkids",a="indexlifestyle",i="indexboys",n="indexgirls",o="uniquebrand",s=window.location.href,d=window.location.host,l="";-1!==s.indexOf("search")&&(l=re["search"+de._Channel]),-1!==s.indexOf("list")&&(l=re["list"+de._Channel]),-1!==s.indexOf("brands")&&(l=re["brands"+de._Channel]),-1!==s.indexOf("new")&&(l=re["new"+de._Channel]),-1!==s.indexOf("sale")&&(l=re["sale"+de._Channel]),-1!==s.indexOf("home")&&(l=re["home"+de._Channel]),-1!==s.indexOf("kids")&&(l=re[t]),(-1!==s.indexOf("woman")||-1!==s.indexOf("girls"))&&(l=re[n]),-1!==s.indexOf("lifestyle")&&(l=re[a]),-1!==s.indexOf("www.yohobuy.com")&&"/"===window.location.pathname&&(l=re[i]),e=d.split(".")[0],"list"!==e&&"search"!==e&&"www"!==e&&"new"!==e&&"item"!==e&&"guang"!==e&&(l=re[o+de._Channel]),r(l)}function z(e){G(".hot-brands").find("ul").stop().animate({opacity:0,"z-index":1},200).eq(e).animate({opacity:1,"z-index":2},200)}function O(){var e,t=0;G(".hot-brands").size()>0&&(e=G(".hot-brands").find("ul").size(),G(".hot-brands").find("ul").eq(0).css({opacity:1,"z-index":2}),G(".brands-control").on("click",".next",function(){t===e-1?t=0:t++,z(t)}),G(".brands-control").on("click",".prev",function(){0===t?t=e-1:t--,z(t)}))}function P(){setInterval(_,2e3)}function N(){var e=G("#goodcartempwarpper"),t="";e&&e.html()&&(t=G("#goodcartempwarpper").html().replace(/\\/g,""),G("#goodcartempwarpper").html(t),Q=Y.compile(G("#tmpl-my-login-new").html()))}function L(){var e="http://search.yohobuy.com/api/suggest";G("#query_key").search(e)}function F(e){var t=(new Date).getTime(),a='<span>Hi~</span>[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out ">请登录</a>]&nbsp;[<a href="http://www.yohobuy.com/reg.html" class="list-a login-out" onclick="">免费注册</a>]',i='<span>Hi~<a href="http://www.yohobuy.com/home?t='+t+'">{{user_name}}</a></span>&nbsp;{{#if islogin}}[<a href="{{logout}}" class="list-a login-out">退出</a>]{{/if}}{{#unless islogin}}[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>]&nbsp;[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]{{/unless}}',n=G("#loginBox"),o=window.cookie("_UID"),s=e.data.profile_name,r=0,d=0,l="",c=o.split("::"),u=c[0]||" ",p="http://www.yohobuy.com/logout_",h="1",f=0,m={user_name:s,logout:p+e.data.token+".html",random:Math.random()};if(W=Y.compile(i),"undefined"==typeof o||null===o)return n.html(a),!1;if("undefined"==typeof c||c.length<4)return n.html(a),!1;for(d;d<u.length;d++)l=u.substr(d,1),r+=/.*[\u4e00-\u9fa5]+.*$/.test(l)?2:1;if(10>=r)s=u;else{for(f=0,d;d<u.length;d++)10>f&&(l=u.substr(d,1),"*"!==l&&(f+=/.*[\u4e00-\u9fa5]+.*$/.test(l)?2:1),s+=l);s.length<u.length&&(s+="...")}p=/http:\/\//.test(c[3])?c[3].replace("www.yohobuy.com","www.yohobuy.com"):"http://www.yohobuy.com/logout_"+c[3]+".html",-1===e.result&&(h="-1"),m.islogin=h,n.html(W(m))}function U(e){var t=e.data,a="";if(1===e.result){if(void 0===typeof t||t.length<1)return!1;"3"===t.vip.curVipInfo.curLevel&&(t.vip3=!0),G("#myYohoBox").mouseenter(function(){return G(this).addClass("acttags"),G("#myYohoBox .myyoho-info").show().html(Q(t)),a=G(".myyoho-photo img").attr("data-url"),1===G._checkUrlState?void G(".myyoho-photo").show().find("img").attr("src",a):void(""!==a&&""===G._checkUrl&&G.ajax({url:a,type:"GET",complete:function(e){(200===e.status||0===e.status)&&(G(".myyoho-photo").show().find("img").attr("src",a),G._checkUrlState=1),G._checkUrl=a}}))}),G("#myYohoBox").mouseleave(function(){G(this).removeClass("acttags"),G("#myYohoBox .myyoho-info").hide()})}}function B(){var e={method:"open.passport.get"};G.getData(X,e,function(e){-1!==e.result?(F(e),U(e)):window.setCookie("_UID","",{domain:".yohobuy.com",expires:-1})})}function M(){y(),w(),N(),C(),x(),k(),j(),o(),c(),l(),m(),$(),O(),n(),E(),_(),P(),L(),D(),T(),A(),B(),n()}var R,H,G=e("jquery"),Y=e("handlebars"),Z=e("index"),Q=null,W=null,X=G("#api-domain").val(),J="",V=/^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/]{0,}$/g,K="",ee="",te=[],ae=null,ie=0,ne=G(".icon-logo"),oe=!0,se=500,re={listboys:"4f78b0f418fc42314d8b6e791cfb7fa8",listgirls:"00c1f025a51b6b597dc37925951ea27d",listkids:"b02df11184727701ade1b6de9737d08c",listlifestyle:"fd35c52dced0c880976ba858346d1fc5",searchboys:"9fb8986ea700cc27a8057361c3924394",searchgirls:"e3e207a1443ca60c8037fe52a5560c18",searchkids:"620fc77f479da8feaeb06f2324e5d0bb",searchlifestyle:"a3c93301c6ffaf3ed0f36a4a451be36d",uniquebrandboys:"2ebb0810c0d1a67e5229149c9c3aba7d",uniquebrandgirls:"99e23385f4ba4b65f406b7e2968ac821",uniquebrandkids:"a74ebc9b17840c91b9ea46568111fe6b",uniquebrandlifestyle:"0e8c81ead53f56302baa4d0ad967f527",brandsboys:"77b352db07129c76a9d532acad149f9f",brandsgirls:"bf047f16e52ebc38be5ce9c7623831e6",brandskids:"e3ae1ce9b5e13c6d271ef3eccb831652",brandslifestyle:"e4ac8029c30f65d7f1af030980d140fe",newboys:"869d3c5f3b450fb52101d00a61ce87cb",newgirls:"d953b6dfdac02483d1dcce8d96055954",newkids:"0874cb6d75df8e0e78f2d475e53ecc08",newlifestyle:"43e8fc8e178115c262bbce2bd0012db7",saleboys:"c846e3165c994769b4201d8c32f3ae9b",salegirls:"52b1d389edcbc62d65de71b80c4d6ad0",salekids:"ad8b1703c761ba00973868ab5199cc27",salelifestyle:"7acc64905c70ac91846f43fb2cec4bbd",homeboys:"b0856a771ef1b59ab1234c74688fa42d",homegirls:"2bd61fa12e4933211518f70fe5ce3c48",homekids:"895c59e8c64b40399c9533509507320c",homelifestyle:"2e037d4e25d2767352ca3e0a4627f7bd",indexboys:"0c911d3000f52e8ca7cffb74f5864c29",indexgirls:"b645b8980c423ab30485e0a9d08c2ef7",indexkids:"17f6d5d5d454d2c507bc5fcbc90f7756",indexlifestyle:"735cd393e841762af8793c346abbbc36"},de={},le="http://new.yohobuy.com/common/getbanner?content_code=";G("#api-domain").remove(),window.submitSearch=function(){var e,t,a=G("#query_key").val(),n=G("#defaultsearch").val(),o="Search",s="Head Search",r="Search";if(e=G.trim(K.toLowerCase()),t=G.trim(a.toLowerCase()),i(o,s,r),""!==ee&&""!==K&&e===t)location.href=ee.replace("'","");else{if(!V.test(a)||""===a)return""===a&&G("#query_key").val(n),G("#searchForm").submit(),!1;location.href="http://search.yohobuy.com/error?query="+a+"&result=error"}},Y.registerHelper("timestamp",function(){return(new Date).getTime()}),Y.registerHelper("headerimg",function(e){return""===e?"http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100":e}),Y.registerHelper("equallevelthree",function(e,t){return"3"===e?t.fn(this):t.inverse(this)}),Y.registerHelper("notzero",function(e,t){return"0"!==e?t.fn(this):t.inverse(this)}),window.JsonPCallBack=s,window.newArr=[],window.wrapperindex=0,window.gindex=0,window.targetArr1=[],window.targetArr2=[],window.targetArr3=[],window.oh1=0,window.oh2=0,window.oh3=0,window.valueIndex=0,window.nowIndex=0,window.inner1="",window.inner2="",window.inner3="",window.finalresult="",M()}),define("js/simple-header",["jquery"],function(e,t,a){function i(e){var t,a,i,n=0,o=0;for(i=0;i<e.length;i++)a=e.substr(i,1),o+=/.*[\u4e00-\u9fa5]+.*$/.test(a)?2:1;if(10>=o)t=e;else{for(n=0,t="",i=0;i<e.length;i++)10>n&&(a=e.substr(i,1),"*"!==a&&(n+=/.*[\u4e00-\u9fa5]+.*$/.test(a)?2:1),t+=a);t.length<e.length&&(t+="...")}return t}function n(e){var t,a,n=e.data;-1!==e.result?(a=i(n.profile_name),t='<span>Hi~</span><a href="http://www.yohobuy.com/home?t='+n.random+'">'+a+'</a>&nbsp;<a href="http://www.yohobuy.com/logout_'+n.token+'.html">[退出]</a>'):t='<span>Hi~</span>&nbsp;<a href="http://www.yohobuy.com/signin.html">[请登录]</a>&nbsp;<a href="http://www.yohobuy.com/reg.html">[免费注册]</a>',s(".header-tool li").eq(0).html(t)}function o(){var e={return_type:"jsonp",method:"open.passport.get"};s.getJSON(d+"/?callback=?",e,function(e){e&&e.data&&n(e.data)})}var s=e("jquery"),r=s("#api-domain"),d=r.val();r.remove(),s(".simple-header").size()>0&&s(".tool-options").on("mouseenter",function(){s(this).find(".tool-select").fadeIn()}).on("mouseleave",function(){s(this).find(".tool-select").fadeOut()}),o()}),define("js/product/entry",["jquery","handlebars","source-map","lazyload","index"],function(e,t,a){e("js/product/list"),e("js/product/brand"),e("js/product/hotrank"),e("js/product/item")}),define("js/product/list",["jquery","handlebars","source-map","lazyload"],function(e,t,a){e("js/product/filter"),e("js/product/sort-pager"),e("js/product/latest-walk"),e("js/product/product")}),define("js/product/filter",["jquery","handlebars","source-map"],function(e,t,a){function i(e,t){e.each(function(){v(this).closest(".attr").hasClass("checked")||v(this).removeClass("checked").html(y.unchecked)}),t.find(".checkbox").addClass("checked").html(y.checked)}function n(){b.addClass("hide"),x.removeClass("hide")}function o(){x.addClass("hide"),b.removeClass("hide"),q.children("span").removeClass("hover")}function s(e,t){var a,i=window.queryString();i[e]=t,a="?"+decodeURIComponent(v.param(i)),window.location.href=a}function r(e){D.children(".senior-sub:eq("+m+")").addClass("hide"),S.children(".attr:eq("+m+")").removeClass("hover"),m=-1}var d,l,c,u,p,h,f,m,v=e("jquery"),g=e("handlebars"),y={unchecked:"&#xe635;",checked:"&#xe636;"},w={up:"&#xe610;",down:"&#xe600;"},b=v(".brand .default"),C=v("#brand-search-input"),x=v(".brand .brand-panel"),k=x.find(".attr"),j=v("#brand-more"),_=v("#brand-multi"),q=v(".brands-index"),I=v(".ud-price-range"),T=/^\d+$/,A=v(".sort-sub-wrap"),D=v(".senior-sub-wrap"),S=v(".senior-attr-wrap"),E='{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',$={},z=v(".filter-box .size");E=g.compile(E),v(".filter-box").on("selectstart",".attr, .brands-index span",function(){return!1}),v(".sort-pre").on("click","li",function(){var e=v(this),t=e.index(),a=e.data("id");return e.hasClass("active")?(e.removeClass("active"),A.children(":eq("+t+")").addClass("hide"),void z.addClass("hide")):(e.siblings(".active").removeClass("active"),e.addClass("active"),A.children(":not(.hide)").addClass("hide"),A.children(":eq("+t+")").removeClass("hide"),void(z.data("load")||($[a]?(z.find(".attr-content").html($[a]),z.removeClass("hide")):v.ajax({url:"/product/search/sortSize",data:{msort:a}}).then(function(e){"array"===v.type(e)&&e.length?($[a]=E({size:e}),z.find(".attr-content").html($[a]),z.removeClass("hide")):z.addClass("hide")}))))}),j.length>0&&(d=j.children("em"),l=j.children(".iconfont")),_.click(function(){"none"===x.css("display")&&j.trigger("click"),n(),x.removeClass("hide").addClass("multi"),v(this).addClass("hide"),j.addClass("hide")}),j.click(function(){var e=v(this);e.hasClass("more")?(o(),d.text("更多"),l.html(w.down),C.val("").trigger("keyup")):(n(),d.text("收起"),l.html(w.up)),v(this).toggleClass("more")}),q.on("mouseenter","span",function(){var e=v(this),t=e.data("index");e.hasClass("hover")||setTimeout(function(){e.siblings("span.hover").removeClass("hover"),e.addClass("hover"),0===e.index()?k.removeClass("hide"):k.addClass("hide").filter("[data-index="+t+"]").removeClass("hide")},120)}),C.keyup(function(){var e=v(this).val().toLowerCase();""===e?k.removeClass("hide"):k.addClass("hide").filter('[data-key*="'+e+'"]').removeClass("hide")}),v("#brand-multi-ok").click(function(){var e=[];v(this).hasClass("dis")||(x.find("span.checked").each(function(){e.push(v(this).data("id"))}),s("brand",e.join(",")))}),v(".multi-select-cancel").click(function(){var e=v(this).closest(".multi");e.hasClass("brand-panel")&&(_.removeClass("hide"),j.trigger("click"),j.removeClass("hide"),C.val("").trigger("keyup"),o()),e.addClass("hide").removeClass("multi"),i(e.find(".checkbox.checked"),e.find(".attr.checked")),v(this).siblings(".multi-select-ok").addClass("dis")}),v(".check-container").on("click",".attr",function(){var e=v(this),t=e.find(".checkbox"),a=e.closest(".brand-panel, .senior-sub").find(".multi-select-ok");t.toggleClass("checked"),t.hasClass("checked")?t.html(y.checked):t.html(y.unchecked),t.hasClass("checked")||e.siblings(".attr").find(".checked").length>0?a.removeClass("dis"):a.addClass("dis")}),v(".brand, .senior").on("click",".attr > a",function(e){v(this).closest(".multi").length>0&&e.preventDefault()}),v(".filter-box").on("click","li.checked, a.checked",function(e){e.preventDefault()}),I.length>0&&(c=I.find(".limit"),u=c.filter(".min"),p=c.filter(".max"),h=I.find(".price-sure"),c.keyup(function(){var e,t,a,i=v.trim(v(this).val()),n=T.test(i);n||(e=parseInt(i,10),v(this).val(isNaN(e)?"":e)),t=v.trim(u.val()),a=v.trim(p.val()),""!==t||""!==a?h.removeClass("hide"):h.addClass("hide")}),h.click(function(){var e,t=v.trim(u.val()),a=v.trim(p.val());""!==t&&""!==a&&+t>+a&&(e=a,a=t,t=e),s("price",t+","+a)})),S.on("mouseenter",".attr",function(){var e=v(this),t=e.index();e.hasClass("no-sub")||(e.addClass("hover").siblings().removeClass("hover"),D.children(".senior-sub:eq("+t+")").removeClass("hide").siblings().addClass("hide"))}).on("mouseleave",".attr",function(){var e=v(this),t=e.index();e.hasClass("no-sub")||(m=t,f=setTimeout(function(){r()},100))}),v(".senior-sub").on("click",".multi-select",function(){v(this).closest(".senior-sub").addClass("multi")}).on("click",".multi-select-ok",function(){var e=v(this),t=e.closest(".senior-sub"),a=[];e.hasClass("dis")||(t.find("span.checked").each(function(){a.push(v(this).data("id"))}),s(t.data("attr"),a.join(",")))}).on("mouseenter",function(){
clearTimeout(f)}).on("mouseleave",function(){r()})}),define("js/product/sort-pager",["jquery"],function(e,t,a){var i=e("jquery"),n=i("#count-per-page"),o=n.next("ul"),s=200;i(document).click(function(e){i(e.target).closest(".page-count").length>0||o&&o.slideUp(s)}),n.click(function(){"none"===o.css("display")?o.slideDown(s):o.slideUp(s)})}),define("js/product/latest-walk",["jquery","handlebars","source-map","lazyload"],function(e,t,a){var i=e("jquery"),n=e("handlebars"),o=e("lazyload"),s=i("#latest-walk-count");!function(){var e;0!==s.length&&(e=n.compile(i("#latest-walk-tpl").html()),i.ajax({url:"http://itemapi.yohobuy.com/item/item/recentreview",dataType:"jsonp",data:{limit:s.val()},success:function(t){var a,n,s,r=[];if(200===t.code){if(a=t.data,0===a.length)return void i(".latest-walk").addClass("hide");for(n=0;n<a.length;n++)s=a[n],r.push({href:s.url,img:s.pic_url,name:s.product_name,salePrice:s.price,marketPrice:s.market_price});r.length>0&&(i("#latest-walk-goods").html(e({latestWalk:r})),o(i("#latest-walk-goods .lazy")))}}}))}()}),define("js/product/product",["jquery","lazyload"],function(e,t,a){var i,n=e("jquery"),o=e("lazyload"),s=e("js/common/product-event"),r=n(".goods-container"),d=r.find(".good-info"),l=r.find(".good-item-wrapper"),c=r.find(".good-info-main"),u=r.find(".good-select-color"),p=n(".product-list-nav");o(n("img.lazy")),t.init=function(e){function t(e,t){var a,i,n,o="",s=e.length,r=4,d=Math.ceil(s/r),l=0;for(a=0;d>a;a++)for(o+="<ul>",i=0;r>i&&(n=a*r+i,n!==s);i++)o+='<li><a target="_blank" href="'+e[a*r+i].url+t+'"><img src="'+e[a*r+i].src+'" data-cover="'+e[a*r+i].coverImg+'" /></a></li>',i===r-1&&(o+="</ul>",l++);return d>l&&(o+="</ul>"),{colorListStr:o,ulNum:d}}function a(){c.html(""),u.html(""),l.css({display:"none"})}i=null,d.unbind(),i=s(d,e),i.addHandler("MouseEnter",function(e){var i,o,s,d,p,h,f,m,v=10,g=35,y="",w=e.target.attr("data-from")||"";n.ajax({type:"POST",url:"/product/list/getProductPic",dataType:"jsonp",jsonp:"callback",data:{skn:e.target.attr("data-skn")}}).then(function(b){var C=b.data,x=t(C.pics,w);a(),y=x.colorListStr,i=x.ulNum,c.append(e.targetDuplicate),u.append(n(y)),h=l.css("paddingLeft"),f=l.css("paddingTop"),m=r.css("paddingTop"),o=10+65*i+e.targetWidth,d=(e.targetX-1)*(e.targetWidth+v)-(parseInt(h)+1),p=(e.targetY-1)*(e.targetHeight+g)+parseInt(m)-(parseInt(f)+1),s=e.offsetR-(65*i+25),0>=s&&(d=d+s-25),l.css({width:o,left:d,top:p,display:"inline-block"}),C.pics[0]&&C.pics[0].src&&c.find(".good-thumb img").attr("src",C.pics[0].src)})}),l.mouseleave(function(){a()})},n(document).on("hover",".good-select-color li",function(){var e=n(this).find("img").attr("data-cover"),t=n(this).closest(".good-item-wrapper").find(".good-detail-img").find("img");t.attr("src",e)}),p.find("h3").click(function(e){var t=n(this).closest(".product-list-nav");t.hasClass("active")?t.find(".sort-child-list").stop(!0,!0).slideUp():t.find(".sort-child-list").stop(!0,!0).slideDown(),t.toggleClass("active")})}),define("js/common/product-event",["jquery"],function(e,t,a){function i(){this.handlers={}}var n=e("jquery");i.prototype={constructor:i,addHandler:function(e,t){"undefined"==typeof this.handlers[e]&&(this.handlers[e]=[]),this.handlers[e].push(t)},fire:function(e){var t,a;if(e.target||(e.target=this),this.handlers[e.type]instanceof Array)for(t=this.handlers[e.type],a=0;a<t.length;a++)t[a](e)},removeHandler:function(e,t){var a,i;if(this.handlers[e]instanceof Array){for(a=this.handlers[e],i=0;i<a.length&&a[i]!==t;i++);a.splice(i,1)}}},a.exports=function(e,t){function a(e){var a,i=0,l=0,c=t,u=0,p="",h=0,f=0;switch(e.type){case"mouseenter":a=n(this),p=a.clone(),u=a.index()+1,i=u%c===0?c:u%c,l=Math.ceil(u/c),h=a.offset().left,f=d-(h+s),o.fire({type:"MouseEnter",target:a,targetWidth:s,targetHeight:r,targetX:i,targetY:l,rowWidth:c,activeIndex:u,targetDuplicate:p,offsetL:h,offsetR:f});break;case"mouseleave":o.fire({type:"MouseLeave"})}}var o=new i,s=e.eq(0).width(),r=e.eq(0).height(),d=n(window).width();return e.bind("mouseenter",a),o}}),define("js/product/brand",["jquery"],function(e,t,a){var i=e("jquery"),n=i("#brand-favor"),o=n.data("id");n.on("click",function(){i.ajax({type:"post",url:"/product/index/favoriteBrand",data:{brandId:o}}).then(function(e){200===e.code?"add"===e.message?n.find("i").addClass("coled"):n.find("i").removeClass("coled"):403===e.code&&(location.href="http://www.yohobuy.com/signin.html?refer="+encodeURIComponent(location.href))})}),i.ajax({type:"POST",url:"/product/index/isFavoriteBrand",data:{brandId:o}}).then(function(e){200===e.code?n.find("i").addClass("coled"):404===e.code&&n.find("i").removeClass("coled")})}),define("js/product/hotrank",["jquery","handlebars","source-map","lazyload"],function(e,t,a){var i=e("jquery"),n=e("handlebars"),o=e("lazyload");e("js/common/slider"),e("js/common/logo-brand"),o(i("img.lazy")),i(".slide-container").slider(),i(".logo-brand").logoBrand({showNum:10,url:i(".logo-brand").data("url")}),function(e){function t(t,a){var d={};d=a?{sid:t,page:a}:{sid:t},e.ajax({type:"GET",dataType:"json",url:"/product/index/getdata",data:d,success:function(t){var d;200===t.code&&(d={list:t.data},s=n.compile(i),a?(e(".hot-week-list").append(s(d)),r.css({position:"fixed",marginTop:-r.height()/2,top:"50%"})):e(".hot-week-list").html(s(d)),o(e("img.lazy")),c=!1)}})}var a,i,s,r=e(".hot-week").find(".floatlayer"),d=(e(".hot-cate").find("li").eq(0).data("sid"),1),l=0,c=!1;i='{{# list}}<div class="good-info"><div class="item-img"><a class="good-thumb" target="_blank" href="{{url}}"><img class="lazy" data-original="{{thumb}}"></a></div><div class="good-detail-text"><a target="_blank" href="{{url}}">{{name}}</a><p class="price">{{# marketPrice}}<span class="market-price">¥{{.}}</span>{{/ marketPrice}} <span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">¥{{salePrice}}</span></p></div></div>{{/ list}}',e(window).on("scroll",function(){var i,n=a+e(".hot-week").outerHeight();a=e(".hot-week").offset().top,e(this).scrollTop()>=a-e(window).height()/2?r.offset().top+r.outerHeight()>=n?r.css({position:"absolute",marginTop:0,top:e(".hot-week").outerHeight()-r.outerHeight()}):r.css({marginTop:-r.height()/2}).stop().animate({opacity:1},200,function(){r.show()}):r.stop().animate({opacity:0},200,function(){r.hide()}),r.offset().top>=e(this).scrollTop()+(e(window).height()-r.outerHeight())/2&&r.css({position:"fixed",marginTop:-r.height()/2,top:"50%"}),e(this).scrollTop()>=a+e(".hot-week").height()-e(window).height()&&(c||(i=e(".hot-cate").find("li.current").data("sid"),d++,c=!0,t(i,d)))}),e(".hot-cate").find("li").each(function(t){var a=e(".hot-cate").width();a>=l&&(l+=e(this).width(),l>=a&&e(".floatlayer").find("li").eq(t).hide().nextAll().hide())}),e(".hot-cate").on("click","li",function(){var i=e(this).index(),n=e(this).data("sid");e(this).hasClass("current")||(e(this).addClass("current").siblings().removeClass("current"),e(".floatlayer").find("li").removeClass("current").eq(i).addClass("current"),e("body,html").stop().animate({scrollTop:a-110},500),t(n),d=1)}),e(".floatlayer").on("click","li",function(){var t=e(this).index();e(this).hasClass("current")||(e(".hot-cate").find("li").eq(t).trigger("click"),e(this).addClass("current").siblings().removeClass("current"),e(".hot-cate").find("li").removeClass("current").eq(t).addClass("current"))}),e(".hot-cate").find("li").eq(0).addClass("current"),e(".floatlayer").find("li").eq(0).addClass("current")}(i)}),define("js/common/slider",["jquery","lazyload"],function(e,t,a){var i=e("jquery"),n=e("lazyload");!function(e){var t=function(t,a){this.$element=e(t),this.options=e.extend({},e.fn.slider.defaults,a),this.bigItem=this.$element.find(".slide-wrapper").find("li"),this.smallItem=null,this.len=this.bigItem.size(),this.index=0,this.timer=null,this.init()};t.prototype={init:function(){if(this.$element){if(this.len<=1)return void n(this.$element.find("img.lazy"));this.options.pagination?this.smallItem=e(this.options.pagination).find("li"):this._createPage(),this.options.orient&&this._createOrient(),this._slideShow(),this._bindEvent(),this._autoplay()}},_createOrient:function(){var e='<div class="slide-switch"><a class="prev" href="javascript:;"><span class="iconfont">&#xe60c;</span></a><a class="next" href="javascript:;"><span class="iconfont">&#xe60b;</span></a></div>';this.$element.find(".slide-switch").length>0||this.$element.append(e)},_createPage:function(){var t='<div class="slide-pagination"><div class="slide-pagination-inner"><div class="slide-shade"></div><div class="slide-pagination-last">',a=0;if(!(this.len<=1)){for(a=0;a<this.len;a++)t+="<span></span>";t+="</div></div></div>",this.$element.append(e(t)),this.smallItem=this.$element.find(".slide-pagination-inner span")}},_bindEvent:function(){var t=this;this.$element.find(".slide-switch").on("click",".next",function(){t._nextSlide(),clearInterval(t.timer),t.timer=setInterval(function(){t._nextSlide()},t.options.time)}).on("click",".prev",function(){t._prevSlide(),clearInterval(t.timer),t.timer=setInterval(function(){t._nextSlide()},t.options.time)}),this.smallItem.on("mouseenter",function(){t.index=e(this).index(),clearInterval(t.timer),t._slideShow()}).on("mouseleave",function(){t._autoplay()}),this.$element.on("mouseenter",function(){e(this).find(".slide-switch").addClass("show")}).on("mouseleave",function(){e(this).find(".slide-switch").removeClass("show")})},_nextSlide:function(){this.index===this.len-1?this.index=0:this.index++,this._slideShow()},_prevSlide:function(){0===this.index?this.index=this.len-1:this.index--,this._slideShow()},_slideShow:function(){var t=this.bigItem.eq(this.index).find("img.lazy");t.attr("src")!==t.data("original")&&(n(t,{event:"sporty"}),t.trigger("sporty")),this.smallItem.eq(this.index).addClass("focus").siblings().removeClass("focus"),this.bigItem.eq(this.index).show().stop().animate({opacity:1},function(){e(this).find(".slide-tips > p").removeClass("hide")}).siblings().stop().animate({opacity:0},function(){e(this).hide().find(".slide-tips > p").addClass("hide")})},_autoplay:function(){var e=this;clearInterval(this.timer),this.timer=setInterval(function(){e._nextSlide()},this.options.time)}},e.fn.slider=function(a){return this.each(function(){var i=e(this),n=i.data("Slider"),o="object"==typeof a&&a;n||i.data("Slider",n=new t(this,o)),"string"==typeof a&&n[a]()})},e.fn.slider.Constructor=t,e.fn.slider.defaults={time:5e3,orient:!0,pagination:null}}(i)}),define("js/common/logo-brand",["jquery","handlebars","source-map","lazyload"],function(e,t,a){var i=e("jquery"),n=e("handlebars"),o=e("lazyload");!function(e){var t=function(t,a){this.$element=e(t),this.options=e.extend({},e.fn.logoBrand.defaults,a),this.init()};t.prototype={init:function(){this.$element.addClass("logos-"+this.options.showNum),this._sendRequest()},_createHelper:function(){var e=this.options.showNum;n.registerHelper("brandList",function(t,a){var i="<ul>",n=0,o=null,s=0;if(t.length%e!==0)for(s=e-t.length%e,n=0;s>n;n++)t.push({href:"javascript:;",img:""});for(n=0;n<t.length;n++)o=a.fn(t[n]),i=n%e===5||5===n?i+'<li class="logo-brand-switch" data-page="'+Math.floor(n/e)+'"><a class="prev iconfont" href="javascript:;">&#xe60f;</a><a class="next iconfont" href="javascript:;">&#xe60e;</a></li><li data-page="'+Math.floor(n/e)+'">'+o+"</li>":0!==n&&n%e===0?i+'<li class="brand-more" data-page="'+Math.floor(n/(e+1))+'"><a href="javascript:;" target="_blank">MORE ></a></li><li data-page="'+Math.floor(n/e)+'">'+o+"</li>":i+'<li data-page="'+Math.floor(n/e)+'">'+o+"</li>";return i+'<li class="brand-more" data-page="'+Math.floor(n/(e+1))+'"><a href="javascript:;" target="_blank">MORE ></a></li></ul>'})},_sendRequest:function(){var t=this;e.ajax({type:"GET",url:t.options.url,dataType:"json",success:function(e){var a,i;e&&0!==e.length&&(t._createHelper(),i='{{#brandList logoBrand}}<a href="{{href}}" target="_blank"><img class="lazy" data-original="{{img}}" alt=""></a>{{/brandList}}',a=n.compile(i),t.$element.html(a(e)),t.$element.find(".brand-more a").attr("href",e.moreBrand),o(t.$element.find("img.lazy")),t._bindEvent())}})},_brandShow:function(t,a){var i=this;o(e("li[data-page="+a+"]").find("img.lazy").trigger("appear")),i.$element.find("li[data-page="+t+"]").find("img").fadeOut("normal",function(){i.$element.find("li").hide(),i.$element.find("li[data-page="+a+"]").show().find("img").fadeIn()})},_bindEvent:function(){var t=this;t.$element.on("click",".next",function(){var a=e(this).parent().data("page"),i=0,n=Math.ceil(t.$element.find("li").size()/(t.options.showNum+2))-1;i=a===n?0:a+1,t._brandShow(a,i)}),t.$element.on("click",".prev",function(){var a=e(this).parent().data("page"),i=0,n=Math.ceil(t.$element.find("li").size()/(t.options.showNum+2))-1;i=0===a?n:a-1,t._brandShow(a,i)})}},e.fn.logoBrand=function(a){return this.each(function(){var i=e(this),n=i.data("LogoBrand"),o="object"==typeof a&&a;n||i.data("LogoBrand",n=new t(this,o)),"string"==typeof a&&n[a]()})},e.fn.logoBrand.Constructor=t,e.fn.logoBrand.defaults={showNum:16,url:"/boys/getBrand"}}(i)}),define("js/product/item",["jquery","lazyload","handlebars","source-map","index"],function(e,t,a){function i(e){p.attr("src",e)}function n(){return+y.text()}function o(){y.text("1"),1===A||0===A?(w.addClass("dis"),b.addClass("dis")):(w.removeClass("dis"),b.addClass("dis"))}function s(e){0!==j.length&&(0===A||e&&0===~~e.data("total")?(j.addClass("hide"),x.removeClass("hide")):(j.removeClass("hide"),x.addClass("hide")))}function r(){m.not(".hide").children(".size-warn").removeClass("hide")}var d=e("jquery"),l=e("lazyload"),c=e("handlebars"),u=e("index"),p=d("#img-show"),h=d("#thumbs > .thumb-wrap"),f=d("#sizes"),m=f.children(".size"),v=f.find(".size-warn"),g=f.children(".color-size-tip"),y=d("#num"),w=d("#plus-num"),b=d("#minus-num"),C=d("#add-to-cart"),x=d("#sold-out"),k=d(".lc-container"),j=d(".item-buy"),_=d("#desc-color"),q={},I=d(".main"),T=I.data("id"),A=-1,D=200,S={def:"收藏商品",coled:"已收藏",hover:"取消收藏"},E=e("js/common/dialog").Alert;e("js/product/latest-walk"),e("js/common/share"),function(){var e,t=d("#size-title-json"),a=t.html();""!==a&&(e=u.parse(a),t.remove(),m.children("li").each(function(){var t=d(this),a=t.data("name");t.data("title",e[a])}))}(),q[d(".colors .focus").index()]=!0,d("#brand-favour").click(function(){var e=d(this);d.ajax({type:"POST",url:"/product/index/favoriteBrand",data:{brandId:e.data("id")}}).then(function(t){200===t.code?e.toggleClass("coled"):403===t.code&&(location.href=t.data.url)})}),d(".colors").on("click","li",function(){var e,t=d(this),a=t.index();g.addClass("hide"),v.addClass("hide"),A=-1,t.hasClass("focus")?m.eq(a).children("li").removeClass("focus"):(t.siblings(".focus").removeClass("focus"),t.addClass("focus"),h.not(".hide").addClass("hide"),e=h.eq(a).removeClass("hide").find("img"),"undefined"==typeof q[a]&&(l(e,{event:"sporty"}),e.trigger("sporty"),q[a]=!0),i(e.first().data("shower")),_.text(t.data("color")),m.not(".hide").addClass("hide"),m.eq(a).removeClass("hide").children("li").removeClass("focus")),o(),s(t)}),d("#thumbs").on("mouseenter",".thumb",function(){i(d(this).data("shower"))}),f.on("click","li",function(){var e=d(this);e.hasClass("focus")||(A=+e.data("num"),e.siblings(".focus").removeClass("focus"),e.addClass("focus"),g.html(e.data("title")).removeClass("hide"),v.addClass("hide"),s(),o())}).on("click",".size-ruler",function(){d("body,html").animate({scrollTop:d(".size-info").offset().top},300)}),w.click(function(){var e=n();if(!d(this).hasClass("dis"))return-1===A?void r():void(0!==A&&(e===A-1&&d(this).addClass("dis"),1===e&&b.removeClass("dis"),y.text(e+1>A?A:e+1)))}).on("selectstart",function(){return!1}),b.click(function(){var e=n();d(this).hasClass("dis")||(2===e&&d(this).addClass("dis"),e===A&&w.removeClass("dis"),y.text(0>e-1?0:e-1))}).on("selectstart",function(){return!1}),d(".get-lc:not(.dis)").hover(function(){k.removeClass("hide")},function(){k.addClass("hide")}),C.click(function(){return-1===A?void r():void d.ajax({type:"POST",url:"/cart/index/add",data:{productSku:d(".size li.focus").data("sku"),buyNumber:n()}}).then(function(e){var t=e.code;200===t&&(d("#type-chose").slideUp(D),d("#balance").slideDown(D),d("#cart-num").text(e.data.goods_count))})}),d("#collect-product").click(function(){var e,t=d(this);t.hasClass("coled")&&(e=!0),d.ajax({type:"POST",url:"/product/item/togglecollect",data:{productId:T,type:e?"cancel":"add"}}).then(function(a){var i=a.code;200===i?(t.toggleClass("coled"),e?t.find("em").text(S.def):t.find("em").text(S.coled)):403===i&&(location.href=a.data.url)})}).hover(function(){var e=d(this);e.hasClass("coled")&&e.find("em").text(S.hover)},function(){var e=d(this);e.hasClass("coled")&&e.find("em").text(S.coled)}),d("#keep-shopping").click(function(){d("#type-chose").slideDown(D),d("#balance").slideUp(D)}),d("#buy-now").click(function(){var e,t,a;if(-1===A)return void r();if(!d(this).hasClass("dis")){if(t=d(this).data("base"),!t)return a=new E("打开APP可抢购该商品哦~~"),void a.show();e=m.find(".focus").data("sku"),e&&t&&(location.href=t+"?product_sku="+e)}}),d(".buy-btn").mouseover(function(){d(this).hasClass("dis")||d(this).addClass("hover")}).mouseleave(function(){d(this).removeClass("hover")}),d(".description-material").on("click",".title",function(){var e=d(this),t=e.index(),a=d(".description-content"),i=d(".material-content");e.hasClass("cur")||(e.addClass("cur"),e.siblings(".cur").removeClass("cur"),0===t?(a.slideDown(D),i.slideUp(D)):(a.slideUp(D),i.slideDown(D)))}),d(".after-service-switch").click(function(){var e=d(this),t=e.next(".after-service-content"),a={def:"&#xe604;",spread:"&#xe603;"};"none"===t.css("display")?(t.slideDown(D),e.find(".triangle").html(a.spread)):(t.slideUp(D),e.find(".triangle").html(a.def))}),d.ajax({type:"GET",url:"/product/item/hotarea",data:{productId:T}}).then(function(e){d("#details-html").prepend(e),d(".hot-point").hover(function(){d(this).addClass("hover")},function(){d(this).removeClass("hover")})}),l(d("#details-html img")),function(){var e,t=!0;for(e=0;e<m.length;e++)if(1!==m.eq(e).find("li").length){t=!1;break}t&&m.find("li").click()}(),function(){function e(){d.ajax({type:"GET",url:"/product/item/comments",data:{productId:T,page:a}}).then(function(e){var t;if(200===e.code){if(t=e.data,0===t.length)return void s.next(".more-wrap").addClass("hide");l.text(t[0].total),s.append(n({comments:t})),a++}})}function t(){d.ajax({type:"GET",url:"/product/item/consults",data:{productId:T,page:i}}).then(function(e){var t;if(200===e.code){if(t=e.data,0===t.length)return void r.next(".more-wrap").addClass("hide");u.text(t[0].total),r.append(o({consults:t})),i++}})}var a=1,i=1,n=c.compile(d("#comments-tpl").html()),o=c.compile(d("#consults-tpl").html()),s=d("#comments-ul"),r=d("#consults-ul"),l=d(".comment-num"),u=d(".consult-num");d(".consult-comment").on("click",".title",function(){var e=d(this),t=e.index(),a=d(".comments"),i=d(".consults");e.hasClass("cur")||(e.addClass("cur"),e.siblings(".cur").removeClass("cur"),0===t?(i.slideDown(D),a.slideUp(D)):(i.slideUp(D),a.slideDown(D)))}).on("click",".load-more",function(){var a=d(this);a.hasClass("load-more-comments")?e():t()}),d("#consults-btn").click(function(){d(".new-consult").removeClass("hide"),d(".consult-success").addClass("hide")}),d("#submit-consult").click(function(){var e=d(this),t=e.closest(".new-consult"),a=t.find(".my-consult"),i=d.trim(a.val()),n=t.find(".consult-warn"),o=!0;""===i?(a.addClass("error"),n.removeClass("hide"),o=!1):(a.removeClass("error"),n.addClass("hide")),o!==!1&&d.ajax({type:"POST",url:"/product/item/addconsult",data:{productId:T,content:i}}).then(function(e){var i=e.code;200===i?(t.addClass("hide"),t.siblings(".consult-success").removeClass("hide"),a.val("")):403===i&&(location.href=e.data.url)})}),e(),t()}()}),define("js/common/dialog",["jquery","handlebars","source-map"],function(e,t,a){function i(){return 0===d(".body-mask").length&&d("body").append('<div class="body-mask hide"></div>'),d(".body-mask").css({height:d(document).height(),width:d(document).width()})}function n(e){return d("body").append(p(e)),d(".yoho-dialog")}function o(e){function t(e){s.$el.find("#dialog-"+o.btns[e].id).on("click",function(){o.btns[e].cb&&o.btns[e].cb()})}var a,o=d.extend({},c,e),s=this;if(o.mask&&(s.$mask=i()),s.$el=n(o),s.$el.find(".close").click(function(){s.close()}),o.btns)for(a=0;a<o.btns.length;a++)t(a)}function s(e){var t=this,a={content:e,className:"alert-dialog",btns:[{id:"alert-sure",btnClass:["alert-sure"],name:"确定",cb:function(){t.close()}}]};o.call(this,a)}function r(e){var t=this,a={content:e.content,className:"confirm-dialog",btns:[{id:"confirm-sure",btnClass:["confirm-sure"],name:"确定",cb:e.cb},{id:"confirm-cancel",btnClass:["confirm-cancel"],name:"取消",cb:function(){t.close()}}]};o.call(this,a)}var d=e("jquery"),l=e("handlebars"),c={mask:!0,closeIcon:!0},u='<div class="yoho-dialog {{className}} hide">{{#if closeIcon}}<span class="close"><i class="iconfont">&#xe602;</i></span>{{/if}}<div class="content">{{{content}}}</div><div class="btns">{{# btns}}<span {{#if id}}id="dialog-{{id}}"{{/if}} class="btn{{#each btnClass}} {{.}}{{/each}}">{{name}}</span>{{/ btns}}</div></div>',p=l.compile(u);o.prototype.close=function(){this.$mask&&this.$mask.addClass("hide"),this.$el.remove()},o.prototype.show=function(){this.$mask&&this.$mask.removeClass("hide"),this.$el.removeClass("hide").css({"margin-top":-this.$el.height()/2,"margin-left":-this.$el.width()/2})},t.Dialog=o,s.prototype=new o,s.prototype.constructor=s,t.Alert=s,r.prototype=new o,r.prototype.constructor=r,t.Confirm=r}),define("js/common/share",["jquery"],function(e,t,a){function i(e){var t,a="",i={title:"",url:window.location.href,weixinUrl:"",image:"",desc:"",channel:""},n=["weibo","tweibo","qzone","renren","qq","douban","weixin"],s="<em><i></i></em>";if(i=o.extend(i,e),-1===o.inArray(i.channel,n))return alert("不存在的分享平台!"),!1;switch(i.channel){case"weibo":a="http://service.weibo.com/share/share.php?url="+i.url+"&title="+i.title+"&appkey=3739328910&searchPic=true&pic="+i.image;break;case"tweibo":a="http://share.v.t.qq.com/index.php?c=share&a=index&url="+i.url+"&title="+i.title+"&appkey=c0af9c29e0900813028c2ccb42021792&pic="+i.image;break;case"qzone":a="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+i.url+"&title="+i.title+"&desc=&summary="+i.desc+"&site=YOHO!有货&pics="+i.image;break;case"renren":a="http://widget.renren.com/dialog/share?resourceUrl="+i.url+"&srcUrl="+i.url+"&desc="+i.desc+"&title="+i.title+"&description="+i.desc+"&pic="+i.image;break;case"qq":a="http://connect.qq.com/widget/shareqq/index.html?url="+i.url+"&desc="+i.desc+"&title="+i.title.replace("%","")+"&desc=&summary="+i.desc+"&site=YOHO!有货&pics="+i.image;break;case"weixin":a="http://s.jiathis.com/qrcode.php?url="+i.weixinUrl+"&desc="+i.desc+"&title="+i.title+"&description="+i.desc+"&pic="+i.image;break;case"douban":a="http://www.douban.com/share/service?href="+i.url+"&text="+i.desc+"&image="+i.image+"&title="+i.title+"&comment="}if("weixin"===i.channel){if(!i.self)return;t=i.self.closest(".share-to").find(".weixin-share-box"),t.length>0&&(s+='<div class="con"><h2>分享到微信朋友圈</h2><p class="pic"><img src="'+a+'" /></p><p class="w">打开微信,点击底部得“发现”,使用<br/>“扫一扫“即可将网页分享到我的朋友圈。</p><a href="javascript:void(0)" class="close">x</a></div>',t.find("div").length>0?t.show():t.html(s).show(),t.find(".close").click(function(){o(this).closest(".weixin-share-box").hide()}))}else window.open(encodeURI(a))}function n(e,t){var a=document.title.replace(/(^\s*)|(\s*$)/g,""),n=o("#share-desc").val(),s=o("#share-img").val(),r=o("#weixin-url").val();i("weibo"===e||"tqq"===e?{channel:e,title:a,image:s}:{channel:e,title:a,desc:n,image:s,self:t,weixinUrl:r})}var o=e("jquery");o(".share-wrapper").on("click","i",function(){var e=o(this),t=e.data("type");"weixin"===t?n(t,e):n(t)})}),define("js/index/index",["jquery","lazyload","handlebars","source-map"],function(e,t,a){var i=e("jquery"),n=e("lazyload"),o=i(".home-page").data("page"),s=i(".logo-brand").data("url");e("js/common/slider"),e("js/common/slider2"),e("js/common/logo-brand"),e("js/common/accordion"),i(document).on("mouseenter",".imgopacity a img",function(){i(this).css("opacity",.8)}),i(document).on("mouseout",".imgopacity a img",function(){i(this).css("opacity",1)}),i.inArray(o,["boys","girls","kids","lifestyle"])>-1&&(e("js/common/new-arrivls")({type:o,url:"/common/getNewArrival",count:"boys"===o||"lifestyle"===o?5:4,rows:[5,3]}),window.setCookie("_Channel",o,{domain:".yohobuy.com",path:"/",expires:365})),n(i("img.lazy")),"boys"===o?i(".slide-container").slider({pagination:".thumb-pagination"}):(i(".center-col").slider(),i(".slide-container").slider()),"boys"===o?(i(".logo-brand").logoBrand({url:s}),i(".img-brand").slider2()):(i(".logo-brand").logoBrand({showNum:10,url:s}),i(".img-slider-wrapper").slider2())}),define("js/common/slider2",["jquery"],function(e,t,a){var i=e("jquery");!function(e){e.fn.slider2=function(t){function a(t,a,n){n===!0?(e(".next").trigger("click"),t===a-3?i(--t,a,!1):i(++t,a,!0)):(e(".prev").trigger("click"),0===t?i(++t,a,!0):i(--t,a,!1))}function i(t,i,n){window.setTimeout(a,e.fn.slider2.defaults.delaytime,t,i,n)}function n(t,a,i){var n=-(t*a);e(".img-list").animate({"margin-left":n+"px"},"slow",i)}return e.fn.slider2.defaults={index:0,shownum:3,autoplay:!1,delaytime:3e3},this.each(function(){var a=e.extend({},e.fn.slider2.defaults,t),o=parseInt(e(".img-item").css("margin-right")),s=e(".img-item"),r=[],d=s.outerWidth()+o,l=s.length,c=0;if(3>=l)return void e(this).find(".img-brand-switch").hide();for(c=0;c<s.length;c++)r.push(s[c]);l=r.length,e(this).find(".img-list").css({width:d*l}),e(this).find(".next").on("click",function(t){var a=0,i=null;t.preventDefault(),n(3,d,function(){for(a=0;3>a;a++)i=r.shift(),e(".img-item").parent().append(i.outerHTML),r.push(i);e(".img-item").first().remove(),e(".img-item").first().remove(),e(".img-item").first().remove(),e(".img-list").css({"margin-left":"0"})})}),e(this).find(".prev").on("click",function(t){var a=0,i=null,o="";for(t.preventDefault(),a=0;3>a;a++)i=r.pop(),e(".img-item").parent().prepend(i.outerHTML),r.unshift(i);o=3*d,e(".img-item").last().remove(),e(".img-item").last().remove(),e(".img-item").last().remove(),e(".img-list").css({"margin-left":-o+"px"}),n(0,d)}),a.autoplay===!0&&i(a.index,l,!0)})}}(i)}),define("js/common/accordion",["jquery"],function(e,t,a){function i(e){d.each(function(t){s(this).css("zIndex",t),e>=t?s(this).stop().animate({left:t*c},400):s(this).stop().animate({left:e*c+l+c*(t-e-1)},400)})}var n,o=e("js/common/yohoui/YH.slide"),s=e("jquery"),r=s(".slide-accordion"),d=r.find("li"),l=d.width(),c=1150===parseInt(s(".home-page").width())?125:107;i(0),n=new o({length:5,loop:!1,auto:!1,timeout:2,index:0}),n.on("change",function(e){i(e.to)}),d.mouseover(function(){n.go(s(this).index())}),n.init()}),define("js/common/yohoui/YH.slide",[],function(e,t,a){var i=e("js/common/yohoui/YH.base"),n=function(e){this.__lastTime=null,this.__isStop=!1,e=i.extend(this.defaults,e),n.superclass.constructor.call(this,e)};i.inherit(n,i.assembly),n.prototype.oninit=function(){var e=this,t=e.options;return t.auto&&e.play(),e.go(t.index),this},n.prototype.go=function(e,t){var a,i,n,o,s,r,d,l,c=this,u=c.options;c.__lastTime&&(clearTimeout(c.__lastTime),c.__lastTime=null),t="undefined"==typeof t?u.index:t,a=e===t?0:e>t?1:-1,i=u.loop,o=u.length-1,s=e,e=i?e>o?e-o-1:0>e?e+o+1:e:e>o?o:0>e?0:e,n=u.index=e,r={from:t,to:e,originalto:s,direction:a};for(d in c.registerEvent)if(c.registerEvent[d].length>0)for(l in c.registerEvent[d])c.registerEvent[d].hasOwnProperty(l)&&c.registerEvent[d][l](r);n!==o||e?!c.__isStop&&u.auto&&c.play():c.__lastTime&&clearTimeout(c.__lastTime)},n.prototype.play=function(){var e=this,t=e.options;return e.__lastTime=setTimeout(function(){e.next()},1e3*t.timeout),this},n.prototype.next=function(){var e=this,t=e.options,a=t.index,i=a+t.step;e.go(i,a)},n.prototype.prev=function(){var e=this,t=e.options,a=t.index,i=a-t.step;e.go(i,a)},n.prototype.pause=function(){var e=this;e.__lastTime&&clearTimeout(e.__lastTime),e.__isStop=!0},n.prototype.resume=function(){var e=this;e.__isStop=!1,e.play()},n.prototype.defaults={index:0,timeout:5,step:1,per:1,auto:!1,loop:!1},a.exports=n}),define("js/common/yohoui/YH.base",[],function(e,t,a){var i,n={"[object Array]":"array","[object Boolean]":"boolean","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object Object]":"object","[object RegExp]":"regexp","[object String]":"string"},o={__Index:0,list:[],get:function(e){return void 0===e?this.list:this.list[e]},fn:function(){},inherit:function(e,t){var a=o.fn;a.prototype=t.prototype,e.prototype=new a,e.prototype.constructor=e,e.superclass=t.prototype,e.prototype.constructor===Object.prototype.constructor&&(e.prototype.constructor=t)},extend:function(e,t){var a;for(a in t)t.hasOwnProperty(a)&&(e[a]=t[a]);return e},copy:function(e,t,a){var i,n,s;if("object"!=typeof t)return t;if(i=t.valueOf(),t!==i)return new t.constructor(i);if(t instanceof t.constructor&&t.constructor!==Object){n=e?new e:o.clone(t.constructor.prototype);for(s in t)(e||t.hasOwnProperty(s))&&(n[s]=t[s])}else{n={};for(s in t)n.hasOwnProperty(s)&&(n[s]=t[s])}if(a)for(s in a)n.hasOwnProperty(s)&&(n[s]=a[s]);return n},clone:function(e){return o.__cloneFunc.prototype=e,new o.__cloneFunc},__cloneFunc:function(){},delegate:function(e,t){var a;return t=t||window,arguments.length>2?(a=Array.prototype.slice.call(arguments,2),function(){return e.apply(t,a)}):function(){return e.call(t)}},dom:function(e,t){var a,i,n=e,o={wrap:n},s=n[0].getElementsByTagName("*"),r=s.length;for(i=0;r>i;i++)a=s[i].className,a.indexOf(t)>-1&&(a=a.split(t)[1]),a&&(o[a]=n.find(s[i]));return o},template:function(){var e,t,a,i,n=arguments;if(n.length>0&&o.isString(n[0]))if(e=n[0],2===n.length&&o.isObject(n[1]))for(t in n[1])void 0!==n[1][t]&&(a=new RegExp("({"+t+"})","g"),e=e.replace(a,n[1][t]));else for(i=1;i<n.length;i++)void 0!==n[i]&&(a=new RegExp("({["+(i-1)+"]})","g"),e=e.replace(a,n[i]));return e},__type:function(e){return null==e?String(e):n[Object.prototype.toString.call(e)]||"object"},isObject:function(e){return this.isFunction(e)||!(!e||"object"!=typeof e)},isFunction:function(e){return"function"===this.__type(e)},isArray:Array.isArray||function(e){return"array"===this.__type(e)},isNum:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isString:function(e){return"string"===this.__type(e)},each:function(e,t,a){var i,n;if(o.isArray(e))for(i=0,n=e.length;n>i&&t.call(e[i],i,e[i],a)!==!1;i++);else for(i in e)if(t.call(e[i],i,e[i],a)===!1)break},funManager:{__loadList:{},__loadFun:function(e,t,a){e.methord&&o.isFunction(e.methord())&&(a=a||window,e.methord()(e,function(){t()},a))},load:function(e,t,a,i){i=i||0,e[i]&&o.funManager.__loadFun(e[i],function(){o.funManager.load(e,t,a,i+1)},a),t(i,a)},get:function(e){return this.__loadList[e]}},log:function(e){var t=window.console||{log:function(){}};t.log(e)},Event:{mousewheel:function(e){var t=e.originalEvent,a=t.detail?-1*t.detail:t.wheelDelta/40,i=0>a?-1:1;return{direction:i,unit:a}},__:function(e,t,a,i){var n;for(n in e)if(window[e[n].validator]){t[e[n].validator](e[n].prefix+a,i,!1);break}},add:function(e,t,a){var i=[{validator:"addEventListener",prefix:""},{validator:"attachEvent",prefix:"on"}];this.__(i,e,t,a)},remove:function(e,t,a){var i=[{validator:"removeEventListener",prefix:""},{validator:"detachEvent",prefix:"on"}];this.__(i,e,t,a)}},getUid:function(e){return o.template("me-{0}{1}-{2}",e,(new Date).getTime(),o.__Index++)},Browser:{isTouch:function(){var e=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture;return"ontouchstart"in window||e||window.DocumentTouch?!0:!1},Prefix:function(){var e,t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"],a=document.createElement("div");for(e in t)if(void 0!==a.style[t[e]])return o.template("-{0}-",t[e].replace("Perspective","").toLowerCase())},parseURL:function(e){var t,a,i,n,o,s=document.createElement("a");
return s.href=e,{source:e,protocol:s.protocol.replace(":",""),host:s.hostname,port:s.port,query:s.search,params:function(){for(t={},a=s.search.replace(/^\?/,"").split("&"),i=a.length,n=0,o;i>n;n++)a[n]&&(o=a[n].split("="),t[o[0]]=o[1]);return t}(),file:(s.pathname.match(/\/([^\/?#]+)$/i)||[null,""])[1],hash:s.hash.replace("#",""),path:s.pathname.replace(/^([^\/])/,"/$1"),relative:(s.href.match(/tps?:\/\/[^\/]+(.+)/)||[null,""])[1],segments:s.pathname.replace(/^\//,"").split("/")}}},Array:{indexOf:function(e,t){var a;for(a=0;a<e.length;a++)if(this[a]===t)return a;return-1},remove:function(e,t){var a=this.indexOf(e,t);return a>-1&&e.splice(a,1),e}}};i=function(e){this.initialized=!1,this.registerEvent={before:[],change:[],after:[]},this.options=e,this.init(e)},i.output=function(){o.log(o.list)},i.prototype.oninit=o.fn,i.prototype.init=function(e){this.initialized=!0,this.__Uid=o.getUid("me"),this.oninit(e),o.list[this.__Uid]=this},i.prototype.destory=function(){this.initialized=!1,delete o.list[this.__Uid]},i.prototype.getUid=function(){return this.__Uid},i.prototype.getOptions=function(){return this.options},i.prototype.config=function(){if(!(arguments.length>0))return this.options;if("string"==typeof arguments[0]){if(!(arguments.length>1))return this.options[name];this.options[arguments[0]]=arguments[1]}},i.prototype.on=function(e,t){var a=this,i=a.registerEvent[e];return i&&i.push(t),i},i.prototype.off=function(e,t){var a=this,i=a.registerEvent[e],n=[];o.each(i,function(e,a){a===t&&n.push(e)}),o.each(n.reverse(),function(e,t){i.splice(t,1)})},o.assembly=i,a.exports=o}),define("js/common/new-arrivls",["jquery","lazyload","handlebars","source-map"],function(e,t,a){function i(e){var t={index:0,isload:!0,isrun:!0,offset:{height:null,width:null}};return this.registerEvent={before:[],change:[],after:[]},this.options=n.extend(!0,{},t,e),this}var n=e("jquery"),o=e("lazyload"),s=e("handlebars");i.prototype.on=function(e,t){var a=this,i=a.registerEvent[e];return i&&i.push(t),i},i.prototype.exect=function(e,t){var a,i=this;if(i.registerEvent[e]&&i.registerEvent[e].length>0)for(a in i.registerEvent[e])i.registerEvent[e].hasOwnProperty(a)&&i.registerEvent[e][a](t)},i.prototype.init=function(){function e(){a.isrun&&a.isload&&t.__directionCalculation()&&(a.isload=!1,a.index++,t.exect("after",a)),t.exect("change",a)}var t=this,a=this.options;t.exect("before",a),n(window).scroll(e)},i.prototype.emit=function(){var e=this.options;e.isload=!0},i.prototype.stop=function(){var e=this.options;e.isrun=!1,e.isload=!1},i.prototype.__directionCalculation=function(){var e=this.options;return e.offset.height&&e.offset.height()>0&&n(window).scrollTop()+n(window).height()>=e.offset.height()?!0:!1},a.exports=function(e){var t,a=n("#newarrivals .goods-container"),r=n(".loading a"),d=new i({index:1,isload:!1,offset:{height:function(){return parseFloat(a.offset().top)+parseFloat(a.height())-200}}}),l=e.url,c=e.count,u=e.rows;e.pageIndex=0,delete e.url,delete e.count,delete e.rows,t=function(e,t,i){var l={type:"POST",url:e,success:function(e){var n,l,c,u=e.code;200===u?(l=e.goods.length%i,c=e.goods.length-l-1,e.goods.splice(c,l),n=s.compile(d.tpl),a.append(n(e.goods)),t.pageIndex=t.pageIndex+e.goods.length,o(a.find("img.lazy")),d.emit()):(d.stop(),r.html("查看更多"))},error:function(){d.stop(),r.html("网络断开连接了~")}};l.data=t,n.ajax(l)},d.on("after",function(a){e.pageCount=c*u[1],t(l,e)}),d.on("before",function(a){d.tpl="{{#each this}}",d.tpl+='<div class="good-info imgopacity" data-skn="{{skn}}">',d.tpl+='    <div class="tag-container clearfix">',d.tpl+="        {{# tags}}",d.tpl+="            {{# isNew}}",d.tpl+='                <span class="good-tag new-tag">NEW</span>',d.tpl+="            {{/ isNew}}",d.tpl+="            {{# isReNew}}",d.tpl+='                <span class="good-tag renew-tag">再到着</span>',d.tpl+="            {{/ isReNew}}",d.tpl+="            {{# isSale}}",d.tpl+='                <span class="good-tag sale-tag">SALE</span>',d.tpl+="            {{/ isSale}}",d.tpl+="            {{# isNewFestival}}",d.tpl+='                <span class="good-tag new-festival-tag">新品节</span>',d.tpl+="            {{/ isNewFestival}}",d.tpl+="            {{# isLimit}}",d.tpl+='                <span class="good-tag limit-tag">限量商品</span>',d.tpl+="            {{/ isLimit}}",d.tpl+="            {{# isYearEndPromotion}}",d.tpl+='                <span class="good-tag yep-tag">年终大促</span>',d.tpl+="            {{/ isYearEndPromotion}}",d.tpl+="            {{# isYearMidPromotion}}",d.tpl+='                <span class="good-tag ymp-tag">年中热促</span>',d.tpl+="            {{/ isYearMidPromotion}}",d.tpl+="        {{/ tags}}",d.tpl+="    </div>",d.tpl+='    <div class="good-detail-img">',d.tpl+='        <a class="good-thumb" href="{{url}}" target= "_blank">',d.tpl+='            <img class="lazy" data-original="{{thumb}}">',d.tpl+="        </a>",d.tpl+="        {{# isFew}}",d.tpl+='            <p class="few-tag">即将售罄</p>',d.tpl+="        {{/ isFew}}",d.tpl+="        {{#if showColBtn}}",d.tpl+='            <span class="col-btn iconfont{{#if coled}} coled{{/if}}">&#xe616;</span>',d.tpl+="        {{/if}}",d.tpl+="    </div>",d.tpl+='    <div class="good-detail-text">',d.tpl+='        <a href="{{url}}" target= "_blank">{{name}}</a>',d.tpl+='        <p class="price">',d.tpl+='            <span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">',d.tpl+="                ¥{{salePrice}}",d.tpl+="            </span>",d.tpl+="            {{# marketPrice}}",d.tpl+='                <span class="market-price">¥{{.}}</span>',d.tpl+="            {{/ marketPrice}}",d.tpl+="        </p>",d.tpl+="    </div>",d.tpl+="</div>",d.tpl+="{{/each}}",e.pageCount=c*u[0],t(l,e,e.count)}),d.init()}}),define("js/brand/index",["jquery","lazyload","handlebars","source-map","dot"],function(e,t,a){var i=e("jquery"),n=e("lazyload");e("js/common/slider"),e("js/brand/brands"),n(i("img.lazy")),i(".slide-container").slider({orient:!0})}),define("js/brand/brands",["jquery","handlebars","source-map","dot"],function(e,t,a){function i(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),a=window.location.search.substr(1).match(t);return null!=a?window.unescape(a[2]):null}function n(e,t,a){var i,n=e,o={width:n.width(),left:n.offset().left,right:parseFloat(l(window).width())-parseFloat(n.offset().left)-parseFloat(n.width())},s=n.parent("li");h.find(".brands-dialog").remove(),i=c.compile(a),s.append(i(t)),u(s.find(".right")),o.right-350<0&&s.find(".brands-layer").addClass("brands-layer-right").css("left",-330-o.width)}function o(){g.unbind("mouseenter").unbind("mouseleave").hover(function(){var e=l(this),t=e.attr("data-key"),a={url:"/brands/brandinfo",type:"get",data:{brandId:t},success:function(t){200===t.code&&t.brand&&(_.hasOwnProperty(t.brand.key)||(_[t.brand.key]=t.brand),n(e,_[t.brand.key],q))}};clearTimeout(r),r=setTimeout(function(){_.hasOwnProperty(t)?n(e,_[t],q):l.ajax(a)},200)},function(){clearTimeout(r),h.find(".brands-dialog").remove()})}var s,r,d,l=e("jquery"),c=e("handlebars"),u=e("dot"),p=l(".brands-tabs"),h=l(".brands-list"),f=l(".brands-category"),m=l(".news-txt ul"),v=h.find("dl.clearfix"),g=h.find("li>a"),y=f.find("a"),w=p.find("li>a"),b=p.find(".hoverarr"),C=y.height(),x=y.offset()?y.offset().top:0,k=m.height(),j=m.offset()?m.offset().top:0,_={},q='<div class="brands-dialog">';q+='    <div class="brands-layer">',q+='        <div class="layer-content">',q+='            <div class="title">{{title}}</div>',q+='            <div class="clearfix desc">',q+='                <img src="{{icon}}">',q+='                <p class="right">{{content}}</p>',q+="            </div> ",q+='            <div class="featured">',q+="                <p>{{subtitle}}</p> ",q+='                <div class="clearfix"> ',q+="                    {{#each imgs}}",q+='                    <img src="{{src}}">',q+="                    {{/each}}",q+="                </div>",q+="            </div>",q+="        </div>",q+="    </div>",q+="</div>",u(l(".brand-desc")),l.easing.easeOutQuint=function(e,t,a,i,n){return i*((t=t/n-1)*t*t*t*t+1)+a},m.length&&m.find("li").each(function(){var e=l(this),t=e.offset().top-j+e.height();t>k&&e.hide()}),w.eq(0).parent("li").find(".brands-content").css("z-index","1"),d=i("id")?i("id"):0,s=w.eq(d),s.find(".g-mask").addClass("g-mask-on"),d&&s.length&&b.css({left:parseFloat(s.offset().left)-parseFloat(p.offset().left)}),w.hover(function(){var e=l(this);clearTimeout(r),r=setTimeout(function(){var t=parseFloat(e.offset().left)-parseFloat(p.offset().left);b.animate({left:t},200,"easeOutQuint")},50),p.find(".brands-content").removeAttr("style"),e.parent("li").find(".brands-content").css("z-index","1")},function(){clearTimeout(r)}),l(window).scroll(function(){l(this).scrollTop()>=x?f.addClass("category-fix"):f.removeClass("category-fix")}),y.click(function(){var e=l(this).attr("href").split("#")[1],t=h.find("[name="+e+"]").offset().top-C;return f.hasClass("category-fix")||(t-=C),l("html,body").animate({scrollTop:t},200),!1}),v.length<26&&l.ajax({url:"/brands/brandList",type:"POST",data:{start:v.length?v.length+1:1},success:function(e){e&&(h.append(e),g=h.find("li>a"),o())}}),o()}),define("js/passport/entry",["jquery","jquery.placeholder"],function(e,t,a){e("js/passport/reg"),e("js/passport/back"),e("js/passport/login"),e("js/passport/reset"),e("js/passport/vertification"),e("js/passport/thirdlogin"),e("js/passport/third-pwd")}),define("js/passport/reg",["jquery","jquery.placeholder"],function(e,t,a){function i(){var e=new Date,t=m(".captcha-img"),a=t.attr("src").split("?")[0];t.attr("src",a+"?t="+e.getTime())}function n(e,t){var a,n;"reg"===e?(a="/passport/register/checkmobile",n={mobile:A.val(),area:N.text().split("+")[1]}):"third"===e&&(a="/passport/autouserinfo/bindCheck",n={mobile:A.val(),area:N.text().split("+")[1],openId:m("#open-id").val(),sourceType:m("#source-type").val()}),T[0].message="err",T[0].status=!1,m.ajax({url:a,type:"POST",data:n}).then(function(e){if(e){switch(e.code){case 200:A.val()!==B&&""!==B&&(i(),q.addClass("disable").attr("disabled","disabled"),T[1].message="图形验证码错误",T[1].status=!1),B=A.val(),T[0].message="",T[0].status=!0;break;case 400:i(),T[0].message=e.message,T[0].status=!1}t()}})}function o(e,t){var a;"reg"===e?a="/passport/register/piccaptcha":"third"===e&&(a="/passport/autouserinfo/checkPicCode"),m.ajax({type:"POST",url:a,data:{verifyCode:$.val()}}).then(function(e){if(e){switch(e.code){case 200:T[1].message="",T[1].status=!0;break;case 400:i(),T[1].message="图形验证码错误",T[1].status=!1}t()}})}function s(e,t){var a;"reg"===e?a="/passport/register/msgcaptcha":"third"===e&&(a="/passport/autouserinfo/checkBindMsg"),m.ajax({type:"POST",url:a,data:{code:D.val(),mobile:A.val(),area:N.text().split("+")[1]}}).then(function(e){if(e){switch(e.code){case 200:T[2].message="",T[2].status=!0;break;case 400:T[2].message="短信验证码错误",T[2].status=!1}t()}})}function r(e,t,a){var i,r=m.trim(t.val());t.hasClass("phone-num")?(i=N.text(),""===r?(T[0].message="请输入手机号码",T[0].status=!1,a()):v.phoneRegx[i].test(r)?n(e,a):(T[0].message="手机号码格式不正确,请重新输入",T[0].status=!1,a())):t.hasClass("captcha")?""===r?(T[1].message="请输入图形验证码",T[1].status=!1,a()):r.length<=3?(T[1].message="图形验证码为4位",T[1].status=!1,a()):T[0].status?o(e,a):(T[1].message="图形验证码错误",T[1].status=!1,a()):t.hasClass("msg-captcha")?""===r?(T[2].message="请输入短信验证码",T[2].status=!1,a()):r.length<=3?(T[2].message="短信验证码错误",T[2].status=!1,a()):T[1].status?s(e,a):(T[2].message="短信验证码错误",T[2].status=!1,a()):t.hasClass("pwd")?(""===r?(T[3].message="请输入密码",T[3].status=!1):r.length<6||r.length>20?(T[3].message="密码只支持6-20位字符",T[3].status=!1):U.test(t.val())?(T[3].message="",T[3].status=!0):(T[3].message="密码须字母和数字组合",T[3].status=!1),a()):t.hasClass("repwd")&&(""===r?(T[4].message="请输入密码确认",T[4].status=!1):S.val()!==r?(T[4].message="与密码不一致,请重新输入",T[4].status=!1):(T[4].message="",T[4].status=!0),a())}function d(){var e=f.offset();return C.css({top:e.top-40,left:e.left})}function l(){var e,t=!1,a=T.length;for(e=0;a>e;e++)t||(T[e].message&&"err"!==T[e].message?(C.find("span").text(T[e].message),f=m("#"+T[e].id),d().removeClass("hide"),t=!0):C.addClass("hide"))}function c(){var e,t,a=T.length;for(t=0;a>t;t++)T[t].message?(e=m("#"+T[t].id),e.addClass("error")):(e=m("#"+T[t].id),e.removeClass("error"))}function u(e){var t=e.val(),a=g(t),i=0;switch(i=0===a?0:10>=a?1:20>=a?2:3){case 0:P.removeClass("red yellow green"),O.removeClass("color");break;case 1:P.addClass("red").removeClass("yellow green"),O.filter(".low").addClass("color"),O.filter(".mid,.high").removeClass("color");break;case 2:P.addClass("yellow").removeClass("red green"),O.filter(".low,.mid").addClass("color"),O.filter(".high").removeClass("color");break;case 3:P.addClass("green").removeClass("yellow red"),O.addClass("color")}""===t?b.removeClass("red yes no").addClass("default"):t.length<6||t.length>20?b.removeClass("default yes").addClass("no red"):b.removeClass("default no red").addClass("yes")}var p,h,f,m=e("jquery"),v=e("js/passport/mail-phone-regx"),g=e("js/passport/pwd-strength"),y=m(".register-page"),w=m("#pwd-tips"),b=w.find("#pwd-tip1"),C=m("#err-tip"),x=m("#register-btn"),k=m("#count-down"),j=m(".success-btn"),_=5,q=m("#send-captcha"),I=4,T=[],A=m("#phone-num"),D=m("#msg-captcha"),S=m("#pwd"),E=m("#repwd"),$=m("#captcha"),z=0,O=m(".pwd-intensity"),P=O.closest(".pwd-intensity-container"),N=m("#country-code"),L=m("#region"),F=!1,U=v.pwdValidateRegx,B="";e("jquery.placeholder"),setTimeout(function(){A.val(""),D.val(""),S.val(""),E.val(""),$.val("")},0),$.attr("maxlength",I),S.focus(function(e){w.removeClass("hide"),F=!0,h=m(this).val()}).blur(function(){w.addClass("hide"),F=!1}),m("[placeholder]").placeholder(),T=[{id:"phone-num",message:"",status:!1},{id:"captcha",message:"",status:!1},{id:"msg-captcha",message:"",status:!1},{id:"pwd",message:"",status:!1},{id:"repwd",message:"",status:!1}],m(window).resize(function(){C.hasClass("hide")||d()}),t.init=function(e){m("#agree-terms").click(function(){var e,t=m(this),a=0;if(t.attr("notchecked")){for(t.removeAttr("notchecked"),e=0;e<T.length;e++)T[e].status&&a++;4===a&&x.removeClass("disable").removeAttr("disabled")}else x.addClass("disable").attr("disabled","disabled"),t.attr("notchecked","notchecked")}),y.on("keydown",function(e){var t=e.which;13===t&&x.click()}),y.find(".va").keyup(function(){var t,a=0,i=T.length,n=m(this);r(e,m(this),function(){for(l(),c(),t=0;i>t;t++)T[t].status&&a++;4!==a||m("#agree-terms").attr("notchecked")?x.addClass("disable").attr("disabled","disabled"):x.removeClass("disable").removeAttr("disabled"),T[1].status&&0>=z?q.removeClass("disable").removeAttr("disabled"):q.addClass("disable").attr("disabled","disabled")}),n.hasClass("pwd")&&u(n)}).blur(function(){}),L.change(function(){N.text(m("#region").val()),r(e,A,l)}),q.click(function(){var t,a;m(this).hasClass("disable")||(z=60,m("#msg-tip").removeClass("hide"),q.addClass("disable").attr("disabled","disabled"),t=setInterval(function(){return 0>=z?(q.removeClass("disable").removeAttr("disabled").val("获取短信验证码"),void clearInterval(t)):void q.val(z--+"秒可重新发送")},1e3),"reg"===e?a="/passport/register/sendBindMsg":"third"===e&&(a="/passport/autouserinfo/sendBindMsg"),m.ajax({type:"POST",url:a,data:{area:N.text().split("+")[1],mobile:A.val(),verifyCode:$.val()}}))}),m(".success-box").length<=0&&(S[0].onpaste=function(){return!1}),x.click(function(){var t;"reg"===e?t="/passport/register/mobileregister":"third"===e&&(t="/passport/autouserinfo/bindMobile"),m(this).hasClass("disable")||m.ajax({type:"POST",url:t,data:{area:N.text().split("+")[1],mobile:A.val(),verifyCode:$.val(),code:D.val(),password:S.val()}}).then(function(e){var t,a,i=0;200===e.code?(a=e.data.href,t=setTimeout(function(){i++},1e3),m.ajax({type:"GET",url:e.data.session}).then(function(e){200===e.code&&3>t&&(clearInterval(t),location.href=a)}),t>=3&&(clearInterval(t),location.href=a)):console.log("网络超时~")})}),m(".change-captcha").click(function(){i()}),m(".success-box").length>0&&(p=setInterval(function(){0===_&&(window.location.href=j.attr("data-url"),clearInterval(p)),k.text(_--)},1e3))}}),define("js/passport/mail-phone-regx",[],function(e,t,a){var i={"+86":/^1[35847]{1}[0-9]{9}$/,"+852":/^[965]{1}[0-9]{7}$/,"+853":/^[0-9]{8}$/,"+886":/^[0-9]{10}$/,"+65":/^[98]{1}[0-9]{7}$/,"+60":/^1[1234679]{1}[0-9]{8}$/,"+1":/^[0-9]{10}$/,"+82":/^01[0-9]{9}$/,"+44":/^7[789]{1}[0-9]{8}$/,"+81":/^0[9|8|7][0-9]{9}$/,"+61":/^[0-9]{11}$/},n=/^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/,o=/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;t.phoneRegx=i,t.emailRegx=n,t.pwdValidateRegx=o}),define("js/passport/pwd-strength",[],function(e,t,a){function i(e,t){return e.charCodeAt(t)>=48&&e.charCodeAt(t)<=57?1:e.charCodeAt(t)>=97&&e.charCodeAt(t)<=122?2:e.charCodeAt(t)>=65&&e.charCodeAt(t)<=90?3:4}function n(e,t,a){var i=e.charCodeAt(0),n=t.charCodeAt(0);return i-n===0?!0:4===a||i-n!==1&&i-n!==-1?!1:!0}function o(e,t){return 0===t||e===t?0:4===e||4===t?2:1}function s(e){var t,a,s=0,r=e.length,d="",l=0,c=0;for(c=0;r>c;c++)t=e.charAt(c),a=i(e,c),l===a&&n(t,d,a)||(s+=a+o(a,l)),d=t,l=a;return s}a.exports=s}),define("js/passport/back",["jquery","jquery.placeholder"],function(e,t,a){function i(){var e=new Date,t=d("#captcha-img"),a=t.attr("src").split("?")[0];d("#captcha-img").attr("src",a+"?t="+e.getTime())}function n(){x&&k?y.removeClass("disable").prop("disabled",!1):y.addClass("disable").prop("disabled",!0)}function o(){return x&&k?void d.ajax({type:"POST",url:"/passport/back/authcode",data:{verifyCode:d.trim(m.val()),phoneNum:f.val(),area:h.val()}}).then(function(e){200===e.code?k=!0:402===e.code?(x=!1,k=!0,w.removeClass("hide").find("em").text("该账号不存在"),f.addClass("error")):400===e.code&&(k=!1,i()),n()}):void n()}function s(e){var t=!0,a="";return e=d.trim(e),""!==e?/^[0-9]+$/.test(e)?u[h.val()].test(e)?t=!0:(a="手机号码格式不正确, 请重新输入",t=!1):c.test(e)?t=!0:(a="邮箱格式不正确, 请重新输入",t=!1):(a="账户名不能为空",t=!1),x=t,o(),{pass:t,errTxt:a}}function r(){var e=d.trim(m.val());return""===e||e.length<C?(k=!1,void n()):(k=!0,void o())}var d=e("jquery"),l=e("js/passport/mail-phone-regx"),c=l.emailRegx,u=l.phoneRegx,p=e("js/passport/ac-email"),h=d("#country-code-hide"),f=d("#phone-num"),m=d("#captcha"),v=d("#country-code-list"),g=d("#country-code"),y=d("#find-btn"),w=d("#account-err"),b=d("#captcha-err"),C=4,x=!1,k=!1;e("jquery.placeholder"),p(f,function(){var e=s(f.val());e.pass?(w.addClass("hide"),f.removeClass("error")):(w.removeClass("hide").find("em").text(e.errTxt),f.addClass("error"))}),m.attr("maxlength",C),d("input").placeholder(),d("#change-captcha, #captcha-img").on("click",function(){i()}),g.on("click",function(e){e.stopPropagation(),"block"===v.css("style")?v.slideUp("fast"):v.slideDown("fast")}),v.delegate("li","click",function(e){var t,a=d(this),i=a.data("cc");e.stopPropagation(),h.val(i),g.find("em").html(a.text()),""!==d.trim(f.val())&&(t=s(f.val()),n(),x?(w.addClass("hide"),f.removeClass("error")):(w.removeClass("hide").text(t.errTxt),f.addClass("error"))),v.slideUp("fast")}),d(document).click(function(){"block"===v.css("display")&&v.slideUp()}),f.keyup(function(){s(d.trim(d(this).val()))}).focus(function(){d(this).removeClass("error"),w.addClass("hide")}),m.blur(function(){var e=""===d.trim(m.val())?"验证码不能为空":"验证码不正确";k?(b.addClass("hide"),m.removeClass("error")):(b.removeClass("hide").find("em").text(e),m.addClass("error"),m.val()<C&&i())}).focus(function(){d(this).removeClass("error"),b.addClass("hide")}).keyup(function(){r()}),d("#find-btn").click(function(e){return/^[0-9]+$/.test(d.trim(f.val()))&&d("#find-form").attr("action","/passport/back/mobile"),d(this).hasClass("disable")?void 0:k&&x?void 0:(e.preventDefault(),!0)})}),define("js/passport/ac-email",["jquery"],function(e,t,a){var i,n=e("jquery"),o={num:["qq.com","163.com","126.com","sina.com","gmail.com","sohu.com","hotmail.com","139.com","189.com"],other:["gmail.com","qq.com","163.com","126.com","sina.com","sohu.com","hotmail.com","139.com","189.com"]};a.exports=function(e,t){var a,s='<ul id="email-autocomplete" class="email-autocomplete hide"></ul>';e.parent().append(s),a=n("#email-autocomplete"),e.on("keyup",function(){var e,t,i,s,r=n.trim(n(this).val()),d="";if(r.indexOf("@")>0){for(e=r.match(/^[0-9]+@(.*)/),e?(i=o.num,t=e[1]):(i=o.other,t=r.match(/@(.*)/)[1]),s=0;s<i.length;s++)i[s].indexOf(t)>-1&&(d+="<li>"+r.slice(0,r.indexOf("@"))+"@"+i[s]+"</li>");""!==d&&/.com$/.test(r)===!1?a.html(d).removeClass("hide"):a.html("").addClass("hide")}}).on("blur",function(){i=setTimeout(function(){a.addClass("hide"),t&&t()},200)}),a.on("click","li",function(){clearTimeout(i),e.val(n(this).text()).focus(),a.addClass("hide"),t&&t()})}}),define("js/passport/login",["jquery","jquery.placeholder"],function(e,t,a){function i(){var e,t=!1,a=c.trim(u.val());return""!==a?/^[0-9]+$/.test(a)?x.phoneRegx[y.val()].test(a)?t=!0:(t=!1,e="手机号码不正确,请重新输入"):x.emailRegx.test(a)?t=!0:(t=!1,e="邮箱格式不正确,请重新输入"):e="请输入账户名",t?(f.addClass("hide"),u.removeClass("error")):(f.removeClass("hide").children("em").text(e),u.addClass("error")),t}function n(){var e,t=!1,a=c.trim(p.val());return""!==a?a.length<6?e="请输入长度为6-20字符的密码":t=!0:e="请输入密码",t?(m.addClass("hide"),p.removeClass("error")):(m.removeClass("hide").children("em").text(e),p.addClass("error")),t}function o(){var e,t=!1,a=c.trim(h.val());return q.is(":hidden")?!0:(""!==a?4!==a.length?e="请输入长度为4字符的验证码":t=!0:e="请输入验证码",t?(v.addClass("hide"),h.removeClass("error")):(v.removeClass("hide").children("em").text(e),h.addClass("error")),t)}function s(){var e=!0,t=c.trim(u.val()),a=c.trim(p.val());return""!==t?e=i()&&n()&&o():(e=!1,u.addClass("error"),""===a?(f.addClass("both-error").removeClass("hide").children("em").text("请输入账户名和密码"),m.addClass("hide"),p.addClass("error")):f.removeClass("hide").children("em").text("请输入账户名")),e}function r(){I.attr("src",_+c.now()),h.val(""),q.removeClass("hide")}function d(){var e=s();e&&A===!1&&(A=!0,c.ajax({url:"/passport/login/auth",type:"POST",data:{areaCode:y.val().replace("+",""),account:c.trim(u.val()),password:c.trim(p.val()),captcha:c.trim(h.val()),isRemember:j.hasClass("checked")?!0:!1},success:function(e){200===e.code?e.data&&(location.href=e.data.session):("captcha"===e.data.errorType?(v.removeClass("hide").children("em").html(e.message),h.addClass("error").val("")):(m.removeClass("hide").children("em").html(e.message),p.addClass("error").val("")),e.data&&e.data.needCaptcha&&r())},complete:function(){A=!1}}))}var l,c=e("jquery"),u=c("#account"),p=c("#password"),h=c("#captcha"),f=u.siblings(".err-tip"),m=p.siblings(".err-tip"),v=h.siblings(".err-tip"),g=c("#caps-lock"),y=c("#country-code-hide"),w=c("#country-code > em"),b=c("#country-list"),C=c("#email-autocomplete"),x=e("js/passport/mail-phone-regx"),k=e("js/passport/ac-email"),j=c(".remember-me"),_="/passport/images?t=",q=c(".captcha-wrap"),h=q.find("#captcha"),I=q.find("#captcha-img"),v=q.find(".err-tip"),T={checked:"&#xe612;",unchecked:"&#xe613;"},A=!1;e("jquery.placeholder"),k(u,function(){i()&&c.ajax({url:"/passport/login/account",type:"GET",data:{account:c.trim(u.val())}}).then(function(e){e.data&&e.data.needCaptcha&&r()})}),c("[placeholder]").placeholder(),c("#country-code").on("click",function(){"none"===b.css("display")&&b.slideDown()}),b.on("click","li",function(){var e=c(this),t=e.data("cc");w.html(e.html()),y.val(t),b.slideUp()}),c(document).on("click",function(e){c(e.target).closest("#country-code").length>0||"block"===b.css("display")&&b.slideUp()}),p.on("blur",function(){n(),g.hasClass("hide")||g.addClass("hide")}).on("keypress",function(e){var t=e.which;return t>=65&&90>=t?void g.removeClass("hide"):void g.addClass("hide")}),h.on("blur",function(){o()}),C.on("click","li",function(){clearTimeout(l),u.val(c(this).text()).focus(),C.addClass("hide")}),j.on("click",function(){var e=c(this);e.toggleClass("checked"),e.hasClass("checked")?e.children("i").html(T.checked):e.children("i").html(T.unchecked)}),c(".va").on("focus",function(){var e=c(this);e.removeClass("error"),e.siblings(".err-tip").addClass("hide")}),q.on("click",".change-captcha, .captcha-img",function(){I.attr("src",_+c.now())}),c("#login-btn").on("click",d),c("input.va").on("keypress",function(e){13===e.which&&d()}),""===u.val()&&u.val()!==u.attr("placeholder")||""!==p.val()||p.focus()}),define("js/passport/reset",["jquery","jquery.placeholder"],function(e,t,a){function i(e,t){return e.charCodeAt(t)>=48&&e.charCodeAt(t)<=57?1:e.charCodeAt(t)>=97&&e.charCodeAt(t)<=122?2:e.charCodeAt(t)>=65&&e.charCodeAt(t)<=90?3:4}function n(e,t,a){var i=e.charCodeAt(0),n=t.charCodeAt(0);return i-n===0?!0:4===a||i-n!==1&&i-n!==-1?!1:!0}function o(e,t){return 0===t||e===t?0:4===e||4===t?2:1}function s(e){var t,a,s=0,r=e.length,d="",l=0,c=0;for(c=0;r>c;c++)t=e.charAt(c),a=i(e,c),l===a&&n(t,d,a)||(s+=a+o(a,l)),d=t,l=a;return s}function r(){var e=l.val(),t=s(e),a=0;switch(a=0===t?0:10>=t?1:20>=t?2:3){case 0:g.removeClass("red yellow green"),v.removeClass("color");break;case 1:g.addClass("red").removeClass("yellow green"),v.filter(".low").addClass("color"),v.filter(".mid,.high").removeClass("color");break;case 2:g.addClass("yellow").removeClass("red green"),v.filter(".low,.mid").addClass("color"),v.filter(".high").removeClass("color");break;case 3:g.addClass("green").removeClass("yellow red"),v.addClass("color")}""===e?y.removeClass("red yes no").addClass("default"):e.length<6||e.length>20?y.removeClass("default yes").addClass("no red"):y.removeClass("default no red").addClass("yes"),m=w.test(e)?!0:!1}var d=e("jquery"),l=d("#pwd"),c=d("#re-input"),u=d("#reset-pwd-btn"),p=d("#pwd-err"),h=d("#repwd-err"),f=d("#pwd-tips"),m=!1,v=d(".pwd-intensity"),g=v.closest(".pwd-intensity-container"),y=d("#pwd-tip1"),w=e("js/passport/mail-phone-regx").pwdValidateRegx;e("jquery.placeholder"),d("input").placeholder(),d(".va").keyup(function(){var e=!0;d(this).hasClass("pwd")?r():""===d(this).val()&&(e=!1),e=e&&m&&l.val()===c.val()?!0:!1,e?u.removeClass("disable").prop("disabled",!1):u.addClass("disable").prop("disabled",!0)}).blur(function(){var e=d(this),t=e.val();e.hasClass("pwd")?""===t?(e.addClass("error"),p.removeClass("hide").find("em").text("请输入密码")):t.length<6||t.length>20?(e.addClass("error"),p.removeClass("hide").find("em").text("密码只支持6-20位")):w.test(t)?(p.addClass("hide"),""!==c.val()&&(t!==c.val()?(c.addClass("error"),h.removeClass("hide").find("em").text("两次密码输入不一致,请重新输入")):(c.removeClass("error"),h.addClass("hide")))):(e.addClass("error"),p.removeClass("hide").find("em").text("密码须字母和数字组合")):""===t?(e.addClass("error"),h.removeClass("hide").find("em").text("请输入密码确认")):""!==l.val()&&t!==l.val()?(e.addClass("error"),h.removeClass("hide").find("em").text("两次密码输入不一致,请重新输入")):(e.removeClass("error"),h.addClass("hide"))}).focus(function(){d(this).removeClass("error"),d(this).hasClass("pwd")?p.addClass("hide"):h.addClass("hide")}),l.focus(function(){p.addClass("hide"),f.removeClass("hide")}).blur(function(){f.addClass("hide")}),d("#pwd, #repwd").keydown(function(e){var t=e.keyCode||e.which;return 32===t?void e.preventDefault():void 0})}),define("js/passport/vertification",["jquery"],function(e,t,a){var i,n,o=e("jquery"),s=o("#send-captcha"),r=o("#captcha-tip"),d=o("#err-tip"),l=o("#next-step");s.click(function(){o.post("/passport/back/sendbackmobile",{mobile:o("#mobile").val(),area:o("#area").val(),verifyCode:o("#captchaPic").val()},function(e){if(200===e.code){if(d.hide(),o(this).hasClass("disable"))return;i=60,s.addClass("disable").attr("disabled",!0),r.removeClass("hide"),s.val(i--+"秒后可重新操作"),n=setInterval(function(){0===i?(clearInterval(n),s.val("发送验证码").removeClass("disable").removeAttr("disabled")):s.val(i--+"秒后可重新操作")},1e3)}else o(this).addClass("error"),d.removeClass("hide").text("发送失败")})}),o(this).hasClass("disable")||(i=60,s.addClass("disable").attr("disabled",!0),r.removeClass("hide"),s.val(i--+"秒后可重新操作"),n=setInterval(function(){0===i?(clearInterval(n),s.val("发送验证码").removeClass("disable").removeAttr("disabled")):s.val(i--+"秒后可重新操作")},1e3),o("#captcha").keyup(function(){var e=o.trim(o(this).val()),t=this;4===e.length&&o.ajax({type:"POST",url:"/passport/back/backmobile",dataType:"json",data:{code:o("#captcha").val(),verifyCode:o("#captchaPic").val(),area:o("#area").val(),mobile:o("#mobile").val()},success:function(e){200===e.code?(l.removeClass("disable").attr("href",e.data),d.addClass("hide"),o(t).removeClass("error")):(l.addClass("disable"),d.removeClass("hide").find("em").text("验证码输入错误"),o(t).addClass("error"))}})}).blur(function(){var e=o.trim(o(this).val());""===e&&(o(this).addClass("error"),d.removeClass("hide").text("请输入验证码"))}).focus(function(){o(this).removeClass("error")}))}),define("js/passport/thirdlogin",["jquery"],function(e,t,a){function i(){w(".choosetag").on("change",function(){var e="#f02200";"checked"===w(this).attr("checked")?w(".choosewrapper").css({"background-image":'url("'+q+'")'}):(w(".choosewrapper").css({"background-image":"none"}),e="#CCCCCC"),A.css({"background-color":e})})}function n(){return"checked"===w(".choosetag").attr("checked")}function o(){w(".optionshow").on("click",function(){w(".optionslist").toggleClass("hide")})}function s(){var e="";w(document).on("keyup","#validatenum",function(){e=w(this).val(),4===e.length&&(j||(j=!0,w.ajax({type:"POST",url:"/passport/autouserinfo/checkBindMsg",data:{code:e,mobile:w("#mobile").val(),area:w("#areacode").val()}}).then(function(e){j=!1,200===e.code?_=!0:alert(e.message)})))}),w("#validatenum").focus(function(){w(this).removeAttr("placeholder")}).blur(function(){w(this).attr("placeholder","验证码")})}function r(){w(".optionitem").on("click",function(){var e=w(this),t=e.attr("areanum"),a=e.text();w("#areaname").text(a),w("#areanum").text(t),w("#areacode").val(t),w(".optionslist").addClass("hide")})}function d(){w(document).on("click","body",function(e){var t=w(e.target);t.hasClass("yohoselectarea")||t.hasClass("areaname")||t.hasClass("righttag")||t.hasClass("optionslist")||t.hasClass("optionitem")||w(".optionslist").addClass("hide")})}function l(){var e="",t="";w(".optionitem").each(function(){e=w(this),t=e.attr("areanum").replace(/\+/g,""),e.attr("areanum",t)})}function c(){var e;w(document).on("click","#alreayregist",function(t){e=w(t.target),(e.hasClass("mask")||e.hasClass("backdrop"))&&(w("#alreayregist").hide(),w(".backdrop").hide())}),w(document).on("click","#bindconfirm",function(t){e=w(t.target),(e.hasClass("mask")||e.hasClass("backdrop"))&&(w("#bindconfirm").hide(),w(".backdrop").hide())})}function u(){w(document).on("click","#yohobindbtn",function(e){w(".phonenum").val(""),w("#bindconfirm").hide(),w(".backdrop").hide()}),w(document).on("click","#yohobindbtn2",function(e){w(".phonenum").val(""),w("#alreayregist").hide(),w(".backdrop").hide()})}function p(){return k-=1,0>k?(k=60,void w(".validatewrapper").html(x)):(w(".second").text(k),void window.setTimeout(p,1e3))}function h(e){w(".validatewrapper").html(C),window.setTimeout(p,1e3)}function f(){w(document).on("click","#sendmessage",function(){"disabled"!==w("#sendmessage").attr("disabled")&&(h(w("#mobile").val()),w.ajax({type:"POST",url:"/passport/autouserinfo/sendBindMsg",data:{mobile:w("#mobile").val(),area:w("#areacode").val()}}).then(function(e){200!==e.code&&alert(e.message)}))})}function m(){var e="",t="";t=w("#areacode").val(),e=w("#mobile").val(),w.ajax({type:"POST",url:"/passport/autouserinfo/bindMobile",data:{area:t,openId:w("#openId").val(),sourceType:w("#sourceType").val(),mobile:e,code:w("#validatenum").val()}}).then(function(e){200===e.code?e.data&&e.data.refer?window.location.href=e.data.refer:window.location.href="/passport/thirdlogin/bindsuccess":alert(e.message)})}function v(){w(document).on("click","#gotobindphone",function(){_===!0?(w("#inarea").val(w("#areacode").val()),w("#inmobile").val(w("#mobile").val()),m()):alert("请输入正确验证码")})}function g(){var e="",t="",a="",i="",o="",s="";w("#bindfirststep").on("click",function(r){var d;if(r.preventDefault(),a=w(".phonenum").val(),i=w("#areanum").text(),d=b["+"+i],n()){if(""===a||!d||!d.test(a))return T.find("em").text("手机格式错误"),
void T.removeClass("hide");e=w("#openId").val()||"29803EC6D4AAC3AAB8ABDB6AE829D579",t=w("#sourceType").val()||"qq",w.ajax({type:"post",url:"/passport/autouserinfo/bindCheck",data:{mobile:a,area:i,openId:e,sourceType:t},dataType:"json",success:function(e){var t=w(window).height();200===e.code&&(w("#bindmobileform").attr("action","/passport/thirdlogin/noregist"),w("#bindmobileform").submit()),(400===e.code||402===e.code)&&(T.find("em").text("手机格式错误"),T.removeClass("hide")),506===e.code&&(o=e.data.user.username,s=e.data.user.headImg,w("#registphone").text(a),w("#username").text(o),""===s?w("#userphoto").attr("src","http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100"):w("#userphoto").attr("src",s),w("#logindirectly2").attr("href",e.data.user.bindLogin),w(".backdrop").show(),w("#sendmessage").click(),w("#alreayregist .mask").css({"padding-top":t>440?t/2:217}),w("#alreayregist").show()),505===e.code&&(o=e.data.user.username,s=e.data.user.headImg,w("#registphonetwo").text(a),w("#username1").text(o),""===s?w("#userphoto1").attr("src","http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100"):w("#userphoto1").attr("src",s),w("#logindirectly").attr("href",e.data.user.bindLogin),w(".backdrop").show(),w("#bindconfirm .mask").css({"padding-top":t>440?t/2:217}),w("#bindconfirm").show())}})}})}function y(){l(),f(),i(),r(),o(),d(),g(),c(),u(),v(),s()}var w=e("jquery"),b=e("js/passport/mail-phone-regx").phoneRegx,C=w("#nopermissionmessage").html(),x=w(".validatewrapper").html(),k=+w(".second").text(),j=!1,_=!1,q="http://cdn.yoho.cn/yohobuy/assets/img/passport/choosed.png",I=w(".bindwrapper"),T=I.find(".phone-err-tip"),A=I.find(".yohobindbtn");y()}),define("js/passport/third-pwd",["jquery"],function(e,t,a){function i(e,t){return e.charCodeAt(t)>=48&&e.charCodeAt(t)<=57?1:e.charCodeAt(t)>=97&&e.charCodeAt(t)<=122?2:e.charCodeAt(t)>=65&&e.charCodeAt(t)<=90?3:4}function n(e,t,a){var i=e.charCodeAt(0),n=t.charCodeAt(0);return i-n===0?!0:4===a||i-n!==1&&i-n!==-1?!1:!0}function o(e,t){return 0===t||e===t?0:4===e||4===t?2:1}function s(e){var t=0,a=e.length,s="",r=0,d=0,l="",c="";for(d;a>d;d++)l=e.charAt(d),c=i(e,d),r===c&&n(l,s,c)||(t+=c+o(c,r)),s=l,r=c;return t}function r(e,t){e.find("em").text(t),e.removeClass("hide")}function d(){return _-=1,0>_?(_=60,void C(".validatewrapper").html(I)):(C(".second").text(_),void window.setTimeout(d,1e3))}function l(){C(".validatewrapper").html(q),window.setTimeout(d,1e3)}function c(){C(document).on("click","#sendmessage",function(){l(),C.ajax({type:"POST",url:"/passport/autouserinfo/sendBindMsg",data:{mobile:O,area:P}}).then(function(e){200!==e.code&&alert(e.message)})})}function u(){var e="";C(document).on("keyup","#validatenum",function(){C("#err-info").hide(),e=C(this).val(),4===e.length&&(x||(x=!0,C.ajax({type:"POST",url:"/passport/autouserinfo/checkBindMsg",data:{code:e,mobile:O,area:P}}).then(function(e){x=!1,200!==e.code?C("#err-info").show():k=!0})))})}function p(){var e=g.val(),t=s(e),a=0;switch(a=0===t?0:10>=t?1:20>=t?2:3){case 0:y.removeClass("red yellow green"),b.removeClass("color");break;case 1:y.addClass("red").removeClass("yellow green"),b.filter(".low").addClass("color"),b.filter(".mid,.high").removeClass("color");break;case 2:y.addClass("yellow").removeClass("red green"),b.filter(".low,.mid").addClass("color"),b.filter(".high").removeClass("color");break;case 3:y.addClass("green").removeClass("yellow red"),b.addClass("color")}""===e?(j=!1,w.removeClass("red yes no").addClass("default")):(e.length<6||e.length>20?(j=!1,w.removeClass("default yes").addClass("no red")):(j=!0,w.removeClass("default no red").addClass("yes")),/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/.test(e)?E.removeClass("default no red").addClass("yes"):E.removeClass("default yes").addClass("no red"))}function h(){C(document).on("keyup",".pwdcontent",function(){p(C(this))}),C(document).on("focus",".pwdcontent",function(){C("#pwd-tips").removeClass("hide")}),C(document).on("blur",".pwdcontent",function(){C("#pwd-tips").addClass("hide")})}function f(){var e="",t="";T||(T=!0,setTimeout(function(){T=!1},5e4),e=C("#pwd").val(),t=C("#validatenum").val(),C.ajax({type:"POST",url:"/passport/autouserinfo/bindMobile",data:{area:P,openId:C("#openId").val(),sourceType:C("#sourceType").val(),mobile:O,password:e,code:t}}).then(function(e){T=!1,200===e.code?e.data&&e.data.refer?window.location.href=e.data.refer:window.location.href="/passport/thirdlogin/bindsuccess":alert(e.message)}))}function m(){var e="",t="";C("#confirmsubmit").on("click",function(){var a=!0;e=C("#validatenum").val(),t=C("#pwd").val(),""===e?(r(D,"短信验证码不能为空"),a=!1):k===!1&&(r(D,"请输入正确的验证码"),a=!1),""===t?(r(S,"密码不能为空"),a=!1):t.length<6||t.length>20?(r(S,"密码只支持6-20位字符"),a=!1):z.test(t)?j===!1&&(r(S,"请输入符合强度的密码"),a=!1):(r(S,"密码须由字母和数字组合"),a=!1),a&&f()})}function v(){g=C("#pwd"),y=C(".safelevel"),b=C(".pwd-intensity"),w=C("#pwd-tip1"),c(),u(),h(),m(),O&&P&&$.click()}var g,y,w,b,C=e("jquery"),x=!1,k=!1,j=!1,_="",q="",I="",T=!1,A=C(".bindwrapper"),D=A.find(".code-err-tip"),S=A.find(".pwd-err-tip"),E=C("#pwd-tip2"),$=C("#sendmessage"),z=e("js/passport/mail-phone-regx").pwdValidateRegx,O=C("#mobile").val(),P=C("#area").val();q=C("#nopermissionmessage").html(),I=C(".validatewrapper").html(),_=+C(".second").text(),v()}),define("js/cart/cart",["jquery","handlebars","source-map"],function(e,t,a){function i(e){I={skuList:JSON.stringify(e)},U.ajax({type:"POST",dataType:"json",url:"/cart/index/select",data:I,beforeSend:function(){U(".loading").css({top:U(document).scrollTop()+200}),U(".loading").show()}}).then(function(e){200===e.code&&window.history.go(0)})}function n(e,t,a){U.ajax({type:"GET",dataType:"json",url:t,data:a}).then(function(t){200===t.code&&t.data.item&&t.data.item.length>0&&(e.html(" "),m=f(t.data),e.append(U(m)),U("#orderProduct li:last").addClass("end"),U(".gift").removeClass("none"))})}function o(e){U.ajax({type:"GET",dataType:"html",url:"/cart/index/getProductInfo",data:e}).then(function(e){Q.html(" "),Q.append(e),U(".bigpic :not(:first)").hide(),U(".detail-bigpic:first .con li:first").addClass("active"),U(".showSizeBox:not(.none) span:first").data("num")>0?U(".showSizeBox:not(.none) span:first").addClass("atcive"):(U(".addcart").addClass("none"),U(".btn_sellout").removeClass("none")),U.each(U(".showSizeBox span"),function(){U(this).data("num")<=0&&U(this).addClass("nullAtcivec")}),"undefined"!=typeof S&&(U(".oldprice").html("现价:<del>"+U(".oldprice del").html()+"</div>"),U(".newprice").html('活动价<b class="promotion-price">'+S+"</b>")),Q.show()})}function s(){Q.html(" "),Q.css({top:U(document).scrollTop()+30,left:U(document).width()/2-Q.width()/2})}function r(e){e.addClass("none").siblings("i").removeClass("none"),e.parents(".cart-product-num").siblings("div").toggleClass("fold"),e.siblings(".unfold-color").toggleClass("none"),e.siblings(".cart-page").toggleClass("none")}function d(e,t,a){I={skuList:JSON.stringify(e)},U.ajax({type:"POST",dataType:"json",url:t,data:I,beforeSend:function(){U(".loading").css({top:U(document).scrollTop()+200}),U(".loading").show()}}).then(function(e){200===e.code?(a&&window.setCookie("cart-del-list",JSON.stringify(a),{domain:".yohobuy.com",path:"/"}),window.history.go(0)):300===e.code?(U(".loading").hide(),new H(e.message).show()):403===e.code&&e.data.url&&(window.location=e.data.url)})}function l(e){U.ajax({type:"POST",dataType:"json",url:"/cart/index/modify",data:e}).then(function(e){200===e.code&&window.history.go(0)})}function c(e,t){U.ajax({type:"POST",url:"/cart/index/add",data:e}).then(function(e){200===e.code?(window.history.go(0),t&&window.setCookie("cart-del-list",JSON.stringify(t),{domain:".yohobuy.com",path:"/"})):500===e.code&&new H(e.message).show()})}function u(){U(".gift-wrapper .fold").show(),U(".pre-sell-box input:checked").length===U('.pre-sell-box input[type="checkbox"]').length&&U('.per-list input[type="checkbox"]').attr("checked",!0),U(".common-sell-box input:checked").length===U('.common-sell-box input[type="checkbox"]').length&&U('.common-list input[type="checkbox"]').attr("checked",!0),U(".cart-page").each(function(){1===U(this).data("pageall")?(U(".cart-btn-pre",this).hide(),U(".cart-btn-next",this).hide()):U(".cart-btn-pre",this).hide()}),U(".pre-sell-box input:checked").length>0&&U(".common-sell-box input:checked").length>0?(U(".go_cash_tips").show(),U(".btn_account_disabled").show(),U(".btn_account").hide()):(U(".go_cash_tips").hide(),U(".btn_account").show(),U(".btn_account_disabled").hide()),U(".pay-wapper tr").each(function(){U(this).data("pid")&&ae.push(U(this).data("pid")+"")}),U.ajax({type:"POST",url:"/cart/index/checkFav",data:{pidList:JSON.stringify(ae)}}).then(function(e){E='<span class="cart-yetremove-btn">已收藏</span>',$='<a href="javascript:void(0);" class="cart-remove-btn"><span>移入收藏</span></a>',U.each(e.data,function(e,t,a){U(".pay-wapper tr").each(function(){Number(U(this).data("pid"))===Number(e)&&(t?U(this).find(".cart-operation").append(E):U(this).find(".cart-operation").append($))})})})}function p(e,t){ae=[],b=e.attr("checked")?"Y":"N",U("."+t).each(function(){U(this).data("id")&&ae.push({product_sku:U(this).data("id"),selected:b,buy_number:U(this).data("productnum"),goods_type:U(this).find('input[type="checkbox"]').data("goodstype")})}),i(ae)}var h,f,m,v,g,y,w,b,C,x,k,j,_,q,I,T,A,D,S,E,$,z,O,P,N,L,F,U=e("jquery"),B=e("handlebars"),M=e("js/common/dialog"),R=M.Confirm,H=M.Alert,G=U(".cartnew-sum"),Y=U(".cartnew-tips"),Z=U(".pay-wapper"),Q=U(".goods-detail"),W=U(".histroy"),X=U(".together"),J=U(".shop-cart"),V=U(".detail-bigpic"),K=1,ee=0,te=1,ae=[];Y.find(".btn_close").click(function(){Y.fadeOut()}),Z.on("click",'.common-sell-box input[type="checkbox"], .pre-sell-box input[type="checkbox"]',function(){ae=[],b=U(this).attr("checked")?"Y":"N",q=U(this).parents("tr").data("id"),C=U(this).parents("tr").data("productnum"),x=U(this).data("goodstype"),ae.push({product_sku:q,selected:b,buy_number:C,goods_type:x}),i(ae)}),G.on("click",'input[type="checkbox"]',function(){ae=[],b=U(this).attr("checked")?"Y":"N",U(".pay-wapper:first tr").each(function(){U(this).data("id")&&ae.push({product_sku:U(this).data("id"),selected:b,buy_number:U(this).data("productnum"),goods_type:U(this).find('input[type="checkbox"]').data("goodstype")})}),i(ae)}),h=U("#togetherProduct").html(),f=B.compile(h),n(W,"/cart/index/getHistroyProduct"),n(X,"/cart/index/getTogetherProduct"),X.on("click",".pagenext, .pageprev",function(){n(X,"/cart/index/getTogetherProduct",{page:Math.ceil(100*Math.random())+1})}),J.on("click",".icon-minus, .icon-add",function(){U(this).hasClass("icon-minus")?(U(this).parents(".title").next(".main").hide(),U(this).parents("h2").next(".right").hide()):(U(this).parents(".title").next(".main").show(),U(this).parents("h2").next(".right").show()),U(this).siblings("i").toggleClass("none"),U(this).toggleClass("none")}),W.on("click",".pagenext, .pageprev",function(){U(this).hasClass("pagenext")?K++:--K>0||(K=1),n(W,"/cart/index/getHistroyProduct",{page:K})}),Z.on("click",".cart-add-btn",function(){P=U(this).data("id"),D=U(this).parents("table").data("promotion"),S=U(this).parents("table").find(".subjoin-price").html(),s(),o({productId:P})}),U(".clearfix").on("click",".btn_view_s",function(){P=U(this).data("id"),D=U(this).parents("table").data("promotion"),S=U(this).parents("table").find(".subjoin-price").html(),s(),o({productId:P})}),Q.on("click",".colse",function(){Q.hide(),Q.html(" "),te=1}),Z.on("click",".icon-minusCart, .icon-addCart",function(){r(U(this))}),Z.on("click",".unfold-color",function(){r(U(this)),U(this).siblings(".icon-minusCart").removeClass("none"),U(this).siblings(".icon-addCart").addClass("none")}),Z.on("click",".cart-btn-next",function(){v=U(this).siblings("p").find(".f-red"),y=Number(U(this).siblings("p").find(".subjoinPageNum").html()),g=Number(v.html()),v.html(g+1),g>=y-1?U(this).hide():U(this).siblings("i").show(),w=U(this).parents(".cart-product-num").siblings("div").find("table"),w.addClass("none").eq(g).removeClass("none")}),Z.on("click",".cart-btn-pre",function(){v=U(this).siblings("p").find(".f-red"),y=Number(U(this).siblings("p").find(".subjoinPageNum").html()),g=Number(v.html()),v.html(g-1),2>=g?U(this).hide():U(this).siblings("i").show(),w=U(this).parents(".cart-product-num").siblings("div").find("table"),w.addClass("none").eq(g-2).removeClass("none")}),Q.on("click",".fav_count",function(){U.ajax({type:"POST",dataType:"json",url:"/product/item/togglecollect",data:{productId:P,type:"add"}}).then(function(e){200===e.code?new H(e.message).show():403===e.code?e.data.url&&(window.location=e.data.url):new H(e.message).show()})}),Z.on("click",".cart-del-btn",function(){q={},_={},z=U(this).attr("class"),C=U(this).parents("tr").data("productnum"),q[""+U(this).parents("tr").data("id")]=C,O="<div><span></span>删除商品</div><p>确定从购物车中删除此商品?</p>",U(this).data("gift")||(_={productPrice:U(this).parents("tr").find(".productPrice").text(),productTitle:U(this).parents("tr").find(".pay-pro-info a").text(),link:U(this).parents("tr").find(".pay-pro-info a").attr("href"),productNum:U(this).parents("tr").data("productnum"),productSku:U(this).parents("tr").data("id")}),k="/cart/index/remove",new R({content:O,cb:function(){d(q,k,_)}}).show()}),Z.on("click",".cart-remove-btn",function(){q={},z=U(this).attr("class"),C=U(this).parents("tr").data("productnum"),q[""+U(this).parents("tr").data("id")]=C,d(q,"/cart/index/fav")}),G.on("click",".delAll",function(){q={},ae=[],U(".pay-wapper:first tr").each(function(){U(this).data("id")&&U(this).find('input[type="checkbox"]').attr("checked")&&(q[""+U(this).data("id")]=U(this).data("productnum"),_={productPrice:U(this).find(".productPrice").text(),productTitle:U(this).find(".pay-pro-info a").text(),link:U(this).find(".pay-pro-info a").attr("href"),productNum:U(this).data("productnum"),productSku:U(this).data("id")},ae.push(_))}),k="/cart/index/remove",O="<div><span></span>删除商品</div><p>确定从购物车中删除所有选中商品?</p>",U.isEmptyObject(q)?new H("请至少选择一件商品").show():new R({content:O,cb:function(){d(q,k,ae)}}).show()}),G.on("click",".removeAll",function(){q={},U(".pay-wapper:first tr").each(function(){U(this).data("id")&&U(this).find('input[type="checkbox"]').attr("checked")&&(q[""+U(this).data("id")]=U(this).data("productnum"))}),U.isEmptyObject(q)?new H("请至少选择一件商品").show():d(q,"/cart/index/fav")}),Z.on("click",".minus, .plus",function(){return _={},j=U(this).hasClass("minus")?"decreaseNum":"increaseNum",_[""+j]=1,"1"===U(this).siblings("input").val()&&U(this).hasClass("minus")?(q={},z=U(this).attr("class"),C=U(this).parents("tr").data("productnum"),q[""+U(this).parents("tr").data("id")]=C,O="<div><span></span>删除商品</div><p>确定从购物车中删除此商品?</p>",_={productPrice:U(this).parents("tr").find(".productPrice").text(),productTitle:U(this).parents("tr").find(".pay-pro-info a").text(),link:U(this).parents("tr").find(".pay-pro-info a").attr("href"),productNum:U(this).parents("tr").data("productnum"),productSku:U(this).parents("tr").data("id")},k="/cart/index/remove",!1):void l(U.extend(_,{sku:U(this).parents("tr").data("id")}))}),U(".gift").on("click",".up, .down",function(){U(this).siblings("i").toggleClass("none"),U(this).toggleClass("none")}),Q.on("click",".addcart",function(){T=U(".showSizeBox:not(.none) .atcive").data("num"),A=U(".showSizeBox:not(.none) .atcive").data("sku"),I={productSku:A,buyNumber:U("#mnum").val(),promotionId:D},U("#mnum").val()>T?new H("库存不足,目前还有"+T+"个库存").show():c(I)}),Q.on("click",".cut, .add",function(){if(j=U(this).hasClass("minus")?"decreaseNum":"increaseNum",D)U(this).hasClass("cut")?new H("-_-,已经是最后一件,不能在减了!").show():new H("最多只能购买1,您好像购买的太多了!").show();else{if(U(this).hasClass("add")?te++:te--,1>te)return new H("-_-,已经是最后一件,不能在减了!").show(),!1;U("#mnum").val(te)}}),Q.on("click",".color",function(){U(".color").find("p").removeClass("atcive"),U(this).find("p").addClass("atcive"),U(".showSizeBox").addClass("none").eq(U(this).index()).removeClass("none"),U(".showSizeBox:not(.none) span:first").data("num")>0?(U(".showSizeBox:not(.none) span:first").addClass("atcive"),U(".addcart").removeClass("none"),U(".btn_sellout").addClass("none")):(U(".showSizeBox:not(.none) span:first").addClass("atcivec"),U(".addcart").addClass("none"),U(".btn_sellout").removeClass("none")),V.addClass("none").eq(U(this).index()).removeClass("none"),V.eq(U(this).index()).find(".bigpic:first").show(),V.eq(U(this).index()).find(".con li:first").addClass("active")}),Q.on("click",".showSizeBox span",function(){T=U(this).data("num"),U(this).data("num")>0?(U(".showSizeBox:not(.none) span").removeClass("atcivec atcive").eq(U(this).index()).addClass("atcive"),U(".addcart").removeClass("none"),U(".btn_sellout").addClass("none")):(U(".showSizeBox:not(.none) span").removeClass("atcivec atcive").eq(U(this).index()).addClass("atcivec"),U(".addcart").addClass("none"),U(".btn_sellout").removeClass("none"))}),U(".goBack").on("click",function(){L=U(".dev-revocation .goBack").index(this),ae=[],U(".dev-revocation tr").each(function(e){L!==e&&(_={productPrice:U(this).find(".productPrice").text(),productTitle:U(this).find(".title").text(),link:U(this).find(".title").attr("href"),productNum:U(this).data("productnum"),productSku:U(this).data("productsku")},ae.push(_))}),I={productSku:U(this).parents("tr").data("productsku"),buyNumber:U(this).parents("tr").data("productnum")},c(I,ae)}),Q.on("click",".piclist li",function(){ee=U(this).index(),U(".detail-bigpic:not(.none) .piclist li").removeClass("active"),U(this).addClass("active"),U(".detail-bigpic:not(.none) .bigpic").hide().eq(U(this).index()).show()}),u(),Q.on("click",".pre, .next",function(){if(U(this).hasClass("next")){if(ee>U(this).siblings(".con").find("li").length-2)return!1;ee++}else{if(1>ee)return!1;ee--}U(this).siblings(".con").find("li").removeClass("active").eq(ee).addClass("active"),U(".bigpic").hide().eq(ee).show()}),U(".btn_account").on("click",function(){F="",U(".pay-wapper input:checked").parents("tr").find(".tipNoStore").length>0?(N=U(".pay-wapper input:checked").parents("tr").find(".tipNoStore"),U.each(N.parents(".common-sell-box").find(".pay-pro-info a"),function(){F+=U(this).html()}),new H(F+"库存不足").show()):U(".zp").length>0&&!U(this).attr("title")?(U(this).attr("title","1"),new H("您有赠品没有选择,请选择完再结算!").show()):U("input:checked").length>0?U(".pre-sell-box input:checked").length>0?window.location.href="/cart/index/orderEnsure?type=2":window.location.href="/cart/index/orderEnsure?type=1":new H("请至少选择一件商品").show()}),U(".per-list").on("click",'input[type="checkbox"]',function(){p(U(this),"pre-sell-box")}),U(".common-list").on("click",'input[type="checkbox"]',function(){p(U(this),"common-sell-box")})}),define("js/home/entry",["jquery","handlebars","source-map"],function(e,t,a){e("js/home/index"),e("js/home/orders"),e("js/home/favorite"),e("js/home/returns"),e("js/home/comment"),e("js/home/edit"),e("js/home/gift"),e("js/home/validate"),e("js/home/address"),e("js/home/common-address")}),define("js/home/index",["jquery"],function(e,t,a){var i=e("jquery");i("#close-message").click(function(){i(".message-tip").slideUp(200)}),function(){var e=i(".na-pager"),t=i(".new-arrival ul"),a=Math.ceil(t.children("li").length/5),n=t.children("li:last-child").outerWidth(),o=1;t.width(t.width()*a),e.click(function(){var e,s=i(this);s.hasClass("next")?(++o,2===o&&s.siblings().removeClass("no-visible"),o===a&&s.addClass("no-visible")):(--o,o===a-1&&s.siblings().removeClass("no-visible"),1===o&&s.addClass("no-visible")),e=-5*(o-1)*n,t.animate({marginLeft:e},400)})}()}),define("js/home/orders",["jquery","handlebars","source-map"],function(e,t,a){e("js/home/order-block")}),define("js/home/order-block",["jquery","handlebars","source-map"],function(e,t,a){function i(e){var t={mask:!1,btns:[{id:"cancel-sure",name:"确定并取消订单",btnClass:["cancel-sure"],cb:function(){var t=o(".cancel-dialog :checked");o.ajax({type:"POST",url:"/home/orders/cancelorder",data:{orderCode:e,reason:t.length>0?t.val():""}}).then(function(e){200===e.code?(n.close(),history.go(0)):o(".cancel-dialog .cancel-tip").html(e.message)})}},{id:"cancel-no",name:"取消",btnClass:["cancel-no"],cb:function(){n.close()}}],content:c,className:"cancel-dialog"};return new r(t)}var n,o=e("jquery"),s=e("js/common/dialog"),r=s.Dialog,d=s.Confirm,l=o("#cancel-dialog-tpl"),c=l.html();l.remove(),o(".check-logistics").click(function(){o(this).parent().siblings(".logistics").removeClass("hide")}),o(".close-logistics").click(function(){o(this).closest(".logistics").addClass("hide")}),o(".me-orders").on("click",".cancel-order",function(e){n=i(o(this).closest(".order").data("id")),n.show()}).on("click",".confirm-received",function(e){var t=o(this).closest(".order").data("id");n=new d({cb:function(){o.ajax({type:"POST",url:"/home/orders/confirmorder",data:{orderCode:t}}).then(function(e){200===e.code&&(n.close(),history.go(0))})},content:"您确定要确认收货吗?"}),n.show()})}),define("js/home/favorite",["jquery"],function(e,t,a){var i,n,o,s=e("jquery"),r=e("js/passport/mail-phone-regx").phoneRegx["+86"],d={on:"[ 降价通知 ]",off:"[ 取消通知 ]"};!function(){function e(){c.addClass("hide"),u.addClass("hide"),f.text("订阅成功")}function t(){"undefined"==typeof c&&(s("body").append('<div class="body-mask hide"></div>'),c=s(".body-mask")),c.css({height:s(document).height(),width:s(document).width()}).removeClass("hide"),o.hasClass("noticed")&&s.ajax({type:"GET",url:"/home/favorite/cancelnotice",data:{skn:n}}).then(function(e){200===e.code&&(p.addClass("hide"),h.removeClass("hide").find(".notice-num").text(e.data.num),f.text("取消成功"),o.closest(".reduction-products").length>0?o.closest(".fav-good").remove():o.text(d.on))}),u.removeClass("hide")}var a,l,c,u,p,h,f;0!==s(".fav-products").length&&(i="products",a=s(".default-sorts"),l=s(".all-sorts"),u=s(".price-notice"),p=s("#price-notice .content"),h=s("#price-notice .success"),f=h.find(".subscribe-or-cancel"),s("#spread-sort").click(function(){a.slideUp(function(){l.slideDown()})}),s("#retract-sort").click(function(){l.slideUp(function(){a.slideDown()})}),s(".price-down-clock").click(function(){o=s(this),t(),n=o.closest(".fav-good").data("skn")}),s("#price-notice").on("click",".close",function(){e()}).on("click",".price-notice-sure",function(){var t,a,i=s("#notice-phone-num");if(h.hasClass("hide")){if(t=s.trim(i.val()),""===t||!r.test(t))return a=""===t?"请输入手机号码":"手机号码格式不正确",i.addClass("error"),void s("#price-notice .err-text").removeClass("hide").find("em").html(a);i.removeClass("error"),s("#price-notice .err-text").addClass("hide"),s.ajax({type:"GET",url:"/home/favorite/notice",data:{phone:t,skn:n}}).then(function(e){200===e.code&&(h.removeClass("hide"),p.addClass("hide"),h.find(".notice-num").html(e.data.num),o.toggleClass("noticed").text(d.off))})}else e()}),s(".has-activity").click(function(){var e=s(this),t=e.next(".activites"),a=e.closest("li");t.hasClass("hide")?(t.removeClass("hide"),a.css("padding-bottom",t.outerHeight())):(t.addClass("hide"),a.css("padding-bottom",""))}))}(),function(){0!==s(".fav-brands").length&&(s(".na-not-zero").click(function(){var e=s(this),t=e.next(".na-list"),a=e.closest("li");return t.hasClass("hide")?void s.ajax({type:"GET",url:"/home/newproduct"}).then(function(e){t.removeClass("hide").find(".na-content").html(e),a.css("padding-bottom",t.outerHeight()+10)}):(t.addClass("hide"),void a.css("padding-bottom",""))}),s(".na-content").on("click",".na-pre, .na-next",function(){var e=s(this),t=e.data("url");s.ajax({type:"GET",url:t}).then(function(t){e.closest(".na-content").html(t)})}))}(),s("#me-checkall").click(function(){s('.checkbox input[type="checkbox"]').prop("checked",s(this).prop("checked"))}),s("#me-del-checked").click(function(){var e,t=[];if(s('.checkbox input[type="checkbox"]:checked').each(function(){t.push(s(this).closest(".fav-row").data("id"))}),0!==t.length){switch(i){case"products":e="/home/favorite/multidelgoods";break;case"brands":e="/home/favorite/multidelbrands";break;case"articles":e="/home/favorite/multidelarticles"}s.ajax({type:"GET",url:e,data:{ids:t}}).then(function(e){200===e.code&&window.history.go(0)})}})}),define("js/home/returns",["jquery","handlebars","source-map"],function(e,t,a){e("js/home/returns-detail"),e("js/home/returns-apply")}),define("js/home/returns-detail",["jquery"],function(e,t,a){function i(){m=v[h]?v[h]:"",u.html(m+" 快递单号:"+f),l.val(h),c.val(f)}function n(){var e={};if(e.number=c.val(),e.id=1*l.val(),e.id){if(e.number)return e;alert("请填入快递单号")}else alert("请选择快递公司");return!1}function o(){var e=n();e&&s.ajax({type:"POST",url:"/home/returns/setExpressNumber",data:{id:p,isChange:g,expressId:e.id,expressNumber:e.number,expressCompany:v[e.id]}}).then(function(t){200===t.code?(h=e.id,f=e.number):alert(t.message),i(),d.removeClass("in-edit")})}var s=e("jquery"),r=s(".detail-container"),d=s(".courier-code"),l=s("#express-company"),c=s("#express-number"),u=s(".express-view-box > span"),p=s("#return-id").val(),h=s("#express-old-id").val(),f=c.val(),m="",v={},g=!1;r.parent().hasClass("exchange-detail")&&(g=!0),l.val(h),r.find(".company-list").each(function(){var e=s(this).data();v[e.id]=e.name}),s("#modify").click(function(){d.addClass("in-edit")}),s("#submit-btn").click(function(){o()})}),define("js/home/returns-apply",["jquery","handlebars","source-map"],function(e,t,a){var i=e("jquery"),n=e("js/home/common-address"),o=i("#goods-table"),s=o.find(".return-reason"),r=o.find("input[type=file]"),d=i(".exchange-detail"),l=d.find('input[name="hide-area"]').val();e("plugin/jquery.upload"),l=l?l:"",n.loadAllData(l,{areaDomId:"area"}),s.change(function(){var e=i(this).parent().parent(),t=1*i(this).val();4===t||6===t||8===t?e.next().show():e.next().hide()}),o.find(".up-image-list li").on("click",".btn-del",function(){i(this).parent().empty()}),r.each(function(e){i("#upload-img-"+e).upload({auto:!0,buttonClass:"upload-img-btn",fileType:"image/*",uploadScript:"/home/suggestimgUpload",fileObjName:"fileData",fileSizeLimit:5e3,buttonText:"上传图片",height:34,width:116,multi:!1,onUploadComplete:function(e,t){var a,n,o=i(this).closest(".problem-description"),s=o.find("li"),r=!1;a=JSON.parse(t).imgList[0],n='<span class="btn-del" title="删除"></span><img src="'+a.imgUrl+'" width="126" height="126">',s.each(function(){r||i(this).find("img").length||(r=!0,i(this).html(n))})},onError:function(e,t,a){var i="图片上传失败!";"FILE_SIZE_LIMIT_EXCEEDED"===e&&(i="图片大小超出限制!"),alert(i)}})})}),define("js/home/common-address",["jquery","handlebars","source-map"],function(e,t,a){var i=e("jquery"),n=e("js/common/dialog"),o=n.Alert,s={provinceDomId:"province",cityDomId:"city",areaDomId:"areaCode",initDomIds:function(e){var t=this;void 0!==e.provinceDomId&&(t.provinceDomId=e.provinceDomId),void 0!==e.cityDomId&&(t.cityDomId=e.cityDomId),void 0!==e.areaDomId&&(t.areaDomId=e.areaDomId)},loadAreaData:function(e,t,a,n){var s,r,d,l,c=i("#"+t),u=0,p="";c.empty(),91>e&&(i("#areaCode").empty(),i("#county").attr("disabled","disabled")),i.ajax({type:"GET",url:"/home/address/area",data:"id="+e,success:function(e){if(e.code=200,200!==e.code)return s=new o("暂无数据"),s.show(),!1;c.append('<option value="0">'+a+"</option>");for(u in e.options)e.options[u]&&(r=e.options[u],p="areaCode"===t&&"Y"===r.is_support?"*":"",d=r.value,l="","undefined"!=typeof n&&0!==n&&d===n.substr(0,d.length)&&(l="selected"),c.append('<option value="'+d+'" '+l+">"+p+r.text+"</option>"))}})},bindAreaChange:function(e){var t=this;void 0===i("#"+t.provinceDomId).data("events")&&(i("#"+t.provinceDomId).change(function(){var a=i("#"+t.provinceDomId).val();"0"!==a&&(t.loadAreaData(a,t.cityDomId,"请选择城市",a),i("#"+t.areaDomId).hide(),t.showAreaSel(e.dispDomId))}),i("#"+this.cityDomId).change(function(){var a=i("#"+t.cityDomId).val();"0"!==a&&(t.loadAreaData(a,t.areaDomId,"请选择区县",a),i("#"+t.areaDomId).show(),t.showAreaSel(e.dispDomId))}),i("#"+t.areaDomId).change(function(){t.showAreaSel(e.dispDomId)}),t.showAreaSel(e.dispDomId))},showAreaSel:function(e){var t=this,a="",n=i("#"+t.provinceDomId).find("option:selected").text(),o=i("#"+t.cityDomId).find("option:selected").text(),s=i("#"+t.areaDomId).find("option:selected").text();void 0!==e&&""!==e&&(n.indexOf("选择")<0&&(a=n),""!==o&&o.indexOf("选择")<0&&(a+=","+o),""!==s&&s.indexOf("选择")<0&&(a+=","+s),i("#"+e).html(a))},loadAllData:function(e,t){var a=this;a.initDomIds(t),e+="",91>e?(a.loadAreaData(0,a.provinceDomId,"请选择省份",""),i("#"+a.areaDomId).hide(),i("#"+a.cityDomId).html('<option value="0">请选择市</option>')):4===e.length?(a.loadAreaData(0,a.provinceDomId,"请选择省份",e),a.loadAreaData(e.substr(0,2),a.cityDomId,"请选择城市",e),a.loadAreaData(e,a.areaDomId,"请选择区县",e),i("#"+a.areaDomId).show()):6===e.length&&(a.loadAreaData(0,a.provinceDomId,"请选择省份",e),a.loadAreaData(e.substr(0,2),a.cityDomId,"请选择城市",e),a.loadAreaData(e.substr(0,4),a.areaDomId,"请选择区县",e),i("#"+this.areaDomId).show()),a.bindAreaChange(t)}};a.exports=s}),define("plugin/jquery.upload",["jquery"],function(e,t,a){var n=e("jquery");!function(e){var t={init:function(a){return this.each(function(){var n=e(this);n.data("uploadifive",{inputs:{},inputCount:0,fileID:0,queue:{count:0,selected:0,replaced:0,errors:0,queued:0,cancelled:0},uploads:{current:0,attempts:0,successful:0,errors:0,count:0}});var o=n.data("uploadifive"),s=o.settings=e.extend({auto:!0,buttonClass:!1,buttonText:"Select Files",checkScript:!1,dnd:!0,dropTarget:!1,fileObjName:"Filedata",fileSizeLimit:0,fileType:!1,formData:{},height:30,itemTemplate:!1,method:"post",multi:!0,overrideEvents:[],queueID:!1,queueSizeLimit:0,removeCompleted:!1,simUploadLimit:0,truncateLength:0,uploadLimit:0,uploadScript:"uploadifive.php",width:100},a);if(isNaN(s.fileSizeLimit)){var r=1.024*parseInt(s.fileSizeLimit);s.fileSizeLimit.indexOf("KB")>-1?s.fileSizeLimit=1e3*r:s.fileSizeLimit.indexOf("MB")>-1?s.fileSizeLimit=1e6*r:s.fileSizeLimit.indexOf("GB")>-1&&(s.fileSizeLimit=1e9*r)}else s.fileSizeLimit=1024*s.fileSizeLimit;if(o.inputTemplate=e('<input type="file">').css({"font-size":s.height+"px",opacity:0,position:"absolute",right:"-3px",top:"-3px","z-index":999}),o.createInput=function(){var a=o.inputTemplate.clone(),i=a.name="input"+o.inputCount++;s.multi&&a.attr("multiple",!0),s.fileType&&a.attr("accept",s.fileType),a.bind("change",function(){o.queue.selected=0,o.queue.replaced=0,o.queue.errors=0,o.queue.queued=0;var a=this.files.length;if(o.queue.selected=a,o.queue.count+a>s.queueSizeLimit&&0!==s.queueSizeLimit)e.inArray("onError",s.overrideEvents)<0&&alert("The maximum number of queue items has been reached ("+s.queueSizeLimit+").  Please select fewer files."),"function"==typeof s.onError&&s.onError.call(n,"QUEUE_LIMIT_EXCEEDED");else{for(var r=0;a>r;r++)file=this.files[r],o.addQueueItem(file);o.inputs[i]=this,o.createInput()}s.auto&&t.upload.call(n),"function"==typeof s.onSelect&&s.onSelect.call(n,o.queue)}),o.currentInput&&o.currentInput.hide(),o.button.append(a),o.currentInput=a},o.destroyInput=function(t){e(o.inputs[t]).remove(),delete o.inputs[t],o.inputCount--},o.drop=function(a){o.queue.selected=0,o.queue.replaced=0,o.queue.errors=0,o.queue.queued=0;var i=a.dataTransfer,r=i.name="input"+o.inputCount++,d=i.files.length;if(o.queue.selected=d,o.queue.count+d>s.queueSizeLimit&&0!==s.queueSizeLimit)e.inArray("onError",s.overrideEvents)<0&&alert("The maximum number of queue items has been reached ("+s.queueSizeLimit+").  Please select fewer files."),"function"==typeof s.onError&&s.onError.call(n,"QUEUE_LIMIT_EXCEEDED");else{for(var l=0;d>l;l++)file=i.files[l],o.addQueueItem(file);o.inputs[r]=i}s.auto&&t.upload.call(n),"function"==typeof s.onDrop&&s.onDrop.call(n,i.files,i.files.length),a.preventDefault(),a.stopPropagation()},o.fileExistsInQueue=function(e){for(var t in o.inputs){input=o.inputs[t],limit=input.files.length;for(var a=0;a<limit;a++)if(existingFile=input.files[a],existingFile.name==e.name&&!existingFile.complete)return!0}return!1},o.removeExistingFile=function(e){for(var a in o.inputs){input=o.inputs[a],limit=input.files.length;for(var i=0;i<limit;i++)existingFile=input.files[i],
existingFile.name!=e.name||existingFile.complete||(o.queue.replaced++,t.cancel.call(n,existingFile,!0))}},0==s.itemTemplate?o.queueItem=e('<div class="uploadifive-queue-item">                        <a class="close" href="#">X</a>                        <div><span class="filename"></span><span class="fileinfo"></span></div>                        <div class="progress">                            <div class="progress-bar"></div>                        </div>                    </div>'):o.queueItem=e(s.itemTemplate),o.addQueueItem=function(a){if(e.inArray("onAddQueueItem",s.overrideEvents)<0){o.removeExistingFile(a),a.queueItem=o.queueItem.clone(),a.queueItem.attr("id",s.id+"-file-"+o.fileID++),a.queueItem.find(".close").bind("click",function(){return t.cancel.call(n,a),!1});var i=a.name;i.length>s.truncateLength&&0!=s.truncateLength&&(i=i.substring(0,s.truncateLength)+"..."),a.queueItem.find(".filename").html(i),a.queueItem.data("file",a),o.queueEl.append(a.queueItem)}"function"==typeof s.onAddQueueItem&&s.onAddQueueItem.call(n,a),a.size>s.fileSizeLimit&&0!=s.fileSizeLimit?o.error("FILE_SIZE_LIMIT_EXCEEDED",a):(o.queue.queued++,o.queue.count++)},o.removeQueueItem=function(t,a,i){i||(i=0);var n=a?0:500;t.queueItem&&(" - Completed"!=t.queueItem.find(".fileinfo").html()&&t.queueItem.find(".fileinfo").html(" - Cancelled"),t.queueItem.find(".progress-bar").width(0),t.queueItem.delay(i).fadeOut(n,function(){e(this).remove()}),delete t.queueItem,o.queue.count--)},o.filesToUpload=function(){var e=0;for(var t in o.inputs){input=o.inputs[t],limit=input.files.length;for(var a=0;a<limit;a++)file=input.files[a],file.skip||file.complete||e++}return e},o.checkExists=function(a){if(e.inArray("onCheck",s.overrideEvents)<0){e.ajaxSetup({async:!1});var i=e.extend(s.formData,{filename:a.name});if(e.post(s.checkScript,i,function(e){a.exists=parseInt(e)}),a.exists&&!confirm("A file named "+a.name+" already exists in the upload folder.\nWould you like to replace it?"))return t.cancel.call(n,a),!0}return"function"==typeof s.onCheck&&s.onCheck.call(n,a,a.exists),!1},o.uploadFile=function(t,a){if(!t.skip&&!t.complete&&!t.uploading)if(t.uploading=!0,o.uploads.current++,o.uploads.attempted++,xhr=t.xhr=new XMLHttpRequest,"function"==typeof FormData||"object"==typeof FormData){var r=new FormData;r.append(s.fileObjName,t);for(i in s.formData)r.append(i,s.formData[i]);xhr.open(s.method,s.uploadScript,!0),xhr.upload.addEventListener("progress",function(e){e.lengthComputable&&o.progress(e,t)},!1),xhr.addEventListener("load",function(e){4==this.readyState&&(t.uploading=!1,200==this.status?"Invalid file type."!==t.xhr.responseText?o.uploadComplete(e,t,a):o.error(t.xhr.responseText,t,a):404==this.status?o.error("404_FILE_NOT_FOUND",t,a):403==this.status?o.error("403_FORBIDDEN",t,a):o.error("Unknown Error",t,a))}),xhr.send(r)}else{var d=new FileReader;d.onload=function(i){var r="-------------------------"+(new Date).getTime(),d="--",l="\r\n",c="";c+=d+r+l,c+='Content-Disposition: form-data; name="'+s.fileObjName+'"',t.name&&(c+='; filename="'+t.name+'"'),c+=l,c+="Content-Type: application/octet-stream"+l+l,c+=i.target.result+l;for(key in s.formData)c+=d+r+l,c+='Content-Disposition: form-data; name="'+key+'"'+l+l,c+=s.formData[key]+l;c+=d+r+d+l,xhr.upload.addEventListener("progress",function(e){o.progress(e,t)},!1),xhr.addEventListener("load",function(e){t.uploading=!1;var i=this.status;404==i?o.error("404_FILE_NOT_FOUND",t,a):"Invalid file type."!=t.xhr.responseText?o.uploadComplete(e,t,a):o.error(t.xhr.responseText,t,a)},!1);var u=s.uploadScript;if("get"==s.method){var p=e(s.formData).param();u+=p}xhr.open(s.method,s.uploadScript,!0),xhr.setRequestHeader("Content-Type","multipart/form-data; boundary="+r),"function"==typeof s.onUploadFile&&s.onUploadFile.call(n,t),xhr.sendAsBinary(c)},d.readAsBinaryString(t)}},o.progress=function(t,a){if(e.inArray("onProgress",s.overrideEvents)<0){if(t.lengthComputable)var i=Math.round(t.loaded/t.total*100);a.queueItem.find(".fileinfo").html(" - "+i+"%"),a.queueItem.find(".progress-bar").css("width",i+"%")}"function"==typeof s.onProgress&&s.onProgress.call(n,a,t)},o.error=function(a,i,r){if(e.inArray("onError",s.overrideEvents)<0){switch(a){case"404_FILE_NOT_FOUND":errorMsg="404 Error";break;case"403_FORBIDDEN":errorMsg="403 Forbidden";break;case"FORBIDDEN_FILE_TYPE":errorMsg="Forbidden File Type";break;case"FILE_SIZE_LIMIT_EXCEEDED":errorMsg="File Too Large";break;default:errorMsg="Unknown Error"}i.queueItem.addClass("error").find(".fileinfo").html(" - "+errorMsg),i.queueItem.find(".progress").remove()}"function"==typeof s.onError&&s.onError.call(n,a,i),i.skip=!0,"404_FILE_NOT_FOUND"==a?o.uploads.errors++:o.queue.errors++,r&&t.upload.call(n,null,!0)},o.uploadComplete=function(a,i,r){e.inArray("onUploadComplete",s.overrideEvents)<0&&(i.queueItem.find(".progress-bar").css("width","100%"),i.queueItem.find(".fileinfo").html(" - Completed"),i.queueItem.find(".progress").slideUp(250),i.queueItem.addClass("complete")),"function"==typeof s.onUploadComplete&&s.onUploadComplete.call(n,i,i.xhr.responseText),s.removeCompleted&&setTimeout(function(){t.cancel.call(n,i)},3e3),i.complete=!0,o.uploads.successful++,o.uploads.count++,o.uploads.current--,delete i.xhr,r&&t.upload.call(n,null,!0)},o.queueComplete=function(){"function"==typeof s.onQueueComplete&&s.onQueueComplete.call(n,o.uploads)},!(window.File&&window.FileList&&window.Blob&&(window.FileReader||window.FormData)))return"function"==typeof s.onFallback&&s.onFallback.call(n),!1;if(s.id="uploadifive-"+n.attr("id"),o.button=e('<div id="'+s.id+'" class="uploadifive-button">'+s.buttonText+"</div>"),s.buttonClass&&o.button.addClass(s.buttonClass),o.button.css({height:s.height,"line-height":s.height+"px",overflow:"hidden",position:"relative","text-align":"center",width:s.width}),n.before(o.button).appendTo(o.button).hide(),o.createInput.call(n),s.queueID?o.queueEl=e("#"+s.queueID):(s.queueID=s.id+"-queue",o.queueEl=e('<div id="'+s.queueID+'" class="uploadifive-queue" />'),o.button.after(o.queueEl)),s.dnd){var d=s.dropTarget?e(s.dropTarget):o.queueEl.get(0);d.addEventListener("dragleave",function(e){e.preventDefault(),e.stopPropagation()},!1),d.addEventListener("dragenter",function(e){e.preventDefault(),e.stopPropagation()},!1),d.addEventListener("dragover",function(e){e.preventDefault(),e.stopPropagation()},!1),d.addEventListener("drop",o.drop,!1)}XMLHttpRequest.prototype.sendAsBinary||(XMLHttpRequest.prototype.sendAsBinary=function(e){function t(e){return 255&e.charCodeAt(0)}var a=Array.prototype.map.call(e,t),i=new Uint8Array(a);this.send(i.buffer)}),"function"==typeof s.onInit&&s.onInit.call(n)})},debug:function(){return this.each(function(){console.log(e(this).data("uploadifive"))})},clearQueue:function(){this.each(function(){var a=e(this),n=a.data("uploadifive"),o=n.settings;for(var s in n.inputs)for(input=n.inputs[s],limit=input.files.length,i=0;i<limit;i++)file=input.files[i],t.cancel.call(a,file);"function"==typeof o.onClearQueue&&o.onClearQueue.call(a,e("#"+n.settings.queueID))})},cancel:function(a,i){this.each(function(){var n=e(this),o=n.data("uploadifive"),s=o.settings;"string"==typeof a&&(isNaN(a)||(fileID="uploadifive-"+e(this).attr("id")+"-file-"+a),a=e("#"+fileID).data("file")),a.skip=!0,o.filesCancelled++,a.uploading&&(o.uploads.current--,a.uploading=!1,a.xhr.abort(),delete a.xhr,t.upload.call(n)),e.inArray("onCancel",s.overrideEvents)<0&&o.removeQueueItem(a,i),"function"==typeof s.onCancel&&s.onCancel.call(n,a)})},upload:function(t,a){this.each(function(){var i=e(this),n=i.data("uploadifive"),o=n.settings;if(t)n.uploadFile.call(i,t);else if(n.uploads.count+n.uploads.current<o.uploadLimit||0==o.uploadLimit){if(!a){n.uploads.attempted=0,n.uploads.successsful=0,n.uploads.errors=0;var s=n.filesToUpload();"function"==typeof o.onUpload&&o.onUpload.call(i,s)}e("#"+o.queueID).find(".uploadifive-queue-item").not(".error, .complete").each(function(){return _file=e(this).data("file"),n.uploads.current>=o.simUploadLimit&&0!==o.simUploadLimit||n.uploads.current>=o.uploadLimit&&0!==o.uploadLimit||n.uploads.count>=o.uploadLimit&&0!==o.uploadLimit?!1:void(o.checkScript?(_file.checking=!0,skipFile=n.checkExists(_file),_file.checking=!1,skipFile||n.uploadFile(_file,!0)):n.uploadFile(_file,!0))}),0==e("#"+o.queueID).find(".uploadifive-queue-item").not(".error, .complete").size()&&n.queueComplete()}else 0==n.uploads.current&&(e.inArray("onError",o.overrideEvents)<0&&n.filesToUpload()>0&&0!=o.uploadLimit&&alert("The maximum upload limit has been reached."),"function"==typeof o.onError&&o.onError.call(i,"UPLOAD_LIMIT_EXCEEDED",n.filesToUpload()))})},destroy:function(){this.each(function(){var a=e(this),i=a.data("uploadifive"),n=i.settings;t.clearQueue.call(a),n.queueID||e("#"+n.queueID).remove(),a.siblings("input").remove(),a.show().insertBefore(i.button),i.button.remove(),"function"==typeof n.onDestroy&&n.onDestroy.call(a)})}};e.fn.upload=function(a){return t[a]?t[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void e.error("The method "+a+" does not exist in $.uploadify"):t.init.apply(this,arguments)}}(n)}),define("js/home/comment",["jquery"],function(e,t,a){var i=e("jquery"),n=i(".comment-table"),o=n.find(".remark-btn"),s=i("#comment-dialog-widget"),r=s.find(".dialog-titlebar"),d=s.find("textarea"),l=s.find(".dialog-close-btn"),c=i(document).width(),u=i(document).height(),p=i(window).height(),h={padding:12,canmove:!1,offset:{},maxtop:0,maxleft:0};o.click(function(){var e=i(document).scrollTop();d.val(""),s.removeClass("hide").css({top:e+(p-s.height()-h.padding)/2,left:(c-s.width()-h.padding)/2})}),r.bind("mousedown",function(e){i(e.target).hasClass("dialog-close-btn")||(h.canmove=!0,h.offset={x:e.offsetX,y:e.offsetY},h.maxtop=u-s.height()-h.padding,h.maxleft=c-s.width()-h.padding)}),i(document).mousemove(function(e){var t,a;h.canmove&&(t=e.pageY-h.offset.y,a=e.pageX-h.offset.x,t=t<h.maxtop?t:h.maxtop,a=a<h.maxleft?a:h.maxleft,s.css({top:t>0?t:0,left:a>0?a:0}))}).mouseup(function(e){h.canmove=!1}),l.click(function(){s.addClass("hide")})}),define("js/home/edit",["jquery","handlebars","source-map"],function(e,t,a){function i(){var e=u("#nickname").val().length,t=u("#username").val().length,a=u('input[name="gender"]'),i=u("#year"),n=u("#month"),o=u("#day");return 0===e?(alert("请输入昵称"),!1):0===t?(alert("请输入用户名"),!1):e>=20?(alert("昵称最长为20个字符"),!1):a.is(":checked")?"0"===i.val()||"0"===n.val()||"0"===o.val()?(alert("请选择出生年月日"),!1):!0:(alert("请选择性别"),!1)}function n(){return"0"===u("#province").val()||"0"===u("#city").val()||"0"===u("#areaCode").val()?(alert("请选择所在区域"),!1):null===u("#province").val()||null===u("#city").val()||null===u("#areaCode").val()?(alert("请选择所在区域"),!1):0===u("#phone").val().length&&0===u("#mobile").val().length?(alert("电话和手机号码不能同时为空,请填写!"),!1):0===u("#fullAddress").val().length?(alert("请填写地址"),!1):0===u("#zipCode").val().length||u("#zipCode").val().length<2?(alert("请填写邮编"),!1):!0}function o(){return u(".user-habbit-info input").is(":checked")?!0:(alert("请填写购物&着装习惯"),!1)}function s(){return""===u("#likebrand").val()?(alert("请选择品牌"),!1):!0}function r(e){var t=u("#likebrand").val();return 0===parseInt(e)?!1:(u("#likebrand").val(t.replace(","+e+",",",")),u("#pp-"+e).attr("checked",!1),void u("#brand-"+e).remove())}function d(e,t,a){var i='<li id="brand-'+t+'">'+a+'<a href="javascript:void(0);" class="btn-del"></a></li>',n=u("#brand-"+t).html(),o=u("#likebrand").val(),s=u("#brand-box");return 0===parseInt(t)?!1:"undefined"!=typeof e&&""!==e&&e.checked===!1?(r(t),!1):n?(alert("您已经选择了该品牌."),!1):(s.append(i),s.find("li>a").off("click").on("click",function(){r(u(this).closest("li").attr("id").substr(6))}),o+=t+",",void u("#likebrand").val(o))}function l(){var e={brandName:u("#keywords").val()};u.post("/home/user/isbrandname",e,function(e){return 200===e.code?e.data.id&&e.data.brand_name?(d("",e.data.id,e.data.brand_name),u("#keywords").val(""),!0):(alert("网络异常,请重试"),!1):(alert(e.message),!1)},"json")}function c(e,t){var a=u("#"+t).closest("form");u.post(e,a.serialize(),function(e){return 200===e.code?(alert(e.message),setTimeout(function(){a.closest("div").next().find("h2").click()},100),!0):(alert(e.message),!1)},"json")}var u=e("jquery"),p=u(".userinfo-edit form"),h=e("js/home/common-address"),f={init:function(e,t,a){var i=u("#year"),n=u("#month"),o=u("#day"),s=this;this.createDay(i.val(),n.val(),o.val()),i.on("change",function(){s.update()}),n.on("change",function(){s.update()})},update:function(){this.createDay(u("#year").val(),u("#month").val(),u("#day").val())},createDay:function(e,t,a){var i,n,o='<select name="day" id="day">',s=new Array(4,6,9,11),r=31;if(e=parseInt(e),t=parseInt(t),0===e&&(e=0),0===t&&(t=0),u("#year").val(e.toString()),u("#month").val(t.toString()),o+='<option value="0">日</option>',e>0&&t>0)for(-1!==u.inArray(t,s)?r=30:2===t&&(r=28,0!==e%4||e%100===0&&e%400!==0||(r=29)),n=1;r>=n;n++)i="",parseInt(a)===n&&(i="selected"),o+='<option value="'+n+'" '+i+">"+n+"</option>";o+="</select>",u("#day").replaceWith(o)}};u(".userinfo-edit h2").on("click",function(){var e=u(this).next();p.slideUp("fast"),"none"===e.css("display")?e.slideDown("slow"):null}),u("#base-info").on("click",function(){i()&&c("/home/user/edituserinfo/","base-info")}),u("#contact-info").on("click",function(){n()&&c("/home/user/editusercontactinfo/","contact-info")}),u("#shopping-info").on("click",function(){o()&&c("/home/user/edituserhabitsinfo/","shopping-info")}),u("#favorite-brand").on("click",function(){s()&&u.ajax({url:"/home/user/edituserlikebrand/",type:"post",datatype:"json",data:{brand:u("#likebrand").val()},success:function(e){return 200===e.code?(alert(e.message),!0):(alert(e.message),!1)},error:function(e){alert("网络异常")}})}),u("#add-brand-btn").on("click",function(){l()}),u('.user-favorite-info input[type="checkbox"]').on("click",function(){var e=u(this);d(this,e.attr("id").substr(3),e.parent().text())}),function(){var e=u("#brand-box li");e.length>0&&e.find("a").on("click",function(){r(u(this).closest("li").attr("id").substr(6))})}(),f.init(),function(){u("#province").val()?h.bindAreaChange({provinceDomId:"province",cityDomId:"city",areaDomId:"areaCode"}):h.loadAllData(0,{provinceDomId:"province",cityDomId:"city",areaDomId:"areaCode"})}()}),define("js/home/gift",["jquery"],function(e,t,a){function i(){var e=new Date;return n("#imgcode").attr("src","/home/gift/captcha?t="+e.getTime()),!1}var n=e("jquery"),o=n(".giftCardCode").find(".gift-error"),s=n(".captchaCode").find(".gift-error"),r="",d="",l={suc1:!1,suc2:!1,suc3:!1,suc4:!1,bindGiftCardForm:function(){n("#giftCardCode1").bind("blur keyup",function(){r=/^[0-9a-zA-Z]{4,4}$/,r.test(n("#giftCardCode1").val())?(o.html(""),n("#giftCardCode2").focus(),l.suc1=!0):(o.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),l.suc1=!1)}),n("#giftCardCode2").bind("blur keyup",function(){r=/^[0-9a-zA-Z]{4,4}$/,r.test(n("#giftCardCode2").val())?(o.html(""),n("#giftCardCode3").focus(),l.suc2=!0):(o.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),l.suc2=!1)}),n("#giftCardCode3").bind("blur keyup",function(){r=/^[0-9a-zA-Z]{4,4}$/,r.test(n("#giftCardCode3").val())?(o.html(""),l.suc3=!0):(o.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),l.suc3=!1)}),n("#captchaCode").bind("blur keyup",function(){d=n("#captchaCode").val(),d.length<=0?(s.html("请输入验证码!"),l.suc4=!1):(s.html(""),l.suc4=!0)})},checkForm:function(){return""===n.trim(n("#giftCardCode1").val())||""===n.trim(n("#giftCardCode2").val())||""===n.trim(n("#giftCardCode3").val())?(o.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),!1):""===n.trim(n("#captchaCode").val())?(s.html("请输入验证码!"),!1):!0}};n("#sub-gift").on("click",function(){return l.checkForm()?void n("#giftCardForm").submit():!1}),n(document).on("click","#imgcode,.check-img",function(){i()}),n(function(){i(),l.bindGiftCardForm()})}),define("js/home/validate",["jquery"],function(e,t,a){function i(e){var t=e.val(),a=t.length,i=e.parent(),n=i.find(".check-info"),o=e.attr("name"),s="";if(n.html(""),"oldpassword"===o){if(0===a)return n.html('<div class="form-error">密码不能为空!</div>'),e.addClass("input-error"),!1;c.get("/home/account/pass?pass="+encodeURIComponent(t),function(t){return"undefined"!=typeof t.code&&200===t.code?(n.html('<div class="form-success">&nbsp;</div>'),e.removeClass("input-error"),!0):(n.html('<div class="form-error">密码错误!</div>'),e.addClass("input-error"),!1)})}if("code"===o&&c.get("/home/account/review?code="+t,function(t){return"undefined"!=typeof t.code&&200===t.code?(n.html('<div class="form-success">&nbsp;</div>'),e.removeClass("input-error"),!0):(n.html('<div class="form-error">验证码错误!</div>'),e.addClass("input-error"),!1)}),"newmail"===o){if(s="([a-zA-Z0-9]+)@([a-zA-Z0-9]+)[.]([a-zA-Z0-9]+)",null===t.match(s))return n.html('<div class="form-error">邮箱错误!</div>'),e.addClass("input-error"),!1;c.get("/home/account/mail?mail="+t,function(t){return"undefined"!=typeof t.code&&200===t.code?(n.html('<div class="form-success">&nbsp;</div>'),e.removeClass("input-error"),!0):(n.html('<div class="form-error">邮箱已存在!</div>'),e.addClass("input-error"),!1)})}if("mobile"===o){if(s="^1[35847]{1}[0-9]{9}",0===a)return n.html('<div class="form-error">手机号不能为空!</div>'),e.addClass("input-error"),!1;if(null===t.match(s))return n.html('<div class="form-error">手机号错误!</div>'),e.addClass("input-error"),!1;c.get("/home/mobile/exmobi?mobile="+t,function(t){return"undefined"!=typeof t.code&&200!==t.code?(e.addClass("input-error"),n.html('<div class="form-error">手机号已经存在!</div>'),!1):(e.removeClass("input-error"),n.html('<div class="form-success">&nbsp;</div>'),!0)})}if("password"===o)return 6>a||a>20?(e.addClass("input-error"),n.html('<div class="form-error">密码长度为6-20字符</div>'),!1):(e.removeClass("input-error"),n.html('<div class="form-success">&nbsp;</div>'),!0);if("confirm_password"===o){if(c("#password").val()!==t)return e.addClass("input-error"),n.html('<div class="form-error">两次密码不一致!</div>'),!1;if(""!==c("#password").val())return e.removeClass("input-error"),c("#password").next().html('<div class="form-success">&nbsp;</div>'),n.html('<div class="form-success">&nbsp;</div>'),!0}return!0}function n(){var e=[];return c.each(p,function(t,a){e.push(i(c(a)))}),e.indexOf(!1)>=0?!1:!0}function o(){var e=(new Date).getTime();c("#the-code-img").attr("src","/home/account/code?g=email_auth&time="+e)}function s(){var e="";f>0?(e="重新发送"+f+"秒",c("#sendButton").text(e),f-=1):(f=60,c("#sendButton").text("发送验证码"),clearInterval(l),h=!0)}function r(){var e=c("#mobilevalue"),t=c("#inputcode"),a=e.next(),i=e.val(),n=t.parent().find("check-info");return h?null===i.match("^1[35847]{1}[0-9]{9}")?(a.html('<div class="form-error">手机号错误!</div>'),e.addClass("input-error"),!1):void c.get("/home/mobile/sendcode?mobile="+i,function(e){"undefined"!=typeof e.code&&200===e.code?(h=!1,l=setInterval(function(){s()},1e3),n.html("")):n.html('<div class="form-error">验证码发送失败</div>')}):!1}function d(){window.location.href="/home/account"}var l,c=e("jquery"),u=c(".check-user"),p=u.find("input").not("input[type=button],input[type=hidden]"),h=!0,f=60;p.blur(function(){i(c(this))}),c(".sub-btn").on("click",function(){return n()?void c("#pwdform").submit():!1}),c(".the-code").on("click",function(){o()}),c("#send-mobile-code").on("click",function(){r()}),c("#inputcode").change(function(){var e=c("#inputcode").val();""!==e&&c.get("/home/mobile/review?code="+e,function(e){"undefined"!=typeof e.code&&200===e.code?c("#codetip").html('<div class="form-success">&nbsp;</div>'):c("#codetip").html('<div class="form-error">验证码错误!</div>')})}),c(function(){var e=null;c(".res-info").length>0&&(e=setTimeout(function(){d()},5e3)),o()})}),define("js/home/address",["jquery","handlebars","source-map"],function(e,t,a){function i(e){var t=e.parents(".address-content"),a=t.attr("addressId");return a}function n(e){var t="";"addressName"===e.inputName&&(t="真实姓名在2到5个汉字之间"),"address"===e.inputName&&(t="请填写详细地址"),"zipCode"===e.inputName&&(t="请输入收货人所在地邮编号"),"phone"===e.inputName&&(t="格式例如:0577-88888888"),"mobile"===e.inputName&&(t="请输入手机号,如1360000000"),"email"===e.inputName&&(t="用来接收订单提醒邮件,便于您及时了解订单状态"),e.$checkInfo.removeClass("form-prompt").addClass("form-focus").html(t)}function o(e){var t="",a=!0,i="输入正确",n="form-info form-success",o=e.val;return"addressName"===e.inputName&&(t=/^[\u4e00-\u9fa5]{2,5}$/,e.len<1||e.len>12?(i="真实姓名在2到5个汉字之间,请确认",a=!1,n="form-info form-error"):t.test(e.val)===!1&&(i="真实姓名至少2个中文,最多5个中文",a=!1,n="form-info form-error")),"address"===e.inputName&&e.len<2&&(i="请填写详细地址",a=!1,n="form-info form-error"),"zipCode"===e.inputName&&(t=/^[0-9]{6}$/,0===e.len?(i="请输入收货人所在地邮编号",a=!1,n="form-info form-error"):t.test(e.val)===!1&&(i="你输入的邮编式不正确",a=!1,n="form-info form-error")),"phone"===e.inputName&&(t=/^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/,0===e.len?(i="你真的不想留联系电话了吗?",a=!0,n="form-info form-success"):t.test(e.val)===!1&&(i="你输入的联系电话格式不正确",a=!1,n="form-info form-error")),"mobile"===e.inputName&&(t=/^1[3|4|5|8|7][0-9]{9}$/,11!==e.len?(i="手机号码必须是11位的,请确认",a=!1,n="form-info form-error"):t.test(e.val)===!1&&(i="您输入的手机号格式不正确",a=!1,n="form-info form-error")),"email"===e.inputName&&(t="^[a-z0-9_-]+(.[_a-z0-9-]+)*@([_a-z0-9-]+.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$",(null===o.match(t)||0===e.len)&&(i="你输入的邮件地址格式不正确",a=!1,n="form-info form-error")),e.$checkInfo.removeClass().addClass(n).html(i),a}function s(e,t){var a=e.val(),i=e.parent(),s={val:a,len:a.length,$domParent:e.parent(),$checkInfo:i.find("span"),inputName:e.attr("name")};return"focus"===t&&n(s),"blur"===t?o(s):void 0}function r(){var e=c("#phone").next(),t=c("#mobile").next();return t.hasClass("form-success")&&!e.hasClass("form-error")&&0===c("#phone").val().length?(e.removeClass().addClass("form-prompt form-info").html("请输入你的联系电话,可以为空哦"),!0):"输入正确"!==e.html()||t.hasClass("form-error")||0!==c("#mobile").val().length?t.hasClass("form-success")||"输入正确"===e.html()?void 0:(e.removeClass().addClass("form-success form-info").html("你真的不想留联系电话了吗?"),t.removeClass().addClass("form-prompt form-info").html("填写手机号便于接收发货和收货通知"),c("#mobile").focus(),!1):(t.removeClass().addClass("form-prompt form-info").html("填写手机号便于接收发货和收货通知"),!0)}function d(){var e=[];return c.each(v,function(t,a){e.push(s(c(a),"blur"))}),e.push(r()),c.each(c(".form-info"),function(e,t){return c(t).hasClass("form-error")?(c(t).prev().focus(),!1):void 0}),-1===e.indexOf(!1)?!0:!1}var l,c=e("jquery"),u=e("js/home/common-address"),p=e("js/common/dialog"),h=p.Alert,f=c(".address-del"),m=c(".address-modify"),v=c(".input-1"),g={evil:function(e){var t=Function;return new t("return "+e)()},clearAddrForm:function(){c("#addressName").val(""),c("#address").val(""),c("#zipCode").val(""),c("#phone").val(""),c("#mobile").val(""),c("#email").val(""),c("#addrId").val(0),c("#btn-reset").hide(),c("#form-status").html("添加新地址")},editAddr:function(e){c.getJSON("/home/address/editAddress?id="+e,function(e){200===e.code&&(c("#form-status").html("修改地址"),c("#addressName").val(e.data.consignee),u.loadAllData(e.data.area_code,{}),c("#address").val(e.data.address),c("#email").val(e.data.email),c("#phone").val(e.data.phone),c("#mobile").val(e.data.mobile),c("#zipCode").val(e.data.zip_code),c("#addrId").val(e.data.address_id),c("#btn-reset").show())})},saveAddr:function(e){c.post("/home/address/saveAddress",c("#address-form").serialize(),function(e){200===e.code?location.reload():(l=new h(e.message),l.show())},"json")},delAddr:function(e){c.getJSON("/home/address/delAddress?id="+e,function(t){200===t.code?c(".address-list").find("li[addressId="+e+"]").remove():(l=new h("删除失败"),l.show())})},setDefaultAddr:function(e){var t=c(".address-list").find(".default-btn"),a=c(".address-list").find(".default-btn").parents("li"),i=c(".address-list").find("li[addressId="+e+"]"),n=i.find(".set-default-btn");c.getJSON("/home/address/defaultAddress?id="+e,function(e){200===e.code?(t.attr("class","btn-c3 set-default-btn"),a.removeClass("preferred"),t.html("<span>设为常用地址</span>"),n.attr("class","btn-c2 default-btn"),t.html("<span>设为常用地址</span>"),i.addClass("preferred")):(l=new h("设置失败"),l.show())})}};Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var a,i;for(a=t||0,i=this.length;i>a;a++)if(this[a]===e)return a;return-1}),c(document).on("click",".set-default-btn",function(){var e=i(c(this));g.setDefaultAddr(e)}),f.on("click",function(){var e=i(c(this));g.delAddr(e)}),m.on("click",function(){var e=i(c(this));g.editAddr(e),c("#btn-reset").show()}),v.on("focus",function(){s(c(this),"focus")}),v.on("blur",function(){s(c(this),"blur")}),c("#address-info").on("click",function(){d()&&g.saveAddr()}),c(document).ready(function(){u.loadAllData(0,{provinceDomId:"province",cityDomId:"city",areaDomId:"areaCode"}),g.clearAddrForm(),c("#btn-reset").click(function(){g.clearAddrForm()})})}),define("js/order/ensure",["jquery","handlebars","source-map"],function(e,t,a){var i=e("jquery"),n=e("js/order/address"),o=e("js/common/dialog"),s={Data:{product:0,activity:0,carriage:0,juan:0,yohocoin:0},UI:{e:{$pan:i(".pan"),$jc:i("#juancode"),$bp:i("#biprice"),$statistics:i("li",".play-total"),$tobi:i("p em",".play-bi-pan .play-pan"),$cancel:i(".cancel",".btn-group"),$total:i("em",".to-play"),$tbody:i("table tbody",".pay-wapper"),$orderSelectionSave:i(".address-list h2 span"),$addAddress:i(".add-address"),$addressManage:i(".address-manage"),$spanPayTypeLegend:i("span.pay-type-legend"),$supportType:i(".support-type"),$existAddressListWrap:i(".exist-address-list"),$existAddressList:i(".exist-address-list").find("li"),$existAddress:i(".exist-address-list").find('input[name="exist-address"]'),$payTimeModify:i(".pay-time-modify"),$switchPayModify:i(".switch-pay-modify"),$modityPayInfo:i(".modity-pay-info"),$payTotal:i(".play-total"),$toPay:i(".to-play em")},init:function(){var e=this.e,t=s.Data,a=s.Common;e.$tbody.find("tr").each(function(n){var o=i(this).find("td"),s=e.$tbody.find("tr").length,r=parseFloat(o.eq(1).html())*parseInt(o.eq(3).html());o.eq(1).html("¥"+o.eq(1).html()),o.hasClass("xforone")?(o.eq(4).find("del").html("¥"+a.strFixed(r)),r=0):o.eq(4).html("¥"+a.strFixed(r)),t.product+=r,n?o.last().remove():o.last().attr("rowspan",s),n===s-1&&e.$tbody.find("tr").eq(0).find("td").last().html("<strong>¥"+a.strFixed(t.product)+"</strong>")}),e.$pan.find("dt").click(function(){var e=i(this).parent("dl.pan");e.find("dd").is(":hidden")?(a.winShow(e),i(this).addClass("active")):(a.winHide(e),i(this).removeClass("active"))}),e.$orderSelectionSave.click(function(){var t=0,a=i(".exist-address-list li"),n=a.length,o=0;if(i(this).attr("expand")){for(t=0;n>t;t++)a.eq(t).hasClass("address_select")&&o++,a.eq(t).hasClass("address_select")||a.eq(t).addClass("hide");0===o&&i('.exist-address-list li:not(".use-new-address")').removeClass("hide"),i(this).removeAttr("expand").text("[修改]"),i(".save-btn").addClass("hide"),e.$existAddressListWrap.removeClass("address-expand"),e.$addressManage.addClass("hide")}else i(this).attr("expand","expand").text("[不保存并关闭]"),i(".exist-address-list li").removeClass("hide"),i(".save-btn").removeClass("hide"),e.$existAddressListWrap.addClass("address-expand"),1===n&&e.$addressManage.removeClass("hide")}),e.$switchPayModify.click(function(){console.log(1),e.$payTimeModify.hasClass("hide")?(e.$payTimeModify.removeClass("hide"),e.$modityPayInfo.addClass("hide"),i(this).text("[不保存并关闭]")):(e.$payTimeModify.addClass("hide"),e.$modityPayInfo.removeClass("hide"),i(this).text("[修改]"),e.$payTimeModify.find('input[name="pay-type"]').filter(".checked").attr("checked","checked"),e.$payTimeModify.find('input[name="pay-time-radio"]').filter(".checked").attr("checked","checked"),e.$payTimeModify.find('input[name="call-me"]').filter(".checked").attr("checked","checked"))}),e.$spanPayTypeLegend.click(function(){i(this).toggleClass("active"),e.$supportType.toggleClass("hide")}),i(document).on("click",".exist-address-list li",function(){i(".exist-address-list li").removeClass("active"),i(this).addClass("active"),i(this).find("input").attr("checked","checked"),i(this).hasClass("use-new-address")&&(e.$addressManage.removeClass("hide"),i(".address-manage input").val(""),i(".save-btn").removeAttr("data-id"),n.newAddress(0,"000000"))})},render:function(e,t){var a,i=this.e,n=e.promotion_formula_list,o="",s="";for(a=0;a<n.length;a++)"优惠券:"===n[a].promotion&&(n[a].promotion=t+'<span class="juan-modify">[修改]</span>:'),"YOHO币:"===n[a].promotion&&(n[a].promotion='YOHO币<span class="bi-modify">[修改]</span>:'),s=n[a].isExpress?"total-express-w":"",o+='<li class="'+s+'"><label>'+n[a].promotion+"</label><em>"+n[a].promotion_amount+"</em></li>";i.$payTotal.html(o),i.$toPay.html(e.last_order_amount.toFixed(2))}},Common:{enterNUM:function(e,t){return e=e.replace(/[^\d]/g,""),e&&t&&(e=parseInt(e),t=parseInt(t),e>t&&(e=t)),e},calucate:function(){var e=s.Data;return i.each(s.Data,function(t,a){e[t]=parseFloat(s.Data[t])}),e.product-e.activity+e.carriage-e.juan-e.yohocoin},winShow:function(e){e.find("dt").show(),e.find("dd").show(),e.attr("class").match(/(-bi-)|(-juan-)/g)&&e.find("dt").hide()},winHide:function(e){e.find("dt").show(),e.find("dd").hide()},strFixed:function(e){return parseFloat(e).toFixed(2)}},Bll:{e:{$juanok:i("#juansubmit"),$juantip:i(".errtip",".play-juan-pan"),$biok:i("#bisubmit"),$carriageGroup:i('input[name="carriagegroup"]'),$selectExpress:i(".express-list input"),$bp:i("#biprice"),$errorTip:i(".errbitip"),$useEnvelopes:i(".use-envelopes"),$hasEnvelopes:i(".has-envelopes span"),$redEnvelopes:i(".red-envelopes"),$loading:i(".loading")},init:function(){function e(e){var t,a=i('.play-juan.is-select input[name="juangroup"]:checked'),n=i('.express-list input[name="carriagegroup"]').val(),o=i("#biprice.is-select").val(),s=a.val(),r=i(".address-manage").attr("cart-type"),d=i(".use-envelopes input:checked").attr("data-use");s=s?s:a.closest("li").find("#juancode").val(),t={cartType:r,deliveryWay:n,couponCode:s,yohoCoin:o},d&&(t.redEnvelopes=d),e(t)}function t(e,t){var a=e;a.keyup(function(){a.val().length>t&&a.val(a.val().substr(0,t))})}var a,n=this.e,r=s.UI,d=s.Common;n.$selectExpress.click(function(){var t=i(this).val();n.$loading.show(),e(function(e){e.deliveryWay=t,a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){console.log(e),n.$loading.hide(),200===e.code?(r.render(e.data),"1"===t?i(".express-list.sf").addClass("hide"):"2"===t&&i(".express-list.sf").removeClass("hide")):new o.Alert(e.message).show()}},i.ajax(a)})}),n.$juanok.click(function(){var t=i(this).parents("dl.pan"),o="";i(".play-juan").addClass("is-select"),e(function(e){var s=e.couponCode;s?(n.$loading.show(),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){n.$loading.hide(),200===e.code?(o=i('.play-juan input[value="'+s+'"]').next().text(),r.render(e.data,o),d.winHide(t),n.$juantip.html("")):(n.$juantip.html(e.message),i(".play-juan").removeClass("is-select"))}},i.ajax(a)):(n.$juantip.html("请选择或填写一个优惠券"),i(".play-juan").removeClass("is-select"))})}),i(document).on("click",".juan-modify",function(){var e=i(".play-juan-pan");d.winShow(e)}),n.$biok.click(function(){var t,o=i(this).parents("dl.pan");i("#biprice").addClass("is-select"),e(function(e){e.couponCode&&(t=i('.play-juan input[value="'+e.couponCode+'"]').next().text()),1*e.yohoCoin===0?(i(".errbitip").html("请填写一个正整数"),i("#biprice").removeClass("is-select")):1*e.yohoCoin>1*i(".play-pan em").text()?(i(".errbitip").html("您的YOHO币不足"),i("#biprice").removeClass("is-select")):(n.$loading.show(),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){n.$loading.hide(),200===e.code?(r.render(e.data,t),d.winHide(o)):(i(".errbitip").html(e.message),i("#biprice").removeClass("is-select"))}},i.ajax(a))})}),i(document).on("click",".bi-modify",function(){var e=i(".play-bi-pan");d.winShow(e)}),n.$bp.keyup(function(){var e=i(this).val();0>1*e||e.indexOf(".")>0?n.$errorTip.html("请输入一个正整数"):1*e>1*i(this).data("bi")?n.$errorTip.html("您的YOHO币不足"):n.$errorTip.html("抵扣"+(e/100).toFixed(2)+"元");
}),i(".cancel-bi").click(function(){var t,o=i(".play-bi-pan");i("#biprice").hasClass("is-select")?(n.$loading.show(),e(function(e){e.yohoCoin=0,e.couponCode&&(t=i('.play-juan input[value="'+e.couponCode+'"]').next().text()),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){n.$loading.hide(),200===e.code?(r.render(e.data,t),d.winHide(o),i("#biprice").val("0"),i("#biprice").removeClass("is-select"),i(".errbitip").html("")):i(".errbitip").html(e.message)}},i.ajax(a)})):(d.winHide(o),i("#biprice").val("0"))}),i(".cancel-code").click(function(){var t=i(".play-juan-pan");i(".play-juan").hasClass("is-select")?(n.$loading.show(),e(function(e){e.couponCode="",a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){n.$loading.hide(),200===e.code?(r.render(e.data),d.winHide(t),i(".play-juan").removeClass("is-select"),i("#juancode").val("").siblings('input[name="juangroup"]').attr("checked","checked")):n.$juantip.html(e.message)}},i.ajax(a)})):d.winHide(t)}),n.$useEnvelopes.find("input").click(function(){var t=i(this);n.$loading.show(),e(function(e){t.attr("checked")?e.redEnvelopes=t.val():e.redEnvelopes=0,a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){n.$loading.hide(),200===e.code?(r.render(e.data),t.attr("checked")?(n.$redEnvelopes.addClass("active"),n.$useEnvelopes.find("span").html("-¥"+(1*t.val()).toFixed(2)),n.$hasEnvelopes.html("¥0.00"),t.attr("data-use",t.val()),t.val(0)):(n.$useEnvelopes.find("span").html("-¥0.00"),n.$hasEnvelopes.html("¥"+(1*t.attr("data-use")).toFixed(2)),n.$redEnvelopes.removeClass("active"),t.val(t.attr("data-use")),t.attr("data-use",0))):new o.Alert(e.message).show()}},i.ajax(a)})}),t(i("#piaodesc"),30),t(i("#notedesc"),100)}}};s.Data.activity=0,s.Data.carriage=0,s.UI.init(),s.Bll.init(),n.getUserAddressList(),n.newAddress(0,"000000"),n.modifyAddress(),n.saveAddress()}),define("js/order/address",["jquery","handlebars","source-map"],function(e,t,a){function i(e,t,a){var i,n,o="";for(i=0;i<t.length;i++)o+=t[i].id===a?'<option selected value="'+t[i].id+'">'+t[i].caption+"</option>":'<option value="'+t[i].id+'">'+t[i].caption+"</option>";"province"===e.attr("name")?n='<option value="0">请选择省份</option>':"city"===e.attr("name")?n='<option value="0">请选择城市</option>':"county"===e.attr("name")&&(n='<option value="0">请选择区县</option>'),e.html(n+o)}function n(e,t){var a,n=e.selectId;"getProvince"===e.type?a=h:"getCity"===e.type?a=f:"getCounty"===e.type&&(a=m),l.ajax({type:"GET",url:"/cart/index/getAreaList",dataType:"json",data:{id:1*e.id}}).then(function(e){i(a,e.data,n),"function"==typeof t&&t()}).fail(function(){})}function o(e){y.val(e.attr("data-name")),y.attr("data-id",e.attr("data-id")),C.val(e.attr("data-addressDesc")),w.val(e.attr("data-mobile")),b.val(e.attr("data-email")),x.val(e.attr("data-zipcode")),j.val(e.attr("data-phoneCode")),_.val(e.attr("data-codeNum"))}function s(){q.removeClass("active"),I.find('li:not(".active")').addClass("hide"),I.find("li.active").addClass("address_select"),p.addClass("hide"),k.addClass("hide"),I.removeClass("address-expand"),l(".order-selection h2 span").text("[修改]")}function r(){var e,t,a,i=l(".play-juan ul"),n="";l.ajax({type:"GET",dataType:"json",url:"/cart/index/getCouponList"}).then(function(o){if(200===o.code){for(t=o.data,e=t.length,a=0;e>a;a++)n+='<li><input name="juangroup" type="radio" value="'+t[a].code+'"><label>'+t[a].desc+"</label></li>";i.prepend(l(n))}})}function d(e){return"N"===e?!1:!0}var l=e("jquery"),c=e("js/common/dialog"),u=!1,p=l(".address-manage"),h=p.find('.text-input[name="province"]'),f=p.find('.text-input[name="city"]'),m=p.find('.text-input[name="county"]'),v=p.find('.text-input[name="province"], .text-input[name="city"]'),g=l(".address-list"),y=p.find('.text-input[name="name"]'),w=p.find('.text-input[name="phone"]'),b=p.find('.text-input[name="mail"]'),C=p.find('.text-input[name="address"]'),x=p.find('.text-input[name="code"]'),k=l(".save-btn"),j=p.find('.text-input[name="tel-code"]'),_=p.find('.text-input[name="tel"]'),q=l(".use-new-address"),I=l(".exist-address-list"),T=l(".loading"),A=p.attr("cart-type");t.getUserAddressList=function(){var e,t,a="",i="",n="",o="",s=0;l.ajax({type:"GET",url:"/cart/index/getAddress",dataType:"json"}).then(function(r){if(200===r.code){if(e=r.data.list,!e)return g.find(">h2").find("span").click(),l(".exist-address-list li").click(),void l(".use-new-address").removeClass("active");for(t=0;t<e.length;t++)e[t].checked?(i="checked",n="active address_select",s++,o="默认地址"):(i="",n="hide",o="设为默认地址"),a+='<li data-id="'+e[t].id+'" class="'+n+'" data-express="'+e[t].isSupport+'"><input data-name="'+e[t].user+'" data-areaCode="'+e[t].areaCode+'" data-addressDesc="'+e[t].addressDesc+'" data-mobile="'+e[t].mobile+'" data-phoneNum="'+e[t].phoneNum+'" data-phoneCode="'+e[t].phoneCode+'" data-zipCode="'+e[t].zipCode+'" data-email="'+e[t].email+'" class="radio" type="radio" name="address" '+i+' /><label for=""><strong>'+e[t].user+"</strong>"+e[t].address+'<a href="javascript:void(0);" class="default-address">'+o+'</a><div class="order-modify-btn"><span class="address-modify">[修改]</span><span class="address-del">[删除]</span></div></label></li>';l(".use-new-address").before(l(a)),0===s&&l(".address-list h2 span").click(),"N"===l(".active.address_select").attr("data-express")?(l('.express-list input[name="carriagegroup"][value="2"]').attr("disabled","disabled"),l('.express-list input[name="carriagegroup"][value="1"]').attr("checked","checked"),l(".express-list.sf").addClass("hide"),l(".is-sup").removeClass("hide")):(l('.express-list input[name="carriagegroup"][value="2"]').removeAttr("disabled"),l(".express-list.sf").removeClass("hide"),l(".is-sup").addClass("hide"))}})},t.newAddress=function(e,t){var a=e||0,i=/[0-9]{2}/gi,o=!!t&&t.match(i);n({id:a,type:"getProvince",selectId:o[0]},function(){var e=h.val();"0"!==e?n({id:e,type:"getCity",selectId:""+o[0]+o[1]},function(){var e=f.val();"0"!==e&&n({id:e,type:"getCounty",selectId:t})}):(p.find('select[name="city"]').html('<option value="0">请选择城市</option>'),p.find('select[name="county"]').html('<option value="0">请选择区县</option>'))}),v.change(function(){var e=l(this);"province"===e.attr("name")&&("0"===e.val()?(p.find('select[name="city"]').html('<option value="0">请选择城市</option>'),p.find('select[name="county"]').html('<option value="0">请选择区县</option>')):(n({id:e.val(),type:"getCity"},function(){u=!0}),p.find('select[name="county"]').html('<option value="0">请选择区县</option>'))),"city"===e.attr("name")&&u&&("0"===e.val()?p.find('select[name="county"]').html('<option value="0">请选择区县</option>'):n({id:e.val(),type:"getCounty"}))})},t.modifyAddress=function(){g.click(function(e){var a=l(e.target),i=a.closest("li").attr("data-id"),n=a.closest("li").find(".radio").attr("data-areaCode");a.hasClass("address-modify")?(p.removeClass("hide"),t.newAddress(0,n),o(a.closest("li").find(".radio")),l(".address-list-inner .save-btn").removeClass("hide"),k.attr("data-id",i),u=!0):a.hasClass("address-del")?(T.show(),l.ajax({type:"POST",url:"/cart/index/delAddress",data:{id:i}}).then(function(e){T.hide(),200===e.code?a.closest("li").remove():new c.Alert(e.message).show()}).fail(function(){})):a.hasClass("default-address")&&!a.parents("li").hasClass("address_select")&&(T.show(),l.ajax({type:"post",url:"/cart/index/setDefaultAddress",data:{id:i}}).then(function(e){T.hide(),200===e.code?(l(".exist-address-list li").removeClass("address_select").find(".default-address").text("设为默认地址"),a.parents("li").addClass("address_select"),a.text("默认地址")):new c.Alert(e.message).show()}))})},t.saveAddress=function(){k.click(function(){function e(e){return e===g?e?e+"-":" ":e?e+" ":" "}var t,a,i,n=l(this),o=y.val(),r=h.val(),d=f.val(),u=m.val(),p=C.val(),v=w.val(),g=j.val(),q=_.val(),I=b.val(),T=x.val(),A=h.find('option[value="'+r+'"]').text(),D=f.find('option[value="'+d+'"]').text(),S=m.find('option[value="'+u+'"]').text(),E={consignee:o,areaCode:u,address:p,email:I,mobile:v,zipCode:T,phoneCode:g,phoneNum:q},$=/^[\u4e00-\u9fa5]{2,5}$/,z=/^[\s\S]{3,100}$/,O=/^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/,P=/^[0-9]{6}$/,N=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,L=/^[0-9]{3,5}$/,F=/^[0-9]{5,10}$/;if(i=l('.exist-address-list li:not(".use-new-address")').find('input[name="address"]:checked').length>0,l(".add-address").attr("checked")||!i||l(".save-btn").attr("data-id")||(l(".exist-address-list li").removeClass("address_select"),l(".exist-address-list li.active").addClass("address_select").find('input[name="address"]').attr("checked","checked"),l(".address-list span").removeAttr("expand"),s()),!l(".address-manage").hasClass("hide")){if(!$.test(o))return void new c.Alert("真实姓名至少2个中文,最多5个中文").show();if(!z.test(p))return void new c.Alert("你输入的地址格式不正确").show();if(!O.test(v))return void new c.Alert("你输入的联系电话格式不正确").show();if(g&&!L.test(g)||q&&!F.test(q)||L.test(g)&&!F.test(q)||!L.test(g)&&F.test(q))return void new c.Alert("你输入的电话格式不正确").show();if(I&&!N.test(I))return void new c.Alert("你输入的邮箱格式不正确").show();if(T&&!P.test(T))return void new c.Alert("你输入的邮编格式不正确").show();k.attr("data-id")&&(E.id=k.attr("data-id")),l.ajax({type:"post",url:"/cart/index/saveAddress",data:E}).then(function(i){var r;200===i.code?(r=i.data,console.log(r),"Y"===r.is_support?(l('.express-list input[name="carriagegroup"][value="2"]').removeAttr("disabled"),l(".express-list.sf").removeClass("hide"),l(".is-sup").addClass("hide")):(l('.express-list input[name="carriagegroup"][value="2"]').attr("disabled","disabled"),l(".express-list.sf").addClass("hide"),l(".is-sup").removeClass("hide")),t=E.id?'<li class="active" data-id="'+E.id+'" data-express="'+r.is_support+'"><input data-name="'+E.consignee+'" data-areaCode="'+E.areaCode+'" data-addressDesc="'+E.address+'" data-mobile="'+E.mobile+'" data-phoneNum="'+E.phoneNum+'" data-phoneCode="'+E.phoneCode+'" data-zipCode="'+E.zipCode+'" data-email="'+E.email+'" checked="checked" class="radio" type="radio" name="address" /><label><strong>'+o+"</strong><span>"+A+" "+D+" "+S+" "+p+" "+e(T)+e(v)+e(g)+e(q)+'</span><a href="javascript:void(0);" class="default-address">设为默认地址</a><div class="order-modify-btn"><span class="address-modify">[修改]</span><span class="address-del">[删除]</span></div></label></li>':'<li class="active" data-id="'+r.id+'" data-express="'+r.is_support+'"><input data-name="'+r.consignee+'" data-areaCode="'+r.area_code+'" data-addressDesc="'+r.address+'" data-mobile="'+r.mobile+'" data-phoneNum="'+r.a+'" data-phoneCode="'+r.b+'" data-zipCode="'+r.zip_code+'" data-email="'+r.email+'" checked="checked" class="radio" type="radio" name="address" /><label><strong>'+o+"</strong><span>"+A+" "+D+" "+S+" "+p+" "+e(T)+e(v)+e(g)+e(q)+'</span><a href="javascript:void(0);" class="default-address">设为默认地址</a><div class="order-modify-btn"><span class="address-modify">[修改]</span><span class="address-del">[删除]</span></div></label></li>',n.attr("data-id")?(a=l('.exist-address-list li[data-id="'+n.attr("data-id")+'"]'),a.after(l(t)).remove()):l(".use-new-address").before(l(t)),l(".address-list span").removeAttr("expand"),s()):new c.Alert(i.message).show()})}return 0===l(".exist-address-list li").find('input[name="address"]:checked').length?void new c.Alert("请选择一个地址").show():void 0})},l(".pay-time-modify .pay-btn").click(function(){var e=l(".modity-pay-info"),t=l(".pay-time-modify"),a=t.find('input[name="pay-type"]:checked').val(),i=t.find('input[name="pay-type"]:checked').next("label").text(),n=t.find('input[name="pay-time-radio"]:checked').next("label").text(),o=t.find('input[name="pay-time-radio"]:checked').val(),s=t.find('input[name="call-me"]:checked').next("label").text(),r=t.find('input[name="call-me"]:checked').val();T.show(),l.ajax({type:"POST",url:"/cart/index/orderCompute",dataType:"json",data:{cartType:A,paymentType:a}}).then(function(t){T.hide(),200===t.code?(e.find("li").eq(0).find("span").text(i),e.find("li").eq(1).find("span").text(n),e.find("li").eq(2).find("span").text(s),l(".pay-time-modify").addClass("hide").find('input[name="pay-type"][value='+a+"]").addClass("checked").end().find('input[name="pay-time-radio"][value='+o+"]").addClass("checked").end().find('input[name="call-me"][value='+r+"]").addClass("checked"),l(".modity-pay-info").removeClass("hide"),l(".switch-pay-modify").text("[修改]")):new c.Alert(t.message).show()})}),r(),l(".to-play input.submit").click(function(){var e=l('.exist-address-list input[name="address"]:checked').closest("li").attr("data-id"),t=l('.pay-time-modify input[name="pay-time-radio"]:checked').val(),a=l('.pay-time-modify input[name="carriagegroup"]:checked').val(),i=l("#piaodesc").val(),n=l("#piaotype").val(),o=l('.pay-time-modify input[name="pay-type"]:checked').val(),s=l('.pay-time-modify input[name="pay-type"]:checked').data("pay"),r=l("#notedesc").val(),u=l("#biprice").val(),p=l('.pay-time-modify input[name="call-me"]:checked').val(),h=l('.pay-time-modify input[name="isPP"]:checked').val(),f=l(".use-envelopes input:checked").attr("data-use"),m=l('.play-juan.is-select input[name="juangroup"]:checked'),v=m.val(),g=v?v:m.closest("li").find("#juancode").val();T.show(),l.ajax({type:"POST",dataType:"json",url:"/cart/index/orderSub",data:{addressId:e,cartType:A,deliveryTimeId:t,deliveryWayId:a,invoiceTitle:i,invoiceId:n,paymentId:s,paymentType:o,remark:r,couponCode:g,yohoCoin:u,isPreContact:d(p),isPrintPrice:d(h),redEnvelopes:f}}).then(function(e){T.hide(),200===e.code?window.location.href=e.data.payUrl:new c.Alert(e.message).show()})})});