\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 e=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",e)}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 e=$(''),i=0;i'),n=i;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>i&&(t.to_fetch=t.total),s[t.start_time]||(s[t.start_time]=[]),s[t.start_time].push(t)});var p=Object.keys(s).sort(function(t,o){return 1*t-1*o}).map(function(t){return 1*t}),h=void 0,l=void 0;p.some(function(t,o){if(o===p.length-1)h||(h=p[o]);else{var e=p[o+1];if(0===o&&t>a)return l=t,!0;t<=a&&e>a&&(h=t,l=e)}});var m=function(t){var e=[];return t.length<=o.props.cnt?t:(t.forEach(function(t){t.to_fetch>0&&e.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:e?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=i(o.price_min,"cent").short,n.marketPrice=i(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=i(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 i(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 e=t('[data-editor-tag-name="horizontal_border_label"]'),i=t('[data-editor-tag-name="circle-background-double-line"]'),a=e.find(".tag-content"),n=i.find(".tag-content");if(e.length&&o.showMarketPrice&&(a.text()||(a.text(o.downPriceText),e.children().show())),i.length&&o.showMarketPrice&&!n.text().trim())if(i.find('[data-auto-mode="××折"]').length)n.html(''+o.discountText+'折
'),i.children().show();else{var r="";o.downPriceValue>1e5&&(r="#ffea00"),n.html('直降
'+o.downPrice+"
"),i.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:m(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:i,list:a}}function a(t,o){var i=void 0,a=void 0;parseInt(t)>1e8?(i={model:"Cart",action:"add",parameters:{product_id:t,consumption:"1"}},a=p({url:w,$dom:e})):(i={model:"Cart",action:"add",parameters:{pid:t,num:"1"}},a=p({url:j,$dom:e})),c({detail:i},function(t){t.detail.code?toast(h(t.detail)||"加入购物车失败"):(v.emit("add-cart-success"),g.app?toast("加入购物车成功"):toast("已加入购物车,请前往有品App结算"),o&&o())},!1,a)}function n(){function o(t){r(".bottom").hide(),r('.bottom[data-mode="'+t+'"]').show()}function i(){function t(t,o){for(var e in o)if(t.type[e]!=o[e])return!1;return!0}var e={};r(".tag.active").each(function(){var t=$(this),o=t.parent().data("type-name"),i=t.text().trim();e[o]=i});for(var i in e)r(".tag:not(.active)").addClass("disabled");var a=void 0;b.list.forEach(function(o){if(t(o,e)){a=o;for(var i in o.type)e[i]||r('[data-type-name="'+i+"\"] .tag[data-tag='"+o.type[i]+"']").removeClass("disabled")}});var n=function(o){var i=Object.assign({},e);delete i[o],b.list.forEach(function(e){t(e,i)&&r('[data-type-name="'+o+'"] [data-tag="'+e.type[o]+'"]').removeClass("disabled")})};for(var i in e)n(i);Object.keys(e).length===Object.keys(b.type).length&&a?(r(".title").text(a.name),r(".price").text("¥"+m(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],e=$(s(t));r(".layer>main").append(e),o.forEach(function(t){e.find("main").append($(l(t)))})};for(var p in b.type)c(p);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=e;if(!h)return void toast("请先选中商品");if(h.pid){if(h.map_id&&"0"!==h.map_id)return v(),void f("https://m.xiaomiyoupin.com/shop/detail?gid="+t.gid+"&pid="+h.pid,{$dom:o});g.app?(v(),f("https://m.xiaomiyoupin.com/shop/check?quickOrder=2&pid="+h.pid,{$dom:o})):(v(),f("https://m.xiaomiyoupin.com/shop/checkshop/check?quickOrder=2&pid="+h.pid,{$dom:o}))}else a(h.mapId,function(){v(),f("https://m.xiaomiyoupin.com/shop/cart",{$dom:o})})}),i();var w=g.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()),i())});var j=u(n,function(){},!1,!0,!0);v=j.exit,n.parent().css({left:0,right:0,"max-width":"none"})}var d=function(t,o,e){return'\n
\n
\n \n

