\n
\n

\n
\n \n '+t.name+'
\n ¥'+formatMoney(t.flash_price,"cent").short+'\n ¥'+formatMoney(t.origin_price,"cent").short+"
\n ");if(t.to_fetch){var i=d({url:"http://m.xiaomiyoupin.com/shop/detail?gid="+t.gid+"&pid="+t.pid,$dom:this.$dom,traceAppend:[t.pid],uid:!1});o.attr("href",i)}else o.append('\n 已抢完\n
');return ua.pc?o.css("zoom","1.3"):ua.iOS&&o.css("zoom","1.1"),o}},{key:"renderPage",value:function(t,o){for(var i=$(''),e=0;e'),n=e;no.name?1:-1:t.ctime-o.ctime});var s={};n.forEach(function(t){t.total<=0&&(t.total=1),t.to_fetch<0&&(t.to_fetch=0),t.to_fetch>t.total&&(t.to_fetch=t.total),1e3*t.start_time>e&&(t.to_fetch=t.total),s[t.start_time]||(s[t.start_time]=[]),s[t.start_time].push(t)});var l=Object.keys(s).sort(function(t,o){return 1*t-1*o}).map(function(t){return 1*t}),h=void 0,g=void 0;l.some(function(t,o){if(o===l.length-1)h||(h=l[o]);else{var i=l[o+1];if(0===o&&t>a)return g=t,!0;t<=a&&i>a&&(h=t,g=i)}});var p=function(t){var i=[];return t.length<=o.props.cnt?t:(t.forEach(function(t){t.to_fetch>0&&i.length=o)&&(a.push(t),!0)}),a.join(",")}var n={unit:"元",name:"",src:"",descr:"",price:"",marketPrice:"",showMarketPrice:"",showTag:t.showTag};if(o.attr_ext){var r=o.attr_ext;(1===r.price_tag||t.daiqi)&&(n.unit="元起"),r.custom_name&&!t.name&&(n.name=r.custom_name),r.custom_summary&&!t.descr&&(n.descr=r.custom_summary)}return n.name||(n.name=t.name||o.name),t.src?n.src=t.src:"限时购"===t.mode||t.showWhiteProductImage?n.src=o.pic_url:n.src=o.album[0],n.descr||(t.descr?n.descr=t.descr:i?n.descr=a(o.summary,18):n.descr=o.summary),o.market_price||(o.market_price=o.price_min),t.price&&(o.price_min=Math.round(100*t.price)),t.priceOriginal&&(o.market_price=Math.round(100*t.priceOriginal)),n.price=e(o.price_min,"cent").short,n.marketPrice=e(o.market_price,"cent").short,n.showMarketPrice=1*o.price_min<1*o.market_price,n.downPriceValue=o.market_price-o.price_min,n.downPrice=e(n.downPriceValue,"cent").short,n.downPriceText="直降"+n.downPrice+"元",n.discountText=""+Math.ceil(o.price_min/o.market_price*100)/10,n.discountText=""+n.discountText.replace(/\.\d+/,function(t){return t.slice(0,2)}).replace(/\.0/,""),n}function e(t,o){t(".unit").text(o.unit),t(".product-name").html(o.name),t(".product-descr").html(o.descr),t(".price-wrap .num").text(o.price),o.showMarketPrice&&(t(".price-wrap-market").show(),t(".price-wrap-market .num").text(o.marketPrice),o.showTag&&t(".link-wrap>.tag").show().text(o.downPriceText));var i=t('[data-editor-tag-name="horizontal_border_label"]'),e=t('[data-editor-tag-name="circle-background-double-line"]'),a=i.find(".tag-content"),n=e.find(".tag-content");if(i.length&&o.showMarketPrice&&(a.text()||(a.text(o.downPriceText),i.children().show())),e.length&&o.showMarketPrice&&!n.text().trim())if(e.find('[data-auto-mode="××折"]').length)n.html(''+o.discountText+'折
'),e.children().show();else{var r="";o.downPriceValue>1e5&&(r="#ffea00"),n.html('直降
'+o.downPrice+"
"),e.children().show()}}function a(t){function o(t,o){return t.length-1&&(a[o]=t.name)})});var n=void 0;return n=void 0!==t.onsale?t.onsale?1:0:parseInt(t.inventory),{map_id:t.map_id,pid:t.pid,type:a,price:t.price,inventory:n,image_url:t.img,origin_price:parseInt(t.market_price),name:t.name}}),n={price:p(o.detail.data.good.price_min,"cent").short,productName:o.detail.data.good.name,image_url:o.detail.data.good.pic_url};return{info:n,type:e,list:a}}function a(t,o){var e=void 0,a=void 0;parseInt(t)>1e8?(e={model:"Cart",action:"add",parameters:{product_id:t,consumption:"1"}},a=l({url:w,$dom:i})):(e={model:"Cart",action:"add",parameters:{pid:t,num:"1"}},a=l({url:_,$dom:i})),c({detail:e},function(t){t.detail.code?toast(h(t.detail)||"加入购物车失败"):(v.emit("add-cart-success"),m.app?toast("加入购物车成功"):toast("已加入购物车,请前往有品App结算"),o&&o())},!1,a)}function n(){function o(t){r(".bottom").hide(),r('.bottom[data-mode="'+t+'"]').show()}function e(){function t(t,o){for(var i in o)if(t.type[i]!=o[i])return!1;return!0}var i={};r(".tag.active").each(function(){var t=$(this),o=t.parent().data("type-name"),e=t.text().trim();i[o]=e});for(var e in i)r(".tag:not(.active)").addClass("disabled");var a=void 0;b.list.forEach(function(o){if(t(o,i)){a=o;for(var e in o.type)i[e]||r('[data-type-name="'+e+"\"] .tag[data-tag='"+o.type[e]+"']").removeClass("disabled")}});var n=function(o){var e=Object.assign({},i);delete e[o],b.list.forEach(function(i){t(i,e)&&r('[data-type-name="'+o+'"] [data-tag="'+i.type[o]+'"]').removeClass("disabled")})};for(var e in i)n(e);Object.keys(i).length===Object.keys(b.type).length&&a?(r(".title").text(a.name),r(".price").text("¥"+p(a.price,"cent").short),r(".product-img").attr("src",a.image_url),h=a,o(a.inventory?"ready":"gone")):(r(".title").text(b.info.productName),r(".price").text("¥"+b.info.price),r(".product-img").attr("src",b.info.image_url),h=void 0,o("wait"))}var n=$(d(b.info.productName,b.info.price,b.info.image_url)),r=n.find.bind(n),c=function(t){var o=b.type[t],i=$(s(t));r(".layer>main").append(i),o.forEach(function(t){i.find("main").append($(g(t)))})};for(var l in b.type)c(l);var h=void 0;r(".add-cart").on("tap",function(){a(h.pid||h.mapId)});var v=void 0;r(".go-checkout").on("tap",function(){var o=i;if(!h)return void toast("请先选中商品");if(h.pid){if(h.map_id&&"0"!==h.map_id)return v(),void u("https://m.xiaomiyoupin.com/shop/detail?gid="+t.gid+"&pid="+h.pid,{$dom:o});m.app?(v(),u("https://m.xiaomiyoupin.com/shop/check?quickOrder=2&pid="+h.pid,{$dom:o})):(v(),u("https://m.xiaomiyoupin.com/shop/checkshop/check?quickOrder=2&pid="+h.pid,{$dom:o}))}else a(h.mapId,function(){v(),u("https://m.xiaomiyoupin.com/shop/cart",{$dom:o})})}),e();var w=m.pc?"mousedown":"touchstart";n.on(w,".tag",function(){var t=$(this),o=t.parent();t.hasClass("disabled")||(t.hasClass("active")?(t.inactive(),o.inactive()):(t.active(),o.active(),t.siblings().inactive()),e())});var _=f(n,function(){},!1,!0,!0);v=_.exit,n.parent().css({left:0,right:0,"max-width":"none"})}var d=function(t,o,i){return'\n
\n
\n \n

\n
\n \n \n
\n \n
\n
\n
\n
\n
\n'},s=function(t){return'\n'},g=function(t){return' \n '+t+" \n\n"},b={};if(t.gid){if(window.isEditor)return;r(t.gid,function(t){Object.assign(b,e(t))})}else b=t.config;o(function(){var t=0;return b.list?(b.list.forEach(function(o){o.inventory&&o.inventory>0&&t++}),void(t?b.list.length>1?n():a(b.list[0].pid):toast("商品已售罄"))):void getLogin().then(function(t){t?toast("数据加载中..."):jumptoLogin()})})}function r(t,o){k&&clearTimeout(k),C.push({gid:t,cb:o}),k=setTimeout(function(){var t=C.slice(0);C.length=0,k=0;var o={};t.forEach(function(t){var i=t.gid;o[i]={model:"Shopv2",action:"getDetail",parameters:{gid:i}}}),c(o,function(o){var i=function(i){t.forEach(function(t){var e=t.gid,a=t.cb;i==e&&a({detail:o[i]})})};for(var e in o)i(e)},function(t){toast("获取商品信息失败"),console.warn(t)},b(w,"editor-cache",""+Math.floor(Date.now()/36e5)),!0)})}var d=t("util"),c=d.miFetch,s=d.PIPE_URL,l=d.getTracedUrl2,h=d.getChineseMessage,g=d.GPIPE_URL,p=d.formatMoney,m=d.ua,u=d.jumpTo,f=d.showBottomWindow,b=d.addParam,v=d.eventEmitter,w=s.replace("static.",""),_=g.replace("static.",""),y="map_id_add_cart-floating-layer",k=void 0,C=[];o.exports={getFinalInfo:i,renderFinalInfo:e,getRemainTime:a,initBottomWindow:n,getDetail:r}}(a,t),t.exports&&(d["/cloud/module/product_big/util.js"]=t.exports)}(),s="/cloud/module/product_big/product_big.action.js",function(){var t={type:"resource"};!function(t,i){var e=t("util"),a=e.formatMoney,n=e.ua,d=e.setTrace,c=e.addParam,s=e.miFetch,l=t("/cloud/module/product_big/util.js"),h=l.getFinalInfo,g=l.renderFinalInfo,p=l.getRemainTime,m=l.initBottomWindow,u=void 0,f=[];i.exports=function(){function t(i,e){o(this,t),this.init(i,e)}return r(t,[{key:"init",value:function(o,i){var e=this,r=$("[data-id="+i+"]"),c=r.find.bind(r);this.$$=c,this.$dom=r;var s=o.gid;if(s){n.pc&&1===window.devicePixelRatio&&r.find(".top-a-wrap").css("border","1px solid rgb(204,204,204)");var l=c("a.product-big-img-link"),p=c("a.buy-btn-wrap");o.startTime&&o.startTime>Date.now()/1e3&&this.initTimer(),o.href?(l.attr("href",o.href),p.attr("href",o.href)):(l.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s),p.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s)),d(l),d(p),c(".bottom-btn").on("tap",function(){window.countEvent&&window.countEvent("button",this)}),"加入购物车"===o.btn&&m(o,function(t){c(".bottom-btn.cart-btn").on("tap",t)},r);var u=r.parent().is('[data-name="horizontal_layout"],[data-name="test_container"],[data-name="horizontal_scroll_container"],.horizontal_scroll_container_body');this.isSmall=u;var f=r.find(".normal-mode"),b=$(".top-wrap");return n.android&&b.addClass("android"),n.iOS&&b.addClass("iOS"),n.pc&&b.addClass("pc"),u?f.addClass("thin"):f.addClass("big"),o.static?(g(c,o.finalInfo),void setTimeout(this.afterRender.bind(this))):void t.getDetail(s,function(t){var i=t.detail.data;if(!i)return void console.warn("gid error",s);var n=h(o,i.goods,u,a);g(c,n),e.afterRender()})}}},{key:"initTimer",value:function(){function t(t){i.text(p(t))}var o=this.$$,i=o(".bottom-btn"),e="倒计时",a=o(".bottom-btn-wrap"),n=i.html();a.css({"pointer-events":"none",cursor:"not-allowed"});var r=config.startTime-Date.now()/1e3,d=r/3600/24;d>1?(i.text(""+e+Math.floor(d)+"天"),i.addClass("left-days")):!function(){i.addClass("left-time");var o=Math.ceil(config.startTime-Date.now()/1e3);t(o);var e=setInterval(function(){o--,o?t(o):(clearInterval(e),i.html(n).removeClass("left-days").removeClass("left-time"),a.css({"pointer-events":"all",cursor:"pointer"}))},1e3)}()}},{key:"afterRender",value:function(){function t(){var t=i.parent()[0].containerAdjustHeight;t&&t()}function o(){r&&r.css("position","static").removeClass("loading"),n.removeClass("loading").css({"min-height":"0px"}),a?n.css("padding-top","100%"):n.css("padding-top","0px")}var i=this.$dom,e=this.$$,a=this.isSmall,n=e(".product-big-img-link"),r=e(".product");t(),r.length?r[0].naturalWidth?o():r.on("load",o):o()}}],[{key:"getDetail",value:function(t,o){u&&clearTimeout(u),f.push({gid:t,cb:o}),u=setTimeout(function(){var t=f.slice(0);f.length=0,u=0;var o={};t.forEach(function(t){var i=t.gid;o[i]={model:"Product",action:"GetDetail",parameters:{gid:i}}}),s(o,function(o){var i=function(i){t.forEach(function(t){var e=t.gid,a=t.cb;i===""+e&&a({detail:o[i]})})};for(var e in o)i(e)},function(t){toast("获取商品信息失败"),console.warn(t)},c("//m.xiaomiyoupin.com/app/shopv3/pipe","editor-cache",""+Math.floor(Date.now()/36e5)),!0)},100)}}]),t}()}(a,t),t.exports&&(d["/cloud/module/product_big/product_big.action.js"]=t.exports)}(),s="/cloud/module/product_medium/product_medium.action.js",function(){var t={type:"resource"};!function(t,o){function i(t,o){c&&clearTimeout(c),s.push({gid:t,cb:o}),c=setTimeout(function(){var t=s.slice(0);s.length=0,c=0;var o={};t.forEach(function(t){var i=t.gid;o[i]={model:"Product",action:"GetDetail",parameters:{gid:i}}}),miFetch(o,function(o){var i=function(i){t.forEach(function(t){var e=t.gid,a=t.cb;i===""+e&&a({detail:o[i]})})};for(var e in o)i(e)},function(t){toast("获取商品信息失败"),console.warn(t)},addParam("//m.xiaomiyoupin.com/app/shopv3/pipe","editor-cache",""+Math.floor(Date.now()/36e5)),!0)},100)}var a=t("/cloud/module/product_big/util.js"),n=a.getFinalInfo,r=a.renderFinalInfo,d=a.initBottomWindow,c=void 0,s=[];e(function(t,o){function e(){function t(){var t=a.parent()[0].containerAdjustHeight;t&&t()}function o(){l&&l.css("position","static").removeClass("loading"),g.removeClass("loading").css({"min-height":"0px"}),g.css("padding-top","0px")}t(),l.length?l[0].naturalWidth?o():(h.css("min-height",h.width()/1017*451+"px"),l.on("load",o)):o()}var a=$("[data-id="+t+"]"),c=a.find.bind(a),s=o.gid,l=c(".product"),h=c(".product-img-wrap"),g=c(".product-big-img-link"),p=c(".product-big-img-link");s&&(o.href?p.attr("href",o.href):p.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s),setTrace(p),i(s,function(t){var i=t.detail.data,a=n(o,i.goods,!1,formatMoney);r(c,a),e()}),c(".bottom-btn").on("tap",function(){window.countEvent&&window.countEvent("button",this)}),"加入购物车"===o.btn&&c(".bottom-btn").length&&d(o,function(t){c(".bottom-btn.cart-btn").on("tap",t)},a),ua.pc&&c(".top-wrap").addClass("pc"))})}(a,t),t.exports&&(d["/cloud/module/product_medium/product_medium.action.js"]=t.exports)}(),s="/cloud/module/scroll_footer/scroll_footer.action.js",function(){var t={type:"resource"};!function(t,i){var e=t("util"),a=e.eventEmitter,d=e.ua;i.exports=function(){function t(i,e){var n=this;o(this,t);var r=$("[data-id="+e+"]"),c=r.find.bind(r);this.$$=c,this.$dom=r,this.props=i,this.setWidth($("#rags-container").width()),a.on("base-width-change",function(t){n.setWidth(t)});var s=$('');"footer"===i.mode?s.css("bottom","0"):s.css("top","0"),$(document.body).append(s),s.append(r);var l=this;r.on("click","a",function(t){var o=$(this);l.onTap(o),t.preventDefault()}),this.render(),this.setScrolling(!1),d.pc||r.find(".wrap").addClass("hide-scrollbar"),this.updateOffsetHeight()}return r(t,[{key:"updateOffsetHeight",value:function(){this.offsetHeight=this.$dom.height()}},{key:"setScrolling",value:function(t){this.scrolling=t,t?this.$dom.find(".wrap").addClass("prevent"):this.$dom.find(".wrap").removeClass("prevent")}},{key:"active",value:function(t,o){function i(t,o,i){function e(){requestAnimationFrame(function(){var r=Date.now(),d=!1;r>n+i&&(r=n+i,d=!0);var c=Math.sin((r-n)/i*Math.PI/2);c*=o-a,c+=a,t.scrollLeft(c),d?s.setScrolling(!1):e()})}var a=t.scrollLeft(),n=Date.now();e()}var e=this,a=o.preventCheckingScroll;a&&(this.preventCheckingScroll=!0);var n=this.$dom.find(".wrap"),r=$("#rags-container").width(),d=t.offset(),c=d.left+n.scrollLeft()+d.width/2-r/2;c<=0&&(c=0);var s=this;this.setScrolling(!0),i(n,c,300),t.css({color:this.props.colorHighlightText,backgroundColor:this.props.colorHighlightBg});var l=this.$dom.find("a");this.$dom.find(".splitter").remove(),l.forEach(function(o,i){var a=l[i+1]===t[0],n=o===t[0];i===l.length-1||a||n||$(o).append('')})}},{key:"inactive",value:function(t){t.css({color:this.props.colorText,backgroundColor:this.props.colorBg})}},{key:"render",value:function(){var t=this,o=[];this.props.arr.forEach(function(t){var i=t.id,e=$("#"+i);o.push({$dom:e})});var i=$(window),e=!0;i.on("scroll",function(){e=!0});var r=function(){var e=[],r=i.scrollTop();r+=t.offsetHeight-5,o.forEach(function(t,o){var i=t.$dom,a=i.offset();if(a){var n=a.top;e[o]=n}}),e=e.map(function(t,o){var i=1/0;return e.forEach(function(e,a){o!==a&&e>t&&e=e&&ro-1.5*i)||(t(e),!1)})}var e=[];$("img[data-lazy-src]").each(function(){e.push($(this))}),setTimeout(function(){a.scroll(i),i()},500);var a=$(window),n=setInterval(function(){e.length?i():clearInterval(n)},400)}()})