product.discount-detail.js
11.5 KB
webpackJsonp([4],[function(e,t,n){var i=n(1),o=n(6),a=n(24),s=n(11);s.start(),o(i("img.lazy")),a()},,function(e,t,n){function i(e,t){var n,i;"undefined"!=typeof e&&(n=e.toString(),i=t&&t>0?t:2e3,o.text(n).show(),a=setTimeout(function(){"block"===o.css("display")&&o.hide()},i))}var o,a,s=n(1);!function(){var e='<div id="yoho-tip" class="yoho-tip"></div>';s(".yoho-page").append(e),o=s("#yoho-tip"),o.on("touchend",function(){o.hide(),clearTimeout(a)})}(),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 o(e,t,n){var i,o,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()),i=n.path?"; path="+n.path:"",o=n.domain?"; domain="+n.domain:"",a=n.secure?"; secure":"",document.cookie=[e,"=",encodeURIComponent(t),r,i,o,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=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!==m.length&&(e=Math.min(f(window).height(),window.screen.availHeight),f("body").height()<=e-parseInt(m.css("height"),0)?m.addClass("bottom"):m.removeClass("bottom"))}function l(e){var t=f(e).outerHeight();e&&m.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),g=n(4),m=f("#yoho-footer"),p=f(".yoho-page"),v=f(".yoho-header");!function(){var e,t=m.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 g(n[0]),e.on("tap",function(e){return f(window).scrollTop(0),e.srcEvent.preventDefault(),!1})),m.removeClass("hide")}(),function(e,t,n,i,o){var a=t.createElement(n),s=t.getElementsByTagName(n)[0];e.YohoAcquisitionObject=o,e[o]=function(){e[o].p=arguments},a.async=1,a.src=i,s.parentNode.insertBefore(a,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")}),p.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(" "),o=window.requestAnimationFrame,a=window.cancelAnimationFrame;for(t=0;t<i.length&&(!o||!a);t++)e=i[t],o=o||window[e+"RequestAnimationFrame"],a=a||window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"];o&&a||(o=function(e){var t=(new Date).getTime(),i=Math.max(0,16-(t-n)),o=window.setTimeout(function(){e(t+i)},i);return n=t+i,o},a=function(e){window.clearTimeout(e)}),window.requestAnimationFrame=o,window.cancelAnimationFrame=a}(),f.extend({queryString:h}),11===m.find(".user-name").text().length&&m.find(".user-name").html(u(m.find(".user-name").text())),window.cookie=i,window.setCookie=o,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 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 o(){c||(i(),c=!0),s.removeClass("hide")}function a(){s.addClass("hide")}var s,r=n(1),d=r(".yoho-page"),c=!1;t.init=i,t.showLoadingMask=o,t.hideLoadingMask=a,t.show=o,t.hide=a},,function(e,t,n){var i=n(1),o={};i(".query-param").each(function(){var e=i(this);o[e.data("attr")]=e.val()}),e.exports=o},function(e,t,n){var i=n(1),o=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(),o.find(".cart-count").html(t).removeClass("hide"))}})},function(e,t,n){function i(){u.addClass("hide")}function o(){u.removeClass("hide")}function a(){var e=m(".filter-body .classify");e.on("touchstart",".shower",function(){e.removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel",".shower",function(){m(this).removeClass("highlight")})}function s(){var e=m(".filter-body .sub-item");e.on("touchstart",function(){e.removeClass("highlight"),m(this).addClass("highlight")}).on("touchend touchcancel",function(){m(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"),o=i.siblings(".shower");return e.hasClass("chosed")?i:(i.children(".chosed").removeClass("chosed"),e.addClass("chosed"),t=m.trim(e.html()),n=m.trim(o.html()),o.html(n.substring(0,n.indexOf("</span>")+7)+t.substring(0,t.indexOf("<i"))),0===e.index()?o.addClass("default"):o.removeClass("default"),i)}function c(e){var t,n=e.data("id");t=d(e),f&&f({type:t.data("type"),id:n}),g&&g(),i()}function l(e){var t;f=e.fCbFn,g=e.hCbFn,window.missStatus=e.missStatus,a(),s(),u=m(".filter-mask"),t=new p(u[0]),t.on("tap",function(e){var t,n=m(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(),g&&g())})}function h(){"undefined"!=typeof u&&(m(".sub-classify").each(function(){d(m(this).children(":first-child"))}),r(m(".classify > :first-child")))}var u,f,g,m=n(1),p=n(4);t.initFilter=l,t.showFilter=o,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 o(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){var n,i,a,s,l,f={};if(!d){if(e){for(i in S)S.hasOwnProperty(i)&&(S[i].reload=!0);switch(M.children(".active").removeClass("active"),_.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(F,n)}if(c.extend(t||{},F),s=o(_),a=S[s||"all"],l=a.page+1,a.reload)l=1;else if(a.end)return;t?(r=t,c.extend(f,t,{type:s,order:a.order,page:l})):(r=null,c.extend(f,F,{type:s,order:a.order,page:l})),d=!0,g.showLoadingMask(),c.ajax({type:"GET",url:"/product/sale/search",data:f,success:function(e){var t,n;switch(s){case"newest":t=p;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?(a.end=!0,a.reload&&t.html(x)):("category"===s&&(a.page=1),a.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")))),a.reload=!1,a.page=l,d=!1,g.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,g.hideLoadingMask()}})}}function s(){var e=c(window).scrollTop();e>T&&e+k>c(document).height()-.25*m.height()-50&&"undefined"!=typeof _&&(r?a({type:"category"},r):a()),T=e}var r,d,c=n(1),l=n(10),h=n(6),u=n(2),f=n(9),g=n(5),m=c("#goods-container"),p=m.find(".new-goods"),v=m.find(".discount-goods"),w=m.find(".price-goods"),y=m.find(".all-goods"),C=m.find(".category-goods"),b=m.find(".sale-goods"),k=c(window).height(),x='<p class="no-result">未找到相关搜索结果</p>',T=0,F=n(7),M=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,fuck:!0,page:0,end:!1}},_=M.find(".active");n(8),n(3),l.init(),h(c("img.lazy")),c(".sale-vip-page").length>0?F.saleType=2:c(".discount-detail-page").length>0&&(F.saleType=3,F.productPool=c(".discount-detail-page").data("product-pool")||""),c.extend(F,{yh_channel:i("channel")||"all"}),c.ajax({type:"GET",url:"/product/sale/filter",data:F,success:function(e){m.append(e),f.initFilter({fCbFn:a,hCbFn:function(){_.addClass("active"),_.siblings(".filter").removeClass("active")},missStatus:!0})}}),h(c(".lazy")),M.bind("contextmenu",function(){return!1}),M.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(),_.addClass("active"),s.removeClass("active")):(_=s.siblings(".active"),_.removeClass("active"),s.addClass("active"),f.showFilter());else{if(n=o(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"),_=s,t.reload=!0,t.order=0===t.order?1:0)}else{if(i=s.siblings(".active"),_=s,i.hasClass("filter"))f.hideFilter();else switch(m.children(".container:not(.hide)").addClass("hide"),n){case"newest":p.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&&a()}e.stopPropagation()}}),c(window).scroll(function(){window.requestAnimationFrame(s)}),M.on("touchstart","li",function(){c(this).addClass("bytouch")}).on("touchend touchcancel",function(){M.find("li").removeClass("bytouch")}),e.exports={start:a}},,,,,,,,,,,,,function(e,t,n){function i(e){var t="",n=0,i=0,o=0,s=0;e.timeDom.each(function(r,d){t="",e.endTime[r]=e.endTime[r]-e.aSecond,e.endTime[r]>e.aSecond?(n=Math.floor(e.endTime[r]/e.anHour/24),i=Math.floor(e.endTime[r]/e.anHour%24),o=Math.floor(e.endTime[r]/e.aMinute%60),s=Math.floor(e.endTime[r]/e.aSecond%60),t+=n>0?n+"天":"",t+=i>0?i+"小时":"",t+=o+"分钟",t+=s>0?s+"秒":"",""!==t.length&&(t="剩"+t),a(d).find("span").html(t),a(d).fadeIn()):a(d).hide()})}function o(e){a.extend(d,e||{}),setInterval(function(){i(d)},1e3)}var a=n(1),s=a(".activity-time"),r=s?s.data("time-ms"):"",d={anHour:3600,aMinute:60,aSecond:1,timeDom:s,endTime:[r]};e.exports=o}]);