index.js
190 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/help/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:"",tick:""};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=W.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)&&W.parse(a(e.data)),!1):void 0})}catch(o){console.log(o.message)}},getShoppingKey:function(){var e,t=window.cookie("_g"),a=W.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;"> </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("")})),G(document).click(function(e){G(e.target).closest(".searchspan, .search-list").length||G(".search-list").hide()})}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(Q,{method:"open.Shoppingcart.getCartData",shopping_key:G.getShoppingKey()},function(i){""===X&&(X=Y.compile(G("#mini-cart-tpl").html())),G("#miniCartBox").children(".gobuy-wrapper").html(X({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=W.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(Q,{method:"open.Shoppingcart.delone",shopping_key:G.getShoppingKey(),id:e,isreduce:t},function(e){var t=window.cookie("_g"),a=W.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 S(){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 E(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 D(){var e;G("#miniCartBox").mouseenter(function(t){e=G(t.target),("miniCartBox"===e.attr("id")||"ic-infomation"===e.attr("class"))&&E(1)}),G("#miniCartBox").mouseleave(function(e){E(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),Z=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>] [<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> {{#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>] [<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(J=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(J(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(Z(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(Q,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(),D(),_(),P(),L(),S(),T(),A(),B(),n()}var R,H,G=e("jquery"),Y=e("handlebars"),W=e("index"),Z=null,J=null,Q=G("#api-domain").val(),X="",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> <a href="http://www.yohobuy.com/logout_'+n.token+'.html">[退出]</a>'):t='<span>Hi~</span> <a href="http://www.yohobuy.com/signin.html">[请登录]</a> <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){var i=e("jquery");e("js/product/filter"),e("js/product/sort-pager"),e("js/product/latest-walk"),e("js/product/product"),function(){var e,t=i(".banner-img");0!==t.length&&(e=new Image,e.onload=function(){e.height&&t.height(e.height),e=null},e.src=t.css("background-image").replace(/"/g,"").slice(4,-1))}()}),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,delete i.page,a="?"+decodeURIComponent(v.param(i)),window.location.href=a}function r(e){S.children(".senior-sub:eq("+m+")").addClass("hide"),E.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:"",checked:""},w={up:"",down:""},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"),S=v(".senior-sub-wrap"),E=v(".senior-attr-wrap"),D='{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',$={},z=v(".filter-box .size");D=g.compile(D),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]=D({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)})),E.on("mouseenter",".attr",function(){var e=v(this),t=e.index();e.hasClass("no-sub")||(e.addClass("hover").siblings().removeClass("hover"),S.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","handlebars","source-map"],function(e,t,a){var i,n=e("jquery"),o=e("lazyload"),s=e("handlebars"),r=e("js/common/product-event"),d=n(".goods-container"),l=d.find(".good-info"),c=d.find(".good-item-wrapper"),u=d.find(".good-info-main"),p=d.find(".good-select-color"),h=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(){u.html(""),p.html(""),c.css({display:"none"})}i=null,l.unbind(),i=r(l,e),i.addHandler("MouseEnter",function(e){var i,o,s,r,l,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"),skc:e.target.attr("data-skc")}}).then(function(b){var C=b.data,x=t(C.pics,w);a(),y=x.colorListStr,i=x.ulNum,u.append(e.targetDuplicate),p.append(n(y)),h=c.css("paddingLeft"),f=c.css("paddingTop"),m=d.css("paddingTop"),o=10+65*i+e.targetWidth,r=(e.targetX-1)*(e.targetWidth+v)-(parseInt(h)+1),l=(e.targetY-1)*(e.targetHeight+g)+parseInt(m)-(parseInt(f)+1),s=e.offsetR-(65*i+25),0>=s&&(r=r+s-25),c.css({width:o,left:r,top:l,display:"inline-block"}),C.pics[0]&&C.pics[0].src&&u.find(".good-thumb img").attr("src",C.pics[0].src)})}),c.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)}),h.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")}),function(){var e,t=n("#brand-card"),a=n("#brand-favor");t.length&&n.ajax({type:"POST",url:"/product/index/getNodeContent",data:{node:t.data("node")}}).then(function(e){t.html(e)}),a.length&&(e=n("#pic-link-tpl").html(),n.ajax({type:"POST",url:"/product/index/getAdnav",data:{brandId:a.data("id")}}).then(function(t){t&&n("#brand-ad").html(s.compile(e)({picLink:t}))}))}()}),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"></span></a><a class="next" href="javascript:;"><span class="iconfont"></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:;"></a><a class="next iconfont" href="javascript:;"></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,S=200,E={def:"收藏商品",coled:"已收藏",hover:"取消收藏"},D=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").children("li").removeClass("focus"),m.eq(a).removeClass("hide")),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:not(.hide) li.focus").data("sku"),buyNumber:n()}}).then(function(e){var t=e.code;200===t&&(d("#type-chose").slideUp(S),d("#balance").slideDown(S),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(E.def):t.find("em").text(E.coled)):403===i&&(location.href=a.data.url)})}).hover(function(){var e=d(this);e.hasClass("coled")&&e.find("em").text(E.hover)},function(){var e=d(this);e.hasClass("coled")&&e.find("em").text(E.coled)}),d("#keep-shopping").click(function(){d("#type-chose").slideDown(S),d("#balance").slideUp(S)}),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 D("打开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(S),i.slideUp(S)):(a.slideUp(S),i.slideDown(S)))}),d(".after-service-switch").click(function(){var e=d(this),t=e.next(".after-service-content"),a={def:"",spread:""};"none"===t.css("display")?(t.slideDown(S),e.find(".triangle").html(a.spread)):(t.slideUp(S),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-wrap > img").load(function(){d(this).parent(".hot-point-wrap").width(d(this).width())}),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.eq(d(".colors .focus").index()).find("li").click()}(),function(){function e(){a||(a=!0,d.ajax({type:"GET",url:"/product/item/comments",data:{productId:T,page:n}}).then(function(e){var t;if(200===e.code){if(t=e.data,0===t.length)return void l.next(".more-wrap").addClass("hide");p.text(t[0].total),l.append(s({comments:t})),n++}}).always(function(){a=!1}))}function t(){i||(i=!0,d.ajax({type:"GET",url:"/product/item/consults",data:{productId:T,page:o}}).then(function(e){var t;if(200===e.code){if(t=e.data,0===t.length)return void u.next(".more-wrap").addClass("hide");h.text(t[0].total),u.append(r({consults:t})),o++}}).always(function(){i=!1}))}var a,i,n=1,o=1,s=c.compile(d("#comments-tpl").html()),r=c.compile(d("#consults-tpl").html()),l=d("#comments-ul"),u=d("#consults-ul"),p=d(".comment-num"),h=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(S),a.slideUp(S)):(i.slideUp(S),a.slideDown(S)))}).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.inherit)return 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"></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({inherit:!0}),s.prototype.constructor=s,t.Alert=s,r.prototype=new o({inherit:!0}),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}}"></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:S.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):E.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"),S=m("#msg-captcha"),E=m("#pwd"),D=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(""),S.val(""),E.val(""),D.val(""),$.val("")},0),$.attr("maxlength",I),E.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"),q.val("60秒可重新发送"),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&&(E[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:S.val(),password:E.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:"",unchecked:""},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("发送失败")})}),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"))}}):l.addClass("disable").attr("href","javascript:;")}).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)?D.removeClass("default no red").addClass("yes"):D.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(S,"短信验证码不能为空"),a=!1):k===!1&&(r(S,"请输入正确的验证码"),a=!1),""===t?(r(E,"密码不能为空"),a=!1):t.length<6||t.length>20?(r(E,"密码只支持6-20位字符"),a=!1):z.test(t)?j===!1&&(r(E,"请输入符合强度的密码"),a=!1):(r(E,"密码须由字母和数字组合"),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"),S=A.find(".code-err-tip"),E=A.find(".pwd-err-tip"),D=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){U.ajax({type:"POST",dataType:"json",url:"/cart/index/select",data:e,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){te=[],j={},b=e.attr("checked")?"Y":"N",U("."+t).each(function(){oe=U(this).data("promotionid")?!0:!1,U(this).data("id")&&te.push({product_sku:U(this).data("id"),selected:b,buy_number:U(this).data("productnum"),goods_type:U(this).data("goodstype"),promotion_id:U(this).data("promotionid")?U(this).data("promotionid"):0})}),j={skuList:JSON.stringify(te),hasPromotion:oe},i(j)}function o(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 s(e){U.ajax({type:"GET",dataType:"html",url:"/cart/index/getProductInfo",data:e}).then(function(e){K=0,Z.html(" "),Z.append(e),Z.show(),U(".detail-bigpic:not(.none) .con li:first").addClass("active"),U(".showSizeBox:not(.none) span").length<2&&U(".showSizeBox:not(.none) span:first").addClass("atcive"),1!==Number(U("#addToCart").val())&&U(".showSizeBox span").data("num",0),U.each(U(".showSizeBox span"),function(){U(this).data("num")<=0&&(U(this).addClass("nullAtcivec"),console.log(U(".showSizeBox:not(.none) span:first")),U(".showSizeBox:not(.none) span:first").removeClass("atcive"))}),"undefined"!=typeof T&&(L=U(".detail-info .oldprice del").html()?U(".detail-info .oldprice del").html():F,P='<span class="oldprice">现价:<del>'+L+'</del></span><span class="newprice">活动价:<b class="promotion-price">'+T+"</b></span>",U(".detail-info .price").html(P)),U(".detail-bigpic:not(.none) .bigpic:gt(0)").hide(),U(".showSizeBox:not(.none)").find("span").each(function(){return U(this).hasClass("nullAtcivec")?(U(".addcart").addClass("none"),void U(".btn_sellout").removeClass("none")):(U(".addcart").removeClass("none"),U(".btn_sellout").addClass("none"),!1)})})}function r(){Z.html(" "),Z.css({top:U(document).scrollTop()+30,left:U(document).width()/2-Z.width()/2})}function d(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 l(e,t,a){U.ajax({type:"POST",dataType:"json",url:t,data:j,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 c(e){U.ajax({type:"POST",dataType:"json",url:"/cart/index/modify",data:e}).then(function(e){200===e.code&&window.history.go(0)})}function u(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 p(){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('.common-list input[type="checkbox"]').attr("checked")&&(ne=!0),U('.per-list input[type="checkbox"]').attr("checked")&&(ie=!0),0!==U(".per-list").length&&0!==U(".common-list").length?ne&&ie&&U('.batch_div input[type="checkbox"]').attr("checked",!0):(ne||ie)&&U('.batch_div 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")&&te.push(U(this).data("pid")+"")}),U.ajax({type:"POST",url:"/cart/index/checkFav",data:{pidList:JSON.stringify(te)}}).then(function(e){A='<span class="cart-yetremove-btn">已收藏</span>',S='<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(A):U(this).find(".cart-operation").append(S))})})})}var h,f,m,v,g,y,w,b,C,x,k,j,_,q,I,T,A,S,E,D,$,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"),W=U(".pay-wapper"),Z=U(".goods-detail"),J=U(".histroy"),Q=U(".together"),X=U(".shop-cart"),V=1,K=0,ee=1,te=[],ae=[],ie=!1,ne=!1,oe=!1;Y.find(".btn_close").click(function(){Y.fadeOut()}),W.one("click",'.common-sell-box input[type="checkbox"], .pre-sell-box input[type="checkbox"]',function(){b=U(this).attr("checked")?"Y":"N",te=[],te.push({product_sku:U(this).parents("tr").data("id"),selected:b,buy_number:U(this).parents("tr").data("productnum"),goods_type:U(this).parents("tr").data("goodstype"),promotion_id:U(this).parents("tr").data("promotionid")?U(this).parents("tr").data("promotionid"):0}),oe=U(this).parents("tr").promotion_id?!0:!1,j={skuList:JSON.stringify(te),hasPromotion:oe},i(j)}),G.one("click",'input[type="checkbox"]',function(){te=[],N={},j={},b=U(this).attr("checked")?"Y":"N",U(".pay-wapper:first tr").each(function(){U(this).data("promotionid")&&(oe=!0),U(this).data("id")&&te.push({product_sku:U(this).data("id"),selected:b,buy_number:U(this).data("productnum"),goods_type:U(this).data("goodstype"),promotion_id:U(this).data("promotionid")?U(this).data("promotionid"):0})}),j={skuList:JSON.stringify(te),hasPromotion:oe},i(j)}),U(".per-list").on("click",'input[type="checkbox"]',function(){n(U(this),"pre-sell-box")}),U(".common-list").on("click",'input[type="checkbox"]',function(){n(U(this),"common-sell-box")}),h=U("#togetherProduct").html(),f=B.compile(h),o(J,"/cart/index/getHistroyProduct"),o(Q,"/cart/index/getTogetherProduct"),Q.on("click",".pagenext, .pageprev",function(){o(Q,"/cart/index/getTogetherProduct",{page:Math.ceil(100*Math.random())+1})}),X.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")}),J.on("click",".pagenext, .pageprev",function(){U(this).hasClass("pagenext")?V++:--V>0||(V=1),o(J,"/cart/index/getHistroyProduct",{page:V})}),W.on("click",".cart-add-btn",function(){D=U(this).data("id"),I=U(this).parents("table").data("promotion"),T=U(this).parents("table").find(".subjoin-price").html(),F=U(this).parents("table").find(".wapper-price").html(),r(),s({productId:D})}),U(".clearfix").on("click",".btn_view_s",function(){D=U(this).data("id"),I=U(this).parents("table").data("promotion"),T=U(this).parents("table").find(".subjoin-price").html(),r(),s({productId:D})}),Z.on("click",".colse",function(){Z.hide(),Z.html(" "),ee=1}),W.on("click",".icon-minusCart, .icon-addCart",function(){d(U(this))}),W.on("click",".unfold-color",function(){d(U(this)),U(this).siblings(".icon-minusCart").removeClass("none"),U(this).siblings(".icon-addCart").addClass("none")}),W.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")}),W.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")}),Z.on("click",".fav_count",function(){U.ajax({type:"POST",dataType:"json",url:"/product/item/togglecollect",data:{productId:D,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()})}),W.on("click",".cart-del-btn",function(){j={},te=[],I=U(this).parents("tr").data("promotionid")?U(this).parents("tr").data("promotionid"):0,te.push({product_sku:U(this).parents("tr").data("id"),buy_number:U(this).parents("tr").data("productnum"),promotion_id:I}),oe=I?!0:!1,j={skuList:JSON.stringify(te),hasPromotion:oe},E="<div><span></span>删除商品</div><p>确定从购物车中删除此商品?</p>",U(this).data("gift")||(k={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"),promotionId:U(this).parents("tr").data("promotionid")}),C="/cart/index/remove",new R({content:E,cb:function(){l(j,C,k)}}).show()}),W.on("click",".cart-remove-btn",function(){j={},te=[],I=U(this).parents("tr").data("promotionid")?U(this).parents("tr").data("promotionid"):0,te.push({product_sku:U(this).parents("tr").data("id"),buy_number:U(this).parents("tr").data("productnum"),promotion_id:I}),oe=I?!0:!1,j={skuList:JSON.stringify(te),hasPromotion:oe},l(j,"/cart/index/fav")}),G.on("click",".delAll",function(){j={},k={},te=[],ae=[],U(".pay-wapper:first tr").each(function(){U(this).find('input[type="checkbox"]').attr("checked")&&(I=U(this).data("promotionid")?U(this).data("promotionid"):0,I&&(oe=!0),U(this).data("id")&&(U(this).find('input[type="checkbox"]').attr("checked")&&te.push({product_sku:U(this).data("id"),buy_number:U(this).data("productnum"),promotion_id:I}),k={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"),promotionId:U(this).data("promotionid")},ae.push(k)))}),C="/cart/index/remove",E="<div><span></span>删除商品</div><p>确定从购物车中删除所有选中商品?</p>",j={skuList:JSON.stringify(te),hasPromotion:oe},U.isEmptyObject(te)?new H("请至少选择一件商品").show():new R({content:E,cb:function(){l(j,C,ae)}}).show()}),G.on("click",".removeAll",function(){j={},k={},te=[],U(".pay-wapper:first tr").each(function(){U(this).find('input[type="checkbox"]').attr("checked")&&(I=U(this).data("promotionid")?U(this).data("promotionid"):0,I&&(oe=!0),U(this).data("id")&&U(this).find('input[type="checkbox"]').attr("checked")&&te.push({product_sku:U(this).data("id"),buy_number:U(this).data("productnum"),promotion_id:I}))}),j={skuList:JSON.stringify(te),hasPromotion:oe},U.isEmptyObject(te)?new H("请至少选择一件商品").show():l(j,"/cart/index/fav")}),W.one("click",".minus, .plus",function(){return k={},x=U(this).hasClass("minus")?"decreaseNum":"increaseNum",k[""+x]=1,"1"===U(this).siblings("input").val()&&U(this).hasClass("minus")?!1:void c(U.extend(k,{sku:U(this).parents("tr").data("id")}))}),U(".gift").on("click",".up, .down",function(){U(this).siblings("i").toggleClass("none"),U(this).toggleClass("none")}),Z.on("click",".addcart",function(){return 0===U(".showSizeBox:not(.none) .atcive").length?(new H("请选择尺码").show(),!1):(_=U(".showSizeBox:not(.none) .atcive").data("num"),q=U(".showSizeBox:not(.none) .atcive").data("sku"),j={productSku:q,buyNumber:U("#mnum").val(),promotionId:I},void(U("#mnum").val()>_?new H("库存不足,目前还有"+_+"个库存").show():1===Number(U("#addToCart").val())?u(j):new H("该商品无法加入购物车").show()))}),Z.on("click",".cut, .add",function(){if(x=U(this).hasClass("minus")?"decreaseNum":"increaseNum",I)U(this).hasClass("cut")?new H("-_-,已经是最后一件,不能在减了!").show():new H("最多只能购买1,您好像购买的太多了!").show();else{if(U(this).hasClass("add")?ee++:ee--,1>ee)return new H("-_-,已经是最后一件,不能在减了!").show(),!1;U("#mnum").val(ee)}}),Z.on("click",".color",function(){K=0,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").length<2&&U(".showSizeBox:not(.none) span:first").addClass("atcive"),U(".detail-bigpic").addClass("none").eq(U(this).index()).removeClass("none"),U(".detail-bigpic").eq(U(this).index()).find(".bigpic").hide(),U(".detail-bigpic").eq(U(this).index()).find(".bigpic:first").show(),U(".detail-bigpic").eq(U(this).index()).find(".con li").removeClass("active"),U(".detail-bigpic").eq(U(this).index()).find(".con li:first").addClass("active"),U(".showSizeBox").eq(U(this).index()).find("span").each(function(){return U(this).hasClass("nullAtcivec")?(U(".addcart").addClass("none"),void U(".btn_sellout").removeClass("none")):(U(".addcart").removeClass("none"),U(".btn_sellout").addClass("none"),!1)})}),Z.on("click",".showSizeBox span",function(){_=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(){j={},z=U(".dev-revocation .goBack").index(this),te=[],U(".dev-revocation tr").each(function(e){z!==e&&(k={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"),promotionId:U(this).data("promotionid")},te.push(k))}),j={productSku:U(this).parents("tr").data("productsku"),promotionId:U(this).parents("tr").data("promotionid"),buyNumber:U(this).parents("tr").data("productnum")},u(j,te)}),Z.on("click",".piclist li",function(){K=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()}),p(),Z.on("click",".pre, .next",function(){if(U(this).hasClass("next")){if(K>=U(this).siblings(".con").find("li").length-1)return!1;K++}else{if(1>K)return!1;K--}U(this).siblings(".con").find("li").removeClass("active").eq(K).addClass("active"),U(".detail-bigpic:not(.none) .bigpic").hide().eq(K).show()}),U(".btn_account").on("click",function(){O="",U(".pay-wapper input:checked").parents("tr").find(".tipNoStore").length>0?($=U(".pay-wapper input:checked").parents("tr").find(".tipNoStore"),U.each($.parents("tr").find(".pay-pro-info a"),function(){O+=U(this).html()}),new H(O+"库存不足").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()}),W.on("selectstart",function(){return!1}),Z.on("selectstart",function(){return!1})}),define("js/home/entry",["jquery","handlebars","source-map","dot"],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/complaints"),e("js/home/message"),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","handlebars","source-map"],function(e,t,a){var i=e("jquery");e("js/home/order-block"),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/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"),a=o(".cancel-dialog .cancel-tip");return 0===t.length?void a.html("请选择要取消订单的原因"):void o.ajax({type:"POST",url:"/home/orders/cancelorder",data:{orderCode:e,reason:t.val()}}).then(function(e){200===e.code?(n.close(),history.go(0)):a.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).siblings(".logistics").removeClass("hide")}),o(".close-logistics").click(function(){o(this).closest(".logistics").addClass("hide")}),o(".me-orders, .order-detail").on("click",".cancel-order",function(e){n=i(o(this).closest(".order, .order-detail").data("id")),n.show()}).on("click",".confirm-received",function(e){var t=o(this).closest(".order, .order-detail").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/orders",["jquery","handlebars","source-map"],function(e,t,a){e("js/home/order-block")}),define("js/home/favorite",["jquery","handlebars","source-map","dot"],function(e,t,a){var i,n,o,s=e("jquery"),r=e("handlebars"),d=e("js/passport/mail-phone-regx").phoneRegx["+86"],l={on:"[ 降价通知 ]",off:"[ 取消通知 ]"};e("dot"),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:{id: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(l.on))}),u.removeClass("hide")}var a,r,c,u,p,h,f;0!==s(".fav-products").length&&(i="products",a=s(".default-sorts"),r=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(){r.slideDown()})}),s("#retract-sort").click(function(){r.slideUp(function(){a.slideDown()})}),s(".price-down-clock").click(function(){o=s(this),t(),n=o.closest(".fav-good").data("id")}),s('.reduction-filter input[type="checkbox"]').change(function(){location.href=s(this).parent().attr("href")}),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||!d.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:{mobile:t,id: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(l.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(){function e(e,t){var a=e.data("id"),n=e.find(".na-goods-ul"),o=i[a],s=o.cur?o.cur:1,r=Math.ceil(o.total/5),d=e.find(".na-pre"),l=e.find(".na-next");s+=t,d.removeClass("hidden"),l.removeClass("hidden"),1===s&&d.addClass("hidden"),s===r&&l.addClass("hidden"),n.animate({marginLeft:-(s-1)*n.parent(".na-goods").width()},200),o.cur=s}function t(e,t){e.css("padding-bottom",t.outerHeight()+10)}var a,i={};0!==s(".fav-brands").length&&(a=r.compile(s("#na-tpl").html()),s(".na-trigger").click(function(){var e,n=s(this),o=n.next(".na-list"),r=n.closest("li");return o.hasClass("hide")?(e=r.data("id"),i[e]&&i[e].cache?(o.removeClass("hide"),void t(r,o)):void s.ajax({type:"GET",url:"/home/favorite/newproduct",data:{id:e}}).then(function(n){var s,d,l;200===n.code&&(d=n.data,l=0===d.length?{}:{naGoods:d},s=a(l),o.removeClass("hide").find(".na-content").html(s),t(r,o),d.length>5&&r.find(".na-next").removeClass("hidden"),i[e]||(i[e]={}),i[e].cache=!0,i[e].total=d.length)})):(o.addClass("hide"),void r.css("padding-bottom",""))}),s(".na-content").on("click",".na-pre, .na-next",function(){var t=s(this),a=t.hasClass("na-pre")?-1:1;e(t.closest(".fav-brand"),a)}))}(),function(){s(".fav-articles").length<0||s(".fav-articles .desc").dotdotdot()}(),s("#me-checkall").click(function(){s('.checkbox input[type="checkbox"]').prop("checked",s(this).prop("checked"))}),s(".del-favorite").click(function(e){var t=s(this).closest(".fav-row").data("id");e.preventDefault(),s.ajax({type:"GET",url:"/home/favorite/cancel",data:{id:t,type:location.href.match(/type=(.*)[&]*/)[1]}}).then(function(e){200===e.code&&history.go(0)})}),s("#me-del-checked").click(function(){var e=[];s('.checkbox input[type="checkbox"]:checked').each(function(){e.push(s(this).closest(".fav-row").data("id"))}),0!==e.length&&s.ajax({type:"GET",url:"/home/favorite/cancel",data:{ids:e.join(","),type:location.href.match(/type=(.*)[&]*/)[1]}}).then(function(e){200===e.code&&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){function i(e){r.ajax({type:"POST",url:"/home/returns/getDelivery",data:{areaCode:e}}).then(function(e){var t="";200===e.code&&(r.each(e.data,function(e,a){var i="";"Y"===a.is_default&&(i='checked="checked"'),t+='<input type="radio" name="delivery-tpye" value="'+a.id+'" '+i+'"">'+a.name}),x.html(t))})}function n(){var e=[],t="换货";return k&&(t="退货"),c.length||(q="没有可以"+t+"的商品"),c.each(function(){var a,i=r(this).parent().parent(),n=i.next();q.length||r(this).prop("checked")&&(a={product_skn:i.find('input[name="skn"]').val(),product_skc:i.find('input[name="skc"]').val(),product_sku:i.find('input[name="sku"]').val(),goods_type:i.find('input[name="typeid"]').val(),last_price:i.find('input[name="price"]').val(),reason:1*i.find(".return-reason").val()},k?a.returned_reason=a.reason:(a.exchange_reason=a.reason,a.new_goods_id=1*i.find(".exchange-color").val(),a.new_product_sku=1*i.find(".exchange-size").val(),q||a.new_goods_id||(q="请选择要换的颜色"),q||a.new_product_sku||(q="请选择要换的尺码")),q||a.reason||(q="请选择"+t+"原因"),(4===a.reason||6===a.reason||8===a.reason)&&(a.remark=r.trim(n.find("textarea").val()),a.evidence_images=[],n.find('input[name="imgs"]').each(function(){a.evidence_images.push(r(this).val())}),q||a.remark||(q="请填写"+t+"描述"),q||a.evidence_images.length||(q="请上传图片")),delete a.reason,e.push(a))}),q||e.length||(q="请选择要"+t+"的商品"),e}function o(){var e={};return e.goods=n(),e.payment={},h.each(function(){r(this).prop("checked")&&(e.payment.return_amount_mode=1*r(this).val())}),q||e.payment.return_amount_mode||(q="请选择退款方式"),2===e.payment.return_amount_mode?(e.payment.province=f.val(),e.payment.city=m.val(),e.payment.area_code=v.val(),!q&&1*!e.payment.area_code&&(q="请选择银行所在地"),e.payment.bank_name=r.trim(g.find('input[name="bank-name"]').val()),q||e.payment.bank_name||(q="请填写银行名称"),e.payment.payee_name=r.trim(g.find('input[name="payee-name"]').val()),q||e.payment.payee_name||(q="请填写收款人姓名"),e.payment.bank_card=r.trim(g.find('input[name="bank-card"]').val()),q||e.payment.bank_card||(q="请填写收款账户")):3===e.payment.return_amount_mode&&(e.payment.alipay_name=r.trim(g.find('input[name="alipay-name"]').val()),
q||e.payment.alipay_name||(q="请填写收款人姓名"),e.payment.alipay_account=r.trim(g.find('input[name="alipay-account"]').val()),q||e.payment.alipay_account||(q="请填写收款账户")),e}function s(){var e={};return e.goods=n(),e.consigneeName=r.trim(C.find('input[name="name"]').val()),q||e.consigneeName||(q="请填写收货人姓名"),e.areaCode=v.val(),!q&&1*!e.areaCode&&(q="请选择地区"),e.address=r.trim(C.find('input[name="address"]').val()),q||e.address||(q="请填写详细地址"),e.mobile=r.trim(C.find('input[name="phone"]').val()),q||e.mobile||(q="请填写手机号"),e.zipCode=r.trim(C.find('input[name="postcode"]').val()),e.deliveryType=C.find('input[name="delivery-tpye"]:checked').val(),q||e.deliveryType||(q="请选择商品返回方式"),e}var r=e("jquery"),d=e("js/home/common-address"),l=r("#goods-table"),c=l.find('input[type="checkbox"]'),u=l.find(".return-reason"),p=l.find("input[type=file]"),h=r('input[name="refund-type"]'),f=r("#province"),m=r("#city"),v=r("#area"),g=r("#refund-pay-info"),y=g.find(".type-yoho"),w=g.find(".type-bank"),b=g.find(".type-alipay"),C=r(".exchange-detail"),x=C.find(".refund-mode"),k=0,j=r("#order-code").val(),_=C.find('input[name="hide-area"]').val(),q="",I={};e("plugin/jquery.upload"),g.length?k=1:i(_),_=_?_:"",d.loadAllData(_,{areaDomId:"area"}),l.find(".sizeinfo").each(function(){var e=[];r(this).children().each(function(){e.push(r(this).data())}),I[r(this).data().id]=e}),u.change(function(){var e=r(this).parent().parent(),t=1*r(this).val();4===t||6===t||8===t?e.next().show():e.next().hide()}),c.change(function(){var e=r(this).parent().parent();r(this).prop("checked")?e.find("select").prop("disabled",!1):(e.find("select").val(0).prop("disabled",!0),e.next().hide())}),l.on("change",".exchange-color",function(){var e=r(this).closest(".exchange-choose-wrap"),t='<option value="0">请选择尺码</option>',a=r(this).val();I[a]&&r.each(I[a],function(e,a){t+='<option value="'+a.id+'">'+a.name+"</option>"}),e.find(".exchange-size").html(t).val(0)}),l.on("click",".btn-del",function(){r(this).parent().empty()}),p.each(function(e){r("#upload-img-"+e).upload({auto:!0,buttonClass:"upload-img-btn",fileType:"image/*",uploadScript:"/home/returns/imgUpload",fileObjName:"fileData",fileSizeLimit:5e3,buttonText:"上传图片",height:34,width:116,multi:!1,onUploadComplete:function(e,t){var a,i,n=r(this).closest(".problem-description"),o=n.find("li"),s=!1;a=JSON.parse(t).imgList[0],i='<span class="btn-del" title="删除"></span><img src="'+a.imgUrl+'" width="126" height="126"><input type="hidden" name="imgs" value="'+a.imgRelUrl+'">',o.each(function(){s||r(this).find("img").length||(s=!0,r(this).html(i))})},onError:function(e,t,a){var i="图片上传失败!";"FILE_SIZE_LIMIT_EXCEEDED"===e&&(i="图片大小超出限制!"),alert(i)}})}),C.on("change","#area",function(){var e=1*r(this).val();e&&i(e)}),h.change(function(){var e=1*r(this).val();y.hide(),2===e?(w.show(),b.hide(),y.hide()):3===e?(b.show(),w.hide(),y.hide()):4===e&&(y.show(),w.hide(),b.hide())}),r(".save-btn").click(function(){var e,t;return q="",k?(e="/home/returns/saveRefund",t=o()):(e="/home/returns/saveExchange",t=s()),t.orderCode=j,q?void alert(q):void r.ajax({type:"POST",url:e,data:t}).then(function(e){200===e.code?e.data&&e.data.refer&&(window.location.href=e.data.refer):alert(e.message)})})}),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=this,u=i("#"+t),p=0,h="";u.empty(),91>e&&(i("#"+c.areaDomId).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;u.append('<option value="0">'+a+"</option>");for(p in e.options)e.options[p]&&(r=e.options[p],h=t===c.areaDomId&&"Y"===r.is_support?"*":"",d=r.value,l="","undefined"!=typeof n&&0!==n&&d===n.substr(0,d.length)&&(l="selected"),u.append('<option value="'+d+'" '+l+">"+h+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,n=e("jquery"),o=n(".comment-table"),s=o.find(".remark-btn"),r=n("#comment-dialog-widget"),d=r.find(".dialog-titlebar"),l=r.find("textarea"),c=n(document).width(),u=n(document).height(),p=n(window).height(),h={canmove:!1,offset:{},maxtop:0,maxleft:0},f={};s.each(function(){var e=n(this).next(),t=e.data(),a=t.orderid;f[a]={},f[a].productSkn=t.productskn,f[a].productId=t.productid,f[a].goodsId=t.goodsid,f[a].orderId=t.orderid,f[a].erpSkuId=t.erpskuid,e.remove(),n(this).data("code",a)}),s.click(function(){var e=n(document).scrollTop();i=n(this),l.val(""),r.removeClass("hide").css({top:e+(p-r.outerHeight())/2,left:(c-r.outerWidth())/2})}),d.bind("mousedown",function(e){n(e.target).hasClass("dialog-close-btn")||(h.canmove=!0,h.offset={x:e.offsetX,y:e.offsetY},h.maxtop=u-r.outerHeight(),h.maxleft=c-r.outerWidth())}),n(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,r.css({top:t>0?t:0,left:a>0?a:0}))}).mouseup(function(e){h.canmove=!1}),r.on("click",".dialog-save-btn",function(){var e,t=n.trim(l.val());""===t&&alert("请添加评论内容"),i.length&&(e=f[i.data().code],e.content=t,n.ajax({type:"POST",url:"/home/comment/saveComment",data:e}).then(function(e){var a=i.parent();200===e.code?(a.prev().text(t),a.html('<span class="remarked">已评论!</span>'),i.length=0,r.addClass("hide")):alert(e.message)}))}),r.on("click",".dialog-close-btn",function(){i.length=0,r.addClass("hide")})}),define("js/home/complaints",["jquery"],function(e,t,a){function i(){return m?!0:(m=!0,setTimeout(function(){m=!1},1e3),!1)}function n(e){var t=e.dom.siblings(".option-tip"),a=d.trim(e.dom.val()),i=a.length;return e.min&&i<e.min?(t.text(e.onmin),!1):e.max&&i>e.max?(t.text(e.onmax),!1):e.regexp&&!e.regexp.test(a)?(t.text(e.onerror),!1):(t.text("输入正确"),!0)}function o(){var e,t={};return d.each(v,function(a,i){n(i)?t[a]=d.trim(i.dom.val()):e||(e=a,i.dom.focus())}),t.complaintsType=p.val(),e?!1:t}function s(){var e=o();!i()&&e&&d.ajax({type:"POST",url:"/home/complaints/addcomplaints",data:e}).then(function(e){m=!1,200===e.code?window.location.reload():alert(e.message)})}function r(e,t){var a=t;i()||d.ajax({type:"POST",url:"/home/complaints/cancelcomplaints",data:{id:e}}).then(function(e){m=!1,200===e.code?(a.prev().remove(),a.text("问题已撤销")):alert(e.message)})}var d=e("jquery"),l=d(".cancel-btn"),c=d("#title"),u=d("#customer"),p=d("#complaintsType"),h=d("#orderCode"),f=d("#content"),m=!1,v={title:{dom:c,min:1,max:10,onshow:"请输入您的投诉主题",onfocus:"请输入主题",onmin:"投诉主题不能为空",onmax:"输入投诉主题不能超过10个字"},customer:{dom:u,min:1,max:10,onshow:"请填写您要投诉的对象,比如:客服00*号、发货员...",onfocus:"请填写您要投诉的对象",onmin:"投诉对象不能为空",onmax:"输入投诉对象不能超过10个字"},orderCode:{dom:h,regexp:/^([0-9,]{9,})$/,onshow:"如果多个是多个订单号,请用英文逗号隔开,没有则不填",onfocus:"请输入订单号",onerror:"您输入的订单格式不对,如果多个是多个订单号,请用英文逗号隔开"},content:{dom:f,min:1,max:130,onshow:"输入您投诉的内容",onfocus:"请输入您投诉的内容",onmin:"投诉内容不能为空",onmax:"输入的投诉内容不能超过130个字"}};d.each(v,function(e,t){t.dom.focus(function(){t.dom.siblings(".option-tip").text(t.onfocus)}).blur(function(){n(t)})}),d("#complaint-submit").click(function(){s()}),l.click(function(){var e=d(this).data();e&&e.id&&r(e.id,d(this).parent())})}),define("js/home/message",["jquery"],function(e,t,a){function i(){var e=!1;o=r.find(".msg-check:checked"),c=[],o.each(function(){var t=s(this).parent().parent();c.push(s(this).val()),t.hasClass("new-msg")&&(e=!0)}),e?l.addClass("has-new"):l.removeClass("has-new")}function n(e,t){var a;switch(e){case"del":a="/home/message/delMessage";break;case"read":a="/home/message/readMessage"}s.ajax({type:"GET",url:a,data:t}).then(function(t){t.code?200===t.code?"read"===e&&o.removeClass("new-msg"):alert(t.message):"del"===e&&(r.html(t),d=r.find(".msg-check"),l=r.find(".read-choose-btn"))})}var o,s=e("jquery"),r=s("#message-main-container"),d=r.find(".msg-check"),l=r.find(".read-choose-btn"),c=[];e("js/home/message-content"),r.on("change",'input[type="checkbox"]',function(){var e=s(this).attr("checked");s(this).hasClass("choose-all")&&("checked"===e?d.attr("checked",!0):d.removeAttr("checked")),i()}),r.on("click",".del-btn",function(){confirm("您确定要删除这条短消息?")&&n("del",s(this).data())}),r.on("click",".del-choose-btn",function(){confirm("确定要删除您选中的消息")&&n("del",{id:c.join(",")})}),r.on("click",".read-choose-btn",function(){s(this).hasClass("has-new")&&n("read",{id:c.join(",")})})}),define("js/home/message-content",["jquery"],function(e,t,a){var i=e("jquery"),n=i(".pick-coupon-btn");n.click(function(){var e=i(this).data();i.ajax({type:"GET",url:"/home/message/pickCoupon",data:e}).then(function(e){var t=e.message;200===e.code&&(t="领取成功",i(this).removeClass("pick-coupon-btn")),alert(t)})})}),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","handlebars","source-map"],function(e,t,a){function i(){var e=new Date;return o("#imgcode").attr("src","/passport/images?t="+e.getTime()),!1}var n,o=e("jquery"),s=e("js/common/dialog"),r=s.Alert,d=o(".giftCardCode").find(".gift-error"),l=o(".captchaCode").find(".gift-error"),c="",u="",p=1,h={suc:[!1,!1,!1,!1],checkCard:function(e){if(c=/^[0-9a-zA-Z]{4,4}$/,c.test(o("#giftCardCode"+e).val())){for(p=1;3>=p;p++)c.test(o("#giftCardCode"+p).val())?(d.html(""),h.suc[p]=!0):(d.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),h.suc[p]=!1);3!==e&&o("#giftCardCode"+(e+1)).focus()}else d.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),h.suc[e-1]=!1},bindGiftCardForm:function(){o("#giftCardCode1").bind("blur keyup",function(){h.checkCard(1)}),o("#giftCardCode2").bind("blur keyup",function(){h.checkCard(2)}),o("#giftCardCode3").bind("blur keyup",function(){h.checkCard(3)}),o("#captchaCode").bind("blur keyup",function(){u=o("#captchaCode").val(),u.length<=0?(l.html("请输入验证码!"),h.suc[3]=!1):(l.html(""),h.suc[3]=!0)})},checkForm:function(){return c.test(o("#giftCardCode1").val())&&c.test(o("#giftCardCode2").val())&&c.test(o("#giftCardCode3").val())?""===o.trim(o("#captchaCode").val())?(l.html("请输入验证码!"),!1):!0:(d.html("您输入的兑换码有误,兑换码必须为数字或字母,每个文本框里只能输入四个兑换码!"),!1)}};o("#sub-gift").on("click",function(){return h.checkForm()?void o.post("/home/gift/exchange",o("#giftCardForm").serialize(),function(e){200===e.code?window.location.href="/home/gift?type=1":400===e.code?(n=new r(e.message),n.show(),i()):window.location.href="/home/gift?type=2"},"json"):!1}),o(document).on("click","#imgcode,.check-img",function(){i()}),o(function(){i(),h.bindGiftCardForm()})}),define("js/home/validate",["jquery","handlebars","source-map"],function(e,t,a){function i(e,t){return e.$checkInfo.html('<div class="form-error">'+t+"</div>"),e.dom.addClass("input-error"),!1}function n(e){return e.$checkInfo.html('<div class="form-success"> </div>'),e.dom.removeClass("input-error"),!0}function o(e){var t=e.val(),a=t.length,o=e.parent(),s=o.find(".check-info"),r=e.attr("name"),d="",l="",c={$checkInfo:s,dom:e};if(s.html(""),"password"===r){if(0===a)return i(s,e,"密码不能为空!");m.post("/home/account/checkpassword",{password:t},function(e){return"undefined"!=typeof e.code&&200===e.code?n(c):i(c,"密码错误!")})}if("verifyCode"===r&&m.post("/home/account/checkverifycode",{verifyCode:t},function(e){return"undefined"!=typeof e.code&&200===e.code?n(c):i(c,"验证码错误!")}),"email"===r){if(d="([a-zA-Z0-9]+)@([a-zA-Z0-9]+)[.]([a-zA-Z0-9]+)",null===t.match(d))return i(c,"邮箱错误!");m.post("/home/account/checkemail",{email:t},function(e){return"undefined"!=typeof e.code&&200===e.code?n(c):i(c,e.message)})}if("mobile"===r){if(d=g.phoneRegx,l=t.split("-"),d=1===l.length?t.match("^1[35847]{1}[0-9]{9}"):d["+"+l[0]].test(l[1]),0===a)return i(c,"手机号不能为空!");if(null===d||!d)return i(c,"手机号错误!");m.post("/home/account/checkmobile",{mobile:t},function(e){return"undefined"!=typeof e.code&&200!==e.code?i(c,"手机号已经存在!"):n(c)})}if("newPwd"===r)return 6>a||a>20?i(c,"密码长度为6-20字符"):n(c);if("confirm_password"===r){if(m("#newPwd").val()!==t)return i(c,"两次密码不一致!");if(""!==m("#newPwd").val())return m("#newPwd").next().html('<div class="form-success"> </div>'),n(c)}return"code"===r&&""!==t&&m.post("/home/account/checkmobilemsg",m("#pwdform").serialize(),function(t){return"undefined"!=typeof t.code&&200===t.code?n(s,e):i(c,"验证码错误!")}),!0}function s(){var e=[];return m.each(b,function(t,a){e.push(o(m(a)))}),e.indexOf(!1)>=0?!1:!0}function r(){var e=(new Date).getTime();m("#the-code-img").attr("src","/passport/images?len=6&time="+e)}function d(){var e="";x>0?(e="重新发送"+x+"秒",m("#sendButton").text(e),x-=1):(x=60,m("#sendButton").text("发送验证码"),clearInterval(h),C=!0)}function l(){var e=m("#mobilevalue"),t=m("#inputcode"),a=e.next(),i=e.val(),n=t.parent().find("check-info"),o=i.split("-");return o=1===o.length?i.match("^1[35847]{1}[0-9]{9}"):g.phoneRegx["+"+o[0]].test(o[1]),C?null!==o&&o?void m.post("/home/account/sendmobilemsg",{mobile:i},function(e){"undefined"!=typeof e.code&&200===e.code?(C=!1,h=setInterval(function(){d()},1e3),n.html("")):n.html('<div class="form-error">验证码发送失败</div>')}):(a.html('<div class="form-error">手机号错误!</div>'),e.addClass("input-error"),!1):!1}function c(){window.location.href="/home/account"}function u(e,t){m.post(e.url,e.data,function(a){return 200!==a.code?(f=new y(a.message),f.show(),!1):(t&&(e.hrefUrl+="&checkCode="+a.data),void(window.location.href=e.hrefUrl))},"json")}function p(){var e=m(".progress-bar .cur").index(),t=m("#verifyType").val(),a="",i={};m(".email").length>0&&(a="email"),m(".mobile").length>0&&(a="mobile"),m(".userpwd").length>0&&(a="userpwd"),0===e?"1"===t?(i={url:"/home/account/verifypassword",data:m("#pwdform").serialize(),hrefUrl:"/home/account/"+a+"?step=2"},u(i,"step1")):"2"===t?(i={url:"/home/account/sendemail",data:{checkType:a,email:m("#isVerifyType").html()},hrefUrl:"/home/account/sendemailsuccess?email="+m("#isVerifyType").html()+"&type=1&checkType="+a},u(i)):(i={url:"/home/account/checkmobilemsg",data:{email:m("#isVerifyType").html()},hrefUrl:"/home/account/"+a+"?step=2"
},u(i,"step1")):1===e&&("userpwd"===a?(i={url:"/home/account/modifypwd",data:m("#pwdform").serialize(),hrefUrl:"/home/account/userpwd?step=3"},u(i)):"email"===a?(i={url:"/home/account/modifyemail",data:{email:m("#email").val()},hrefUrl:"/home/account/sendemailsuccess?email="+m("#email").val()+"&type=2&checkType=email"},u(i)):(i={url:"/home/account/modifymobile",data:{mobile:m("#mobilevalue").val()},hrefUrl:"/home/account/mobile?step=3"},u(i)))}var h,f,m=e("jquery"),v=e("js/common/dialog"),g=e("js/passport/mail-phone-regx"),y=v.Alert,w=m(".check-user"),b=w.find("input").not("input[type=button],input[type=hidden]"),C=!0,x=60;b.blur(function(){o(m(this))}),m(".sub-btn").on("click",function(){return s()?void p():!1}),m("input[name=verifyCode]").keydown(function(e){if(13===e.keyCode){if(!s())return!1;p()}}),m(".the-code").on("click",function(){r()}),m("#send-mobile-code").on("click",function(){l()}),m(function(){var e=null;m(".res-info").length>0&&(e=setTimeout(function(){c()},5e3)),r()})}),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/help/entry",["jquery","handlebars","source-map"],function(e,t,a){e("js/help/search")}),define("js/help/search",["jquery","handlebars","source-map"],function(e,t,a){var i=e("jquery"),n=e("handlebars"),o=i(".search-content"),s=i("#help-dialog-widget"),r=i("#help-dialog-bg"),d=i(document).width(),l=i(window).height(),c='<div class="dialog-titlebar"><span class="dialog-close-btn"></span></div><div class="dialog-content"><p class="ask">问:<br>{{ask}}</p><p class="answer">答:<br>{{answer}}</p></div>',u=n.compile(c);o.on("click",".faqs",function(){var e=i(this).data(),t=i(document).scrollTop();s.html(u(e)).removeClass("hide"),r.removeClass("hide"),s.html(u(e)).css({top:t+(l-s.outerHeight())/2,left:(d-s.outerWidth())/2})}),s.on("click",".dialog-close-btn",function(){s.addClass("hide"),r.addClass("hide")})}),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"),$redEnvelopes:i(".red-envelopes"),$useEnvelopes:i(".use-envelopes"),$hasEnvelopes:i(".has-envelopes span"),$useEnvelopesInput:i(".use-envelopes").find("input")},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(".use-new-address input").removeAttr("checked")),i(".address-list-inner li.address_select input").attr("checked","checked"),i(".address-list-inner li").removeClass("active"),i(".address-list-inner li.address_select").addClass("active"),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(){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,n,o,s=this.e,r=e.promotion_formula_list,d="",l="";for(n=t?t:"",a=0;a<r.length;a++)"优惠券:"===r[a].promotion&&(r[a].promotion=(n?n:"优惠券")+'<span class="juan-modify">[修改]</span>:'),"YOHO币:"===r[a].promotion&&(r[a].promotion='YOHO币<span class="bi-modify">[修改]</span>:'),l=r[a].isExpress?"total-express-w":"",d+='<li class="'+l+'"><label>'+r[a].promotion+"</label><em>"+r[a].promotion_amount+"</em></li>";s.$payTotal.html(d),s.$toPay.html(e.last_order_amount.toFixed(2)),i("#biprice").val(100*e.use_yoho_coin),0===~~e.use_yoho_coin?i(".errbitip").text(""):i(".errbitip").text("抵扣"+e.use_yoho_coin.toFixed(2)+"元"),o=s.$useEnvelopesInput.data("all")-e.use_red_envelopes,~~e.use_red_envelopes>0?(s.$useEnvelopes.find("span").html("-¥"+e.use_red_envelopes.toFixed(2)),s.$useEnvelopes.find("input").attr("data-use",e.use_red_envelopes)):(s.$useEnvelopes.find("span").html("-¥0.00"),s.$hasEnvelopes.html("¥"+(1*s.$useEnvelopesInput.attr("data-all")).toFixed(2)),s.$redEnvelopes.removeClass("active"),s.$useEnvelopesInput.prop("checked",!1)),s.$hasEnvelopes.html("¥"+o.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"),$useEnvelopesInput:i(".use-envelopes").find("input"),$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,r=this.e,d=s.UI,l=s.Common;r.$selectExpress.click(function(){var t=i(this).val();r.$loading.show(),e(function(e){e.deliveryWay=t,a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){r.$loading.hide(),200===e.code?(d.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)})}),r.$juanok.click(function(){var t=i(this).parents("dl.pan"),n="";i(".play-juan").addClass("is-select"),e(function(e){var o=e.couponCode;o?(r.$loading.show(),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){r.$loading.hide(),200===e.code?(n=i('.play-juan input[value="'+o+'"]').next().text(),d.render(e.data,n),l.winHide(t),r.$juantip.html("")):(r.$juantip.html(e.message),i(".play-juan").removeClass("is-select"))}},i.ajax(a)):(r.$juantip.html("请选择或填写一个优惠券"),i(".play-juan").removeClass("is-select"))})}),i(document).on("click",".juan-modify",function(){var e=i(".play-juan-pan");l.winShow(e)}),r.$biok.click(function(){var t,n=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()),/^\d+$/.test(e.yohoCoin+"")&&1*e.yohoCoin!==0?1*e.yohoCoin>1*i(".play-pan em").text()?(i(".errbitip").html("您的YOHO币不足"),i("#biprice").removeClass("is-select")):(r.$loading.show(),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){r.$loading.hide(),200===e.code?(d.render(e.data,t),l.winHide(n)):(i(".errbitip").html(e.message),i("#biprice").removeClass("is-select"))}},i.ajax(a)):(i(".errbitip").html("请输入一个正整数"),i("#biprice").removeClass("is-select"))})}),i(document).on("click",".bi-modify",function(){var e=i(".play-bi-pan");l.winShow(e)}),r.$bp.keyup(function(){var e=i(this).val();/^\d+$/.test(e+"")?1*e>1*i(this).data("bi")?r.$errorTip.html("您的YOHO币不足"):r.$errorTip.html("抵扣"+(e/100).toFixed(2)+"元"):r.$errorTip.html("请输入一个正整数")}),i(".cancel-bi").click(function(){var t,n=i(".play-bi-pan");i(".errbitip").html(""),i("#biprice").hasClass("is-select")?(r.$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){r.$loading.hide(),200===e.code?(d.render(e.data,t),l.winHide(n),i("#biprice").val("0"),i("#biprice").removeClass("is-select"),i(".errbitip").html("")):i(".errbitip").html(e.message)}},i.ajax(a)})):(l.winHide(n),i("#biprice").val("0"))}),i(".cancel-code").click(function(){var t=i(".play-juan-pan");i(".play-juan").hasClass("is-select")?(r.$loading.show(),e(function(e){e.couponCode="",a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){r.$loading.hide(),200===e.code?(d.render(e.data),l.winHide(t),i(".play-juan").removeClass("is-select"),i("#juancode").val("").siblings('input[name="juangroup"]').attr("checked","checked")):r.$juantip.html(e.message)}},i.ajax(a)})):l.winHide(t)}),n=r.$useEnvelopesInput.data("all")-r.$useEnvelopesInput.data("use"),r.$hasEnvelopes.text("¥"+n.toFixed(2)),r.$useEnvelopes.find("input").click(function(){var t,n=i(this);r.$loading.show(),n.attr("disabled","disabled"),e(function(e){n.attr("checked")?e.redEnvelopes=n.data("use"):e.redEnvelopes=0,t=i('.play-juan input[value="'+e.couponCode+'"]').next().text(),a={type:"POST",url:"/cart/index/orderCompute",data:e,success:function(e){r.$loading.hide(),200===e.code?(d.render(e.data,t),n.removeAttr("disabled"),n.attr("checked")?r.$redEnvelopes.addClass("active"):(r.$useEnvelopes.find("span").html("-¥0.00"),r.$hasEnvelopes.html("¥"+(1*n.attr("data-all")).toFixed(2)),r.$redEnvelopes.removeClass("active"))):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="",s="";for(i=0;i<t.length;i++)s="Y"===t[i].is_support_express?"*":"",o+=t[i].id===a?'<option selected value="'+t[i].id+'">'+s+t[i].caption+"</option>":'<option value="'+t[i].id+'">'+s+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()})}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-phoneNum"))}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(".address-list 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=l("#order-edit-main"),S=p.attr("cart-type");T.show(),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(T.hide(),200===r.code){if(e=r.data.list,!e)return A.attr("data-new")&&(k.addClass("new-user-btn").html("下一步:选择支付及送货时间"),l(".pay-btn").addClass("new-user-pay").html("下一步:发票和备注"),l(".switch-pay-modify").html("")),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===q?e?e+"-":" ":e?e+" ":" "}function t(e){var t=e.substr(0,3),a=e.substr(7);return t+"****"+a}var a,i,n,o=l(this),r=y.val(),d=h.val(),u=f.val(),p=m.val(),v=C.val(),g=w.val(),q=j.val(),I=_.val(),T=b.val(),A=x.val(),S=h.find('option[value="'+d+'"]').text().replace(/\*/,""),E=f.find('option[value="'+u+'"]').text().replace(/\*/,""),D=m.find('option[value="'+p+'"]').text().replace(/\*/,""),$={consignee:r,areaCode:p,address:v,email:T,mobile:g,zipCode:A,phoneCode:q,phoneNum:I},z=/^[\u4e00-\u9fa5]{2,5}$/,O=/^[\s\S]{2,100}$/,P=/^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/,N=/^[0-9]{6}$/,L=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,F=/^[0-9]{3,5}$/,U=/^[0-9]{5,10}$/;if(n=l('.exist-address-list li:not(".use-new-address")').find('input[name="address"]:checked').length>0,l(".add-address").attr("checked")||!n||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(!z.test(r))return void new c.Alert("真实姓名至少2个中文,最多5个中文").show();if(!O.test(v))return void new c.Alert("你输入的地址格式不正确").show();if(!P.test(g))return void new c.Alert("你输入的联系电话格式不正确").show();if(q&&!F.test(q)||I&&!U.test(I)||F.test(q)&&!U.test(I)||!F.test(q)&&U.test(I))return void new c.Alert("你输入的电话格式不正确").show();if(T&&!L.test(T))return void new c.Alert("你输入的邮箱格式不正确").show();if(A&&!N.test(A))return void new c.Alert("你输入的邮编格式不正确").show();k.attr("data-id")&&($.id=k.attr("data-id")),l.ajax({type:"post",url:"/cart/index/saveAddress",data:$}).then(function(n){var d;200===n.code?(d=n.data,"Y"===d.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 input[name="carriagegroup"][value="1"]').attr("checked","checked"),l(".express-list.sf").addClass("hide"),l(".is-sup").removeClass("hide")),a=$.id?'<li class="active" data-id="'+$.id+'" data-express="'+d.is_support+'"><input data-name="'+$.consignee+'" data-areaCode="'+$.areaCode+'" data-addressDesc="'+$.address+'" data-mobile="'+$.mobile+'" data-phoneNum="'+$.phoneNum+'" data-phoneCode="'+$.phoneCode+'" data-zipCode="'+$.zipCode+'" data-email="'+$.email+'" checked="checked" class="radio" type="radio" name="address" /><label><strong>'+r+"</strong><span>"+S+" "+E+" "+D+" "+v+" "+e(A)+e(g)+e(q)+e(I)+'</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="'+d.id+'" data-express="'+d.is_support+'"><input data-name="'+d.consignee+'" data-areaCode="'+d.area_code+'" data-addressDesc="'+d.address+'" data-mobile="'+d.mobile+'" data-phoneNum="'+$.phoneNum+'" data-phoneCode="'+$.phoneCode+'" data-zipCode="'+d.zip_code+'" data-email="'+d.email+'" checked="checked" class="radio" type="radio" name="address" /><label><strong>'+r+"</strong><span>"+S+" "+E+" "+D+" "+v+" "+e(A)+t(g)+e(q)+e(I)+'</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>',o.attr("data-id")?(i=l('.exist-address-list li[data-id="'+o.attr("data-id")+'"]'),i.after(l(a)).remove()):l(".use-new-address").before(l(a)),l(".address-list span").removeAttr("expand"),s()):new c.Alert(n.message).show()})}return 0===l(".exist-address-list li").find('input[name="address"]:checked').length?void new c.Alert("请选择一个地址").show():("N"===l(".exist-address-list li").find('input[name="address"]:checked').closest("li").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")),void(o.hasClass("new-user-btn")&&l(".switch-pay-modify").click()))})},l(".pay-time-modify .pay-btn").click(function(){var e=l(this),t=l(".modity-pay-info"),a=l(".pay-time-modify"),i=a.find('input[name="pay-type"]:checked').val(),n=a.find('input[name="pay-type"]:checked').next("label").text(),o=a.find('input[name="pay-time-radio"]:checked').next("label").text(),s=a.find('input[name="pay-time-radio"]:checked').val(),r=a.find('input[name="call-me"]:checked').next("label").text(),d=a.find('input[name="call-me"]:checked').val();T.show(),l.ajax({type:"POST",url:"/cart/index/orderCompute",dataType:"json",data:{cartType:S,paymentType:i}}).then(function(a){T.hide(),200===a.code?(t.find("li").eq(0).find("span").text(n),t.find("li").eq(1).find("span").text(o),t.find("li").eq(2).find("span").text(r),l(".pay-time-modify").addClass("hide").find('input[name="pay-type"][value='+i+"]").addClass("checked").end().find('input[name="pay-time-radio"][value='+s+"]").addClass("checked").end().find('input[name="call-me"][value='+d+"]").addClass("checked"),l(".modity-pay-info").removeClass("hide"),l(".switch-pay-modify").text("[修改]"),e.hasClass("new-user-pay")&&(l(".play-piao-pan dd").css({display:"block"}),l(".play-piao-pan dt").addClass("active"))):new c.Alert(a.message).show()})}),r(),l(".to-play input.submit").click(function(){var e=l(this),t=l('.exist-address-list input[name="address"]:checked').closest("li").attr("data-id"),a=l('.pay-time-modify input[name="pay-time-radio"]:checked').val(),i=l('.select-express input[name="carriagegroup"]:checked').val(),n=l("#piaodesc").val(),o=l("#piaotype").val(),s=l('.pay-time-modify input[name="pay-type"]:checked').val(),r=l('.pay-time-modify input[name="pay-type"]:checked').data("pay"),u=l("#notedesc").val(),p=l("#biprice").val(),h=l('.pay-time-modify input[name="call-me"]:checked').val(),f=l('.play-pan input[name="isPP"]:checked').val(),m=l(".use-envelopes input:checked").attr("data-use"),v=l('.play-juan.is-select input[name="juangroup"]:checked'),g=v.val(),y=g?g:v.closest("li").find("#juancode").val();T.show(),e.attr("disabled")||(e.attr("disabled","disabled"),l.ajax({type:"POST",dataType:"json",url:"/cart/index/orderSub",data:{addressId:t,cartType:S,deliveryTimeId:a,deliveryWayId:i,invoiceTitle:n,invoiceId:o,paymentId:r,paymentType:s,remark:u,couponCode:y,yohoCoin:p,isPreContact:d(h),isPrintPrice:d(f),redEnvelopes:m}}).then(function(e){T.hide(),200===e.code?window.location.href=e.data.payUrl:new c.Alert(e.message).show()}).always(function(){e.removeAttr("disabled")}))})});