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