\n '):u.append('\n \n ')}),Promise.all(g.map(function(t){return d(t.img)})).then(function(){l||u.removeClass("hide")})}return i(e,t),e}(a)}(r,t),t.exports&&(d["/cloud/module/smart_nav_bar/smart_nav_bar.action.js"]=t.exports)}(),l="/cloud/module/one_to_three_coupon/one_to_three_coupon.action.js",function(){var t={type:"resource"};!function(t,e){function n(t){return t?(t.replace(/[^\d\s]/g,"").match(/(?:^|\s+)\d+/g)||[]).map(function(t){return 1*t.match(/\d+/)[0]}):[]}function r(t){if(!t)return!1;var e=y(t);return"/app/shop/content"===e.pathname&&e.params.id===k.id||e.pathname===location.pathname}function d(t,e){var i="";return e&&(i=t.format("yyyy")+"."),i+t.format("MM.dd").replace(/(^0)|(\.0)/g,function(t){return t.match(/\./)?".":""})}function p(t,e){t*=1e3;var i=new Date(t),o=!(i.getHours()>=23&&i.getMinutes()>=59);return o?d(new Date(t-864e5),e):d(i,e)}function u(t,e){return m({data:{get:{model:"Couponv2",action:"FetchCheck",parameters:{config_id:t,activity_id:e}}},url:g}).then(function(t){return t.get})}function l(t,e){return m({data:{get:{model:"Couponv2",action:"Fetch",parameters:{config_id:t,activity_id:e}}},url:g}).then(function(i){var o=i.get;return u(t,e).then(function(t){return[o,t]})})}var h=t("mi-home-lib"),f=h.Rag,m=h.miFetch2,g=h.GPIPE_URL,v=h.preloadImage,b=h.getChineseMessage,_=h.toast,w=h.jumpTo,y=h.parseURL,k=h.args,x=function(){function t(e,i,n,r){var a=this;o(this,t),this.$host=n,this.couponId=e,this.actId=i,this.images=r,this.topState=null,this.fetchCheck().then(function(t){return t.code?void _(b(t)):(a.updateState(t.data),a.startTime=d(new Date(1e3*a.state.start_time)),a.endTime=p(a.state.end_time),a.startTimeFull=d(new Date(1e3*a.state.start_time),!0),a.endTimeFull=p(a.state.end_time,!0),void a.$host.append(a.render()))})}return s(t,[{key:"updateState",value:function(t){this.state=t,this.state.fetched>0?this.state.tofetch>0?this.topState="continue":this.topState="go":this.state.tofetch>0?this.topState="fetch":this.topState="gone",this.setCorrespondingBgImg()}},{key:"fetchCheck",value:function(){return u(this.couponId,this.actId)}},{key:"setBg",value:function(t){this.$host.find(".bg").setSrc(t)}},{key:"setCorrespondingBgImg",value:function(){"continue"===this.topState||"fetch"===this.topState?this.setBg(this.images[0]):"go"===this.topState?this.setBg(this.images[2]):"gone"===this.topState&&this.setBg(this.images[1])}},{key:"onPressFetch",value:function(){var t=this;return"go"===this.topState?this.state.target?void(r(this.state.target)?_("已领取"):w(this.state.target,{$dom:this.$host})):void 0:void u(this.couponId,this.actId).then(function(e){return e.code?void _(b(e)):(t.updateState(e.data),void(e.data.tofetch<1||l(t.couponId,t.actId).then(function(e){var i=a(e,2),o=i[0],n=i[1];return n.data&&"object"==typeof n.data?(t.updateState(n.data),4005200!==o.code?0!==o.code?void _(b(o)):void _(n.data.tofetch>0?"已领取,还可以继续领取":"已领取"):void 0):void _("获取优惠券信息失败:"+n.description)})))})}},{key:"onPressTip",value:function(){_(this.state.scope_desc,3e3)}}]),t}(),P=function(t){function e(){var t=this;o(this,e);for(var i=arguments.length,n=Array(i),r=0;r\n \n '+i+''+o+''+this.state.name_desc+'\n\n 点击查看说明 \n \n \n \n '+this.startTimeFull+"-"+this.endTimeFull+"\n \n ")}}]),e}(x),T=function(t){function e(){var t=this;o(this,e);for(var i=arguments.length,n=Array(i),r=0;r\n \n '+i+''+o+'\n 点击查看说明\n \n \n \n '+this.startTimeFull+"-"+this.endTimeFull+"\n \n ")}}]),e}(x),C=function(t){function e(){var t=this;o(this,e);for(var i=arguments.length,n=Array(i),r=0;r\n '+i+''+o+'\n '+this.state.name_desc+'\n '+this.startTime+"-"+this.endTime+"\n ")}}]),e}(x),j=[P,T,C];e.exports=function(t){function e(){var t=this;o(this,e);for(var i=arguments.length,r=Array(i),a=0;ad.length)for(var p=d.length;p=e)&&(n.push(t),!0)}),n.join(",")}var n=arguments.length<=3||void 0===arguments[3]?c:arguments[3],s={unit:"元",name:"",src:"",descr:"",price:"",marketPrice:"",showMarketPrice:"",showTag:t.showTag,goods_type:e.goods_type,status:e.status};if(e.attr_ext){var d=e.attr_ext;(1===d.price_tag||t.daiqi)&&(s.unit="元起"),d.custom_name&&!t.name&&(s.name=d.custom_name),d.custom_summary&&!t.descr&&(s.descr=d.custom_summary)}return s.name||(s.name=t.name||e.name),t.src?s.src=t.src:t.imgType?"800图"===t.imgType?s.src=e.img800:"场景图"===t.imgType&&(s.src=e.album_url):t.showWhiteProductImage?s.src=e.pic_url:s.src=e.album_url,"undefined"!=typeof r&&r.android&&(s.src=a(s.src,"t","webp")),s.descr||(t.descr?s.descr=t.descr:i?s.descr=o(e.summary,18):s.descr=e.summary),e.market_price||(e.market_price=e.price_min),t.price&&(e.price_min=Math.round(100*t.price)),t.priceOriginal&&(e.market_price=Math.round(100*t.priceOriginal)),s.showBtn=!0,(e.crowdfunding||2===e.type)&&(s.showBtn=!1),s.price=n(e.price_min,"cent").short,s.marketPrice=n(e.market_price,"cent").short,s.showMarketPrice=1*e.price_min<1*e.market_price,s.downPriceValue=e.market_price-e.price_min,s.downPrice=n(s.downPriceValue,"cent").short,s.downPriceText="直降"+s.downPrice+"元",s.discountText=""+Math.ceil(e.price_min/e.market_price*100)/10,s.discountText=""+s.discountText.replace(/\.\d+/,function(t){return t.slice(0,2)}).replace(/\.0/,""),s}function o(t,e){var i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t(".unit").text(e.unit),i.static||(t(".product-name").html(e.name),t(".product-descr").html(e.descr)),t(".price-wrap .num").text(e.price),e.showMarketPrice&&(t(".price-wrap-market").show(),t(".price-wrap-market .num").text(e.marketPrice),e.showTag&&t(".link-wrap>.tag").show().text(e.downPriceText)),e.showBtn||t(".bottom-btn").hide(),e.status===-1){var o=void 0;e.status===-1?o="商品已下架":0===e.status&&(o="商品未上架"),t(".top-wrap").addClass("inactive").append('\n \n '+o+"\n \n ")}var n=t('[data-editor-tag-name="horizontal_border_label"]'),r=t('[data-editor-tag-name="circle-background-double-line"]'),a=n.find(".tag-content"),c=r.find(".tag-content");if(n.length&&e.showMarketPrice&&(a.text()||(a.text(e.downPriceText),n.children().show())),r.length&&e.showMarketPrice&&(!c.text()||!c.text().trim()))if(r.find('[data-auto-mode="××折"]').length)c.html(''+e.discountText+'折'),r.children().show();else{var s="";e.downPriceValue>1e5&&(s="#ffea00"),c.html('直降'+e.downPrice+""),r.children().show()}}var n=t("mi-home-lib"),r=n.ua,a=n.addParam,c=n.formatMoney,s="product2-floating-layer";e.exports={getFinalInfo:i,renderFinalInfo:o,floatingLayerId:s}}(r,t),t.exports&&(d["/cloud/module/product_big/util.js"]=t.exports)}(),function(){var t={type:"resource"};!function(t,n){var r=t("mi-home-lib"),a=r.PIPE_URL,d=r.getTracedUrl2,p=r.getChineseMessage,u=r.GPIPE_URL,l=r.formatMoney,h=r.ua,f=r.jumpTo,m=r.getLogin,g=r.jumptoLogin,v=r.countEvent,b=r.EventEmitter,_=r.eventEmitter,w=r.toast,y=r.miFetch2,k=r.isEditor,x=r.showBottomWindow2,P=function(t){function n(t){o(this,n),c(Object.getPrototypeOf(n.prototype),"constructor",this).call(this),this.fetching=!1,this.props=t,k||this.preloadDetail(this)}return i(n,t),s(n,[{key:"getDetail",value:function(t){var e=this;this.fetching=!0;var i={};for(var o in t)i[o]={model:"Shopv2",action:"getDetail",parameters:{gid:o}};return new Promise(function(i,o){return $.ajax({type:"GET",data:{gids:JSON.stringify(Object.keys(t).map(function(t){return 1*t}))},url:"/app/shop/product",success:function(o){if(o.code)return void w(p(o));o=o.result;var n={};for(var r in t)n[r]=o[r];e.fetching=!1,i(n)},error:function(t){console.log(2,t),o(t)}})})}},{key:"addCart",value:function(t,e){var i=this,o=void 0,n=void 0;return parseInt(t)>1e8?(o={model:"Cart",action:"add",parameters:{product_id:t,consumption:"1"}},n=d({url:a,$dom:this.props.$sourceDom})):(o={model:"Cart",action:"add",parameters:{pid:t,num:"1"}},n=d({url:u,$dom:this.props.$sourceDom})),this.props.cartExtraParams&&Object.assign(o.parameters,this.props.cartExtraParams),y({data:{detail:o},url:n,$dom:this.props.$sourceDom}).then(function(t){t.detail.code?w(p(t.detail)||"加入购物车失败"):(_.emit("add-cart-success"),i.emit("cart-success"),w(h.app||h.weirdhybrid||$(".editor-fixed-cart-btn").length?"加入购物车成功":"已加入购物车"),e&&e())})}},{key:"renderSection",value:function(t){return'\n \n '+t+' \n \n \n \n \n '}},{key:"renderTag",value:function(t){return' \n '+t.name+" \n \n "}},{key:"renderFooter",value:function(){return'\n \n '}},{key:"renderPanel",value:function(t,e,i){return'\n \n \n \n \n \n \n '+t+'\n ¥'+e+'\n \n \n \n \n '+this.renderFooter()+"\n \n \n "}},{key:"getDetailWrap",value:function(){var t=this;this.getDetailP||(this.getDetailP=this.getDetail(this.props.gid).then(function(e){Object.assign(t.config,t.handleResult(e))}))}},{key:"onGetDetail",value:function(t){return!t||t.code?void console.log("error getting detail",this.props.gid,t):void(this.config=this.handleResult(t))}},{key:"trigger",value:function(){var t=this;if(window.isEditor)return void w("不支持编辑器内使用");if(!this.fetching){if(!this.config)return void this.getDetail(e({},this.props.gid,!0)).then(function(e){return e=e[t.props.gid],e.code?void w(p(e)):(t.onGetDetail(e),void t.trigger())});var i=0;if(!this.detailResult)return void w("数据加载中...");if(v("trigger-bottom",this.props.$sourceDom),!this.config.list)return this.detailResult&&this.detailgood.code&&w(p(this.detailgood)),void m().then(function(t){t||g()});this.config.list.forEach(function(t){t.inventory&&t.inventory>0&&i++}),i?this.config.list.length>1?(this.emit("show"),this.show()):this.addCart(this.config.list[0].pid):w("商品已售罄")}}},{key:"setMode",value:function(t){var e=this.$$;e(".bottom").hide(),e('.bottom[data-mode="'+t+'"]').show()}},{key:"onPressAddCart",value:function(t){this.addCart(t)}},{key:"onPressCheckout",value:function(){var t=this,e=this.props.$sourceDom;if(!this.selectingProduct)return void w("请先选中商品");if(this.selectingProduct.pid){var i=function(){if(t.selectingProduct.map_id&&"0"!==t.selectingProduct.map_id)return t.exit(),f("https://m.xiaomiyoupin.com/shop/detail?gid="+t.props.gid+"&pid="+t.selectingProduct.pid,{$dom:e}),{v:void 0};var i=void 0;i=h.app?"https://m.xiaomiyoupin.com/shop/check?quickOrder=2&pid="+t.selectingProduct.pid:"https://m.xiaomiyoupin.com/shop/checkshop/check?quickOrder=2&pid="+t.selectingProduct.pid,t.exit(),m().then(function(t){if(t)f(i,{$dom:e});else{var o=d({url:i,$dom:e});g(o)}})}();if("object"==typeof i)return i.v}else this.addCart(this.selectingProduct.mapId,function(){t.exit(),f("https://m.xiaomiyoupin.com/shop/cart",{$dom:e})})}},{key:"onTriggerTag",value:function(){function t(t,e){for(var i in e)if(!t.type[i]||""+t.type[i].tid!=""+e[i])return!1;return!0}var e=this,i=this.$$,o={};i(".tag.active").each(function(){var t=$(this),e=t.parent().data("type-name"),i=t.data("tag");o[e]=i}),i(".tag:not(.active)").addClass("disabled");var n=void 0;this.config.list.forEach(function(e){if(t(e,o)){n=e;for(var r in e.type)o[r]||i('[data-type-name="'+r+"\"] .tag[data-tag='"+e.type[r].tid+"']").removeClass("disabled")}});var r=function(n){var r=Object.assign({},o);delete r[n],e.config.list.forEach(function(e){t(e,r)&&i('[data-type-name="'+n+'"] [data-tag="'+e.type[n].tid+'"]').removeClass("disabled")})};for(var a in o)r(a);Object.keys(o).length===Object.keys(this.config.type).length&&n?(i(".title").text(n.name),i(".price").text("¥"+l(n.price,"cent").short),i(".product-img").attr("src",n.image_url),this.selectingProduct=n,n.inventory?this.setMode("ready"):this.setMode("gone")):(i(".title").text(this.config.info.productName),i(".price").text("¥"+this.config.info.price),i(".product-img").attr("src",this.config.info.image_url),this.selectingProduct=void 0,this.setMode("wait")),this.emit("trigger-tag")}},{key:"show",value:function(){var t=this,e=$(this.renderPanel(this.config.info.productName,this.config.info.price,this.config.info.image_url)),i=e.find.bind(e);this.$$=i;var o=function(e){var o=t.config.type[e],n=$(t.renderSection(e));i(".layer>main").append(n),o.forEach(function(e){n.find("main").append($(t.renderTag(e)))})};for(var n in this.config.type)o(n);i(".add-cart").on("tap",function(){t.onPressAddCart(t.selectingProduct.pid||t.selectingProduct.mapId)}),i(".go-checkout").on("tap",function(){t.onPressCheckout()}),this.onTriggerTag();var r=this;e.on("tap",".tag",function(){var t=$(this),e=t.parent();t.hasClass("disabled")||(t.hasClass("active")?(t.inactive(),e.inactive()):(t.active(),e.active(),t.siblings().inactive()),r.onTriggerTag())});var a=x({$dom:e,cb:function(){return t.emit("exit")},closeOnTap:!1,tapShadowHide:!0,backToExit:!0}),c=a.exit;this.exit=c,e.parent().css({left:0,right:0,"max-width":"none"})}},{key:"handleResult",value:function(t){var e=this;this.detailResult=t;var i={};if(!t.group){var o="none"===this.props.$sourceDom[0].style.display||this.props.$sourceDom.hasClass("hide");return void console.warn("商品信息错误",t,this.props.gid,o?"(已隐藏)":"")}var n=t.group;this.props.pidWhiteList&&this.props.pidWhiteList.match(/[^ ]/)&&!function(){var i=e.props.pidWhiteList.split(/ +/).filter(function(t){return t});t.tag_prop=t.tag_prop.filter(function(t){var e=t.pid;return i.indexOf(""+e)>-1}),t.props=t.props.filter(function(t){var e=t.pid;return i.indexOf(""+e)>-1});var o={};t.tag_prop.forEach(function(t){var e=t.tid;o[e]=!0}),t.group.forEach(function(t){t.tags=t.tags.filter(function(t){var e=t.tid;return o[e]})})}();var r=t.tag_prop;n.forEach(function(t){i[t.name]=[],t.tags.forEach(function(e){i[t.name].push(e)})});var a=t.props.filter(function(t){return"-1"!==t.status&&t.status!==-1}).map(function(t){var e=[],i={};r.forEach(function(i){i.pid===t.pid&&e.push(i.tid)}),n.forEach(function(t){var o=t.name;t.tags.forEach(function(t){var n=e.indexOf(t.tid);n>-1&&(i[o]=t)})});var o=void 0;return o=void 0!==t.onsale?t.onsale?1:0:parseInt(t.inventory),{map_id:t.map_id,pid:t.pid,type:i,price:t.price,inventory:o,image_url:t.img,origin_price:parseInt(t.market_price),name:t.name}}),c={price:l(t.good.price_min,"cent").short, productName:t.good.name,image_url:t.good.pic_url};return{info:c,type:i,list:a}}},{key:"preloadDetail",value:function(t){var e=this;n.getDetailCnt>50?(n.getDetailCnt=0,n.requestQueue=[]):clearTimeout(n.getDetailTimeout),n.requestQueue.push(t),n.getDetailCnt++;var i=n.requestQueue.slice();n.getDetailTimeout=setTimeout(function(){var t={};i.forEach(function(e){t[e.props.gid]=!0}),setTimeout(function(){e.getDetail(t).then(function(t){i.forEach(function(e){var i=e.props.gid;e.onGetDetail(t[i])}),i.length=0})},1e3)})}}]),n}(b);P.requestQueue=[],P.getDetailTimeout=0,P.getDetailCnt=0,n.exports=P}(r,t),t.exports&&(d["/cloud/module/product_big/bottom_window.js"]=t.exports)}(),function(){var t={type:"resource"};!function(t,e){var n=t("mi-home-lib"),r=n.formatMoney,a=n.ua,d=n.setTrace,p=(n.addParam,n.miFetch2),u=n.jumpTo,l=n.toast,h=n.Rag,f=n.GPIPE_URL,m=n.getChineseMessage,g=t("/cloud/module/product_big/util.js"),v=g.getFinalInfo,b=g.renderFinalInfo,_=g.floatingLayerId,w=t("/cloud/module/product_big/bottom_window.js"),y=void 0,k=window.publicAttribute["产品模块"]&&window.publicAttribute["产品模块"].neigou,x=[];e.exports=function(t){function e(t,i){var n=this;o(this,e),c(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t,i),t.inFirstPage?this.init(t,i):setTimeout(function(){n.init(t,i)},500)}return i(e,t),s(e,[{key:"replaceA",value:function(){var t=this;try{var e=function(){var e=t.$$(".img-link"),i=e.attr("href"),o=e.children();if(!e[0])return{v:void 0};var n=$(e[0].outerHTML.replace(//g,"/div>"));n.empty(),n.append(o),e.replaceWith(n),n.originalOn("tap",function(){u(i,{$dom:t.$dom})})}();if("object"==typeof e)return e.v}catch(t){l(t.message)}}},{key:"init",value:function(t){var i=this,o=this.$dom,n=this.$$,c=t.gid;if(!(!c||k&&window.isEditor)){a.pc&&1===window.devicePixelRatio&&o.find(".top-a-wrap").css("border","1px solid rgb(204,204,204)");var s=n(".img-link"),p=n("a.buy-btn-wrap"),u=$().add(s).add(p);t.href?u.attr("href",t.href):u.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+c),d(u),a.pc||this.replaceA(),n(".bottom-btn").on("tap",function(){"加入购物车"===t.btn&&i.countEvent("addcart")}),"加入购物车"===t.btn&&!function(){var e=new w({id:_,gid:c,$sourceDom:o,pidWhiteList:t.pidWhiteList});n(".bottom-btn.cart-btn").on("click",function(){e.trigger()})}();var l=o.parent().is('[data-name="horizontal_layout"],[data-name="test_container"],[data-name="horizontal_scroll_container"],.horizontal_scroll_container_body,.horizontal-adjust-wrapper');this.isSmall=l;var h=n(".top-wrap");a.android&&h.addClass("android"),a.iOS&&h.addClass("iOS"),a.pc&&h.addClass("pc"),l?h.addClass("thin"):h.addClass("big"),("没按钮"===t.btn||a.weirdhybrid)&&(this.nobutton=!0,h.addClass("nobutton")),e.getDetail(c,function(e){if(!e)return void console.warn("gid error",c);var o=v(t,e,l,r);b(n,o,t),i.afterRender()})}}},{key:"afterRender",value:function(){function t(){var t=i.parent()[0].containerAdjustHeight;t&&t()}function e(){a&&a.css("position","static").removeClass("loading"),r.removeClass("loading").css({"min-height":"0px"}),n?r.css("padding-top","100%"):r.css("padding-top","0px")}var i=this.$dom,o=this.$$,n=this.isSmall,r=o(".img-link"),a=o(".product");t(),a.length?a[0].naturalWidth?e():a.on("load",e):e()}}],[{key:"getDetail",value:function(t,e){y&&clearTimeout(y),x.push({gid:t,cb:e}),y=setTimeout(function(){var t=x.slice(0);x.length=0,y=0;var e={model:"Product",action:k?"GetDetailLiteWithAct":"GetDetailLite",parameters:{}};e.parameters.gid=t.map(function(t){var e=t.gid;return e});var i=void 0;i="static.home.mi.com"===location.host?f:"/app/shopv3/pipe",p({data:{gid:e},success:function(e){if(e.code)return void l(m(e));var i=e.gid.data,o=function(e){t.forEach(function(t){var o=t.gid,n=t.cb;e===""+o&&n(i[e])})};for(var n in i)o(n)},error:function(t){l("获取商品信息失败"),console.warn(t)},url:k?"/app/shopv3/pipe":i,skipLogin:!k})},100)}}]),e}(h)}(r,t),t.exports&&(d["/cloud/module/product_big/action.js"]=t.exports)}(),l="/cloud/module/product_with_tags/product_with_tags.action.js",function(){var t={type:"resource"};!function(t,e){var n=t("/cloud/module/product_big/action.js");e.exports=function(t){function e(){o(this,e);for(var t=arguments.length,i=Array(t),n=0;n/g,"/div>"));n.empty(),n.append(o),e.replaceWith(n),n.originalOn("tap",function(){u(i,{$dom:t.$dom})})}();if("object"==typeof e)return e.v}catch(t){l(t.message)}}},{key:"init",value:function(t){var i=this,o=this.$dom,n=this.$$,c=t.gid;if(!(!c||k&&window.isEditor)){a.pc&&1===window.devicePixelRatio&&o.find(".top-a-wrap").css("border","1px solid rgb(204,204,204)");var s=n(".img-link"),p=n("a.buy-btn-wrap"),u=$().add(s).add(p);t.href?u.attr("href",t.href):u.attr("href","//m.xiaomiyoupin.com/shop/detail?gid="+c),d(u),a.pc||this.replaceA(),n(".bottom-btn").on("tap",function(){"加入购物车"===t.btn&&i.countEvent("addcart")}),"加入购物车"===t.btn&&!function(){var e=new w({id:_,gid:c,$sourceDom:o,pidWhiteList:t.pidWhiteList});n(".bottom-btn.cart-btn").on("click",function(){e.trigger()})}();var l=o.parent().is('[data-name="horizontal_layout"],[data-name="test_container"],[data-name="horizontal_scroll_container"],.horizontal_scroll_container_body,.horizontal-adjust-wrapper');this.isSmall=l;var h=n(".top-wrap");a.android&&h.addClass("android"),a.iOS&&h.addClass("iOS"),a.pc&&h.addClass("pc"),l?h.addClass("thin"):h.addClass("big"),("没按钮"===t.btn||a.weirdhybrid)&&(this.nobutton=!0,h.addClass("nobutton")),e.getDetail(c,function(e){if(!e)return void console.warn("gid error",c);var o=v(t,e,l,r);b(n,o,t),i.afterRender()})}}},{key:"afterRender",value:function(){function t(){var t=i.parent()[0].containerAdjustHeight;t&&t()}function e(){a&&a.css("position","static").removeClass("loading"),r.removeClass("loading").css({"min-height":"0px"}),n?r.css("padding-top","100%"):r.css("padding-top","0px")}var i=this.$dom,o=this.$$,n=this.isSmall,r=o(".img-link"),a=o(".product");t(),a.length?a[0].naturalWidth?e():a.on("load",e):e()}}],[{key:"getDetail",value:function(t,e){y&&clearTimeout(y),x.push({gid:t,cb:e}),y=setTimeout(function(){var t=x.slice(0);x.length=0,y=0;var e={model:"Product",action:k?"GetDetailLiteWithAct":"GetDetailLite",parameters:{}};e.parameters.gid=t.map(function(t){var e=t.gid;return e});var i=void 0;i="static.home.mi.com"===location.host?f:"/app/shopv3/pipe",p({data:{gid:e},success:function(e){if(e.code)return void l(m(e));var i=e.gid.data,o=function(e){t.forEach(function(t){var o=t.gid,n=t.cb;e===""+o&&n(i[e])})};for(var n in i)o(n)},error:function(t){l("获取商品信息失败"),console.warn(t)},url:k?"/app/shopv3/pipe":i,skipLogin:!k})},100)}}]),e}(h)}(r,t),t.exports&&(d["/cloud/module/product_big/product_big.action.js"]=t.exports)}(),l="/cloud/container/venue_card_container/venue_card_container.action.js",function(){var t={type:"resource"};!function(t,e){e.exports=function(){function t(e,i){o(this,t);var n=$('[data-id="'+i+'"]'),r=n.children(),a=r.length;r.eq(Math.floor(Math.random()*a)).show()}return t}()}(r,t),t.exports&&(d["/cloud/container/venue_card_container/venue_card_container.action.js"]=t.exports)}(),l="/cloud/module/venue_main_product_card_a/venue_main_product_card_a.action.js",function(){var t={type:"resource"};!function(t,e){function n(t,e){var i=void 0,o=void 0;return parseInt(t)>1e8?(i={model:"Cart",action:"add",parameters:{product_id:t,consumption:"1"}},o=y({url:k,$dom:e})):(i={model:"Cart",action:"add",parameters:{pid:t,num:"1"}},o=y({url:x,$dom:e})),m({data:{detail:i},url:o,$dom:e}).then(function(t){v(t.detail.code?_(t.detail)||"加入购物车失败":f.app||f.weirdhybrid||$(".editor-fixed-cart-btn").length?"加入购物车成功":"已加入购物车")})}function r(t,e){T&&clearTimeout(T),C.push({gid:t,cb:e}),T=setTimeout(function(){var t=C.slice(0);C.length=0,T=0;var e={model:"Product",action:"GetDetailLite",parameters:{}};e.parameters.gid=t.map(function(t){var e=t.gid;return e});var i=void 0;i="static.home.mi.com"===location.host?x:"/app/shopv3/pipe",m({data:{gid:e},success:function(e){if(e.code)return void v(_(e));var i=e.gid.data;t.forEach(function(t){var e=t.gid,o=t.cb;i[e]&&o(i[e])})},error:function(t){v("获取商品信息失败"),console.warn(t)},url:i,skipLogin:!0})},10)}function a(t,e){var i=t.optional||{},o=t.tag||{},n={gid:t.gid,pid:t.pid,name:"",summary:"",src:"",price:"",unit:"元",marketPrice:"",showMarketPrice:"",showTag:!1,tagLineCount:2,firstTagLine:"直降",secondTagLine:"",tagDifferent:!0,btnTitle:t.btnTitle,href:i.href,tagBgImg:"https://shop.io.mi-img.com/app/shop/img?id=shop_afbd3e9203ca5887559d665f6172c625.png&w=120&h=121"};if(e.attr_ext){var r=e.attr_ext;n.name=i.name||r.custom_name,n.summary=i.summary||r.custom_summary,1===r.price_tag&&(n.unit="元起")}return n.name||(n.name=i.name||e.name),n.summary||(n.summary=i.summary||e.summary),e.price_min||(e.price_min=e.price),e.market_price||(e.market_price=e.price_min),i.price&&(e.price_min=Math.round(100*parseFloat(i.price))),i.originalPrice&&(e.market_price=Math.round(100*parseFloat(i.originalPrice))),n.price=h(e.price_min,"cent").short,n.marketPrice=h(e.market_price,"cent").short,n.showMarketPrice=1*e.price_min<1*e.market_price,n.downPriceValue=e.market_price-e.price_min,n.downPrice=h(n.downPriceValue,"cent").short,n.discountText=""+Math.ceil(e.price_min/e.market_price*100)/10,n.discountText=""+n.discountText.replace(/\.\d+/,function(t){return t.slice(0,2)}).replace(/\.0/,""),o.show?(n.showTag=!0,n.tagLineCount=parseInt(o.lines),n.firstTagLine=1===n.tagLineCount?o.text:o.firstLine,n.secondTagLine=2===n.tagLineCount?o.secondLine||"":"",n.tagDifferent=2===n.tagLineCount&&o.different,n.tagBgImg=o.bgImg||"https://shop.io.mi-img.com/app/shop/img?id=shop_afbd3e9203ca5887559d665f6172c625.png&w=120&h=121"):n.showMarketPrice&&(n.showTag=!0,n.secondTagLine=n.downPrice),e.inventory&&(n.inventory=e.inventory),n}function d(t,e){function i(t){var i="//m.xiaomiyoupin.com/shop/detail?gid="+e.gid;e.pid&&(i+="&pid="+e.pid);var o=e.href||i;return g(o,{$dom:r}),t&&t.stopPropagation(),!1}var o=t.$$,r=t.$dom,a=o(".tag-box"),c=o(".img-box img"),s=o(".btn");u(r);o(".name").html(e.name).on("tap",i),o(".desc").html(e.summary).on("tap",i),o(".present-price").html(e.price),e.showMarketPrice&&o(".market-price").html(e.marketPrice+"元").show(),"元起"===e.unit&&o(".price-yen").html(e.unit),e.pid||s.html(e.btnTitle),e.showTag&&(a.addClass("in").css("background-image","url("+e.tagBgImg+")"),1===e.tagLineCount&&a.addClass("one-line"),e.tagDifferent&&a.addClass("different"),a.find(".first-line").html(e.firstTagLine),a.find(".second-line").html(e.secondTagLine)),c.on("tap",i),f.wxminiprogram&&r.on("tap",i),s.on("tap",function(){return s.hasClass("waiting")?void v("抢购还未开始,请保持关注"):s.hasClass("disable")?void(s.hasClass("soldoff")&&v("商品已售罄,下次早点来吧")):s.hasClass("success")?(p(e.gid,e.pid,r,e.btnTitle),void("加入购物车"===e.btnTitle?n(e.pid,r).catch(function(t){v(t)}):i())):void("加入购物车"===e.btnTitle?t.bottomWindow.trigger():i())})}function p(t,e,i,o){function n(t){var e=parseInt(t/3600),i=parseInt(t%3600/60),o=t-3600*e-60*i;return e<10&&(e="0"+e),i<10&&(i="0"+i),o<10&&(o="0"+o),e+":"+i+":"+o}function r(t,e){d.html(n(t--)),c&&clearInterval(c),c=setInterval(function(){t>0?d.html(n(t--)):e()},1e3)}function a(n){function a(){d.removeClass("waiting"),c&&clearInterval(c),!f.inventory||parseInt(f.inventory)<=0?d.html("已售罄").addClass("disable soldoff"):d.html(o).addClass("success toDetail")}var s=n.detail&&n.detail.data,u=n.activity&&n.activity.data,l=null,h=Array.isArray(s.props)&&s.props,f=null;return h&&h.forEach(function(t){t.pid==e&&(f=t)}),f?w().then(function(n){if(!Array.isArray(u)||0===u.length)return a(),Promise.resolve(f);for(var s=0,h=void 0;s-1||h.pids.indexOf(parseInt(e))>-1)&&n>h.start&&nn?(m=g-n,m>86400&&(m=86400),setTimeout(function(){c&&clearInterval(c),p(t,e,i,o)},1e3*m+500)):m=0,0===m)return void a();d.addClass("waiting");var v=parseInt(m/86400);v>1?(d.html("倒计时"+v+"天"),setTimeout(function(){c&&clearInterval(c),p(t,e,i,o)},1e3*(m-24*v*3600))):r(m,function(){return setTimeout(function(){p(t,e,i,o)},1e3)})}else a();return Promise.resolve(f)}):Promise.reject("no pid detail")}var c=void 0,s={activity:{model:"Activity",action:"getAct",parameters:{gid:t}},detail:{model:"Shopv2",action:"getDetail",parameters:{gid:t}}},d=i.find(".btn").removeClass("hide");return m({data:s}).then(a)}function u(t){var e=t.data("editor-trace");return window.articleModeTraceName+"-"+window.articleId+"-"+e}var l=t("mi-home-lib"),h=l.formatMoney,f=l.ua,m=(l.args,l.addParam,l.miFetch2),g=l.jumpTo,v=l.toast,b=l.Rag,_=l.getChineseMessage,w=(l.floatingLayerId,l.getServerTimestamp),y=l.getTracedUrl2,k=l.PIPE_URL,x=(l.SHOPV3_URL,l.GPIPE_URL),P=t("/cloud/module/product_big/bottom_window.js"),T=void 0,C=[];e.exports=function(t){function e(t,i){o(this,e),c(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t,i),this.initBtnTitle=t.btnTitle,this.init(t,i)}return i(e,t),s(e,[{key:"init",value:function(t){var e=this,i=t.gid,o=t.pid;i&&(o?p(i,o,this.$dom,this.initBtnTitle).then(function(i){var o=a(t,i);d(e,o)}).catch(function(t){return console.log(t)}):r(i,function(o){if(!o)return void console.warn("gid error",i);var n=a(t,o);d(e,n)}),"加入购物车"===t.btnTitle&&(this.bottomWindow=new P({id:"venue-product-floating",gid:t.gid,$sourceDom:this.$dom})))}}]),e}(b)}(r,t),t.exports&&(d["/cloud/module/venue_main_product_card_a/venue_main_product_card_a.action.js"]=t.exports)}(),l="/cloud/container/pure_container/pure_container.action.js",function(){var t={type:"resource"};!function(t,e){}(r,t),t.exports&&(d["/cloud/container/pure_container/pure_container.action.js"]=t.exports)}(),l="/cloud/module/product_soft_article/product_soft_article.action.js",function(){var t={type:"resource"};!function(t,e){var n=t("mi-home-lib"),r=n.Rag;e.exports=function(t){function e(){o(this,e);for(var t=arguments.length,i=Array(t),n=0;n