\n
\n \n \n
\n \n
\n
\n
\n
\n
\n'},s=function(t){return'\n'},l=function(t){return' \n '+t+" \n\n"},b={};if(t.gid){if(window.isEditor)return;r(t.gid,function(t){Object.assign(b,i(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){P&&clearTimeout(P),y.push({gid:t,cb:o}),P=setTimeout(function(){var t=y.slice(0);y.length=0,P=0;var o={};t.forEach(function(t){var e=t.gid;o[e]={model:"Shopv2",action:"getDetail",parameters:{gid:e}}}),c(o,function(o){var e=function(e){t.forEach(function(t){var i=t.gid,a=t.cb;e==i&&a({detail:o[e]})})};for(var i in o)e(i)},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,p=d.getTracedUrl2,h=d.getChineseMessage,l=d.GPIPE_URL,m=d.formatMoney,g=d.ua,f=d.jumpTo,u=d.showBottomWindow,b=d.addParam,v=d.eventEmitter,w=s.replace("static.",""),j=l.replace("static.",""),_="map_id_add_cart-floating-layer",P=void 0,y=[];o.exports={getFinalInfo:e,renderFinalInfo:i,getRemainTime:a,initBottomWindow:n,getDetail:r}}(i,t),t.exports&&(r["/cloud/module/product_big/util.js"]=t.exports)}(),c="/cloud/module/product_big/product_big.action.js",function(){var t={type:"resource"};!function(t,e){var i=t("util"),a=i.formatMoney,r=i.ua,d=i.setTrace,c=i.addParam,s=i.miFetch,p=t("/cloud/module/product_big/util.js"),h=p.getFinalInfo,l=p.renderFinalInfo,m=p.getRemainTime,g=p.initBottomWindow,f=void 0,u=[];e.exports=function(){function t(e,i){o(this,t),this.init(e,i)}return n(t,[{key:"init",value:function(o,e){var i=this,n=$("[data-id="+e+"]"),c=n.find.bind(n);this.$$=c,this.$dom=n;var s=o.gid;if(s){r.pc&&1===window.devicePixelRatio&&n.find(".top-a-wrap").css("border","1px solid rgb(204,204,204)");var p=c("a.product-big-img-link"),m=c("a.buy-btn-wrap");o.startTime&&o.startTime>Date.now()/1e3&&this.initTimer(),o.href?(p.attr("href",o.href),m.attr("href",o.href)):(p.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s),m.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s)),d(p),d(m),c(".bottom-btn").on("tap",function(){window.countEvent&&window.countEvent("button",this)}),"加入购物车"===o.btn&&g(o,function(t){c(".bottom-btn.cart-btn").on("tap",t)},n);var f=n.parent().is('[data-name="horizontal_layout"],[data-name="test_container"],[data-name="horizontal_scroll_container"],.horizontal_scroll_container_body');this.isSmall=f;var u=n.find(".normal-mode"),b=$(".top-wrap");return r.android&&b.addClass("android"),r.iOS&&b.addClass("iOS"),r.pc&&b.addClass("pc"),f?u.addClass("thin"):u.addClass("big"),o.static?(l(c,o.finalInfo),void setTimeout(this.afterRender.bind(this))):void t.getDetail(s,function(t){var e=t.detail.data;if(!e)return void console.warn("gid error",s);var n=h(o,e.goods,f,a);l(c,n),i.afterRender()})}}},{key:"initTimer",value:function(){function t(t){e.text(m(t))}var o=this.$$,e=o(".bottom-btn"),i="倒计时",a=o(".bottom-btn-wrap"),n=e.html();a.css({"pointer-events":"none",cursor:"not-allowed"});var r=config.startTime-Date.now()/1e3,d=r/3600/24;d>1?(e.text(""+i+Math.floor(d)+"天"),e.addClass("left-days")):!function(){e.addClass("left-time");var o=Math.ceil(config.startTime-Date.now()/1e3);t(o);var i=setInterval(function(){o--,o?t(o):(clearInterval(i),e.html(n).removeClass("left-days").removeClass("left-time"),a.css({"pointer-events":"all",cursor:"pointer"}))},1e3)}()}},{key:"afterRender",value:function(){function t(){var t=e.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 e=this.$dom,i=this.$$,a=this.isSmall,n=i(".product-big-img-link"),r=i(".product");t(),r.length?r[0].naturalWidth?o():r.on("load",o):o()}}],[{key:"getDetail",value:function(t,o){f&&clearTimeout(f),u.push({gid:t,cb:o}),f=setTimeout(function(){var t=u.slice(0);u.length=0,f=0;var o={};t.forEach(function(t){var e=t.gid;o[e]={model:"Product",action:"GetDetail",parameters:{gid:e}}}),s(o,function(o){var e=function(e){t.forEach(function(t){var i=t.gid,a=t.cb;e===""+i&&a({detail:o[e]})})};for(var i in o)e(i)},function(t){toast("获取商品信息失败"),console.warn(t)},c("//m.xiaomiyoupin.com/app/shopv3/pipe","editor-cache",""+Math.floor(Date.now()/36e5)),!0)},100)}}]),t}()}(i,t),t.exports&&(r["/cloud/module/product_big/product_big.action.js"]=t.exports)}(),function(){var o={type:"resource"};!function(o,e){var i=o("util"),a=i.eventEmitter;e.exports=function(o){function e(){function o(t){var o=t.children()[0].scrollHeight,e=1*(t.css("border-bottom-width").match(/^[\d.]+/)||[0])[0],i=1*(t.css("border-top-width").match(/^[\d.]+/)||[0])[0];return o+e+i}var e=function(e){var i=n[e];if(i.length<2)return"continue";var a=Math.max.apply(Math,t(i.map(o)));i.forEach(function(t){t.css("min-height",a+"px")})};for(var i in n){e(i)}}function i(){setTimeout(e,200),setTimeout(e,2e3)}var n={},r=o.find.bind(o);r("[data-sync-height]").each(function(){var t=$(this),o=t.data("sync-height");n[o]||(n[o]=[]),n[o].push(t)}),Object.keys(n).length&&(o[0].containerAdjustHeight=i,i(),a.on("base-width-change",function(){for(var t in n){var o=n[t];o.length<2||o.forEach(function(t){t.css("min-height","0px")})}i()}))}}(i,o),o.exports&&(r["/cloud/container/horizontal_layout/adjust-height.js"]=o.exports)}(),c="/cloud/container/horizontal_layout/horizontal_layout.action.js",function(){var t={type:"resource"};!function(t,e){var i=t("/cloud/container/horizontal_layout/adjust-height.js");e.exports=function(){function t(e,a){o(this,t);var n=$("[data-id="+a+"]"),r=n.find.bind(n);this.$$=r,this.$dom=n,i(this.$dom),"等高"===e.mode&&this.syncHeight()}return n(t,[{key:"heightAdjust",value:function(){}},{key:"syncHeight",value:function(){function t(t){var o=t.match(/[?&]w=(\d+)\b/),e=t.match(/[?&]h=(\d+)\b/);return o&&e?{width:1*o[1],height:1*e[1]}:(toast("图片链接缺少尺寸参数:"+t),{width:0,height:0})}var o=this.$dom.children();this.$dom.addClass("stretch");var e=[],i=[],a=0,n=1,r=!0;o.each(function(o){var e=$(this),a=void 0;a="IMG"===e.prop("tagName")?e:e.find("img");var d=a.attr("src")||a.data("lazy-src"),c=t(d),s=c.width,p=c.height;if(i[o]={width:s,height:p},!s||!p)return void(r=!1);var h=n/p;parseInt(h)!==h&&(n*=p)}),r&&(o.each(function(t){var o=i[t],r=o.width,d=o.height;e[t]=n/d*r,a+=e[t]}),o.each(function(t){$(this).css("width",100*e[t]/a+"%")}))}}]),t}()}(i,t),t.exports&&(r["/cloud/container/horizontal_layout/horizontal_layout.action.js"]=t.exports)}(),c="/cloud/module/scroll_footer/scroll_footer.action.js",function(){var t={type:"resource"};!function(t,e){var i=t("util"),r=i.eventEmitter,d=i.ua;e.exports=function(){function t(e,i){var a=this;o(this,t);var n=$("[data-id="+i+"]"),c=n.find.bind(n);this.$$=c,this.$dom=n,this.props=e,this.setWidth($("#rags-container").width()),r.on("base-width-change",function(t){a.setWidth(t)});var s=$('');
"footer"===e.mode?s.css("bottom","0"):s.css("top","0"),$(document.body).append(s),s.append(n);var p=this;n[0].addEventListener("tap",function(t){var o=$(t.target);"A"===o.prop("tagName")&&(p.onTap(o),t.preventDefault())}),this.render(),this.setScrolling(!1),d.pc||n.find(".wrap").addClass("hide-scrollbar"),this.updateOffsetHeight(),n[0].addEventListener("touchmove",function(t){t.preventDefault()},!1)}return n(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){var e=this,i=o.preventCheckingScroll;i&&(this.preventCheckingScroll=!0);var a=(this.$dom.find(".wrap"),$("#rags-container").width()),n=t.offset(),r=n.left+0+n.width/2-a/2;r<=0&&(r=0);this.iscroll&&this.iscroll.scrollToElement(t[0],700,0-a/2+n.width/2),t.css({color:this.props.colorHighlightText,backgroundColor:this.props.colorHighlightBg});var d=this.$dom.find("a");this.$dom.find(".splitter").remove(),d.forEach(function(o,i){var a=d[i+1]===t[0],n=o===t[0];i===d.length-1||a||n||$(o).append('')})}},{key:"inactive",value:function(t){t.css({color:this.props.colorText,backgroundColor:this.props.colorBg})}},{key:"show",value:function(){var t=this;this.iscroll||setTimeout(function(){t.iscroll=new window.IScroll(t.$dom[0],{mouseWheel:!0,tap:!0,scrollX:!0,scrollY:!1})},200),this.$dom.show()}},{key:"render",value:function(){var t=this,o=[];this.props.arr.forEach(function(t){var e=t.id,i=$("#"+e);o.push({$dom:i})});var e=$(window),i=!0;e.on("scroll",function(){i=!0});var n=function(){var i=[],n=e.scrollTop();n+=t.offsetHeight-5,o.forEach(function(t,o){var e=t.$dom,a=e.offset();if(a){var n=a.top;i[o]=n}}),i=i.map(function(t,o){var e=1/0;return i.forEach(function(i,a){o!==a&&i>t&&i=i&&n