index.js 115 KB
define("index",["jquery","hammer","swiper","lazyload","mlellipsis","iscroll-probe","handlebars","source-map","index"],function(e,o,t){var n;e("js/common"),e("js/category/entry"),e("js/guang/entry"),e("js/home/entry"),e("js/index/entry"),e("js/passport/entry"),e("js/product/entry"),e("js/me/entry"),e("js/cart/entry"),t.exports=n}),define("js/common",["jquery","hammer"],function(e,o,t){function n(e){var o,t,n=document.cookie;return document.cookie&&""!==document.cookie&&(t=n.indexOf(e+"="),t>-1&&(t+=e.length+1,o=decodeURIComponent(u.trim(n.substring(t,n.indexOf(";",t)))))),o}function a(e,o,t){var n,a,i,s,r="";"undefined"!=typeof o&&(t=t||{},null===o&&(o="",t.expires=-1),t.expires&&("number"==typeof t.expires||t.expires.toUTCString)&&("number"==typeof t.expires?(s=new Date,s.setTime(s.getTime()+24*t.expires*60*60*1e3)):s=t.expires,r="; expires="+s.toUTCString()),n=t.path?"; path="+t.path:"",a=t.domain?"; domain="+t.domain:"",i=t.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(o),r,n,a,i].join(""))}function i(){var e=navigator.cookieEnabled?!0:!1;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!==document.cookie.indexOf("testcookie")?!0:!1),e}function s(){var e,o=n("_UID");return"undefined"==typeof o?0:(e=o.split("::"),"undefined"==typeof e||e.length<4?0:e)}function r(){var e=s();return 0===e?0:e[1]}function d(){var e=n("_g");return"undefined"==typeof e?"":JSON.parse(e).k}function l(){var e;0!==p.length&&(e=Math.min(u(window).height(),window.screen.availHeight),u("body").height()<=e-parseInt(p.css("height"),0)?p.addClass("bottom"):p.removeClass("bottom"))}function c(e){var o=u(e).outerHeight();e&&p.css("margin-bottom",o+"px")}var u=e("jquery"),h=e("hammer"),p=u("#yoho-footer"),f=u(".yoho-page"),m=u(".yoho-header");!function(){var e,o=p.children(".op-row"),t=u(".back-to-top"),n=s();l(),0===n?o.prepend('<a href="http://m.yohobuy.com/signin.html?refer='+location.href+'">登录</a><span class="sep-line">|</span><a href="http://m.yohobuy.com/reg.html">注册</a>'):o.prepend('<span>Hi,</span><a class="user-name" href="http://m.yohobuy.com/home?tmp='+Math.random()+'">'+n[0]+'</a><a href="http://m.yohobuy.com/passport/signout/index?token='+n[3]+'">退出</a>'),t.length>0&&(e=new h(t[0]),e.on("tap",function(e){return u(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),p.removeClass("hide")}(),function(e,o,t,n,a){var i=o.createElement(t),s=o.getElementsByTagName(t)[0];e.YohoAcquisitionObject=a,e[a]=function(){e[a].p=arguments},i.async=1,i.src=n,s.parentNode.insertBefore(i,s)}(window,document,"script","http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js","_yas"),function(){var e=r();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",e,"","")}(),m.on("touchstart","a",function(){m.find("a").removeClass("highlight"),u(this).addClass("highlight")}).on("touchend touchcancel","a",function(){u(this).removeClass("highlight")}),f.on("touchstart",".tap-hightlight",function(){u(this).siblings(".tap-hightlight").removeClass("highlight"),u(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){u(this).removeClass("highlight")}),function(){var e,o,t=0,n="webkit moz ms o".split(" "),a=window.requestAnimationFrame,i=window.cancelAnimationFrame;for(o=0;o<n.length&&(!a||!i);o++)e=n[o],a=a||window[e+"RequestAnimationFrame"],i=i||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];a&&i||(a=function(e,o){var n=(new Date).getTime(),a=Math.max(0,16-(n-t)),i=window.setTimeout(function(){e(n+a)},a);return t=n+a,i},i=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=a,window.cancelAnimationFrame=i}(),u.extend({queryString:function(){var e,o,t=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(o=0;o<n.length;o++)e=n[o].split("="),t.push(e[0]),t[e[0]]=e[1];return t}}),window.cookie=n,window.setCookie=a,window.isCookiesEnabled=i,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=l,window.reMarginFooter=c}),define("js/category/entry",["jquery","hammer","swiper","lazyload","index"],function(e,o,t){e("js/category/index"),e("js/category/brand")}),define("js/category/index",["jquery"],function(e,o,t){var n=e("jquery"),a=n(".category-nav"),i=n(".category-container"),s=i.children(".content"),r=i.find(".sub-level li"),d=i.find(".primary-level li"),l=s.not(".hide");!function(){var e=n(".yoho-header"),o=n("#search-input"),t=n(window).height()-e.outerHeight()-o.outerHeight()-a.outerHeight();i.css("min-height",t),s.height(t)}(),n("#search-input").focus(function(){n(this).blur()}),a.bind("contextmenu",function(e){return!1}),n(".category-container").bind("contextmenu",function(e){return!1}),a.on("touchend touchcancel",function(e){var o=n(e.target).closest("li"),t=o.index();o.hasClass("focus")||(a.find("li.focus").removeClass("focus"),o.addClass("focus"),l.addClass("hide"),l=s.eq(t).removeClass("hide"))}),i.on("touchend",function(e){var o,t,a,i=n(e.target);if(t=i.closest(".p-level-item"),t.length>0){if(a=t.index(),o=i.closest(".content").find(".sub-level"),i.hasClass("focus"))return;i.closest(".primary-level").children(".focus").removeClass("focus"),i.addClass("focus"),o.not(".hide").addClass("hide"),o.eq(a).removeClass("hide")}}),i.find(".primary-level").on("touchstart touchend touchcancel","li",function(){d.removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel","li",function(){n(this).removeClass("highlight")}),i.find(".sub-level").on("touchstart","li",function(){r.removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel","li",function(){n(this).removeClass("highlight")}),a.on("touchstart","li",function(){a.find("li").removeClass("bytouch"),n(this).addClass("bytouch")}).on("touchend touchcancel","li",function(){a.find("li").removeClass("bytouch")})}),define("js/category/brand",["jquery","hammer","swiper","lazyload","index"],function(e,o,t){function n(){var e=p(window).scrollTop();v.eq(0).offset().top<l&&r.hide(),v.each(function(){var o=p(this).offset().top-C;e>=o&&r.css({display:"block"}).find("h2").html(p(this).find(".title-bar").text())})}function a(){var e=p(".brand-list").find("p");e.on("touchstart",function(){e.css("background","#fff"),p(this).css("background","#eee")}).on("touchend touchcancel",function(){p(this).css("background","#fff")})}function i(){var e=(u.val()+"").toLowerCase(),o={},t=0,n="";""!==e&&(p.each(c,function(t,n){p.isArray(n)&&p.each(n,function(n,a){a.name.toLowerCase().indexOf(e)>-1&&(o[t]=o[t]||[],o[t].push(a))})}),p.each(o,function(e,o){var a=['<div class="brand-list bar-',t,'">'];t++,a.push('<div class="title-bar"><h2>'),a.push(e),a.push("</h2></div>"),p.each(o,function(e,o){a.push('<p><a href="'+o.url+'">'+o.name),o.isNew&&a.push('<i class="icon-new">NEW</i>'),o.isHot&&a.push('<i class="icon-hot">HOT</i>'),a.push("</a></p>")}),a.push("</div>"),n+=a.join("")})),p(".search-result").html(n),a()}var s,r,d,l,c,u,h,p=e("jquery"),f=e("hammer"),m=e("swiper"),g=e("lazyload"),v=p(".brand-list"),w=p(".search-icon"),y=p(".newbrand-search").outerHeight(),b=p(".yoho-header").outerHeight(),C=parseInt(y)+parseInt(b)-1;d=new m(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),s=new m(".swiper-container",{lazyLoading:!0,loop:!0,autoplay:3e3,pagination:".swiper-pagination .pagination-inner"}),g(p("img.lazy")),p(".yoho-header").css({"z-index":2,position:"fixed",top:0}),p(".banner-top").length>0&&p(".hot-brands").css("padding-top","0"),r=p('<div class="title-bar fixed-title-bar"><h2></h2></div>'),r.css({position:"fixed",top:C}).hide(),l=C+p(".hot-brands").outerHeight()+p(".banner-top").outerHeight(),v.last().append(r),p(window).scroll(function(){window.requestAnimationFrame(n)}),a(),p(".brand-search-page").length&&(c=p.parseJSON(p("#brands-data").html()),u=p("#keyword"),u.on("input",function(){u.val().length?(w.css("color","#000"),p(this).closest(".search-box").css("width","11.25rem"),p(".search-action").show()):(w.css("color","#b2b2b2"),p(this).closest(".search-box").css("width","12.5rem"),p(".search-action").hide()),i()}).focus(),h=new f(p(".clear-text")[0]),h.on("tap",function(e){e.preventDefault(),p(".search-result").html(""),p("#keyword").val("").trigger("input"),e.srcEvent.stopPropagation()}),p("form.search-box").on("submit",function(){return!1}))}),define("js/guang/entry",["jquery","lazyload","swiper","hammer","mlellipsis","iscroll-probe","index"],function(e,o,t){e("js/guang/plus-star/list"),e("js/guang/plus-star/detail"),e("js/guang/home"),e("js/guang/list"),e("js/guang/detail")}),define("js/guang/plus-star/list",["jquery","lazyload","swiper","index"],function(e,o,t){var n,a=e("jquery"),i=e("lazyload"),s=e("swiper"),r=a("#nav-tab > li"),d=a("#ps-content > .content");i(a("img.lazy")),n=new s(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination"}),a("#nav-tab").bind("contextmenu",function(e){return!1}),a("#nav-tab").on("touchend touchcancel",function(e){var o=a(e.target).closest("li");o.hasClass("focus")||(r.toggleClass("focus"),d.toggleClass("hide"),a(document).trigger("scroll"))}),a("#nav-tab").on("touchstart",function(e){var o=e.target||e.srcElement;o.className="bytouch "+o.className}).on("touchend touchcancel",function(){r.removeClass("bytouch")})}),define("js/guang/plus-star/detail",["jquery","hammer","mlellipsis","lazyload"],function(e,o,t){var n,a,i,s,r=e("jquery"),d=e("hammer"),l=e("mlellipsis"),c=e("lazyload"),u=r("#intro"),h=r("#intro-more-txt"),p=r("#related-infos-container"),f=e("js/guang/info"),m=e("js/plugin/tip"),g=r("#brand-info").data("id"),v=r("#jump-to-app").val();e("js/plugin/wx-share"),l.init(),c(r("img.lazy")),u[0].mlellipsis(3),setTimeout(function(){n=u.text(),a=u.attr("title")}),f.initInfosEvt(p),i=new d(document.getElementById("more-intro")),i.on("tap",function(e){var o=r(e.target).closest("#more-intro");o.toggleClass("spread"),o.hasClass("spread")?(u.text(a),h.text("收起")):(u.text(n),h.text("more"),r(window).scrollTop(0,400)),e.preventDefault()}),s=new d(document.getElementById("brand-like")),s.on("tap",function(e){var o="ok",t=r(e.target);"1"!==v&&(e.preventDefault(),t.hasClass("like")&&(o="cancel"),r.ajax({type:"POST",url:"/guang/opt/favoriteBrand",data:{id:g,opt:o},success:function(e){200===e.code?t.toggleClass("like"):400===e.code||412===e.code?location.href=e.data:m.show(e.message)},error:function(){m.show("网络断开连接了~")}}))})}),define("js/guang/info",["jquery","hammer","mlellipsis","lazyload"],function(e,o,t){function n(e){l(e.find("img.lazy")),e.each(function(){var e=s(this),o=e.find(".info-title"),t=e.find(".info-text");o[0].mlellipsis(2),t[0].mlellipsis(2)})}function a(e){var o;"undefined"!=typeof e&&(o=new r(e[0]),o.on("tap",function(e){var o,t,n=s(e.target),a="ok";return o=n.closest(".like-btn"),o.length>0?(e.preventDefault(),o.hasClass("like")&&(a="cancel"),t=n.closest(".guang-info"),void s.ajax({type:"POST",url:"/guang/opt/praiseArticle",data:{id:t.data("id"),opt:a},success:function(e){var t=e.code;200===t&&(o.next(".like-count").text(e.data),o.toggleClass("like"))},error:function(){c.show("网络断开连接了~")}})):(o=n.closest(".collect-btn"),void(o.length>0&&(e.preventDefault(),o.hasClass("collected")&&(a="cancel"),t=n.closest(".guang-info"),s.ajax({type:"POST",url:"/guang/opt/collectArticle",data:{id:t.data("id"),opt:a},success:function(e){e.code&&200===e.code&&o.toggleClass("collected")},error:function(){c.show("网络断开连接了~")}}))))}),n(e.find(".guang-info")))}function i(e,o,t){var a;m||o.end||(1===o.page&&u.showLoadingMask(),a=e.find(".guang-info").length,m=!0,s.ajax({type:"GET",url:t?t:"/guang/index/page",data:o,success:function(t){var i;return" "===t?(o.end=!0,m=!1,p.addClass("hide"),void f.removeClass("hide")):(e.append(t),i=a>0?e.find(".guang-info:gt("+(a-1)+")"):e.find(".guang-info"),n(i),1===o.page&&(u.hideLoadingMask(),p.removeClass("hide"),window.rePosFooter()),o.page++,void(m=!1))},error:function(){c.show("网络断开连接了~"),m=!1}}))}var s=e("jquery"),r=e("hammer"),d=e("mlellipsis"),l=e("lazyload"),c=e("js/plugin/tip"),u=e("js/plugin/loading"),h=s("#load-more-info"),p=s(""),f=s(""),m=!1;d.init(),h.length>0&&(p=h.children(".loading"),f=h.children(".no-more")),o.initInfosEvt=a,o.setLazyLoadAndMellipsis=n,o.loadMore=i}),define("js/plugin/tip",["jquery"],function(e,o,t){function n(e,o){var t,n;"undefined"!=typeof e&&(t=e.toString(),n=o&&o>0?o:2e3,a.text(t).show(),i=setTimeout(function(){"block"===a.css("display")&&a.hide()},n))}var a,i,s=e("jquery");!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),a=s("#yoho-tip"),a.on("touchend",function(){a.hide(),clearTimeout(i)})}(),o.show=n}),define("js/plugin/loading",["jquery"],function(e,o,t){function n(e){var o='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';l=!0,void 0===e&&(e=d),e.append(o),s=e.children(".loading-mask")}function a(){l||(n(),l=!0),s.removeClass("hide")}function i(){s.addClass("hide")}var s,r=e("jquery"),d=r(".yoho-page"),l=!1;o.init=n,o.showLoadingMask=a,o.hideLoadingMask=i}),define("js/plugin/wx-share",["jquery"],function(e,o,t){var n=e("jquery");t.exports=function(){var e="http://www.yohoshow.com/api/wechat/getSignPackage";n.getJSON(e+"?pageurl="+encodeURIComponent(location.href.split("#")[0])+"&callback=?",function(e){var o,t,n,a;void 0!==e&&""!==e&&(o=e.appId.toString(),t=e.timestamp,n=e.nonceStr.toString(),a=e.signature.toString(),wx.config({debug:!1,appId:o,timestamp:t,nonceStr:n,signature:a,jsApiList:["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","hideMenuItems","showMenuItems","hideAllNonBaseMenuItem","showAllNonBaseMenuItem","translateVoice","startRecord","stopRecord","onRecordEnd","playVoice","pauseVoice","stopVoice","uploadVoice","downloadVoice","chooseImage","previewImage","uploadImage","downloadImage","getNetworkType","openLocation","getLocation","hideOptionMenu","showOptionMenu","closeWindow","scanQRCode","chooseWXPay","openProductSpecificView","addCard","chooseCard","openCard"]}))}),wx.ready(function(){var e=n("#shareTitle").val(),o=n("#shareImg").val(),t=n("#shareDesc").val(),a=n("#shareLink").val(),i={title:e,desc:t,imgUrl:o,link:a};wx.onMenuShareAppMessage(i),wx.onMenuShareTimeline(i),wx.onMenuShareQQ(i),wx.onMenuShareWeibo(i)})}}),define("js/guang/home",["jquery","swiper","hammer","mlellipsis","lazyload","index"],function(e,o,t){function n(){var e=f.not(".hide");i(window).scrollTop()+h>=i(document).height()-.25*e.height()&&d(e,w[v])}var a,i=e("jquery"),s=e("swiper"),r=e("js/guang/info"),d=r.loadMore,l=i("#load-more-info"),c=i(""),u=i(""),h=i(window).height(),p=i("#info-list"),f=p.children(".info-list"),m=i("#guang-nav"),g=m.children(".focus"),v=g.data("type"),w={};l.length>0&&(c=l.children(".loading"),u=l.children(".no-more")),a=new s(".swiper-container",{lazyLoading:!0,pagination:".swiper-pagination",autoplay:3e3}),r.initInfosEvt(p),function(){var e=i("#gender").val();m.children(".guang-nav-item").each(function(){var o=i(this).data("type"),t=i(this).hasClass("focus");w[o]={page:t?2:1,gender:e,type:o,end:!1}})}(),m.bind("contextmenu",function(e){return!1}),m.on("touchend touchcancel",function(e){var o,t,n=i(e.target).closest(".guang-nav-item");n.hasClass("focus")||(t=n.index(),n.addClass("focus"),g.removeClass("focus"),o=f.eq(t),g=n,v=n.data("type"),1===w[v].page?(c.addClass("hide"),u.addClass("hide"),d(o,w[v])):w[v].end?(c.addClass("hide"),u.removeClass("hide")):(c.removeClass("hide"),u.addClass("hide")),f.not(".hide").addClass("hide"),o.removeClass("hide"),1===w[v].page&&window.rePosFooter())}),i(document).scroll(function(){window.requestAnimationFrame(n)}),m.on("touchstart",function(e){var o=e.target||e.srcElement;o.className="bytouch "+o.className}).on("touchend touchcancel",function(){m.find("li").removeClass("bytouch")})}),define("js/guang/list",["jquery","hammer","mlellipsis","lazyload"],function(e,o,t){function n(){a(window).scrollTop()+r>=a(document).height()-.25*p.height()&&s(p,h)}var a=e("jquery"),i=e("js/guang/info"),s=i.loadMore,r=a(window).height(),d=a("#author-infos"),l=a("#tag"),c=a("#gender"),u=a("#isApp"),h={page:2,end:!1},p=a("#info-list");i.initInfosEvt(p),d.length>0&&a.extend(h,{authorId:d.data("id"),isApp:u.val()}),l.length>0&&a.extend(h,{tag:l.val(),gender:c.val(),isApp:u.val()}),a(window).scroll(function(){window.requestAnimationFrame(n)})}),define("js/guang/detail",["jquery","mlellipsis","lazyload","iscroll-probe"],function(e,o,t){function n(e){var o=e.offset().left,t=-C+o+y/2+"px";r.css({backgroundPosition:t+" bottom"}),v&&b.css({backgroundPosition:t+" bottom"})}function a(e){var o,t,a,i=h(e.currentTarget),p=i.index();i.hasClass("focus")||(d.filter(".focus").removeClass("focus"),v&&(o=i.closest(".fixed-thumb-container").length>0?r:b,t=o.find(".thumb").eq(p),b.find(".thumb.focus").removeClass("focus"),t.addClass("focus")),i.addClass("focus"),n(i),l.not(".hide").addClass("hide"),a=l.eq(p),a.removeClass("hide"),f(a.find(".lazy")),v?u&&u.scrollToElement(c,400):h("body").animate({scrollTop:s.offset().top},400),u&&u.refresh())}function i(){var e,o,t,n,a,i=h("#scroller"),d=h(".yoho-header"),l=0;return d.length>0&&(l=d.outerHeight()),u=new m("#wrapper",{probeType:3,mouseWheel:!0,click:!0}),document.addEventListener("touchmove",function(e){e.preventDefault()},!1),w?(e=h(window).height()-l,a=b[0],o=r.outerHeight(),t=s.outerHeight(),n=s.offset().top-l,void u.on("scroll",function(){var s=-this.y,r=a.className;n-e+o>=s?-1===r.indexOf("fixed-bottom")&&b.addClass("fixed-bottom").removeClass("hide"):n>=s?-1===r.indexOf("hide")&&b.addClass("hide").removeClass("fixed-bottom fixed-top"):n+t-o>=s?-1===r.indexOf("fixed-top")&&b.addClass("fixed-top").removeClass("hide absolute").css("top",""):n+t>=s?(-1===r.indexOf("absolute")&&b.addClass("absolute").removeClass("fixed-top hide"),a.style.top=n+l+t-o-s+"px"):s>n+t&&-1===r.indexOf("hide")&&b.addClass("hide").removeClass("absolute"),i.trigger("scroll")})):void u.on("scroll",function(){i.trigger("scroll")})}var s,r,d,l,c,u,h=e("jquery"),p=e("mlellipsis"),f=e("lazyload"),m=e("iscroll-probe"),g=h(".author .intro"),v=!1,w=h(".collocation-block").length>0?!0:!1,y=0,b=h(""),c=document.querySelector("#wrapper .collocation-block"),C=h(window).width();e("js/plugin/wx-share")(),window.onload=function(){u&&u.refresh()},o.i=function(e){var o=navigator.userAgent.indexOf("iPhone")>0?!0:!1;v=o&&e,p.init(),f(h(".lazy")),h(".info-list .title, .one-good .reco-name").each(function(){this.mlellipsis(2)}),g.offset()&&parseInt(g.offset().left,10)===parseInt(g.css("margin-left"),10)&&g.css("padding-top",0),v&&(h(".yoho-header").length>0?h("#wrapper").addClass("ios has-head"):h("#wrapper").addClass("ios")),w&&(s=h(".collocation-block"),r=s.children(".thumb-container"),d=r.find("li"),l=s.find(".prod"),y=d.width(),v&&(b=h("#wrapper").after(r.clone().addClass("fixed-thumb-container fixed-bottom")).next(".thumb-container"),f(b.find(".lazy"),{event:"sporty"})),n(d.filter(".focus")),r.delegate(".thumb","touchend",a),v&&b.delegate(".thumb","touchend",a)),v&&i()}}),define("js/home/entry",["jquery","swiper","lazyload","hammer","index"],function(e,o,t){e("js/home/home"),e("js/home/maybe-like")}),define("js/home/home",["jquery","swiper","lazyload","hammer","index"],function(e,o,t){function n(){b=!1,f.hasClass("menu-open")&&(f.removeClass("menu-open"),u(".overlay").hide(),u(".sub-nav").removeClass("show"),g.removeClass("on"))}function a(){w+=10,y.css({transform:"rotateX("+w+"deg)","-webkit-transform":"rotateX("+w+"deg)","-moz-transform":"rotateX("+w+"deg)"}),w/90%2===1&&(C?(y.addClass("animate"),C=!1):(y.removeClass("animate"),C=!0)),w/90%2===0&&w%360!==0?window.setTimeout(a,3e3):w%360===0?window.setTimeout(a,6e4):window.requestAnimationFrame(a)}var i,s,r,d,l,c,u=e("jquery"),h=e("swiper"),p=e("lazyload"),f=u(".mobile-wrap"),m=u(".overlay"),g=u(".side-nav"),v=u(".sub-nav"),w=0,y=u(".home-header .logo"),b=!1,C=!0;p(u("img.lazy")),u(".nav-btn").on("touchstart",function(e){return f.addClass("menu-open"),m.show().css("opacity",.3),g.addClass("on"),e.preventDefault(),e.stopPropagation(),b=!0,!1}),u(".overlay").on("touchstart",function(e){return n(),!1}),u(".side-nav").on("touchmove",function(){return!1}),g.on("touchstart","li",function(e){return u(this).find(".sub-nav").size()>0&&(u(".sub-nav").removeClass("show"),u(this).find(".sub-nav").addClass("show")),e.stopPropagation(),e.target.pathname===location.pathname?(n(),!1):void 0}),v.each(function(){u(this).find("li").eq(0).on("touchstart",function(e){return u(".sub-nav").removeClass("show"),e.stopPropagation(),!1})}).on("touchstart",function(e){e.currentTarget!==e.target&&v.find("li").removeClass("current")}),g.children("ul").children("li").on("touchstart",function(){g.children("ul").children("li").css("background","#fff"),u(this).css("background","#eee")}).on("touchend touchcancel",function(){u(this).css("background","#fff")}),u(".banner-swiper").find("li").size()>1&&(i=new h(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".banner-top .pagination-inner"})),r=new h(".brands-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"brands-list",slideElement:"li"}),s=new h(".recommend-swiper",{grabCursor:!0,slidesPerView:"auto",wrapperClass:"recommend-list",slideElement:"li"}),u(".trend-topic-swiper").find("li").size()>1&&(d=new h(".trend-topic-swiper",{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:".trend-topic-content .pagination-inner"})),u(".category-swiper").each(function(e,o){c="category-swiper"+e,u(this).addClass(c),u("."+c).find(".swiper-slide").size()>1&&(l=new h("."+c,{loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!1,paginationClickable:!0,slideElement:"li",pagination:"."+c+" .pagination-inner"}))}),setTimeout(a,3e3),u(".home-header .iconfont").on("touchstart",function(){u(this).addClass("highlight")}).on("touchend touchcancel",function(){u(this).removeClass("highlight")}),window.reMarginFooter(".footer-tab"),o.set=function(e){window.setCookie("_Channel",e,{expires:365,domain:".m.yohobuy.com"})},e("js/home/maybe-like")}),define("js/home/maybe-like",["jquery","hammer","lazyload"],function(e,o,t){function n(){v||(v=!0,p.showLoadingMask(),c.ajax({type:"GET",url:r,data:{page:w+1},success:function(e){return" "===e?(v=!1,p.hideLoadingMask(),void(y&&(r="1,3"===y?"/boys/bottomBanner":"/girls/bottomBanner",c.ajax({type:"GET",url:r,success:function(e){e&&e.img&&(c("#load-more-img").show(),c("#load-more-img a").attr("href",e.url),c("#load-more-img a > img").attr("src",e.img))},error:function(){}})))):(s=g.find(".good-info").length,g.append(e),f(0===s?g.find(".good-info").find("img.lazy"):g.find(".good-info:gt("+(s-1)+")").find("img.lazy")),v=!1,p.hideLoadingMask(),void w++)},error:function(){h.show("网络断开连接了~"),v=!1,p.hideLoadingMask()}}))}function a(){c(window).scrollTop()+m>=c(document).height()-200&&n()}var i,s,r,d,l,c=e("jquery"),u=e("hammer"),h=e("js/plugin/tip"),p=e("js/plugin/loading"),f=e("lazyload"),m=c(window).height(),g=c("#goods-list"),v=!1,w=0,y=null,b=c(".mobile-wrap").hasClass("kids-wrap")?!0:!1,C=c(".mobile-wrap").hasClass("lifestyle-wrap")?!0:!1,j=c("#maybe-like-nav");b?r="/product/recom/maylikekids":C?r="/product/recom/maylikelife":(y=c(".mobile-wrap").hasClass("boys-wrap")?"1,3":"2,3",r="/product/recom/maylike?gender="+y),d=j.children(".focus"),C&&(i=new u(j[0]),i.on("tap",function(e){var o,t=c(e.target).closest("li"),n=c(".goods-list");e.preventDefault(),t.hasClass("focus")||(l=t.index(),t.addClass("focus"),d.removeClass("focus"),n.not(".hide").addClass("hide"),o=n.eq(l),o.removeClass("hide"),d=t,c(document).trigger("scroll"),e.srcEvent.stopPropagation())})),p.init(c(".maybe-like")),c(".maybe-like p").on("touchstart",function(e){n()}),c(window).scroll(function(){window.requestAnimationFrame(a)})}),define("js/index/entry",["jquery","hammer"],function(e,o,t){e("js/index/search"),e("js/index/footer"),e("js/index/channel")}),define("js/index/search",["jquery","hammer"],function(e,o,t){var n,a,i=e("jquery"),s=e("js/plugin/security"),r=e("hammer"),d=i("#search-input input"),l=i("#search-input .clear-input"),c=i(".search-icon"),u=i("#search-form"),h=i(".history"),p=i(".history-search"),f=i("#clear-history"),m=e("js/index/write-search"),g=m.getRanToken();n=new r(f[0]),n.on("tap",function(){localStorage.removeItem("historys"),h.html(""),p.hide(),f.hide(),window.rePosFooter()}),d.on("input",function(){""===d.val()?(c.css("color","#b2b2b2"),l.addClass("hide")):(c.css("color","#666"),l.removeClass("hide"))}),a=new r(l[0]),a.on("tap",function(){d.val("").trigger("input")}),i("#search").on("touchend",function(){return s.hasDangerInput()?!1:(i(this).closest("form").submit(),!1)}),function(){var e,o,t,n="";if(localStorage&&(o=localStorage.getItem("historys"),o&&o.length>0)){for(o=o.split(g),t=o.length;t>0;t--)e=o[t-1],""!==e&&(n+='<li><a href="/?query='+e+'">'+e+"</li>");h.html(n),f.removeClass("hide"),p.removeClass("hide"),window.rePosFooter()}}(),m.bindWirteLocal(u)}),define("js/plugin/security",["jquery"],function(e,o,t){function n(e){var o,t,n,s=a("input[type!=hidden], textarea"),r=/['"<>&\|]|--/g,d=s.length,l=void 0===e||"boolean"!=typeof e?!0:e;for(t=0;d>t;t++)if(o=s.eq(t).val(),r.test(o))return l?s.eq(t).val(o.replace(r," ")):(n=o.match(r).join(" "),i.show("不可以输入 "+n+" 哦!")),!l&&!0;return!1}var a=e("jquery"),i=e("js/plugin/tip");o.hasDangerInput=n}),define("js/index/write-search",[],function(e,o,t){function n(){return i}function a(e){e.on("submit",function(){var e,o=this.query.value;if(localStorage){if(e=localStorage.getItem("historys"),e=e?e:"",e.indexOf(i+o+i)>-1)return;""===e&&(o=i+o),e+=o+i,localStorage.setItem("historys",e)}})}var i=" ??++ ";o.getRanToken=n,o.bindWirteLocal=a}),define("js/index/footer",["jquery","hammer"],function(e,o,t){function n(){var e="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445",o=new Date;setTimeout(function(){new Date-o<2e3&&(window.location=e)},500)}var a,i=e("jquery"),s=e("hammer");e("js/common"),i("#float-layer-close").on("touchend",function(e){return i("#float-layer-app").hide(),window.setCookie("_float-layer-app","id490655927",{domain:".yohobuy.com"}),window.setCookie("_float-layer-app-close",1,{domain:".yohobuy.com",expires:1}),!1}),i("#float-layer-btn")&&i("#float-layer-btn")[0]&&(a=new s(i("#float-layer-btn")[0]),a.on("tap",function(e){n("bottom"),e.srcEvent.stopPropagation()}),"function"!=typeof window.cookie||window.cookie("_float-layer-app")?i("#float-layer-app").hide():i("#float-layer-app").show())}),define("js/index/channel",["jquery","hammer"],function(e,o,t){var n=e("jquery"),a=e("js/plugin/security"),i=n(".search-box"),s=n(".box"),r=n(".index-search"),d=n(".index-logo"),l=n(".index-channel a"),c=i.children('input[type="text"]'),u=s.children(".no-search"),h=i.children(".search-icon");e("js/common"),c.on("focus",function(){s.addClass("action"),d.addClass("action")}).on("input",function(){""===c.val()?h.addClass("empty"):h.removeClass("empty")}),u.on("touchend",function(){return s.removeClass("action"),d.removeClass("action"),c.blur(),!1}),i.children(".clear-text").on("touchstart",function(){c.val("").focus().trigger("input")}),i.children(".search-icon").on("touchstart",function(){return a.hasDangerInput()?!1:void r.submit()}),i.keyup(function(e){if(13===e.keyCode){if(a.hasDangerInput())return!1;r.submit()}}),n(".index-channel img").on("load error",function(){window.rePosFooter&&window.rePosFooter()}),l.on("touchstart",function(){l.css({background:"#000",color:"#fff",borderColor:"#fff"}),n(this).css({background:"rgba(255, 255, 255, 0.5)",color:"#000",borderColor:"#000"})}).on("touchend touchcancel",function(){n(this).css({background:"#000",color:"#fff",borderColor:"#fff"})})}),define("js/passport/entry",["jquery","handlebars","source-map","hammer"],function(e,o,t){e("js/passport/register/register"),e("js/passport/register/code"),e("js/passport/register/password"),e("js/passport/login/login"),e("js/passport/login/international"),e("js/passport/back/mobile"),e("js/passport/back/code"),e("js/passport/back/email"),e("js/passport/back/email-success"),e("js/passport/back/new-password"),e("js/passport/bind/bind"),e("js/passport/bind/code"),e("js/passport/bind/password")}),define("js/passport/register/register",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#phone-num"),i=n("#country-select"),s=n("#area-code"),r=n("#btn-next"),d=e("js/passport/api"),l=e("js/plugin/tip"),c=n.trim,u=l.show,h=!1;d.selectCssHack(n("#country-select")),d.bindClearEvt(),a.bind("input",function(){""===c(a.val())?r.addClass("disable"):r.removeClass("disable")}),i.change(function(){s.text(i.val())}),r.on("touchstart",function(){var e=c(a.val()),o=i.val();if(!r.hasClass("disable"))return h?!1:void(d.phoneRegx[o].test(e)?(h=!0,n.ajax({url:"/passport/reg/verifymobile",type:"POST",data:{areaCode:o.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:(u(e.message),h=!1)},error:function(e){u("出错了,请重试"),h=!1}})):u("手机号格式不正确,请重新输入"))})}),define("js/passport/api",["jquery"],function(e,o,t){function n(e){var o,t=r(".has-eye");e&&"open"===e.status?t.append('<div class="eye"></div>'):t.append('<div class="eye close"></div>'),o=t.children(".eye"),o.on("touchstart",function(e){var o=r(this),t=o.siblings(".pwd");e.preventDefault(),o.toggleClass("close"),o.hasClass("close")?t.attr("type","password"):t.attr("type","text"),t.focus()})}function a(){var e,o=r(".has-clear");o.append('<div class="clear-input"></div>'),e=o.children(".clear-input"),e.on("touchstart",function(o){var t=e.siblings(".input");t.val("").trigger("input").focus(),o.preventDefault()}),o.children(".input").bind("input",function(){var e=r(this),o=e.siblings(".clear-input"),t=d(e.val());""===t?o.hide():o.show()})}function i(e){return e.length>=6&&e.length<=20?!0:!1}function s(e){function o(){var o=e.find("option:selected").text().length;switch(o){case 2:e.outerWidth(90);break;case 3:e.outerWidth(110);break;default:e.outerWidth(130)}}var t=navigator.userAgent;t.match(/uc/i)&&t.match(/android/i)?e.change(function(){o()}):e.removeClass("in-android-uc")}var r=e("jquery"),d=r.trim,l=/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/,c={"+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][0-9]{8}$/,"+81":/^0[9|8|7][0-9]{9}$/,"+61":/^[0-9]{11}$/};t.exports={emailRegx:l,phoneRegx:c,bindEyesEvt:n,bindClearEvt:a,pwdValidate:i,selectCssHack:s}}),define("js/passport/register/code",["jquery"],function(e,o,t){e("js/passport/code")(!0)}),define("js/passport/code",["jquery"],function(e,o,t){var n=e("jquery");t.exports=function(o,t){function a(){n.ajax({url:"/passport/bind/bindMobile",type:"post",data:{areaCode:f.replace("+",""),phoneNum:p,openId:h,sourceType:u,nickname:c,password:""},success:function(e){200===e.code?(g.show("登录成功"),setTimeout(function(){location.href=e.data.refer},2e3)):g.show(e.message)},error:function(e){g.show("登录失败,请重试!")}})}function i(){var e,o=59;e=setInterval(function(){0===o?(d.text("重发验证码").removeClass("disable"),clearInterval(e)):d.text("重发验证码 ("+o--+"秒)")},1e3)}var s=n("#captcha"),r=n("#btn-next"),d=n("#captcha-tip"),l=parseInt(n("#isReg").val()),c=n("#nickname").val(),u=n("#sourceType").val(),h=n("#openId").val(),p=n("#phone-num").val(),f=n("#area-code").val().replace("+",""),m=e("js/passport/api"),g=e("js/plugin/tip"),v=n.trim,w=g.show,y=o?"reg":"back";m.bindClearEvt(),s.bind("input",function(){""!==v(s.val())?r.removeClass("disable"):r.addClass("disable")}),d.on("touchstart",function(){d.hasClass("disable")||n.ajax({type:"POST",url:t?"/passport/bind/sendBindMsg":"/passport/"+y+"/sendcode",data:{phoneNum:p,areaCode:f},success:function(e){200===e.code?(d.text("重发验证码 (60秒)").addClass("disable"),i()):w(e.message);
}})}),r.on("touchstart",function(){r.hasClass("disable")||n.ajax({type:"POST",url:t?"/passport/bind/checkBindMsg":"/passport/"+y+"/verifycode",data:{phoneNum:p,areaCode:f,code:v(s.val()),token:n("#token").val()},success:function(e){200===e.code?t?l?a():location.href="/passport/bind/password?phoneNum="+p+"&areaCode="+f+"&openId="+h+"&sourceType="+u+"&nickname="+c:location.href=e.data:w(e.message)}})}),i()}}),define("js/passport/register/password",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#pwd"),i=n("#btn-sure"),s=e("js/passport/api"),r=e("js/plugin/tip"),d=n.trim,l=r.show;s.bindEyesEvt({status:"open"}),a.bind("input",function(){""===d(a.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e=d(a.val());i.hasClass("disable")||(s.pwdValidate(e)===!1?l("密码6-20位,请重新输入"):n.ajax({type:"POST",url:"/passport/reg/setpassword",data:{password:e,phoneNum:n("#phone-num").val(),areaCode:n("#area-code").val(),token:n("#token").val()},success:function(e){var o;200===e.code?(o=e.data,l("注册成功"),n.ajax({url:o.session,dataType:"jsonp"}),setTimeout(function(){location.href=o.href},1e3)):l(e.message)}}))})}),define("js/passport/login/login",["jquery"],function(e,o,t){function n(){h&&p?l.removeClass("disable"):l.addClass("disable")}function a(){c.show(),u.show()}function i(){c.hide(),u.hide()}var s=e("jquery"),r=s("#account"),d=s("#pwd"),l=s("#btn-login"),c=s("#retrive-pwd-mask"),u=s("#retrive-pwd-ways"),h=!1,p=!1,f=e("js/passport/api"),m=e("js/plugin/tip"),g=s.trim,v=m.show;f.bindEyesEvt(),f.bindClearEvt(),r.bind("input",function(){h=""!==g(r.val())?!0:!1,n()}),d.bind("input",function(){p=""===g(d.val())?!1:!0,n()}),l.on("touchstart",function(){var e=g(r.val()),o=g(d.val());l.hasClass("disable")||(l.text("正在登录...").addClass("disable"),(/^[0-9]+$/.test(e)||f.emailRegx.test(e))&&f.pwdValidate(o)?s.ajax({type:"POST",url:"/passport/login/auth",data:{account:e,password:o},success:function(e){var o,t;200===e.code?(o=e.data,s.ajax({url:o.session,dataType:"jsonp",success:function(){clearTimeout(t),setTimeout(function(){location.href=o.href},1e3)}}),t=setTimeout(function(){location.href=o.href},3e3),v("登录成功")):v(e.message)},error:function(){v("网络断开连接啦~")},complete:function(){l.text("登录").removeClass("disable")}}):(v("账号或密码有错误,请重新输入"),l.text("登录").removeClass("disable")))}),s("#forget-pwd").on("touchstart",function(){a()}),c.on("touchstart",function(){i()}),s("#cancel-retrive").on("touchstart",function(e){e.preventDefault(),i()}),r.trigger("input"),d.trigger("input")}),define("js/passport/login/international",["jquery"],function(e,o,t){function n(){c&&u?l.removeClass("disable"):l.addClass("disable")}var a=e("jquery"),i=a("#phone-num"),s=a("#country-select"),r=a("#area-code"),d=a("#pwd"),l=a("#btn-login"),c=!1,u=!1,h=e("js/passport/api"),p=e("js/plugin/tip"),f=a.trim,m=p.show;h.selectCssHack(s),h.bindEyesEvt(),h.bindClearEvt(),i.bind("input",function(){c=""===f(i.val())?!1:!0,n()}),d.bind("input",function(){var e=f(d.val());u=""===e?!1:!0,n()}),s.change(function(){r.text(s.val())}),l.on("touchstart",function(){var e=f(i.val()),o=s.val(),t=f(d.val());l.hasClass("disable")||(l.text("正在登录...").addClass("disable"),h.phoneRegx[o].test(e)&&h.pwdValidate(t)?a.ajax({type:"POST",url:"/passport/login/auth",data:{areaCode:o.replace("+",""),account:e,password:t},success:function(e){var o,t;200===e.code?(o=e.data,m("登录成功"),a.ajax({url:o.session,dataType:"jsonp",success:function(){clearTimeout(t),setTimeout(function(){location.href=o.href},1e3)}}),t=setTimeout(function(){location.href=o.href},3e3),m("登录成功")):m(e.message)},error:function(){m("网络断开连接啦~")},complete:function(){l.text("登录").removeClass("disable")}}):(m("账号或密码有错误,请重新输入"),l.text("登录").removeClass("disable")))}),i.trigger("input"),d.trigger("input")}),define("js/passport/back/mobile",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#phone-num"),i=n("#country-select"),s=n("#area-code"),r=n("#btn-next"),d=e("js/passport/api"),l=e("js/plugin/tip"),c=n.trim,u=l.show;d.selectCssHack(n("#country-select")),d.bindClearEvt(),a.bind("input",function(){""===c(a.val())?r.addClass("disable"):r.removeClass("disable")}),i.change(function(){s.text(i.val())}),r.on("touchstart",function(){var e=c(a.val()),o=i.val();r.hasClass("disable")||(d.phoneRegx[o].test(e)?n.ajax({url:"/passport/back/sendcode",type:"POST",data:{areaCode:o.replace("+",""),phoneNum:e},success:function(e){200===e.code?location.href=e.data:u(e.message)}}):u("手机号格式不正确,请重新输入"))})}),define("js/passport/back/code",["jquery"],function(e,o,t){e("js/passport/code")(!1)}),define("js/passport/back/email",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#email"),i=n("#btn-sure"),s=e("js/passport/api"),r=e("js/plugin/tip"),d=n.trim,l=r.show;s.bindClearEvt(),a.bind("input",function(){""===d(a.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e=d(a.val());i.hasClass("disable")||(s.emailRegx.test(e)?n.ajax({url:"/passport/back/sendemail",type:"POST",data:{email:e},success:function(e){200===e.code?location.href=e.data:l(e.message)}}):l("邮箱格式不正确,请重新输入"))})}),define("js/passport/back/email-success",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#resend"),i=e("js/plugin/tip"),s=i.show;a.on("touchstart",function(e){e.preventDefault(),n.ajax({url:a.data("url"),type:"GET",success:function(e){s(200===e.code?e.message:e.message)}})})}),define("js/passport/back/new-password",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#pwd"),i=n("#btn-ok"),s=e("js/passport/api"),r=e("js/plugin/tip"),d=n.trim,l=r.show,c=n("#phone-num");s.bindEyesEvt({status:"open"}),a.bind("input",function(){""===d(a.val())?i.addClass("disable"):i.removeClass("disable")}),i.on("touchstart",function(){var e,o,t=d(a.val()),r=!0;i.hasClass("disable")||(e={password:t},0===c.length&&(r=!1),r?(n.extend(e,{phoneNum:c.val(),areaCode:n("#areaCode").val(),token:n("#token").val()}),o="/passport/back/passwordByMobile"):(n.extend(e,{code:n("#email-code").val()}),o="/passport/back/passwordByEmail"),s.pwdValidate(t)?n.ajax({type:"POST",url:o,data:e,success:function(e){200===e.code?(l("密码修改成功"),setTimeout(function(){location.href=e.data},1e3)):l(e.message)}}):l("密码6-20位,请重新输入"))})}),define("js/passport/bind/bind",["jquery","handlebars","source-map","hammer"],function(e,o,t){function n(e,o,t){return v?!1:(v=!0,u.addClass("disable").html("绑定中..."),void a.ajax({type:"POST",url:"/passport/bind/sendBindMsg",data:{phoneNum:o,areaCode:t.replace("+","")},success:function(o){location.href=e},error:function(){p.show("出错了,请重试!"),u.removeClass("disable").html("下一步"),v=!1}}))}var a=e("jquery"),i=a("#phone-num"),s=a("#country-select"),r=a("#area-code"),d=a("#openId"),l=a("#nickname"),c=a("#sourceType"),u=a("#btn-next"),h=e("js/passport/api"),p=e("js/plugin/tip"),f=e("js/me/dialog"),m=a.trim,g=p.show,v=!1;h.selectCssHack(a("#country-select")),h.bindClearEvt(),i.bind("input",function(){""===m(i.val())?u.addClass("disable"):u.removeClass("disable")}),s.change(function(){r.text(s.val())}),u.on("touchstart",function(){var e=m(i.val()),o=m(d.val()),t=m(l.val()),r=m(c.val()),p=s.val();u.hasClass("disable")||(h.phoneRegx[p].test(e)?a.ajax({url:"/passport/bind/bindCheck",type:"POST",data:{areaCode:p.replace("+",""),phoneNum:e,openId:o,sourceType:r,nickname:t},success:function(o){200===o.code?1===o.data.isReg?f.showDialog({dialogText:"该手机号已注册过有货\n"+e+",确定绑定吗?",hasFooter:{leftBtnText:"更换号码",rightBtnText:"继续绑定"}},function(){n(o.data.next,e,p)}):n(o.data.next,e,p):g(o.message)}}):g("手机号格式不正确,请重新输入"))})}),define("js/me/dialog",["jquery","handlebars","source-map","hammer"],function(e,o,t){function n(){return void 0===i&&(i='<div id="dialog-wrapper" class="dialog-wrapper"><div class="dialog-box">{{# hasHeader}}{{/ hasHeader}}<div class="dialog-content">{{dialogText}}</div>{{# hasFooter}}<div class="dialog-footer">{{# leftBtnText}}<span class="dialog-left-btn">{{.}}</span>{{/ leftBtnText}}{{# rightBtnText}}<span class="dialog-right-btn">{{.}}</span>{{/ rightBtnText}}</div>{{/ hasFooter}}</div></div>',s=d.compile(i)),s}var a,i,s,r=e("jquery"),d=e("handlebars"),l=e("hammer");o.showDialog=function(e,o,t){var i,s,d,c=n(),u=c(e);r(".dialog-wrapper").remove(),r("body").append(r(u)),i=r(".dialog-box"),a=r(".dialog-wrapper"),d=new l(document.getElementById("dialog-wrapper")),e.fast?a.css({display:"block"}):a.fadeIn(),i.css({top:"50%",marginTop:-(i.height()/2)}),e.autoHide&&(s=1e3,e.autoHide>1&&(s=e.autoHide),setTimeout(function(){a.fadeOut()},s)),a.on("touchmove",function(){return!1}),d.on("tap",function(e){r(e.target).hasClass("dialog-left-btn")?("function"==typeof t&&t(),a.fadeOut()):r(e.target).hasClass("dialog-right-btn")&&o(),e.preventDefault(),e.srcEvent.stopPropagation()})},o.hideDialog=function(){r(".dialog-wrapper").remove()}}),define("js/passport/bind/code",["jquery"],function(e,o,t){e("js/passport/code")(!0,!0)}),define("js/passport/bind/password",["jquery"],function(e,o,t){function n(e){a.ajax({url:"/passport/bind/bindMobile",type:"post",data:{areaCode:m.replace("+",""),phoneNum:f,openId:p,sourceType:h,nickname:u,password:e},success:function(e){200===e.code?(d.show("登录成功"),setTimeout(function(){location.href=e.data.refer},2e3)):d.show(e.message)},error:function(e){d.show("登录失败,请重试!")}})}var a=e("jquery"),i=a("#pwd"),s=a("#btn-sure"),r=e("js/passport/api"),d=e("js/plugin/tip"),l=a.trim,c=d.show,u=a("#nickname").val(),h=a("#sourceType").val(),p=a("#openId").val(),f=a("#phone-num").val(),m=a("#area-code").val().replace("+","");r.bindEyesEvt({status:"open"}),i.bind("input",function(){""===l(i.val())?s.addClass("disable"):s.removeClass("disable")}),s.on("touchstart",function(){var e=l(i.val());s.hasClass("disable")||(r.pwdValidate(e)===!1?c("密码6-20位,请重新输入"):n(e))})}),define("js/product/entry",["jquery","swiper","lazyload","hammer","index"],function(e,o,t){e("js/product/newsale/newarrival"),e("js/product/newsale/discount"),e("js/product/list"),e("js/product/detail/detail"),e("js/product/detail/consultform"),e("js/product/newsale/hot-rank")}),define("js/product/newsale/newarrival",["jquery","swiper","lazyload","hammer","index"],function(e,o,t){function n(e){var o,t,n,a,i,u,f={};if(!l){if(e){for(t in T)T.hasOwnProperty(t)&&(T[t].reload=!0);switch(q.children(".active").removeClass("active"),E.addClass("active"),e.type){case"gender":o={gender:e.id};break;case"brand":o={brand:e.id};break;case"sort":o={sort:e.id};break;case"color":o={color:e.id};break;case"size":o={size:e.id};break;case"price":o={price:e.id};break;case"discount":o={discount:e.id};break;case"limit":o={limit:e.id};break;case"channel":o={channel:e.id};break;case"p_d":o={p_d:e.id}}c.extend(b,o)}if(E.hasClass("today")?(a="today",i=1):E.hasClass("week")?(a="week",i=2):E.hasClass("sale")&&(a="sale",i=3),n=T[a],u=n.page+1,n.reload)u=1;else if(n.end)return;c.extend(f,b,{dayLimit:i,page:u}),l=!0,m.showLoadingMask(),c.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:f,success:function(e){var o,t;switch(a){case"today":o=s;break;case"week":o=r;break;case"sale":o=d}" "===e?(n.end=!0,n.reload&&o.html(y)):n.reload?(o.html(e),h(o.find(".lazy"))):(t=o.find(".good-info").length,o.append(e),h(o.find(".good-info:gt("+(t-1)+") .lazy"))),n.reload=!1,n.page=u,l=!1,m.hideLoadingMask(),window.rePosFooter()},error:function(){p.show("网络断开连接了~"),l=!1,m.hideLoadingMask()}})}}function a(){c(window).scrollTop()+w>c(document).height()-.25*g.height()-50&&void 0!==E&&n()}var i,s,r,d,l,c=e("jquery"),u=e("swiper"),h=e("lazyload"),p=e("js/plugin/tip"),f=e("js/plugin/filter"),m=e("js/plugin/loading"),g=c("#goods-container"),v=g.children(),s=c(v.get(0)),r=c(v.get(1)).addClass("hide"),d=c(v.get(2)).addClass("hide"),w=c(window).height(),y='<p class="no-result">未找到相关搜索结果</p>',b=e("js/product/query-param"),C=c.extend({},b),j=new Date,x=j.getMonth()+1,k=j.getDate(),q=c("#list-nav"),T={today:{reload:!0,page:0,end:!1},week:{reload:!0,page:0,end:!1},sale:{reload:!0,page:0,end:!1}},E=q.find(".active");e("js/product/suspend-cart"),c("#today a").text(x+"月"+k+"号"),c(".swiper-container .swiper-slide").length>1&&(i=new u(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner"})),c.ajax({type:"GET",url:"/product/newsale/filter",data:b,success:function(e){g.append(e),f.initFilter({fCbFn:n,hCbFn:function(){E.addClass("active"),E.siblings(".filter").removeClass("active")}})}}),h(c(".lazy")),q.bind("contextmenu",function(e){return!1}),q.on("touchend touchcancel",function(e){var o,t,a,i=c(e.target).closest("li");if(e.preventDefault(),i.hasClass("filter"))i.hasClass("active")?(f.hideFilter(),E.addClass("active"),i.removeClass("active")):(E=i.siblings(".active"),E.removeClass("active"),i.addClass("active"),f.showFilter());else{if(i.hasClass("today")?t="today":i.hasClass("week")?t="week":i.hasClass("sale")&&(t="sale"),o=T[t],!i.hasClass("active")){if(a=i.siblings(".active"),E=i,a.hasClass("filter"))f.hideFilter();else{switch(g.children(".container:not(.hide)").addClass("hide"),t){case"today":s.removeClass("hide");break;case"week":r.removeClass("hide");break;case"sale":d.removeClass("hide")}f.resetFilter(),b=c.extend({},C)}a.removeClass("active"),i.addClass("active")}o.reload&&n()}e.stopPropagation()}),c(window).scroll(function(){window.requestAnimationFrame(a)}),n(),q.on("touchstart","li",function(e){c(this).addClass("bytouch")}).on("touchend touchcancel",function(){q.find("li").removeClass("bytouch")})}),define("js/plugin/filter",["jquery","hammer"],function(e,o,t){function n(){h.addClass("hide")}function a(){h.removeClass("hide")}function i(){var e=g(".filter-body .classify");e.on("touchstart",".shower",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",".shower",function(){g(this).removeClass("highlight")})}function s(){var e=g(".filter-body .sub-item");e.on("touchstart",function(){e.removeClass("highlight"),g(this).addClass("highlight")}).on("touchend touchcancel",function(){g(this).removeClass("highlight")})}function r(e){e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}function d(e){var o,t,n=e.closest(".sub-classify"),a=n.siblings(".shower");return e.hasClass("chosed")?n:(n.children(".chosed").removeClass("chosed"),e.addClass("chosed"),o=g.trim(e.html()),t=g.trim(a.html()),a.html(t.substring(0,t.indexOf("</span>")+7)+o.substring(0,o.indexOf("<i"))),0===e.index()?a.addClass("default"):a.removeClass("default"),n)}function l(e){var o,t=e.data("id");o=d(e),p&&p({type:o.data("type"),id:t}),n()}function c(e){var o;p=e.fCbFn,f=e.hCbFn,m=e.missStatus,i(),s(),h=g(".filter-mask"),o=new v(h[0]),o.on("tap",function(e){var o,t=g(e.target);e.preventDefault(),t.closest(".filter-body").length>0?(o=t.closest(".sub-item"),o.length>0?(o=t.closest("li"),l(o)):(o=t.closest(".classify-item"),e.srcEvent.stopPropagation(),r(o))):(n(),f&&f())})}function u(){"undefined"!=typeof h&&(g(".sub-classify").each(function(){d(g(this).children(":first-child"))}),r(g(".classify > :first-child")))}var h,p,f,m,g=e("jquery"),v=e("hammer");o.initFilter=c,o.showFilter=a,o.hideFilter=n,o.resetFilter=u}),define("js/product/query-param",["jquery"],function(e,o,t){var n=e("jquery"),a={};n(".query-param").each(function(){var e=n(this);a[e.data("attr")]=e.val()}),t.exports=a}),define("js/product/suspend-cart",["jquery"],function(e,o,t){var n=e("jquery"),a=n("#suspend-cart");n.ajax({type:"GET",url:"/cart/index/count",success:function(e){var o;200===e.code&&(o=e.data.cart_goods_count,o>99&&(o="99+"),0===o&&n(".cart-count").remove(),a.find(".cart-count").html(o).removeClass("hide"))}})}),define("js/product/newsale/discount",["jquery","swiper","lazyload","hammer","index"],function(e,o,t){function n(e){var o,t,n,a,i,d={};if(!s){if(e){for(t in j)j.hasOwnProperty(t)&&(j[t].reload=!0);switch(C.children(".active").removeClass("active"),x.addClass("active"),e.type){case"gender":o={gender:e.id};break;case"brand":o={brand:e.id};break;case"sort":o={sort:e.id};break;case"color":o={color:e.id};break;case"size":o={size:e.id};break;case"price":o={price:e.id};break;case"discount":o={discount:e.id}}r.extend(b,o)}if(x.hasClass("new")?a="newest":x.hasClass("price")?a="price":x.hasClass("discount")&&(a="discount"),n=j[a],i=n.page+1,n.reload)i=1;else if(n.end)return;r.extend(d,b,{type:a,order:n.order,page:i}),s=!0,h.showLoadingMask(),r.ajax({type:"GET",url:"/product/newsale/selectNewSale",data:d,success:function(e){var o,t;switch(a){case"newest":o=m;break;case"price":o=g;break;case"discount":o=v}" "===e?(n.end=!0,n.reload&&o.html(y)):n.reload?(o.html(e),l(o.find(".lazy"))):(t=o.find(".good-info").length,o.append(e),l(o.find(".good-info:gt("+(t-1)+") .lazy"))),n.reload=!1,n.page=i,s=!1,h.hideLoadingMask(),window.rePosFooter()},error:function(){c.show("网络断开连接了~"),s=!1,h.hideLoadingMask()}})}}function a(){r(window).scrollTop()+w>r(document).height()-.25*p.height()-50&&void 0!==x&&n()}var i,s,r=e("jquery"),d=e("swiper"),l=e("lazyload"),c=e("js/plugin/tip"),u=e("js/plugin/filter"),h=e("js/plugin/loading"),p=r("#goods-container"),f=p.children(),m=r(f.get(0)),g=r(f.get(1)),v=r(f.get(2)),w=r(window).height(),y='<p class="no-result">未找到相关搜索结果</p>',b=e("js/product/query-param"),C=r("#list-nav"),j={newest:{order:1,reload:!0,page:0,end:!1},price:{order:0,reload:!0,page:0,end:!1},discount:{order:0,reload:!0,page:0,end:!1}},x=C.find(".active");e("js/product/suspend-cart"),r(".swiper-container .swiper-slide").length>1&&(i=new d(".swiper-container",{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner"})),r.ajax({type:"GET",url:"/product/newsale/filter",data:b,success:function(e){p.append(e),u.initFilter({fCbFn:n,hCbFn:function(){x.addClass("active"),x.siblings(".filter").removeClass("active")},missStatus:!0})}}),l(r(".lazy")),C.bind("contextmenu",function(e){return!1}),C.on("touchend touchcancel",function(e){var o,t,a,i=r(e.target).closest("li");if(e.preventDefault(),"undefined"!=typeof i&&0!==i.length){if(i.hasClass("filter"))i.hasClass("active")?(u.hideFilter(),x.addClass("active"),i.removeClass("active")):(x=i.siblings(".active"),x.removeClass("active"),i.addClass("active"),u.showFilter());else{if(i.hasClass("new")?t="newest":i.hasClass("price")?t="price":i.hasClass("discount")&&(t="discount"),o=j[t],i.hasClass("active")){if(i.hasClass("new"))return;(i.hasClass("price")||i.hasClass("discount"))&&(i.find(".icon > .iconfont").toggleClass("cur"),x=i,o.reload=!0,o.order=0===o.order?1:0)}else{if(a=i.siblings(".active"),x=i,a.hasClass("filter"))u.hideFilter();else switch(p.children(".container:not(.hide)").addClass("hide"),t){case"newest":m.removeClass("hide");break;case"price":g.removeClass("hide");break;case"discount":v.removeClass("hide")}a.removeClass("active"),i.addClass("active")}o.reload&&n()}e.stopPropagation()}}),r(window).scroll(function(){window.requestAnimationFrame(a)}),n(),C.on("touchstart","li",function(e){r(this).addClass("bytouch")}).on("touchend touchcancel",function(){C.find("li").removeClass("bytouch")})}),define("js/product/list",["jquery","hammer","lazyload"],function(e,o,t){function n(e){var o,t,n,a,s,r={};if(!i){if(e){for(t in I)I.hasOwnProperty(t)&&(I[t].reload=!0);switch(E.children(".active").removeClass("active"),L.addClass("active"),e.type){case"gender":o={gender:e.id};break;case"brand":o={brand:e.id};break;case"sort":o={sort:e.id};break;case"color":o={color:e.id};break;case"size":o={size:e.id};break;case"price":o={price:e.id};break;case"discount":o={discount:e.id}}l.extend(T,o)}if(L.hasClass("new")?a="newest":L.hasClass("price")?a="price":L.hasClass("discount")&&(a="discount"),n=I[a],s=n.page+1,n.reload)s=1;else if(n.end)return;l.extend(r,T,{type:a,order:n.order,page:s}),i=!0,v.showLoadingMask(),l.ajax({type:"GET",url:"/index/search/search",data:r,success:function(e){var o,t,r='<p class="no-result">未找到相关搜索结果</p>';switch(a){case"newest":t=y;break;case"price":t=b;break;case"discount":t=C}if(" "===e?(n.end=!0,n.reload&&t.html(r)):n.reload?(t.html(e),u(t.find(".lazy"))):(o=t.find(".good-info").length,t.append(e),u(t.find(".good-info:gt("+(o-1)+") .lazy"))),n.reload=!1,n.page=s,i=!1,v.hideLoadingMask(),window.rePosFooter(),window._yas)switch(a){case"newest":window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",window._ozuid,"",".new-goods .good-info .good-detail-img .good-thumb");break;case"price":window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",window._ozuid,"",".price-goods .good-info .good-detail-img .good-thumb");break;case"discount":window._yas(1*new Date,"1.0.13.6.3","yohobuy_m",window._ozuid,"",".discount-goods .good-info .good-detail-img .good-thumb")}}})}}function a(){l(window).scrollTop()+j>l(document).height()-.25*w.height()&&n()}var i,s,r,d,l=e("jquery"),c=e("hammer"),u=e("lazyload"),h=l("#brand-header"),p=l("#intro-box"),f=e("js/plugin/filter"),m=e("js/index/write-search"),g=e("js/plugin/tip"),v=e("js/plugin/loading"),w=l("#goods-container"),y=w.children(".new-goods"),b=w.children(".price-goods"),C=w.children(".discount-goods"),j=l(window).height(),x=l("#search-input input"),k=l(".search-icon"),q=l("#search-input .clear-input"),T=e("js/product/query-param"),E=l("#list-nav"),I={newest:{order:1,reload:!0,page:0,end:!1},price:{order:0,reload:!0,page:0,end:!1},discount:{order:0,reload:!0,page:0,end:!1}},L=E.find(".active");x.on("input",function(){""===x.val()?(k.css("color","#b2b2b2"),q.addClass("hide")):(k.css("color","#666"),q.removeClass("hide"))}),q.on("touchend",function(){x.val("").trigger("input")}),l("#search").on("touchend",function(){return l(this).closest("form").submit(),!1}),e("js/product/suspend-cart"),l.ajax({type:"GET",url:"/search/filter",data:T,success:function(e){w.append(e),f.initFilter({fCbFn:n,hCbFn:function(){L.addClass("active"),L.siblings(".filter").removeClass("active")}})}}),u(l(".lazy")),m.bindWirteLocal(l("#search-form")),E.bind("contextmenu",function(e){return!1}),E.on("touchend touchcancel",function(e){var o,t,a,i=l(e.target).closest("li");if(i.hasClass("filter"))i.hasClass("active")?(f.hideFilter(),L.addClass("active"),i.removeClass("active")):(L=i.siblings(".active"),L.removeClass("active"),i.addClass("active"),f.showFilter());else{if(i.hasClass("new")?t="newest":i.hasClass("price")?t="price":i.hasClass("discount")&&(t="discount"),o=I[t],i.hasClass("active")){if(i.hasClass("new"))return;(i.hasClass("price")||i.hasClass("discount"))&&(i.find(".icon > .iconfont").toggleClass("cur"),L=i,o.reload=!0,o.order=0===o.order?1:0)}else{if(a=i.siblings(".active"),L=i,a.hasClass("filter"))f.hideFilter();else switch(w.children(".container:not(.hide)").addClass("hide"),t){case"newest":y.removeClass("hide");break;case"price":b.removeClass("hide");break;case"discount":C.removeClass("hide")}a.removeClass("active"),i.addClass("active")}o.reload&&n()}}),l(window).scroll(function(){window.requestAnimationFrame(a)}),h.length>0&&(s=new c(h.children(".btn-intro")[0]),s.on("tap",function(){p.removeClass("hide"),l("body").addClass("overflow-hidden")}),r=new c(document.getElementById("intro-box")),r.on("tap",function(e){var o=l(e.target);e.srcEvent.preventDefault(),(0===o.closest("#brand-intro").length||o.hasClass("close-intro"))&&(p.addClass("hide"),l("body").removeClass("overflow-hidden"))}),d=new c(h.children(".btn-col")[0]),d.on("tap",function(e){var o,t=l(e.target).closest(".btn-col"),n=h.data("id");o=t.hasClass("coled")?"cancel":"ok",l.ajax({type:"POST",url:"/product/opt/favoriteBrand",data:{id:n,opt:o},success:function(e){200===e.code?(t.toggleClass("coled"),"ok"===o?g.show("添加收藏成功"):g.show("取消收藏成功")):400===e.code?location.href=e.data:g.show(e.message)},error:function(){g.show("网络断开连接了~")}})})),n(),E.on("touchstart","li",function(){E.find("li").removeClass("bytouch"),l(this).addClass("bytouch")}).on("touchend touchcancel","li",function(){E.find("li").removeClass("bytouch")})}),define("js/product/detail/detail",["jquery","swiper","hammer","lazyload","index"],function(e,o,t){function n(){var e=i(".cart-bar"),o=setInterval(function(){e?(window.reMarginFooter(".cart-bar"),clearInterval(o)):e=i(".cart-bar")},200)}var a,i=e("jquery"),s=e("swiper"),r=e("hammer"),d=e("lazyload"),l=i(".goodsDiscount .discount-folder"),c=i(".goodsDiscount .first-item span"),u=document.getElementById("goodsDiscount"),h=u&&new r(u),p=i(u).find(".first-item"),f=i(".cart-bar");n(),e("js/product/detail/like"),d(i("img.lazy")),i("#goodsDiscount h1").length<1&&i(".dropdown").remove(),a=new s(".banner-swiper",{lazyLoading:!0,lazyLoadingInPrevNext:!0,paginationClickable:!0,pagination:".banner-top .pagination-inner",nextButton:".my-swiper-button-next",prevButton:".my-swiper-button-prev",spaceBetween:3}),0===l.children().length&&(l.css("display","none"),c.html("")),h&&l.children().length>0&&h.on("tap",function(e){l.is(":hidden")?(p.removeClass("short-text"),c.removeClass("icon-down").addClass("icon-up").html("&#xe608;"),l.slideDown()):(p.addClass("short-text"),c.removeClass("icon-up").addClass("icon-down").html("&#xe609;"),l.slideUp())}),e("js/product/detail/desc"),e("js/product/detail/comments-consults"),e("js/product/recommend-for-you-product-desc"),i.ajax({type:"GET",url:"/cart/index/count",success:function(e){var o;if(200===e.code){if(o=e.data.cart_goods_count||0,0===o)return!1;o>99&&(o="99+"),f.find(".num-tag").html(o).removeClass("hide")}}}),i(".good-detail-page").length>0&&i("#yoho-footer").css("border-top","1px solid #e0e0e0")}),define("js/product/detail/like",["jquery"],function(e,o,t){var n=e("jquery"),a=e("js/plugin/tip"),i=e("js/cart/chose-panel"),s=n("#productId").val();n("#likeBtn").on("touchstart",function(){var e,o,t=n(this);return t.hasClass("liked")?(e="cancel",o=0):(e="ok",o=1),n.ajax({type:"POST",url:"/product/opt/favoriteProduct",data:{id:s,opt:e},success:function(o){200===o.code?(t.toggleClass("liked"),"cancel"===e?a.show("取消收藏成功"):"ok"===e&&a.show("收藏成功")):400===o.code?location.href=o.data:a.show(o.message)},error:function(){a.show("网络断开连接了~")}}),window._yas&&window._yas.sendCustomInfo({pd:s,fa:o},!0),!1}),n("#addtoCart").on("touchstart",function(){return i.show(),window._yas&&window._yas.sendCustomInfo({pd:s,by:1},!0),!1})}),define("js/cart/chose-panel",["jquery"],function(e,o,t){function n(){y=!1,b=!1,C=null,q=T.queryString(),h=T(".chose-panel").find(".thumb"),k=T(".chose-items"),j=T(".size-list ul"),p=T("#left-num"),f=j.eq(0).toggleClass("hide")}function a(){return y||b?y?b?!0:(E.show("请选择尺码~"),!1):(E.show("请选择颜色~"),!1):(E.show("请选择颜色和尺码~"),!1)}function i(e,o){var t=[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop],a=T("html, body");a.data("scroll-position",t),a.data("previous-overflow",a.css("overflow")),a.css("overflow","hidden"),a.css("height","100%"),window.scrollTo(t[0],t[1]),e&&(L.html(e),""!==T("#promotionId").val()&&(z.off("touchstart",".btn-minus"),z.off("touchstart",".btn-plus")),n()),T(".chose-panel").show(),c=T("#good-num"),x=o}function s(){var e=T("html, body"),o=e.data("scroll-position");e.css("overflow",e.data("previous-overflow")),e.css("height","auto"),window.scrollTo(o[0],o[1]),T(".chose-panel").hide()}function r(){u=k.find(".chosed"),2===u.closest(".zero-stock").length?T("#chose-btn-sure").css("background-color","#c0c0c0").html("已售罄"):T("#chose-btn-sure").css("background-color","#eb0313").html("加入购物车")}function d(e){var o,t;if(b)for(o=(C.data("numstr")+"").split("/"),t=0;t<o.length;t++)"0"===o[t]?e.find(".block").eq(t).addClass("zero-stock"):e.find(".block").eq(t).removeClass("zero-stock");else e.find("ul>li").each(function(){0===T(this).data("num")?T(this).addClass("zero-stock"):T(this).removeClass("zero-stock")})}function l(){y&&v>=0&&h.addClass("hide").eq(v).removeClass("hide")}var c,u,h,p,f,m,g,v,w,y,b,C,j,x,k,q,T=e("jquery"),E=e("js/plugin/tip"),I=e("js/plugin/loading"),L=T("#chose-panel"),z=T(".yoho-page");n(),z.on("touchstart",".chose-panel",function(e){var o=T(e.target);o.closest(".main").length>0||s()}),z.on("touchstart",".color-list .block",function(){var e,o,t,n,a,i,s,d=T(this),c=d.closest(".block-list").siblings(":first");if(d.siblings(".chosed").removeClass("chosed"),e=d.index(),t=c.find(".chosed"),n=j.eq(e),d.hasClass("chosed")){if(k.find(".num .left-num").html(""),p.val(0),y=!1,d.removeClass("zero-stock"),C)for(a=(C.data("numstr")+"").split("/"),i=0;i<a.length;i++)"0"===a[i]&&T(".color-list .block").eq(i).addClass("zero-stock")}else y=!0,j.addClass("hide"),n.removeClass("hide").addClass("show"),t.length>0&&(t.removeClass("chosed"),o=n.children().get(w),C=T(o)),o&&(s=T(o).data("num"),T(o).addClass("chosed"),s>0?(k.find(".num .left-num").html("剩余"+s+"件"),p.val(s)):(k.find(".num .left-num").html(""),p.val(0)));d.toggleClass("chosed"),v=e,T("#good-num").val(1),l(),r()}).on("touchstart",".size-list .block",function(){var e,o,t,n=T(this),a=n.closest(".block-list").siblings(":first");n.siblings(".chosed").removeClass("chosed"),e=n.index(),o=j.eq(e),n.hasClass("chosed")?(k.find(".num .left-num").html(""),T("#left-num").val(0),b=!1,w=null,C=null):(b=!0,t=n.data("num"),C&&C.removeClass("chosed"),t>0&&y?(k.find(".num .left-num").html("剩余"+t+"件"),T("#left-num").val(t)):(k.find(".num .left-num").html(""),T("#left-num").val(0)),0===t&&y&&n.addClass("zero-stock"),w=e,C=n),n.toggleClass("chosed"),T("#good-num").val(1),d(a),r()}),z.on("touchstart",".btn-minus",function(){var e=parseInt(c.val(),10);return m=T("#left-num").val(),a()?1===e||0===m-0?void E.show("您选择的数量不能为零~"):0>e?void E.show("您选择的数量不能为负数~"):void c.val(e-1):void 0}).on("touchstart",".btn-plus",function(){var e=parseInt(c.val(),10);return m=T("#left-num").val(),a()&&e-0!==m&&0!==m?e>m-1?void E.show("您选择的数量超过了最大库存量~"):void c.val(e+1):void 0}).on("touchstart","#chose-btn-sure",function(){var e,o,t=T("#good-num").val()-0,n=0,i=parseInt(c.val(),10);if(a()&&"已售罄"!==T("#chose-btn-sure").html()){if(m=T("#left-num").val()-0,i>m)return void E.show("您选择的数量超过了最大库存量~");if(0>i)return void E.show("您选择的数量小于一件~");if(u=T(".block-list>ul>li.chosed"),2===u.length&&0===u.closest(".zero-stock").length){if(e=C.data("skuid"),o=T("#promotionId").val(),g)return!1;g=!0,I.showLoadingMask(),T.ajax({method:"POST",url:"/cart/index/add",data:{productSku:e,buyNumber:t,promotionId:o,isEdit:n,cartType:q.cartType}}).done(function(e){var o;I.hideLoadingMask(),200===e.code&&(o=e.data.goods_count,o>99&&(o="99+"),T(".num-tag").html(o).removeClass("hide"),g=!1,x&&x()),e.message&&E.show(e.message),s()}).fail(function(){E.show("网络出了点问题~")}).always(function(){g=!1})}}}),o.init=n,o.show=i}),define("js/product/detail/desc",["jquery","lazyload","swiper","index"],function(e,o,t){function n(e){var o,t;e.length>0&&(o=e[0].getBoundingClientRect().right,t=e.find(".swiper-slide:last-child")[0].getBoundingClientRect().right,0>t-o?e.next(".tips").css("display","none"):e.next(".tips").css("display","block"))}function a(e,o){var t=null;c(e).each(function(n,a){t=c(e).slice(n,n+o),t.length===o&&n%o===0&&c(t).wrapAll(c('<div class="js-wraper"></div>'))})}function i(){v||w||(v=!0,p.showLoadingMask(),c.ajax({type:"GET",url:m,success:function(e){r=c("#productDesc"),r.append(e),window.rePosFooter(),u(r.find("img.lazy")),d=new h("#size-swiper-container",{slidesPerView:"auto"}),l=new h("#reference-swiper-container",{slidesPerView:"auto"}),n(c("#size-swiper-container")),n(c("#reference-swiper-container")),a(".detail .column",2),v=!1,w=!0,p.hideLoadingMask()},error:function(){f.show("网络断开连接了~"),v=!1,p.hideLoadingMask()}}))}function s(){(!w||c(window).scrollTop()+g>=c(document).height()-200)&&i()}var r,d,l,c=e("jquery"),u=e("lazyload"),h=e("swiper"),p=e("js/plugin/loading"),f=e("js/plugin/tip"),m=c("#introUrl").val(),g=c(window).height(),v=!1,w=!1;c(window).scroll(function(){window.requestAnimationFrame(s)})}),define("js/product/detail/comments-consults",["jquery","hammer"],function(e,o,t){var n,a,i=e("jquery"),s=e("js/plugin/tip"),r=e("hammer"),d=document.getElementById("nav-tab"),l=d&&new r(d),c=document.getElementById("goto-consult"),u=c&&new r(c);!function(){a=i("#nav-tab .consults-num").html()-0,
n=i("#nav-tab .comments-num").html()-0,i("#nav-tab li").each(function(){i(this).removeClass("focus")}),i("#feedback-content .content").each(function(){i(this).addClass("hide")}),0!==n?(i("#nav-tab .comment-nav").addClass("focus"),i("#feedback-content .comment-content").removeClass("hide")):0!==a&&(i("#nav-tab .consult-nav").addClass("focus"),i("#feedback-content .consult-content").removeClass("hide"))}(),l&&l.on("tap",function(e){var o=i(e.target).closest("li"),t=o.index();o.hasClass("comment-nav")&&0===n?s.show("暂无商品评价"):o.hasClass("focus")||(i("#nav-tab li").each(function(){i(this).removeClass("focus")}),i("#feedback-content .content").each(function(){i(this).addClass("hide")}),o.addClass("focus"),i("#feedback-content .content:eq("+t+")").removeClass("hide"))}),u&&u.on("tap",function(){location.href=i(c).find("a").attr("href")}),i(".goods-consults-page").length>0&&i("#yoho-header").css("position","fixed").css("top","0")}),define("js/product/recommend-for-you-product-desc",["swiper","jquery","index"],function(e,o,t){function n(){h||u||(h=!0,l&&r.get(l).then(function(e){e.length<5?d.css("display","none"):(d.html(e).show(),r("#swiper-recommend").length&&(i=new s("#swiper-recommend",{slidesPerView:"auto",grabCursor:!0,slideElement:"a",lazyLoading:!0,watchSlidesVisibility:!0}))),h=!1,u=!0,window.rePosFooter()}).fail(function(){d.hide()}))}function a(){(!u||r(window).scrollTop()+c>=r(document).height()-200)&&n()}var i,s=e("swiper"),r=e("jquery"),d=r(".recommend-for-you"),l=r("#preferenceUrl").val(),c=r(window).height(),u=!1,h=!1;r(window).scroll(function(){window.requestAnimationFrame(a)})}),define("js/product/detail/consultform",["jquery"],function(e,o,t){var n,a=e("jquery"),i=e("js/plugin/tip"),s=e("js/plugin/loading"),r=a(".consult-form"),d=a("#submit"),l=a("#content"),c=a("#product_id").val();d.on("touchend",function(){return l.blur(),r.submit(),!1}).on("touchstart",function(){a(this).addClass("highlight")}).on("touchend touchcancel",function(){a(this).removeClass("highlight")}),l.on("focus",function(){"请输入咨询内容"===l.val()&&l.val("")}).on("blur",function(){""===l.val()&&l.val("请输入咨询内容")}),r.on("submit",function(){var e;return n?!1:(e=l.val(),e&&"请输入咨询内容"!==e?(n=!0,s.showLoadingMask(),a.ajax({method:"POST",url:"/product/detail/consultsubmit",data:{product_id:c,content:e}}).then(function(e){"object"!==a.type(e)&&(e={}),200!==e.code?(i.show(e.message||"网络出了点问题~"),n=!1,s.hideLoadingMask()):(i.show("提交成功~"),setTimeout(function(){window.history.go(-1)},3e3))}).fail(function(){i.show("网络出了点问题~"),n=!1}),!1):(i.show("咨询内容不能为空"),!1))})}),define("js/product/newsale/hot-rank",["jquery","swiper","lazyload","index"],function(e,o,t){function n(e,o,t,n){h.showLoadingMask(),l.ajax({type:"GET",url:"/product/newsale/selectHotrank?"+o,dataType:"html",data:{page:e,tab_id:t,notab:n},success:function(o){" "===o?l(".rank-main").length<1&&l(".goods-nav").length<1?l("#hotRank").html(v):1===e&&(d=l(".goods-nav").prop("outerHTML"),l("#hotRank").html(d+v)):(l(".no-result").remove(),1===e&&l(".rank-main").remove(),l("#hotRank").append(o)),u(l("img.lazy")),l(".rank-main ul li:gt(9)").find(".item-content i").removeClass("top"),i=l(window).height(),0!==l(".rank-main").length?(l("#yoho-footer").css("position","static"),s=l(".rank-main").find("ul").offset().top):l("#yoho-footer").css("position","fixed"),r=new c(".s-goods-nav",{grabCursor:!0,slidesPerView:"auto",slideElement:"li"}),h.hideLoadingMask()}})}function a(){2!==p&&(l(window).scrollTop()+i<s+l("#hotRank").height()-100||(p=2,f=1,n(p,m,g,f)))}var i,s,r,d,l=e("jquery"),c=e("swiper"),u=e("lazyload"),h=e("js/plugin/loading"),p=1,f=0,m="",g="",v='<p class="no-result">未找到相关搜索结果</p>';e("js/product/suspend-cart"),l(window).scroll(function(){window.requestAnimationFrame(a)}),n(p,m,g,f),l("#hotRank").on("touchend touchcancel",function(e){var o=o||window.event,t=o.target||o.srcElement;"span"===t.nodeName.toLowerCase()&&(l(".s-goods-nav .nav-item").removeClass("active"),t.parentNode.className="active "+t.parentNode.className,g=t.getAttribute("data-id")?t.getAttribute("data-id"):"",m=t.getAttribute("data-sort")?t.getAttribute("data-sort"):"",p=1,f=1,n(p,m,g,f))}),l("#hotRank").bind("contextmenu",function(e){return!1}),l("#hotRank").on("touchstart",function(e){var o=o||window.event,t=o.target||o.srcElement;"span"===t.nodeName.toLowerCase()&&(t.parentNode.className="bgActive "+t.parentNode.className)}).on("touchend touchcancel",function(){l(".s-goods-nav .nav-item").removeClass("bgActive")})}),define("js/me/entry",["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"],function(e,o,t){e("js/me/order"),e("js/me/order-detail"),e("js/me/fav"),e("js/me/suggest"),e("js/me/index"),e("js/me/coupons"),e("js/me/online-service"),e("js/me/address"),e("js/me/suggest"),e("js/me/browse-record"),e("js/me/address-act"),e("js/me/logistic"),e("js/me/pay"),e("js/me/personal-details"),e("js/me/currency")}),define("js/me/order",["jquery","hammer","lazyload","handlebars","source-map"],function(e,o,t){function n(e){var o={type:f,page:m.page+1},t=e&&!e.noLoadingMask;g||(g=!0,t&&v.showLoadingMask(),s.ajax({type:"GET",url:"/home/getOrders",data:o,success:function(e){var n;" "!==e?(m.page=o.page,1===o.page?(h.html(e),d(h.find(".lazy"),{try_again_css:"order-failure"})):(n=h.children(".order").length,h.append(e),d(h.children(".order:gt("+(n-1)+")").find(".lazy"),{try_again_css:"order-failure"})),window.rePosFooter()):m.end=!0,g=!1,t&&v.hideLoadingMask()}}))}function a(){m.end===!1&&s(window).scrollTop()+p>s(document).height()-.25*u.height()&&n({noLoadingMask:!0})}var i,s=e("jquery"),r=e("hammer"),d=e("lazyload"),l=e("js/plugin/tip"),c=s("#order-nav > li"),u=s("#order-container"),h=u.children(".orders:not(.hide)"),p=s(window).height(),f=c.filter(".active").data("type"),m={page:0,end:!1},g=!1,v=e("js/plugin/loading"),w=e("js/me/dialog");d({try_again_css:"order-failure"}),function(){var e=c.length;4!==e&&c.width(100/e+"%")}(),v.init(s("body")),i=new r(document.getElementById("order-container")),i.on("tap",function(e){var o,t,n,a=s(e.target);a.closest(".locHref").length>0||(o=a.closest(".order"),t=o.data("id"),a.closest(".del").length>0?w.showDialog({dialogText:"确定删除订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){s.ajax({type:"GET",url:"/home/delOrder",data:{id:t},success:function(e){w.hideDialog(),e.message&&l.show(e.message),200===e.code&&window.location.reload()},error:function(){l.show("取消订单失败")}})}):a.closest(".cancel").length>0?w.showDialog({dialogText:"确定取消订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){s.ajax({type:"GET",url:"/home/cancelOrder",data:{id:t},success:function(e){e.message&&l.show(e.message),200===e.code&&window.location.reload()},error:function(){l.show("取消订单失败")}})}):a.closest(".order-goods").length>0&&(n=o.data("href"),location.href=n))}),s(window).scroll(function(){window.requestAnimationFrame(a)}),n()}),define("js/me/order-detail",["jquery","lazyload","hammer","handlebars","source-map"],function(e,o,t){var n,a=e("jquery"),i=e("lazyload"),s=e("hammer"),r=e("js/me/dialog"),d=e("js/plugin/tip"),l=a("#order-detail").data("id");i({try_again_css:"order-failure"}),n=new s(document.getElementsByClassName("opt")[0]),n.on("tap",function(e){var o=a(e.target);o.hasClass("btn-del")?r.showDialog({dialogText:"确定删除订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){a.ajax({type:"GET",url:"/home/delOrder",data:{id:l}}).then(function(e){a("#dialog-wrapper").hide(),"object"===a.type(e)&&(e.message&&d.show(e.message),window.location.href="/home/orders")}).fail(function(){d.show("网络错误")})}):o.hasClass("btn-cancel")&&r.showDialog({dialogText:"确定取消订单吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){a.ajax({type:"GET",url:"/home/cancelOrder",data:{id:l}}).then(function(e){a("#dialog-wrapper").hide(),"object"===a.type(e)&&(e.message&&d.show(e.message),window.location.href="/home/orders")}).fail(function(){d.show("网络错误")})})})}),define("js/me/fav",["jquery","hammer","swiper","handlebars","source-map","index"],function(e,o,t){function n(e){p.filter(".active").removeClass("active"),p.eq(e).addClass("active"),f.filter(".show").removeClass("show"),f.eq(e).addClass("show")}function a(e){var o,t,n=/container-(\d+)['"]{1}/gi,a=/\d+/,i=e.match(n),s=i.length;for(o=0;s>o;o++)t=i[o].match(a)[0],m[t]=new u("#swiper-container-"+t,{slidesPerView:"auto",grabCursor:!0,slideElement:"li",wrapperClass:"swiper-wrapper-"+t,lazyLoading:!0,watchSlidesVisibility:!0})}function i(e,o,t){"favBrand"===o?q=!0:k=!0,l.ajax({method:"post",url:"/home/"+o,data:{page:t},success:function(t){"favBrand"===o?v.addClass("hide"):g.addClass("hide")," "===t?(e.closest(".fav-type").find(".fav-content-loading").addClass("hide"),e.closest(".fav-type").find(".fav-null-box").removeClass("hide")):"end"===t?(e.closest(".fav-type").find(".fav-load-background").removeClass("fav-load-background").html("没有更多了"),q=!0,k=!0):t.length>10&&(e.append(t),e.closest(".fav-type").find(".fav-content-loading").remove(),"favBrand"===o?(a(t),q=!1):k=!1),window.rePosFooter()}})}function s(){l(window).scrollTop()+w>=l(document).height()-.25*C.height()-y&&(T?(v.filter(".hide").removeClass("hide"),q||(x++,i(C,"favBrand",x))):(g.filter(".hide").removeClass("hide"),k||(j++,i(b,"favProduct",j))))}var r,d,l=e("jquery"),c=e("hammer"),u=e("swiper"),h=e("js/me/dialog"),p=l("#fav-tab > li"),f=l(".fav-content > .fav-type"),m={},g=l(".fav-load-more"),v=l(".fav-brand-load-more"),w=l(window).height(),y=l("#yoho-footer").height(),b=l(".fav-product-list"),C=l(".fav-brand-swiper-wrapper"),j=1,x=1,k=!0,q=!0,T=!1;l("#fav-tab").hasClass("brand-tab")?(n(1),i(C,"favBrand",1),T=!0,window.rePosFooter()):(n(0),i(b,"favProduct",1),T=!1,window.rePosFooter()),r=new c(document.getElementById("fav-tab")),r.on("tap",function(e){var o,t=l(e.target).closest("li");0===t.length||t.hasClass("active")||(o=t.index(),0===o?(T=!1,0===b.find("li").length&&b.closest(".fav-type").find(".fav-null-box").hasClass("hide")&&i(b,"favProduct",1)):(T=!0,0===C.find("div").length&&C.closest(".fav-type").find(".fav-null-box").hasClass("hide")&&i(C,"favBrand",1)),n(o),window.rePosFooter())}),d=new c(document.getElementById("fav-content")),d.on("tap",function(e){var o="";l(e.target).hasClass("del-fav")&&h.showDialog({dialogText:"您确定要取消收藏吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){o=l(e.target).closest("li").attr("data-id"),l.ajax({method:"post",url:"/home/favoriteDel",data:{id:o}}).then(function(o){200===o.code?(h.showDialog({autoHide:!0,fast:!0,dialogText:"已经取消收藏"}),l(e.target).closest("li").remove()):400===o.code?h.showDialog({autoHide:!0,fast:!0,dialogText:o.message}):h.showDialog({autoHide:!0,fast:!0,dialogText:"取消收藏失败"})}).fail(function(){h.showDialog({autoHide:!0,dialogText:"网络错误~"})})})}),l(window).scroll(s),l(document).on("touchend",".swiper-header",function(){var e=l(this).find(".fav-more").attr("href");window.location.href=e})}),define("js/me/suggest",["jquery","hammer","lazyload","handlebars","source-map"],function(e,o,t){var n,a,i,s,r=e("jquery"),d=e("hammer"),l=e("lazyload"),c=e("handlebars"),u=e("js/me/dialog"),h=r(".upload-img-list"),p=r(".suggest-item .like-btn"),f=r(".suggest-item .dislike-btn"),m=r(".img-add"),g="",v=0;e("js/me/jquery.upload"),i='{{# imgList}}<li>{{# imgUrl}}<img src="{{.}}" /><span class="upload-img-remove"></span>{{/ imgUrl}}</li>{{/ imgList}}',s=c.compile(i),r("#upload-img").upload({auto:!0,fileType:"image/*",uploadScript:"/home/suggestimgUpload",fileObjName:"fileData",fileSizeLimit:300,height:"100%",width:"100%",multi:!1,onAddQueueItem:function(e){h.html(s({imgList:!0}))},onUploadComplete:function(e,o){h.html(""),g=JSON.parse(o).imgList[0].imgRelUrl,h.html(s(JSON.parse(o))),m.hide(),v++}}),l(),n=new d(document.getElementById("yoho-header")),n.on("tap",function(e){var o=r("#suggest-textarea").val(),t=/\S+/;if(r(e.target).hasClass("nav-btn")){if(!t.test(o))return void u.showDialog({autoHide:!0,dialogText:"意见不能为空"});r.ajax({method:"post",url:"/home/savesuggest",data:{content:o,image:g}}).then(function(e){200===e.code?(u.showDialog({autoHide:!0,dialogText:"提交成功"}),setTimeout(function(){location.pathname="home/suggest"},2e3)):u.showDialog({autoHide:!0,dialogText:"提交失败~"})}).fail(function(){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})}}),null!==document.getElementById("img-form")&&(a=new d(document.getElementById("img-form")),a.on("tap",function(e){r(e.target).hasClass("upload-img-remove")&&(h.html(""),g="",v--,setTimeout(function(){m.show()},50))})),p.bind("click",function(){var e=r(this).closest(".suggest-item").attr("data-id"),o=r(this);r.ajax({method:"post",url:"/home/upAndDown",data:{suggest_id:e,reliable:1}}).then(function(e){200===e.code&&(o.closest(".suggest-type").removeClass("show"),o.closest(".suggest-item").find(".suggest-good").addClass("show"))}).fail(function(e){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})}),f.bind("click",function(){var e=r(this).closest(".suggest-item").attr("data-id"),o=r(this);r.ajax({method:"post",url:"/home/upAndDown",data:{suggest_id:e,reliable:2}}).then(function(e){200===e.code&&(o.closest(".suggest-type").removeClass("show"),o.closest(".suggest-item").find(".suggest-bad").addClass("show"))}).fail(function(e){u.showDialog({autoHide:!0,dialogText:"网络错误~"})})})}),define("js/me/jquery.upload",["jquery"],function(e,o,t){var n=e("jquery");!function(e){var o={init:function(t){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 a=n.data("uploadifive"),s=a.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},t);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(a.inputTemplate=e('<input type="file">').css({"font-size":s.height+"px",opacity:0,position:"absolute",right:"-3px",top:"-3px","z-index":999}),a.createInput=function(){var t=a.inputTemplate.clone(),i=t.name="input"+a.inputCount++;s.multi&&t.attr("multiple",!0),s.fileType&&t.attr("accept",s.fileType),t.bind("change",function(){a.queue.selected=0,a.queue.replaced=0,a.queue.errors=0,a.queue.queued=0;var t=this.files.length;if(a.queue.selected=t,a.queue.count+t>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;t>r;r++)file=this.files[r],a.addQueueItem(file);a.inputs[i]=this,a.createInput()}s.auto&&o.upload.call(n),"function"==typeof s.onSelect&&s.onSelect.call(n,a.queue)}),a.currentInput&&a.currentInput.hide(),a.button.append(t),a.currentInput=t},a.destroyInput=function(o){e(a.inputs[o]).remove(),delete a.inputs[o],a.inputCount--},a.drop=function(t){a.queue.selected=0,a.queue.replaced=0,a.queue.errors=0,a.queue.queued=0;var i=t.dataTransfer,r=i.name="input"+a.inputCount++,d=i.files.length;if(a.queue.selected=d,a.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],a.addQueueItem(file);a.inputs[r]=i}s.auto&&o.upload.call(n),"function"==typeof s.onDrop&&s.onDrop.call(n,i.files,i.files.length),t.preventDefault(),t.stopPropagation()},a.fileExistsInQueue=function(e){for(var o in a.inputs){input=a.inputs[o],limit=input.files.length;for(var t=0;t<limit;t++)if(existingFile=input.files[t],existingFile.name==e.name&&!existingFile.complete)return!0}return!1},a.removeExistingFile=function(e){for(var t in a.inputs){input=a.inputs[t],limit=input.files.length;for(var i=0;i<limit;i++)existingFile=input.files[i],existingFile.name!=e.name||existingFile.complete||(a.queue.replaced++,o.cancel.call(n,existingFile,!0))}},0==s.itemTemplate?a.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>'):a.queueItem=e(s.itemTemplate),a.addQueueItem=function(t){if(e.inArray("onAddQueueItem",s.overrideEvents)<0){a.removeExistingFile(t),t.queueItem=a.queueItem.clone(),t.queueItem.attr("id",s.id+"-file-"+a.fileID++),t.queueItem.find(".close").bind("click",function(){return o.cancel.call(n,t),!1});var i=t.name;i.length>s.truncateLength&&0!=s.truncateLength&&(i=i.substring(0,s.truncateLength)+"..."),t.queueItem.find(".filename").html(i),t.queueItem.data("file",t),a.queueEl.append(t.queueItem)}"function"==typeof s.onAddQueueItem&&s.onAddQueueItem.call(n,t),t.size>s.fileSizeLimit&&0!=s.fileSizeLimit?a.error("FILE_SIZE_LIMIT_EXCEEDED",t):(a.queue.queued++,a.queue.count++)},a.removeQueueItem=function(o,t,n){n||(n=0);var i=t?0:500;o.queueItem&&(" - Completed"!=o.queueItem.find(".fileinfo").html()&&o.queueItem.find(".fileinfo").html(" - Cancelled"),o.queueItem.find(".progress-bar").width(0),o.queueItem.delay(n).fadeOut(i,function(){e(this).remove()}),delete o.queueItem,a.queue.count--)},a.filesToUpload=function(){var e=0;for(var o in a.inputs){input=a.inputs[o],limit=input.files.length;for(var t=0;t<limit;t++)file=input.files[t],file.skip||file.complete||e++}return e},a.checkExists=function(t){if(e.inArray("onCheck",s.overrideEvents)<0){e.ajaxSetup({async:!1});var a=e.extend(s.formData,{filename:t.name});if(e.post(s.checkScript,a,function(e){t.exists=parseInt(e)}),t.exists&&!confirm("A file named "+t.name+" already exists in the upload folder.\nWould you like to replace it?"))return o.cancel.call(n,t),!0}return"function"==typeof s.onCheck&&s.onCheck.call(n,t,t.exists),!1},a.uploadFile=function(o,t){if(!o.skip&&!o.complete&&!o.uploading)if(o.uploading=!0,a.uploads.current++,a.uploads.attempted++,xhr=o.xhr=new XMLHttpRequest,"function"==typeof FormData||"object"==typeof FormData){var r=new FormData;r.append(s.fileObjName,o);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&&a.progress(e,o)},!1),xhr.addEventListener("load",function(e){4==this.readyState&&(o.uploading=!1,200==this.status?"Invalid file type."!==o.xhr.responseText?a.uploadComplete(e,o,t):a.error(o.xhr.responseText,o,t):404==this.status?a.error("404_FILE_NOT_FOUND",o,t):403==this.status?a.error("403_FORBIDDEN",o,t):a.error("Unknown Error",o,t))}),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+'"',o.name&&(c+='; filename="'+o.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){a.progress(e,o)},!1),xhr.addEventListener("load",function(e){o.uploading=!1;var n=this.status;404==n?a.error("404_FILE_NOT_FOUND",o,t):"Invalid file type."!=o.xhr.responseText?a.uploadComplete(e,o,t):a.error(o.xhr.responseText,o,t)},!1);var u=s.uploadScript;if("get"==s.method){var h=e(s.formData).param();u+=h}xhr.open(s.method,s.uploadScript,!0),xhr.setRequestHeader("Content-Type","multipart/form-data; boundary="+r),"function"==typeof s.onUploadFile&&s.onUploadFile.call(n,o),xhr.sendAsBinary(c)},d.readAsBinaryString(o)}},a.progress=function(o,t){if(e.inArray("onProgress",s.overrideEvents)<0){if(o.lengthComputable)var a=Math.round(o.loaded/o.total*100);t.queueItem.find(".fileinfo").html(" - "+a+"%"),t.queueItem.find(".progress-bar").css("width",a+"%")}"function"==typeof s.onProgress&&s.onProgress.call(n,t,o)},a.error=function(t,i,r){if(e.inArray("onError",s.overrideEvents)<0){switch(t){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,t,i),i.skip=!0,"404_FILE_NOT_FOUND"==t?a.uploads.errors++:a.queue.errors++,r&&o.upload.call(n,null,!0)},a.uploadComplete=function(t,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(){o.cancel.call(n,i)},3e3),i.complete=!0,a.uploads.successful++,a.uploads.count++,a.uploads.current--,delete i.xhr,r&&o.upload.call(n,null,!0)},a.queueComplete=function(){"function"==typeof s.onQueueComplete&&s.onQueueComplete.call(n,a.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"),a.button=e('<div id="'+s.id+'" class="uploadifive-button">'+s.buttonText+"</div>"),s.buttonClass&&a.button.addClass(s.buttonClass),a.button.css({height:s.height,"line-height":s.height+"px",overflow:"hidden",position:"relative","text-align":"center",width:s.width}),n.before(a.button).appendTo(a.button).hide(),a.createInput.call(n),s.queueID?a.queueEl=e("#"+s.queueID):(s.queueID=s.id+"-queue",a.queueEl=e('<div id="'+s.queueID+'" class="uploadifive-queue" />'),a.button.after(a.queueEl)),s.dnd){var d=s.dropTarget?e(s.dropTarget):a.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",a.drop,!1)}XMLHttpRequest.prototype.sendAsBinary||(XMLHttpRequest.prototype.sendAsBinary=function(e){function o(e){return 255&e.charCodeAt(0)}var t=Array.prototype.map.call(e,o),n=new Uint8Array(t);this.send(n.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 t=e(this),n=t.data("uploadifive"),a=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],o.cancel.call(t,file);"function"==typeof a.onClearQueue&&a.onClearQueue.call(t,e("#"+n.settings.queueID))})},cancel:function(t,n){this.each(function(){var a=e(this),i=a.data("uploadifive"),s=i.settings;"string"==typeof t&&(isNaN(t)||(fileID="uploadifive-"+e(this).attr("id")+"-file-"+t),t=e("#"+fileID).data("file")),t.skip=!0,i.filesCancelled++,t.uploading&&(i.uploads.current--,t.uploading=!1,t.xhr.abort(),delete t.xhr,o.upload.call(a)),e.inArray("onCancel",s.overrideEvents)<0&&i.removeQueueItem(t,n),"function"==typeof s.onCancel&&s.onCancel.call(a,t)})},upload:function(o,t){this.each(function(){var n=e(this),a=n.data("uploadifive"),i=a.settings;if(o)a.uploadFile.call(n,o);else if(a.uploads.count+a.uploads.current<i.uploadLimit||0==i.uploadLimit){if(!t){a.uploads.attempted=0,a.uploads.successsful=0,a.uploads.errors=0;var s=a.filesToUpload();"function"==typeof i.onUpload&&i.onUpload.call(n,s)}e("#"+i.queueID).find(".uploadifive-queue-item").not(".error, .complete").each(function(){return _file=e(this).data("file"),a.uploads.current>=i.simUploadLimit&&0!==i.simUploadLimit||a.uploads.current>=i.uploadLimit&&0!==i.uploadLimit||a.uploads.count>=i.uploadLimit&&0!==i.uploadLimit?!1:void(i.checkScript?(_file.checking=!0,skipFile=a.checkExists(_file),_file.checking=!1,skipFile||a.uploadFile(_file,!0)):a.uploadFile(_file,!0))}),0==e("#"+i.queueID).find(".uploadifive-queue-item").not(".error, .complete").size()&&a.queueComplete()}else 0==a.uploads.current&&(e.inArray("onError",i.overrideEvents)<0&&a.filesToUpload()>0&&0!=i.uploadLimit&&alert("The maximum upload limit has been reached."),"function"==typeof i.onError&&i.onError.call(n,"UPLOAD_LIMIT_EXCEEDED",a.filesToUpload()))})},destroy:function(){this.each(function(){var t=e(this),n=t.data("uploadifive"),a=n.settings;o.clearQueue.call(t),a.queueID||e("#"+a.queueID).remove(),t.siblings("input").remove(),t.show().insertBefore(n.button),n.button.remove(),"function"==typeof a.onDestroy&&a.onDestroy.call(t)})}};e.fn.upload=function(t){return o[t]?o[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("The method "+t+" does not exist in $.uploadify"):o.init.apply(this,arguments)}}(n)}),define("js/me/index",["jquery","swiper","index"],function(e,o,t){var n,a=e("jquery"),i=a(".user-avatar"),s=a(".list-item"),r=new Image;e("js/product/recommend-for-you"),e("js/product/suspend-cart"),n=i.data("avatar"),r.src=n,r.onload=function(){i.css("background-image","url("+n+")")},a(".yoho-page").on("touchstart",".list-item, .type-item, .order-title",function(){s.removeClass("highlight"),a(this).addClass("highlight")}).on("touchend touchcancel",".list-item, .type-item, .order-title",function(){a(this).removeClass("highlight")})}),define("js/product/recommend-for-you",["swiper","jquery","index"],function(e,o,t){var n,a=e("swiper"),i=e("jquery"),s=i(".recommend-for-you");i.get("/home/preference").then(function(e){s.html(e).show(),i("#swiper-recommend").length&&(n=new a("#swiper-recommend",{slidesPerView:"auto",grabCursor:!0,slideElement:"a",lazyLoading:!0,watchSlidesVisibility:!0}))}).fail(function(){s.hide()})}),define("js/me/coupons",["jquery","hammer","mlellipsis"],function(e,o,t){function n(e,o){d.showLoadingMask(),i.ajax({type:"POST",url:"/home/couponData",dataType:"html",data:{status:e,page:o},success:function(e){i("#employ").append(e),window.rePosFooter(),d.hideLoadingMask()}})}var a,i=e("jquery"),s=e("hammer"),r=e("mlellipsis"),d=e("js/plugin/loading"),l=0,c=1;r.init(),i(".yoho-footer").css("border-top","1px solid #e0e0e0"),i(".employ span").each(function(e){a=new s(i(".employ span")[e]),a.on("tap",function(o){i(".employ span").removeClass("active").eq(e).addClass("active"),i("#employ").html(" "),l=e,c=1,n(l,c),window.rePosFooter()})}),i(window).scroll(function(){return i(window).scrollTop()+i(window).height()>i("body").height()-1?(c++,void n(l,c)):void 0}),n(l,c)}),define("js/me/online-service",["jquery"],function(e,o,t){var n=e("jquery"),a=n(".question-tab .tab-item");a.on("touchend",function(){var e=n(this).data("tab");e='[data-tab-name="'+e+'"]',a.removeClass("current"),n(this).addClass("current"),n(".question-list").removeClass("current"),n(e).addClass("current")}),n(".yoho-page").on("touchstart",".connect-item, .question-item",function(){n(this).siblings().removeClass("highlight"),n(this).addClass("highlight")}).on("touchend touchcancel",".connect-item, .question-item",function(){n(this).removeClass("highlight")})}),define("js/me/address",["jquery","hammer"],function(e,o,t){var n,a=e("jquery"),i=e("js/plugin/tip"),s=e("js/plugin/loading"),r=a(".action"),d=a(".add-address"),l=a("#yoho-footer"),c=a(".confim-mask"),u=a(".page-wrap"),h=a(".address-item");e("js/common"),u.first().css("min-height",function(){return a(window).height()-a("#yoho-header").height()-l.height()}),window.rePosFooter(),c.on("touchend",".cancel",function(e){return n=null,c.fadeOut(),!1}).on("touchend",".confim",function(){return s.showLoadingMask(),c.fadeOut(),a.ajax({method:"POST",url:"/home/delAddress",data:{id:n}}).then(function(e){"object"!==a.type(e)&&(e={}),200!==e.code?(i.show(e.message||"网络出了点问题~"),s.hideLoadingMask()):window.location.reload()}).fail(function(){i.show("网络出了点问题~"),s.hideLoadingMask()}).always(function(){n=null}),!1}),h.length<5&&d.attr("href",d.data("href")),d.on("touchend",function(){return h.length>=5?(i.show("您最多添加5个收货地址"),!1):void 0}),r.on("touchend",".del",function(){return n=a(this).data("id"),c.fadeIn(),!1})}),define("js/me/browse-record",["jquery","lazyload","handlebars","source-map","hammer"],function(e,o,t){function n(e){var o=d.children(".browse-record-good").length;f||(1===h&&l.removeClass("hide"),f=!0,a.ajax({type:"GET",url:"/home/recordContent",data:{page:h+1},success:function(t){" "===t?(p=!0,c.addClass("hide"),u.removeClass("hide")):(0===o?(d.html(t),i()):(d.append(t),i(d.find(".browse-record-good:gt("+(o-1)+") .lazy"))),window.rePosFooter(),h++,e&&e())},complete:function(){f=!1}}))}var a=e("jquery"),i=e("lazyload"),s=e("js/plugin/loading"),r=e("js/me/dialog"),d=a(".records"),l=a(".load-more"),c=l.children(".more"),u=l.children(".no-more"),h=0,p=!1,f=!1,m=a(window).height();s.init(),s.showLoadingMask(),n(s.hideLoadingMask),a(window).scroll(function(){p||m+a(window).scrollTop()>a(document).height()-.25*d.height()&&n()}),d.on("touchstart",".del-icon",function(){var e=a(this).closest(".browse-record-good"),o=e.data("skn");r.showDialog({dialogText:"确定删除此条浏览记录吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){a.ajax({type:"GET",url:"/home/delRecord",data:{skn:o},success:function(e){200===e.code&&(r.showDialog({dialogText:"删除浏览记录成功",autoHide:2e3,fast:!0}),setTimeout(function(){window.history.go(0)},1200))}})})})}),define("js/me/address-act",["jquery","hammer"],function(e,o,t){var n,a=e("jquery"),i=e("hammer"),s=e("js/plugin/tip"),r=e("js/plugin/security"),d=e("js/plugin/loading"),l=a(".edit-address"),c=a(".submit"),u=a(".my-edit-address-page"),h=a(".my-address-list-page"),p=a(".nav-back"),f=a(".nav-title"),m=a("input, textarea"),g=f.html(),v=a(".area"),w="edit",y=[],b=a.queryString();a(u,h).css("min-height",function(){return a(window).height()-a("#yoho-header").height()}),p.attr("href","javascript:void(0);"),p.on("touchend",function(e){"list"===w?(h.hide(),u.show(),e.preventDefault(),w="edit",f.html(g),h.hide(),h.find("ul").hide().find("li").removeClass("highlight"),h.children("ul").show().children("li").show(),y=[]):window.history.go(-1)}),l.on("submit",function(){return n?!1:r.hasDangerInput(!1)?!1:a(this).find('[name="consignee"]').val()?a(this).find('[name="mobile"]').val()?a(this).find('[name="area_code"]').val()&&a(this).find('[name="area"]').val()?a(this).find('[name="address"]').val()?(n=!0,d.showLoadingMask(),a.ajax({method:"POST",url:"/home/saveAddress",data:a(this).serialize()}).then(function(e){"object"!==a.type(e)&&(e={}),200!==e.code?(s.show(e.message||"网络出了点问题~"),n=!1,d.hideLoadingMask()):"shopping"===b.refer?window.location.href="/cart/index/selectAddress":window.location.href="/home/address"}).fail(function(){s.show("网络出了点问题~"),n=!1}),!1):(s.show("地址不能为空"),!1):(s.show("省市区不能为空"),!1):(s.show("手机号不能为空"),!1):(s.show("收件人不能为空"),!1)}),c.on("touchend",function(){return r.hasDangerInput(!1)?!1:(m.blur(),l.submit(),!1)}).on("touchstart",function(){a(this).addClass("highlight")}).on("touchend touchcancel",function(){a(this).removeClass("highlight")}),a.ajax({method:"GET",url:"/home/locationList",timeout:6e4}).then(function(e){h.html(e),v.on("touchend",function(){u.hide(),h.show(),w="list",f.html("地区选择")}),h.find(".address").each(function(e,o){var t=new i(o);t.on("tap",function(e){var o=a(e.target);"li"!==e.target.tagName.toLowerCase()&&(o=o.parent("li")),
y.push(o.children(".caption").text().trim()),o.siblings().hide(),o.children("ul").show().children("li").show(),e.srcEvent.preventDefault(),e.srcEvent.stopPropagation()})}),h.find(".address-last").each(function(e,o){var t=new i(o);t.on("tap",function(e){var o=a(e.target);y.push(o.text().trim()),a('[name="area"]').val(y.join(" ")),a('[name="area_code"]').val(o.data("id")),u.show(),w="edit",f.html(g),h.hide(),h.find("ul").hide().find("li").removeClass("highlight"),h.children("ul").show().children("li").show(),y=[],e.srcEvent.preventDefault(),e.srcEvent.stopPropagation()})}),h.on("touchstart","li",function(){a(this).addClass("highlight")}).on("touchend touchcancel","li",function(){a(this).removeClass("highlight")})}).fail(function(){s.show("获取省市区列表失败")})}),define("js/me/logistic",["jquery"],function(e,o,t){function n(){d+r>s?window.rePosFooter():i.css("border-top","1px solid #f1f1f1")}var a=e("jquery"),i=a("#yoho-footer"),s=window.outerHeight,r=document.body.offsetHeight,d=i.height();a(document).ready(n)}),define("js/me/pay",["jquery","hammer"],function(e,o,t){function n(){document.addEventListener("WeixinJSBridgeReady",function(){window.WeixinJSBridge&&window.WeixinJSBridge.call("hideOptionMenu")})}function a(e,o){window.WeixinJSBridge&&window.WeixinJSBridge.invoke("getBrandWCPayRequest",o,function(o){window.location.href="/home/orders/detail?order_code="+e})}function i(e){var o;void 0===typeof WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",a,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",a),document.attachEvent("onWeixinJSBridgeReady",a)):p.ajax({type:"GET",url:"/shopping/pay/wechatwapapi?order_code="+e,dataType:"json",success:function(t){200===t.code?(o=t.data.jsApiParameters,a(e,o)):m.show("微信支付调取失败")},error:function(){m.show("请刷新本页面,完成微信支付")}})}function s(){var e=window.navigator.userAgent.toLowerCase();return e.indexOf("micromessenger")>0?!0:!1}function r(){var e=p(".app");e.each(function(e,o){return"weixin"===p(o).parent().attr("id")?(p(o).parent().css("display","none"),!1):void 0})}function d(){s()||r()}function l(e,o){p(e).css("background-position-y",o)}function c(){var e=p(".box"),o=null,t=null;e.each(function(e,n){o=p(n).find(".icon").find("div"),o.length>0&&(t=p(n).attr("id"),"alipay"!==t&&l(o,b[t]))})}function u(){var e=p(".payapp-list");e.css("visibility","visible")}function h(){d(),f.hideLoadingMask(),u(),c()}var p=e("jquery"),f=e("js/plugin/loading"),m=e("js/plugin/tip"),g=e("hammer"),v=document.getElementById("ordercode").value,w=document.getElementById("weixin"),y=w&&new g(w),b={baidu:"-2.7rem",weixin:"-1.2rem",QQ:"-5.4rem",bank:"-4rem"};window.wx&&wx.hideOptionMenu(),void 0===typeof WeixinJSBridge?(document.addEventListener?document.addEventListener("WeixinJSBridgeReady",n,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",n),document.attachEvent("onWeixinJSBridgeReady",n)),n()):n(),y&&y.on("tap",function(){i(v)}),f.showLoadingMask(),p(document).ready(h)}),define("js/me/personal-details",["jquery"],function(e,o,t){var n,a=e("jquery"),i=a(".user-avatar"),s=new Image;n=i.data("avatar"),s.src=n,s.onload=function(){i.css("background-image","url("+n+")")}}),define("js/me/currency",["jquery"],function(e,o,t){function n(e){a.ajax({type:"POST",url:"/home/ajaxCurrencyDetail",dataType:"html",data:{page:e},success:function(e){a(".coin-detail").append(e),window.rePosFooter()}})}var a=e("jquery"),i=1;a(window).scroll(function(){return a(window).scrollTop()+a(window).height()>a("body").height()-1?(i++,void n(i)):void 0}),n(i)}),define("js/cart/entry",["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"],function(e,o,t){e("js/cart/cart"),e("js/cart/gift-advance"),e("js/cart/order-ensure"),e("js/cart/select-coupon"),e("js/cart/select-address")}),define("js/cart/cart",["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"],function(e,o,t){function n(){return window.isCookiesEnabled()?p(".cart-goods").length<=0&&!T:p(".cart-goods").length<=0}function a(){return b.not(".hide")}function i(){a().find(".shopping-cart-good .name").each(function(){this.mlellipsis(2)}),q=!0}function s(){return a().find(".cart-goods .icon-cb-checked").length>0?!0:!1}function r(){var e=a().find(".freebie");return e.length<=0?!1:!0}function d(){var e,o=!1;return"ordinary"===C?e=p(".common .low-stocks"):"advance"===C&&(e=p(".presell .low-stocks")),e.length<=0?o:(e.each(function(e,t){return p(t).parent().parent().parent().siblings(".checkbox").hasClass("icon-cb-checked")?(o=!0,!1):void 0}),o)}function l(){v.showDialog({dialogText:"您还未选择赠品,是否去选择赠品",hasFooter:{leftBtnText:"我不要赠品",rightBtnText:"去选择"}},function(){window.location.href=a().find(".freebie > a").attr("href")},function(){window.location.href="/cart/index/orderEnsure?cartType="+C})}var c,u,h,p=e("jquery"),f=e("mlellipsis"),m=e("hammer"),g=e("js/cart/chose-panel"),v=e("js/me/dialog"),w=e("js/plugin/loading"),y=e("js/plugin/tip"),b=p(".cart-content"),C=p("#cartType").val(),j=p(".cart-nav"),x=p(".shopping-cart-page"),k=!1,q=!1,T="true"===window.cookie("_yoho-cart-refreshByDelete")?!0:!1;w.showLoadingMask(),n()?e("js/product/recommend-for-you"):(T&&p("body").css("background-color","#f0f0f0"),e("js/cart/good")),x.css("display","block"),w.hideLoadingMask(),window.setCookie("_yoho-cart-refreshByDelete",!1),f.init(),"function"==typeof window.cookie&&"y"===window.cookie("_hasShowCartPresellTip")?(p("#presell-tip").removeClass("show").addClass("hide"),k=!0):p("#presell-tip").removeClass("hide").addClass("show"),"advance"===C&&(b.toggleClass("hide"),p("#common-cart-nav").removeClass("active"),p("#presell-cart-nav").addClass("active"),i(),p(window).trigger("scroll")),j.length>0&&(c=new m(document.getElementsByClassName("cart-nav")[0]),c.on("tap",function(e){var o=p(e.target).closest("li");o.hasClass("active")||("ordinary"===C?(C="advance",p("#cartType").val("advance")):(C="ordinary",p("#cartType").val("ordinary")),o.siblings(".active").removeClass("active"),o.addClass("active"),b.toggleClass("hide"),q===!1&&i(),p(window).trigger("scroll"))}),k||setTimeout(function(){p("#presell-tip").removeClass("show").addClass("hide"),window.setCookie("_hasShowCartPresellTip","y")},3e3)),p(".advance-buy").length>0&&(u=new m(document.getElementsByClassName("advance-buy")[0]),u.on("tap",function(e){window.location.href="/cart/index/advanceBuy?cartType="+C})),p(".freebie").length>0&&(h=new m(document.getElementsByClassName("freebie")[0]),h.on("tap",function(e){window.location.href="/cart/index/gift?cartType="+C})),p(".btn-balance").on("touchend",function(){return d()?(y.show("所选商品中含有库存不足的商品"),!1):r()?(l(),!1):void(s()?window.location.href="/cart/index/orderEnsure?cartType="+C:y.show("请先勾选商品"))}),p(".chose").on("touchend",function(){g.show()}),j.on("touchstart","li",function(e){p(this).addClass("bytouch")}).on("touchend touchcancel",function(){j.find("li").removeClass("bytouch")}),p(window).scrollTop(1).scrollTop(0)}),define("js/cart/good",["jquery","mlellipsis","lazyload","handlebars","source-map","hammer"],function(e,o,t){function n(e){this.goods_type=e.goods_type,this.buy_number=e.buy_number,this.product_sku=e.product_sku,this.selected=e.selected}function a(e,o){m||(m=!0,r.ajax({url:"select",type:"post",data:{skuList:JSON.stringify(e)},success:function(e){200===e.code?o():h.show(e.message)},error:function(){h.show("网络异常")},complete:function(){m=!1}}))}function i(){var e,o=r(".shopping-cart-good .icon-cb-checked"),t=r(".shopping-cart-good .icon-checkbox");f.hasClass("icon-cb-checked")?(f.removeClass("icon-cb-checked").addClass("icon-checkbox"),e=!0):(f.removeClass("icon-checkbox").addClass("icon-cb-checked"),e=!1),e?o.each(function(e,o){r(o).removeClass("icon-cb-checked").addClass("icon-checkbox")}):t.each(function(e,o){r(o).removeClass("icon-checkbox").addClass("icon-cb-checked")}),window.location.href="/cart/index/index?cartType="+r("#cartType").val()}function s(e,o,t){var i={},s=r(".cart-content:not(.hide) .shopping-cart-good"),d=null,l=[];i.goods_type=o,i.selected=e?"N":"Y",s.each(function(e,o){d=r(o),i.product_sku=r(o).data("id"),i.buy_number=d.find(".count").eq(0).text().trim().replace("×",""),l.push(new n(i))}),a(l,t)}var r=e("jquery"),d=e("mlellipsis"),l=e("js/cart/chose-panel"),c=e("lazyload"),u=e("js/me/dialog"),h=e("js/plugin/tip"),p=e("js/cart/order-info").orderInfo,f=r(".balance .checkbox"),m=!1;d.init(),c({try_again_css:"order-failure"}),setTimeout(function(){r(".shopping-cart-good .name").each(function(){this.mlellipsis(2)})},0),r(".cart-goods").on("touchstart",".checkbox",function(){var e=r(this),o=e.closest(".shopping-cart-good"),t=o.data("id"),a=[],i={};return!e.hasClass("icon-cb-checked")&&e.siblings(".info").find(".low-stocks").length>0?(h.show("库存不足,无法购买"),!1):(i.goods_type=r("#cartType").val(),i.selected=e.hasClass("icon-cb-checked")?"N":"Y",i.product_sku=t,i.buy_number=o.find(".count").eq(0).text().trim().replace("×",""),a.push(new n(i)),void r.ajax({type:"post",url:"select",data:{skuList:JSON.stringify(a)}}).then(function(o){200===o.code?(e.hasClass("icon-cb-checked")?e.removeClass("icon-cb-checked").addClass("icon-checkbox"):e.removeClass("icon-checkbox").addClass("icon-cb-checked"),window.location.href="/cart/index/index?cartType="+r("#cartType").val()):400===o.code&&h.show("网络异常")},function(){h.show("网络异常")}))}),r(".icon-del").on("touchstart",function(e){var o=r(this);e.stopPropagation(),u.showDialog({dialogText:"您确定要从购物车中删除吗?",hasFooter:{leftBtnText:"取消",rightBtnText:"确定"}},function(){var e=o.closest(".shopping-cart-good").data("id"),t=o.data("count");r.ajax({method:"post",url:"/cart/index/del",data:{sku:e,count:t}}).then(function(e){200===e.code?(u.showDialog({dialogText:"删除成功",autoHide:!0,fast:!0}),p("couponCode",null),p("couponName",null),window.setCookie("_yoho-cart-refreshByDelete",!0),window.location.href="/cart/index/index?cartType="+r("#cartType").val()):h.show(e.message)},function(){h.show("网络异常"),window.location.reload()})})}),f.on("touchend",function(){var e=r("#cartType").val(),o=r(this).hasClass("icon-cb-checked");if("ordinary"===e){if(!o&&r(".common .low-stocks").length>0)return h.show("所选商品中含有库存不足的商品"),!1}else if("advance"===e&&!o&&r(".presell .low-stocks").length>0)return h.show("所选商品中含有库存不足的商品"),!1;s(o,e,i)}),r(".down").on("touchend",function(){l.show()})}),define("js/cart/order-info",["jquery","hammer"],function(e,o,t){function n(){i={uid:window.getUid(),deliveryId:1,deliveryTimeId:1,paymentTypeId:1,yohoCoin:a(".coin").data("yoho-coin")||0,addressId:null,couponCode:null,couponName:null,invoice:null,invoiceText:null,invoiceType:null,msg:null,cartType:"ordinary"},window.setCookie("order-info",JSON.stringify(i))}var a=e("jquery"),i=window.cookie("order-info");e("js/common");try{i=JSON.parse(i),i.yohoCoin=a(".coin").data("yoho-coin")||0}catch(s){n()}o.init=n,o.orderInfo=function(e,o){return void 0===o?i[e]:(i[e]=o,void window.setCookie("order-info",JSON.stringify(i)))}}),define("js/cart/gift-advance",["jquery","lazyload","hammer"],function(e,o,t){function n(e,o){d.showLoadingMask(),a.get("/cart/index/giftinfo",{skn:e,promotionId:o}).then(function(e){return e?void l.show(e,function(){window.location.href="/cart/index/index?cartType="+u.cartType}):void r.show("网络错误")},function(){r.show("网络错误")}).always(function(){d.hideLoadingMask()})}var a=e("jquery"),i=e("lazyload"),s=e("hammer"),r=e("js/plugin/tip"),d=e("js/plugin/loading"),l=e("js/cart/chose-panel"),c=a(".gift-advance-page"),u=a.queryString();e("js/common"),i(a(".lazy")),c.find(".chose").each(function(e,o){var t=new s(o);t.on("tap",function(e){var o=a(e.target),t=o.closest(".gift-advance-good").data("id"),i=o.closest(".advance-block").data("promotion-id");n(t,i)})})}),define("js/cart/order-ensure",["jquery","lazyload","hammer","handlebars","source-map"],function(e,o,t){function n(e){var o=c(e.target).closest("li");0===o.length||o.hasClass("chosed")||(o.siblings("li.chosed").removeClass("chosed"),o.addClass("chosed"))}function a(){c.ajax({method:"POST",url:"/cart/index/orderCompute",data:{cartType:q("cartType")||"ordinary",deliveryId:q("deliveryId"),paymentTypeId:q("paymentTypeId"),couponCode:q("couponCode"),yohoCoin:q("yohoCoin")}}).then(function(e){var o;"object"!==c.type(e)?window.location.reload():(e.last_order_amount&&(e.last_order_amount=(+e.last_order_amount).toFixed(2)),e.use_yoho_coin&&(C.find("em").html("- ¥ "+e.use_yoho_coin),j.html("已抵¥"+e.use_yoho_coin),C.find("em").show(),j.show()),o=x({cartPayData:e.promotion_formula_list,price:e.last_order_amount}),w.html(o))}).fail(function(){window.location.reload()})}function i(){var e=v.find('[name="invoice-title"]').val()||q("invoiceText"),o=c("#msg").find("input").val()||q("msg");if(2===q("deliveryId")&&!b.data("support"))return void f.show("当前地址不支持顺丰快递");if(l)return!1;if(q("invoice")){if(!e)return void f.show("请输入发票抬头");if(e.length>30)return void f.show("发票抬头不得超过30个汉字")}return o&&o.length>40?void f.show("留言不得超过40个汉字"):(m.showLoadingMask(),l=!0,void c.ajax({method:"POST",url:"/cart/index/orderSub",data:{addressId:q("addressId"),cartType:q("cartType")||"ordinary",deliveryId:q("deliveryId"),deliveryTimeId:q("deliveryTimeId"),invoiceText:q("invoice")?e:null,invoiceType:q("invoice")?v.find(".invoice-type").val()||q("invoiceType"):null,msg:o,paymentTypeId:q("paymentTypeId"),paymentType:q("paymentType"),couponCode:q("couponCode"),yohoCoin:q("yohoCoin")}}).then(function(e){var o;return e?void(200===e.code?(o=2===d?"/home/orderDetail?order_code="+e.data.order_code:"/home/orders/pay?order_code="+e.data.order_code,window.setCookie("order-info",""),window.location.href=o):e.message&&f.show(e.message)):void f.show("网络出错")}).fail(function(){f.show("网络出错")}).always(function(){l=!1,m.hideLoadingMask()}))}var s,r,d,l,c=e("jquery"),u=e("lazyload"),h=e("hammer"),p=e("handlebars"),f=e("js/plugin/tip"),m=e("js/plugin/loading"),g=e("js/cart/order-info"),v=c(".invoice"),w=c(".price-cal"),y=c(".coupon-use.used"),b=c(".address-wrap"),C=c(".coin-check"),j=c(".coin .used"),x=p.compile(c("#tmpl-price").html()),k=c.queryString(),q=g.orderInfo;e("js/common"),u(),window.getUid()!==q("uid")&&(g.init(),window.location.reload()),y.data("name")!==q("couponName")&&(q("couponCode",null),q("couponName",null)),q("cartType",k.cartType||k.carttype||"ordinary"),s=new h(document.getElementsByClassName("dispatch-mode")[0]),s.on("tap",n),r=new h(document.getElementsByClassName("dispatch-time")[0]),r.on("tap",n),c(".checkbox").on("touchstart",function(){var e=c(this);return e.hasClass("icon-cb-checked")?void e.removeClass("icon-cb-checked").addClass("icon-checkbox"):void(e.hasClass("icon-checkbox")&&e.removeClass("icon-checkbox").addClass("icon-cb-checked"))}),c(".invoice").on("touchend",".checkbox",function(){var e=c(this);e.hasClass("icon-cb-checked")&&c(".invoice").addClass("focus"),e.hasClass("icon-checkbox")&&c(".invoice").removeClass("focus")}),q("addressId")||q("addressId",b.data("id")),c(".dispatch-mode").on("touchend","li",function(){var e=c('.dispatch-mode [data-id="1"]');b.data("support")||2!==c(this).data("id")?(q("deliveryId",c(this).data("id")),a()):(n({target:e}),f.show("当前地址不支持顺丰快递"))}),c(".dispatch-time").on("touchend","li",function(){q("deliveryTimeId",c(this).data("id"))}),c(".coin").on("touchend",function(){var e=c(this);e.find(".checkbox").hasClass("icon-cb-checked")?(q("yohoCoin",e.data("yoho-coin")),e.find(".can-use").hide()):(q("yohoCoin",0),e.find(".coin-check em").hide(),e.find(".can-use").show(),e.find(".used").hide()),a()}),v.on("touchend",function(){var e=c(this);q("invoice",e.find(".checkbox").hasClass("icon-cb-checked"))}),v.find('[name="invoice-title"]').on("blur",function(){q("invoiceText",c(this).val())}).end().find(".invoice-type").on("change",function(){q("invoiceType",c(this).val())}),c("#msg").find("textarea").on("blur",function(){q("msg",c(this).val())}),c(".pay-mode").on("click","li",function(){var e=c(this);q("paymentTypeId",e.data("pay-id")),q("paymentType",e.data("pay-type")),d=e.data("pay-type"),i()}),c("form").on("submit",function(){return!1})}),define("js/cart/select-coupon",["jquery","handlebars","source-map","mlellipsis","hammer"],function(e,o,t){function n(){var e=r(".null"),o=r(".nav-title").height(),t=e.height();return 0===e.length?!1:void e.css({top:w/2-t/2+o})}function a(e){var o=[];return r.isArray(e)?(e.length<10&&(f=!1),e.length||2!==p?(r.each(e,function(e,t){t.notAvailable&&o.push(t)}),r("#coupon-list").append(m({coupons:e})),o.length&&r(".not-avaliable-coupon-line").show(),r("#coupon-list-not").append(g({notAvailableCoupons:o})),void window.rePosFooter()):(r(".coupin-wrap").html(r("#tmpl-no-coupon").html()),void n())):void p--}function i(){f&&(s||(c.showLoadingMask(),p+=1,s=!0,r.ajax({type:"POST",url:"/cart/index/couponList",dataType:"json",data:{page:p}}).then(a).fail(function(){p-=1,u.show("加载优惠券失败")}).always(function(){s=!1,c.hideLoadingMask()})))}var s,r=e("jquery"),d=e("handlebars"),l=e("mlellipsis"),c=e("js/plugin/loading"),u=e("js/plugin/tip"),h=e("js/cart/order-info").orderInfo,p=1,f=!0,m=d.compile(r("#tmpl-coupon").html()),g=d.compile(r("#tmpl-coupon-not-avaliable").html()),v=r("#new-coupon"),w=r(window).height();e("js/common"),l.init(),v.on("submit",function(){var e=r(this);return e.find('[name="couponCode"]').val()?(r.ajax({method:"POST",url:"/cart/index/couponSearch",data:e.serialize()}).then(function(e){200===e.code?(u.show("优惠券可用"),h("couponCode",e.data.coupon_code),h("couponName",e.data.coupon_title),window.location.href="/cart/index/orderEnsure"):u.show(e.message||"网络错误")}).fail(function(){u.show("网络错误")}),!1):(u.show("请输入优惠券码"),!1)}),r("#coupon-list").on("click",".employ-main",function(){var e=r(this),o=e.data("coupon-code");r.ajax({method:"POST",url:"/cart/index/couponSearch",data:{couponCode:o}}).then(function(e){200===e.code?(h("couponCode",e.data.coupon_code),h("couponName",e.data.coupon_title),window.location.href="/cart/index/orderEnsure"):u.show(e.message||"网络错误")}).fail(function(){u.show("网络错误")})}).on("touchstart",".employ-main",function(){var e=r(this);e.siblings().removeClass("focus"),e.addClass("focus")}).on("touchend touchcancel",".employ-main",function(){var e=r(this);e.siblings().removeClass("focus"),e.removeClass("focus")}),r("body").on("touchend",".not-use",function(){h("couponCode",null),h("couponName",null)}),v.find("input").on("input",function(){""!==r(this).val()?v.find(".submit").css("background","#444"):v.find(".submit").css("background","#b0b0b0")}),i()}),define("js/cart/select-address",["jquery","hammer"],function(e,o,t){var n,a=e("jquery"),i=e("js/cart/order-info").orderInfo,s=a(".confim-mask");e("js/common"),a(".address-item").on("touchend",function(){var e=a(this),o=e.data("address-id"),t={address_id:e.data("address-id"),consignee:e.find(".name").text(),mobile:e.find(".tel").text(),address_info:e.find(".address-info").text(),is_support:e.data("is-support")};i("addressId",o),i("address",t)}).on("touchend",".edit",function(){return window.location.href=a(this).data("href"),!1}).on("touchstart",".del",function(){n=a(this).data("id")}),s.on("touchend",".confim",function(){i("addressId")===n&&(i("addressId",null),i("address",null))})});