product.sale.js 11.9 KB
webpackJsonp([6],[function(e,t,i){var n=i(1),a=i(11),o=i(8),s=i(18),r=i(7),d=i(12);i(3),d.start(),r(n("img.lazy")),o.init(),n(".swiper-container").each(function(){n(this).find(".swiper-slide").length>1&&new a(n(this).get(0),{lazyLoading:!0,lazyLoadingInPrevNext:!0,loop:!0,autoplay:3e3,autoplayDisableOnInteraction:!0,paginationClickable:!0,pagination:n(this).closest(".banner-top").find(".pagination-inner").get(0)})}),n(function(){var e=n("body"),t=n(".sale-nav-select"),i=n(".vip-floor"),a=n(".sale-nav-wrap"),o=a.find("#list-nav"),d=n(".filter-mask");s.attach(document.body),n(".sale-nav").on("click",function(){t.toggleClass("show")}),n.ajax({url:"/product/sale/search",data:{yh_channel:window.queryString.channel||"boys",saleType:"2",productPool:i.data("id"),limit:"4"}}).then(function(e){/good-info/.test(e)&&(i.html(e).addClass("goods-container"),r(i.find("img.lazy")),n(".good-detail-text .name").each(function(){var e=n(this),t=e.find("a");t[0].mlellipsis(2)}),i.css("padding-bottom","0.75rem"))}),a.css({height:a.height()}),n(window).on("scroll",function(){d.length||(d=n(".filter-mask")),e.scrollTop()>a.offset().top?(o.addClass("fixed"),d.addClass("fixed")):(o.removeClass("fixed"),d.removeClass("fixed"))}).trigger("scroll")})},,function(e,t,i){function n(e,t){var i,n;"undefined"!=typeof e&&(i=e.toString(),n=t&&t>0?t:2e3,a.text(i).show(),o=setTimeout(function(){"block"===a.css("display")&&a.hide()},n))}var a,o,s=i(1);!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(o)})}(),t.show=n},function(e,t,i){function n(e){var t,i,n=document.cookie;return document.cookie&&""!==document.cookie&&(i=n.indexOf(e+"="),i>-1&&(i+=e.length+1,t=decodeURIComponent(f.trim(n.substring(i,n.indexOf(";",i)))))),t}function a(e,t,i){var n,a,o,s,r="";"undefined"!=typeof t&&(i=i||{},null===t&&(t="",i.expires=-1),i.expires&&("number"==typeof i.expires||i.expires.toUTCString)&&("number"==typeof i.expires?(s=new Date,s.setTime(s.getTime()+24*i.expires*60*60*1e3)):s=i.expires,r="; expires="+s.toUTCString()),n=i.path?"; path="+i.path:"",a=i.domain?"; domain="+i.domain:"",o=i.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,n,a,o].join(""))}function o(){var e=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||e||(document.cookie="testcookie",e=-1!==document.cookie.indexOf("testcookie")),e}function s(){var e,t=n("_UID");return"undefined"==typeof t?0:(e=t.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(f(window).height(),window.screen.availHeight),f("body").height()<=e-parseInt(p.css("height"),0)?p.addClass("bottom"):p.removeClass("bottom"))}function c(e){var t=f(e).outerHeight();e&&p.css("margin-bottom",t+"px")}function h(){var e,t,i=[],n=window.location.search.slice(1).split("&");for(t=0;t<n.length;t++)e=n[t].split("="),i.push(e[0]),i[e[0]]=e[1];return i}function u(e){return e.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}var f=i(1),g=i(4),p=f("#yoho-footer"),m=f(".yoho-page"),v=f(".yoho-header");!function(){var e,t=p.children(".op-row"),i=f(".back-to-top"),n=s();l(),0===n?t.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>'):t.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">退出</a>'),i.length>0&&(e=new g(i[0]),e.on("tap",function(e){return f(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),p.removeClass("hide")}(),function(e,t,i,n,a){var o=t.createElement(i),s=t.getElementsByTagName(i)[0];e.YohoAcquisitionObject=a,e[a]=function(){e[a].p=arguments},o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script",("https:"===document.location.protocol?"https":"http")+"://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js","_yas"),function(){var e=r();e=0===e?"":e,window._ozuid=e,window._yas&&window._yas(1*new Date,"1.0.17","yohobuy_m",e,"","")}(),v.on("touchstart","a",function(){v.find("a").removeClass("highlight"),f(this).addClass("highlight")}).on("touchend touchcancel","a",function(){f(this).removeClass("highlight")}),m.on("touchstart",".tap-hightlight",function(){f(this).siblings(".tap-hightlight").removeClass("highlight"),f(this).addClass("highlight")}).on("touchend touchcancel",".tap-hightlight",function(){f(this).removeClass("highlight")}),f(".nav-home").on("touchstart",function(){f(".homebuttom").toggleClass("hide")}),function(){var e,t,i=0,n="webkit moz ms o".split(" "),a=window.requestAnimationFrame,o=window.cancelAnimationFrame;for(t=0;t<n.length&&(!a||!o);t++)e=n[t],a=a||window[e+"RequestAnimationFrame"],o=o||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];a&&o||(a=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-i)),a=window.setTimeout(function(){e(t+n)},n);return i=t+n,a},o=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=a,window.cancelAnimationFrame=o}(),f.extend({queryString:h}),11===p.find(".user-name").text().length&&p.find(".user-name").html(u(p.find(".user-name").text())),window.cookie=n,window.setCookie=a,window.isCookiesEnabled=o,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=l,window.reMarginFooter=c,window.queryString=h()},,,function(e,t,i){function n(e){var t='<div class="loading-mask hide"><div class="loading"><div></div><div></div><div></div></div></div>';l=!0,e||(e=d),e.append(t),s=e.children(".loading-mask"),r("body").on("touchstart touchmove touchend",".loading-mask",function(){return!1})}function a(){l||(n(),l=!0),s.removeClass("hide")}function o(){s.addClass("hide")}var s,r=i(1),d=r(".yoho-page"),l=!1;t.init=n,t.showLoadingMask=a,t.hideLoadingMask=o,t.show=a,t.hide=o},,,function(e,t,i){var n=i(1),a={};n(".query-param").each(function(){var e=n(this);a[e.data("attr")]=e.val()}),e.exports=a},function(e,t,i){function n(){u.addClass("hide")}function a(){u.removeClass("hide")}function o(){var e=p(".filter-body .classify");e.on("touchstart",".shower",function(){e.removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel",".shower",function(){p(this).removeClass("highlight")})}function s(){var e=p(".filter-body .sub-item");e.on("touchstart",function(){e.removeClass("highlight"),p(this).addClass("highlight")}).on("touchend touchcancel",function(){p(this).removeClass("highlight")})}function r(e){e.hasClass("active")||(e.siblings(".active").removeClass("active"),e.addClass("active"))}function d(e){var t,i,n=e.closest(".sub-classify"),a=n.siblings(".shower");return e.hasClass("chosed")?n:(n.children(".chosed").removeClass("chosed"),e.addClass("chosed"),t=p.trim(e.html()),i=p.trim(a.html()),a.html(i.substring(0,i.indexOf("</span>")+7)+t.substring(0,t.indexOf("<i"))),0===e.index()?a.addClass("default"):a.removeClass("default"),n)}function l(e){var t,i=e.data("id");t=d(e),f&&f({type:t.data("type"),id:i}),g&&g(),n()}function c(e){var t;f=e.fCbFn,g=e.hCbFn,window.missStatus=e.missStatus,o(),s(),u=p(".filter-mask"),u[0]&&(t=new m(u[0]),t.on("tap",function(e){var t,i=p(e.target);e.preventDefault(),i.closest(".filter-body").length>0?(t=i.closest(".sub-item"),t.length>0?(t=i.closest("li"),l(t)):(t=i.closest(".classify-item"),e.srcEvent.stopPropagation(),r(t))):(n(),g&&g())}))}function h(){"undefined"!=typeof u&&(p(".sub-classify").each(function(){d(p(this).children(":first-child"))}),r(p(".classify > :first-child")))}var u,f,g,p=i(1),m=i(4);t.initFilter=c,t.showFilter=a,t.hideFilter=n,t.resetFilter=h},,function(e,t,i){function n(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),i=window.location.search.substr(1).match(t);return null!==i?i[2]:null}function a(e){var t="category";return e.hasClass("new")?t="newest":e.hasClass("price")?t="price":e.hasClass("discount")?t="discount":e.hasClass("sale")?t="sale":e.hasClass("all")?t="all":e.hasClass("category")&&(t="category"),t}function o(e,t,i){var n,o,s,r,h,g={};if(!l){if(e&&!i){for(o in S)S.hasOwnProperty(o)&&(S[o].reload=!0);switch(_.children(".active").removeClass("active"),q.addClass("active"),e.type){case"gender":n={gender:e.id};break;case"ageLevel":n={age_level:e.id};break;case"brand":n={brand:e.id};break;case"sort":n={sort:e.id};break;case"color":n={color:e.id};break;case"size":n={size:e.id};break;case"price":n={price:e.id};break;case"discount":n={discount:e.id};break;case"p_d":n={p_d:e.id}}c.extend(z,n)}if(c.extend(t||{},z),r=a(q),s=S[r||"all"],h=s.page+1,s.reload)h=1;else if(s.end)return;t?(d=t,c.extend(g,t,{type:r,order:s.order,page:h})):(d=null,c.extend(g,z,{type:r,order:s.order,page:h})),l=!0,p.showLoadingMask(),c.ajax({type:"GET",url:"/product/sale/search",data:g,success:function(e){var t,i;switch(r){case"newest":t=v;break;case"price":t=y;break;case"discount":t=w;break;case"sale":t=k;break;case"all":t=C;break;case"categroy":t=b;break;default:t=C}t.hasClass("hide")&&(t.siblings().addClass("hide"),t.removeClass("hide")),""===e?(s.end=!0,s.reload&&t.html(F)):("category"===r&&(s.page=1),s.reload?(t.html(e),u(t.find(".lazy"))):(i=t.find(".good-info").length,t.append(e),u(t.find(".good-info:gt("+(i-1)+") .lazy")))),s.reload=!1,s.page=h,l=!1,p.hideLoadingMask(),window.rePosFooter(),c(".good-detail-text .name").each(function(){var e=c(this),t=e.find("a");t[0].mlellipsis(2)})},error:function(){f.show("网络断开连接了~"),l=!1,p.hideLoadingMask()}})}}function s(){c.ajax({type:"GET",url:"/product/sale/filter",data:z,success:function(e){m.append(e),g.initFilter({fCbFn:o,hCbFn:function(){q.addClass("active"),q.siblings(".filter").removeClass("active")},missStatus:!0})}})}function r(){var e=c(window).scrollTop();e>T&&e+x>c(document).height()-.25*m.height()-50&&"undefined"!=typeof q&&(d?o({type:"category"},d,!0):o()),T=e}var d,l,c=i(1),h=i(8),u=i(7),f=i(2),g=i(10),p=i(6),m=c("#goods-container"),v=m.find(".new-goods"),w=m.find(".discount-goods"),y=m.find(".price-goods"),C=m.find(".all-goods"),b=m.find(".category-goods"),k=m.find(".sale-goods"),x=c(window).height(),F='<p class="no-result">未找到相关搜索结果</p>',T=0,z=i(9),_=c("#list-nav"),S={all:{order:0,reload:!0,page:0,end:!1},newest:{order:0,reload:!0,page:0,end:!1},price:{order:1,reload:!0,page:0,end:!1},discount:{order:1,reload:!0,page:0,end:!1},sale:{order:0,reload:!0,page:0,end:!1},category:{order:0,reload:!0,page:0,end:!1}},q=_.find(".active");i(3),h.init(),u(c("img.lazy")),c(".sale-vip-page").length>0?z.saleType=2:c(".discount-detail-page").length>0&&(z.saleType=3,z.productPool=c(".discount-detail-page").data("product-pool")||""),c.extend(z,{yh_channel:n("channel")||"all"}),0===c(".outlet-index-page").length&&s(),u(c(".lazy")),_.bind("contextmenu",function(){return!1}),_.on("touchend touchcancel",function(e){var t,i,n,s=c(e.target).closest("li");if(e.preventDefault(),"undefined"!=typeof s&&0!==s.length){if(s.hasClass("filter"))s.hasClass("active")?(g.hideFilter(),q.addClass("active"),s.removeClass("active")):(q=s.siblings(".active"),q.removeClass("active"),s.addClass("active"),g.showFilter());else{if(i=a(s),t=S[i],s.hasClass("active")){if(s.hasClass("new")||s.hasClass("sale")||s.hasClass("all"))return;(s.hasClass("price")||s.hasClass("discount"))&&(s.find(".icon > .iconfont").toggleClass("cur"),q=s,t.reload=!0,t.order=0===t.order?1:0)}else{if(n=s.siblings(".active"),q=s,n.hasClass("filter"))g.hideFilter();else switch(m.children(".container:not(.hide)").addClass("hide"),i){case"newest":v.removeClass("hide");break;case"price":y.removeClass("hide");break;case"discount":w.removeClass("hide");break;case"sale":k.removeClass("hide");break;case"all":C.removeClass("hide")}n.removeClass("active"),s.addClass("active")}t.reload&&o()}e.stopPropagation()}}),c(window).scroll(function(){0===c(".outlet-index-page").length&&window.requestAnimationFrame(r)}),_.on("touchstart","li",function(){c(this).addClass("bytouch")}).on("touchend touchcancel",function(){_.find("li").removeClass("bytouch")}),e.exports={start:o}}]);