\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'),r=i;ro.name?1:-1:t.ctime-o.ctime});var s={};r.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 l=Object.keys(s).sort(function(t,o){return 1*t-1*o}).map(function(t){return 1*t}),h=void 0,p=void 0;l.some(function(t,o){if(o===l.length-1)h||(h=l[o]);else{var e=l[o+1];if(0===o&&t>a)return p=t,!0;t<=a&&e>a&&(h=t,p=e)}});var g=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 r={unit:"元",name:"",src:"",descr:"",price:"",marketPrice:"",showMarketPrice:"",showTag:t.showTag};if(o.attr_ext){var n=o.attr_ext;(1===n.price_tag||t.daiqi)&&(r.unit="元起"),n.custom_name&&!t.name&&(r.name=n.custom_name),n.custom_summary&&!t.descr&&(r.descr=n.custom_summary)}return r.name||(r.name=t.name||o.name),t.src?r.src=t.src:"限时购"===t.mode||t.showWhiteProductImage?r.src=o.pic_url:r.src=o.album[0],r.descr||(t.descr?r.descr=t.descr:e?r.descr=a(o.summary,18):r.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)),r.price=i(o.price_min,"cent").short,r.marketPrice=i(o.market_price,"cent").short,r.showMarketPrice=1*o.price_min<1*o.market_price,r.downPriceValue=o.market_price-o.price_min,r.downPrice=i(r.downPriceValue,"cent").short,r.downPriceText="直降"+r.downPrice+"元",r.discountText=""+Math.ceil(o.price_min/o.market_price*100)/10,r.discountText=""+r.discountText.replace(/\.\d+/,function(t){return t.slice(0,2)}).replace(/\.0/,""),r}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"),r=i.find(".tag-content");if(e.length&&o.showMarketPrice&&(a.text()||(a.text(o.downPriceText),e.children().show())),i.length&&o.showMarketPrice&&!r.text().trim())if(i.find('[data-auto-mode="××折"]').length)r.html(''+o.discountText+'折
'),i.children().show();else{var n="";o.downPriceValue>1e5&&(n="#ffea00"),r.html('直降
'+o.downPrice+"
"),i.children().show()}}function a(t){function o(t,o){return t.length-1&&(a[o]=t.name)})});var r=void 0;return r=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:r,image_url:t.img,origin_price:parseInt(t.market_price),name:t.name}}),r={price:g(o.detail.data.good.price_min,"cent").short,productName:o.detail.data.good.name,image_url:o.detail.data.good.pic_url};return{info:r,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=l({url:v,$dom:e})):(i={model:"Cart",action:"add",parameters:{pid:t,num:"1"}},a=l({url:_,$dom:e})),c({detail:i},function(t){t.detail.code?toast(h(t.detail)||"加入购物车失败"):(w.emit("add-cart-success"),m.app?toast("加入购物车成功"):toast("已加入购物车,请前往有品App结算"),o&&o())},!1,a)}function r(){function o(t){n(".bottom").hide(),n('.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={};n(".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)n(".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]||n('[data-type-name="'+i+"\"] .tag[data-tag='"+o.type[i]+"']").removeClass("disabled")}});var r=function(o){var i=Object.assign({},e);delete i[o],b.list.forEach(function(e){t(e,i)&&n('[data-type-name="'+o+'"] [data-tag="'+e.type[o]+'"]').removeClass("disabled")})};for(var i in e)r(i);Object.keys(e).length===Object.keys(b.type).length&&a?(n(".title").text(a.name),n(".price").text("¥"+g(a.price,"cent").short),n(".product-img").attr("src",a.image_url),h=a,o(a.inventory?"ready":"gone")):(n(".title").text(b.info.productName),n(".price").text("¥"+b.info.price),n(".product-img").attr("src",b.info.image_url),h=void 0,o("wait"))}var r=$(d(b.info.productName,b.info.price,b.info.image_url)),n=r.find.bind(r),c=function(t){var o=b.type[t],e=$(s(t));n(".layer>main").append(e),o.forEach(function(t){e.find("main").append($(p(t)))})};for(var l in b.type)c(l);var h=void 0;n(".add-cart").on("tap",function(){a(h.pid||h.mapId)});var w=void 0;n(".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 w(),void f("https://m.xiaomiyoupin.com/shop/detail?gid="+t.gid+"&pid="+h.pid,{$dom:o});m.app?(w(),f("https://m.xiaomiyoupin.com/shop/check?quickOrder=2&pid="+h.pid,{$dom:o})):(w(),f("https://m.xiaomiyoupin.com/shop/checkshop/check?quickOrder=2&pid="+h.pid,{$dom:o}))}else a(h.mapId,function(){w(),f("https://m.xiaomiyoupin.com/shop/cart",{$dom:o})})}),i();var v=m.pc?"mousedown":"touchstart";r.on(v,".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 _=u(r,function(){},!1,!0,!0);w=_.exit,r.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'},p=function(t){return' \n '+t+" \n\n"},b={};if(t.gid){if(window.isEditor)return;n(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?r():a(b.list[0].pid):toast("商品已售罄"))):void getLogin().then(function(t){t?toast("数据加载中..."):jumptoLogin()})})}function n(t,o){k&&clearTimeout(k),j.push({gid:t,cb:o}),k=setTimeout(function(){var t=j.slice(0);j.length=0,k=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(v,"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,p=d.GPIPE_URL,g=d.formatMoney,m=d.ua,f=d.jumpTo,u=d.showBottomWindow,b=d.addParam,w=d.eventEmitter,v=s.replace("static.",""),_=p.replace("static.",""),y="map_id_add_cart-floating-layer",k=void 0,j=[];o.exports={getFinalInfo:e,renderFinalInfo:i,getRemainTime:a,initBottomWindow:r,getDetail:n}}(i,t),t.exports&&(n["/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,n=i.ua,d=i.setTrace,c=i.addParam,s=i.miFetch,l=t("/cloud/module/product_big/util.js"),h=l.getFinalInfo,p=l.renderFinalInfo,g=l.getRemainTime,m=l.initBottomWindow,f=void 0,u=[];e.exports=function(){function t(e,i){o(this,t),this.init(e,i)}return r(t,[{key:"init",value:function(o,e){var i=this,r=$("[data-id="+e+"]"),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"),g=c("a.buy-btn-wrap");o.startTime&&o.startTime>Date.now()/1e3&&this.initTimer(),o.href?(l.attr("href",o.href),g.attr("href",o.href)):(l.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s),g.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+s)),d(l),d(g),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 f=r.parent().is('[data-name="horizontal_layout"],[data-name="test_container"],[data-name="horizontal_scroll_container"],.horizontal_scroll_container_body');this.isSmall=f;var u=r.find(".normal-mode"),b=$(".top-wrap");return n.android&&b.addClass("android"),n.iOS&&b.addClass("iOS"),n.pc&&b.addClass("pc"),f?u.addClass("thin"):u.addClass("big"),o.static?(p(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 r=h(o,e.goods,f,a);p(c,r),i.afterRender()})}}},{key:"initTimer",value:function(){function t(t){e.text(g(t))}var o=this.$$,e=o(".bottom-btn"),i="倒计时",a=o(".bottom-btn-wrap"),r=e.html();a.css({"pointer-events":"none",cursor:"not-allowed"});var n=config.startTime-Date.now()/1e3,d=n/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(r).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(){n&&n.css("position","static").removeClass("loading"),r.removeClass("loading").css({"min-height":"0px"}),a?r.css("padding-top","100%"):r.css("padding-top","0px")}var e=this.$dom,i=this.$$,a=this.isSmall,r=i(".product-big-img-link"),n=i(".product");t(),n.length?n[0].naturalWidth?o():n.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&&(n["/cloud/module/product_big/product_big.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"),n=i.eventEmitter,d=i.ua;e.exports=function(){function t(e,i){var a=this;o(this,t);var r=$("[data-id="+i+"]"),c=r.find.bind(r);this.$$=c,this.$dom=r,this.props=e,this.setWidth($("#rags-container").width()),n.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(r);var l=this;r[0].addEventListener("tap",function(t){var o=$(t.target);"A"===o.prop("tagName")&&(l.onTap(o),t.preventDefault())}),this.render(),this.setScrolling(!1),d.pc||r.find(".wrap").addClass("hide-scrollbar"),this.updateOffsetHeight(),r[0].addEventListener("touchmove",function(t){t.preventDefault()},!1)}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){var e=this,i=o.preventCheckingScroll;i&&(this.preventCheckingScroll=!0);var a=(this.$dom.find(".wrap"),$("#rags-container").width()),r=t.offset(),n=r.left+0+r.width/2-a/2;n<=0&&(n=0);this.iscroll&&this.iscroll.scrollToElement(t[0],700,0-a/2+r.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],r=o===t[0];i===d.length-1||a||r||$(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 r=function(){var i=[],r=e.scrollTop();r+=t.offsetHeight-5,o.forEach(function(t,o){var e=t.$dom,a=e.offset();if(a){var r=a.top;i[o]=r}}),i=i.map(function(t,o){var e=1/0;return i.forEach(function(i,a){o!==a&&i>t&&i=i&&r