product.vip.js
10.9 KB
webpackJsonp([5],[function(e,t,n){var o=n(13);o.start()},,function(e,t,n){function o(e,t){var n,o;"undefined"!=typeof e&&(n=e.toString(),o=t&&t>0?t:2e3,i.text(n).show(),a=setTimeout(function(){"block"===i.css("display")&&i.hide()},o))}var i,a,s=n(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),i=s("#yoho-tip"),i.on("touchend",function(){i.hide(),clearTimeout(a)})}(),t.show=o},function(e,t,n){function o(e){var t,n,o=document.cookie;return document.cookie&&""!==document.cookie&&(n=o.indexOf(e+"="),n>-1&&(n+=e.length+1,t=decodeURIComponent(f.trim(o.substring(n,o.indexOf(";",n)))))),t}function i(e,t,n){var o,i,a,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()),o=n.path?"; path="+n.path:"",i=n.domain?"; domain="+n.domain:"",a=n.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,o,i,a].join(""))}function a(){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=o("_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=o("_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=[],o=window.location.search.slice(1).split("&");for(t=0;t<o.length;t++)e=o[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"),o=s();c(),0===o?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()+'">'+o[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,o,i){var a=t.createElement(n),s=t.getElementsByTagName(n)[0];e.YohoAcquisitionObject=i,e[i]=function(){e[i].p=arguments},a.async=1,a.src=o,s.parentNode.insertBefore(a,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,n=0,o="webkit moz ms o".split(" "),i=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(t=0;t<o.length&&(!i||!a);t++)e=o[t],i=i||window[e+"RequestAnimationFrame"],a=a||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];i&&a||(i=function(e){var t=(new Date).getTime(),o=Math.max(0,16-(t-n)),i=window.setTimeout(function(){e(t+o)},o);return n=t+o,i},a=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=i,window.cancelAnimationFrame=a}(),f.extend({queryString:h}),11===g.find(".user-name").text().length&&g.find(".user-name").html(u(g.find(".user-name").text())),window.cookie=o,window.setCookie=i,window.isCookiesEnabled=a,window.getUser=s,window.getUid=r,window.getShoppingKey=d,window.rePosFooter=c,window.reMarginFooter=l,window.queryString=h()},,,function(e,t,n){function o(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 i(){c||(o(),c=!0),s.removeClass("hide")}function a(){s.addClass("hide")}var s,r=n(1),d=r(".yoho-page"),c=!1;t.init=o,t.showLoadingMask=i,t.hideLoadingMask=a,t.show=i,t.hide=a},,,function(e,t,n){var o=n(1),i={};o(".query-param").each(function(){var e=o(this);i[e.data("attr")]=e.val()}),e.exports=i},function(e,t,n){var o=n(1),i=o("#suspend-cart");o.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&&o(".cart-count").remove(),i.find(".cart-count").html(t).removeClass("hide"))}})},function(e,t,n){function o(){u.addClass("hide")}function i(){u.removeClass("hide")}function a(){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,o=e.closest(".sub-classify"),i=o.siblings(".shower");return e.hasClass("chosed")?o:(o.children(".chosed").removeClass("chosed"),e.addClass("chosed"),t=g.trim(e.html()),n=g.trim(i.html()),i.html(n.substring(0,n.indexOf("</span>")+7)+t.substring(0,t.indexOf("<i"))),0===e.index()?i.addClass("default"):i.removeClass("default"),o)}function c(e){var t,n=e.data("id");t=d(e),f&&f({type:t.data("type"),id:n}),p&&p(),o()}function l(e){var t;f=e.fCbFn,p=e.hCbFn,window.missStatus=e.missStatus,a(),s(),u=g(".filter-mask"),u[0]&&(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))):(o(),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=i,t.hideFilter=o,t.resetFilter=h},,function(e,t,n){function o(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),n=window.location.search.substr(1).match(t);return null!==n?n[2]:null}function i(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 a(e,t,n){var o,a,s,r,h,p={};if(!c){if(e&&!n){for(a in S)S.hasOwnProperty(a)&&(S[a].reload=!0);switch(E.children(".active").removeClass("active"),q.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"p_d":o={p_d:e.id}}l.extend(_,o)}if(l.extend(t||{},_),r=i(q),s=S[r||"all"],h=s.page+1,s.reload)h=1;else if(s.end)return;t?(d=t,l.extend(p,t,{type:r,order:s.order,page:h})):(d=null,l.extend(p,_,{type:r,order:s.order,page:h})),c=!0,g.showLoadingMask(),l.ajax({type:"GET",url:"/product/sale/search",data:p,success:function(e){var t,n;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"))):(n=t.find(".good-info").length,t.append(e),u(t.find(".good-info:gt("+(n-1)+") .lazy")))),s.reload=!1,s.page=h,c=!1,g.hideLoadingMask(),window.rePosFooter(),l(".good-detail-text .name").each(function(){var e=l(this),t=e.find("a");t[0].mlellipsis(2)})},error:function(){f.show("网络断开连接了~"),c=!1,g.hideLoadingMask()}})}}function s(){l.ajax({type:"GET",url:"/product/sale/filter",data:_,success:function(e){m.append(e),p.initFilter({fCbFn:a,hCbFn:function(){q.addClass("active"),q.siblings(".filter").removeClass("active")},missStatus:!0})}})}function r(){var e=l(window).scrollTop();e>T&&e+x>l(document).height()-.25*m.height()-50&&"undefined"!=typeof q&&(d?a({type:"category"},d,!0):a()),T=e}var d,c,l=n(1),h=n(8),u=n(7),f=n(2),p=n(11),g=n(6),m=l("#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=l(window).height(),F='<p class="no-result">未找到相关搜索结果</p>',T=0,_=n(9),E=l("#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=E.find(".active");n(10),n(3),h.init(),u(l("img.lazy")),l(".sale-vip-page").length>0?_.saleType=2:l(".discount-detail-page").length>0&&(_.saleType=3,_.productPool=l(".discount-detail-page").data("product-pool")||""),l.extend(_,{yh_channel:o("channel")||"all"}),0===l(".outlet-index-page").length&&s(),u(l(".lazy")),E.bind("contextmenu",function(){return!1}),E.on("touchend touchcancel",function(e){var t,n,o,s=l(e.target).closest("li");if(e.preventDefault(),"undefined"!=typeof s&&0!==s.length){if(s.hasClass("filter"))s.hasClass("active")?(p.hideFilter(),q.addClass("active"),s.removeClass("active")):(q=s.siblings(".active"),q.removeClass("active"),s.addClass("active"),p.showFilter());else{if(n=i(s),t=S[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"),q=s,t.reload=!0,t.order=0===t.order?1:0)}else{if(o=s.siblings(".active"),q=s,o.hasClass("filter"))p.hideFilter();else switch(m.children(".container:not(.hide)").addClass("hide"),n){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")}o.removeClass("active"),s.addClass("active")}t.reload&&a()}e.stopPropagation()}}),l(window).scroll(function(){0===l(".outlet-index-page").length&&window.requestAnimationFrame(r)}),E.on("touchstart","li",function(){l(this).addClass("bytouch")}).on("touchend touchcancel",function(){E.find("li").removeClass("bytouch")}),e.exports={start:a}}]);