advance.js 7.5 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/miaosha/advance/advance"],{"29b0a":function(t,e,n){"use strict";var i=n("7bc2"),r=n.n(i);r.a},"2d04":function(t,e,n){"use strict";n.r(e);var i=n("f909"),r=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=r.a},"42a5":function(t,e,n){"use strict";n.r(e);var i=n("8e818"),r=n("2d04");for(var a in r)"default"!==a&&function(t){n.d(e,t,(function(){return r[t]}))}(a);n("29b0a");var o,s=n("f0c5"),c=Object(s["a"])(r["default"],i["b"],i["c"],!1,null,"6b667922",null,!1,i["a"],o);e["default"]=c.exports},"7bc2":function(t,e,n){},"8e818":function(t,e,n){"use strict";var i;n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return i}));var r=function(){var t=this,e=t.$createElement;t._self._c},a=[]},db04:function(t,e,n){"use strict";(function(t){n("2d0a");i(n("66fd"));var e=i(n("42a5"));function i(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},f909:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=a(n("a34a")),r=n("2f62");function a(t){return t&&t.__esModule?t:{default:t}}function o(t){return l(t)||u(t)||c(t)||s()}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t,e){if(t){if("string"===typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function u(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function l(t){if(Array.isArray(t))return p(t)}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function f(t,e,n,i,r,a,o){try{var s=t[a](o),c=s.value}catch(u){return void n(u)}s.done?e(c):Promise.resolve(c).then(i,r)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var a=t.apply(e,n);function o(t){f(a,i,r,o,s,"next",t)}function s(t){f(a,i,r,o,s,"throw",t)}o(void 0)}))}}function m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?m(Object(n),!0).forEach((function(e){v(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var g=function(){n.e("plugins/miaosha/components/app-product-list").then(function(){return resolve(n("4bca"))}.bind(null,n)).catch(n.oe)},_={name:"advance",data:function(){return{time_list:[],goods_list:[],next_time:"",page:1,active_index:null,scroll_id:"",is_estimate:0,open_time:0,type:0,page_count:1,nav_bool:!1,currentRoute:this.$platDiff.route(),time:-1,html:"",is_booking:!1,loading:!1}},computed:h(h(h({},(0,r.mapState)({tabBarNavs:function(t){return t.mallConfig.navbar.navs}})),(0,r.mapGetters)("iPhoneX",{BotHeight:"getBotHeight"})),(0,r.mapGetters)("mallConfig",{getTheme:"getTheme"})),onLoad:function(){var t=this;this.$commonLoad.onload(),this.getTimeList().then((function(){var e=!1;t.time_list.map((function(n,i){1===n.status&&(e=!0,t.active_index=i,t.scroll_id="ms_".concat(i),n.type=1,t.getGoodsList(n))})),t.$nextTick((function(){t.loading=!0})),!1===e&&(t.active_index=0,t.time_list.length>0?(t.type=1,t.open_time=t.time_list[0].open_time,t.getGoodsList({open_time:t.open_time,type:t.type})):1===t.is_estimate&&(t.type=2,t.open_time=0,t.is_booking=!0,t.getGoodsList({open_time:t.open_time,type:t.type})))})),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]})},onShow:function(){1===this.type&&this.set_time(this.time_list[this.active_index].date_time)},onHide:function(){clearInterval(this.time)},onUnload:function(){clearInterval(this.time)},methods:{getTimeList:function(){var e=this;return d(i.default.mark((function n(){var r,a,o,s,c;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.showLoading({title:"加载中..."}),n.prev=1,n.next=4,e.$request({url:e.$api.miaosha.time_list,method:"get"});case 4:r=n.sent,0===r.code&&(a=r.data,o=a.is_estimate,s=a.list,c=a.next_miaosha_date_time,e.time_list=s,e.is_estimate=o,e.next_time=c),n.next=11;break;case 8:throw n.prev=8,n.t0=n["catch"](1),new Error(n.t0);case 11:t.hideLoading();case 12:case"end":return n.stop()}}),n,null,[[1,8]])})))()},getGoodsList:function(t){var e=this;return d(i.default.mark((function n(){var r;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.prev=0,e.open_time=t.open_time,e.type=t.type,1===e.type?e.set_time(t.date_time):clearInterval(e.time),n.next=6,e.$request({url:e.$api.miaosha.goods,data:{open_time:t.open_time,type:t.type,page:e.page?e.page:1}});case 6:r=n.sent,0===r.code&&(e.goods_list=r.data.list,e.page_count=r.data.pagination.page_count),n.next=13;break;case 10:throw n.prev=10,n.t0=n["catch"](0),new Error(n.t0);case 13:case"end":return n.stop()}}),n,null,[[0,10]])})))()},activeTime:function(t,e){this.active_index=e,this.scroll_id="ms_".concat(e),this.page=1,this.getGoodsList(t),this.getTimeList(),2===t.type?this.is_booking=!0:this.is_booking=!1},scrollLower:function(){var t=this;return d(i.default.mark((function e(){var n;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(e.prev=0,!(t.page>=t.page_count)){e.next=3;break}return e.abrupt("return");case 3:return t.page++,e.next=6,t.$request({url:t.$api.miaosha.goods,data:{open_time:t.open_time,type:t.type,page:t.page}});case 6:n=e.sent,0===n.code&&(t.goods_list=[].concat(o(t.goods_list),o(n.data.list))),e.next=13;break;case 10:throw e.prev=10,e.t0=e["catch"](0),new Error(e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})))()},set_nav:function(){var t=null;t=this.currentRoute;for(var e=0;e<this.tabBarNavs.length;e++)if(t.includes(this.tabBarNavs[e].url.split("?")[0]))return this.nav_bool=!0;return this.nav_bool=!1},set_time:function(t){var e=this;if(clearInterval(this.time),t){var n=new Date(t.replace(/-/g,"/")),i=n.getTime()-(new Date).getTime(),r=parseInt(i/1e3/60/60/24%30),a=parseInt(i/1e3/60/60%24),o=parseInt(i/1e3/60%60),s=parseInt(i/1e3%60);this.html=r>0?r+"天"+a+":"+(o<10?"0"+o:o)+":"+(s<10?"0"+s:s):a+":"+(o<10?"0"+o:o)+":"+(s<10?"0"+s:s),this.time=setInterval((function(){var t=n.getTime()-(new Date).getTime();t<0&&(clearInterval(e.time),e.time_list[e.active_index].status=2);var i=parseInt(t/1e3/60/60/24%30),r=parseInt(t/1e3/60/60%24),a=parseInt(t/1e3/60%60),o=parseInt(t/1e3%60);e.html=i>0?i+"天"+r+":"+(a<10?"0"+a:a)+":"+(o<10?"0"+o:o):r+":"+(a<10?"0"+a:a)+":"+(o<10?"0"+o:o)}),1e3)}},router_go:function(){t.reLaunch({url:"/pages/index/index"})}},onShareAppMessage:function(){return this.$shareAppMessage({path:"/plugins/miaosha/advance/advance",title:this.$children[0].navigationBarTitle})},onShareTimeline:function(){return this.$shareTimeline({title:this.$children[0].navigationBarTitle,query:{}})},components:{"product-list":g},watch:{tabBarNavs:{handler:function(){this.set_nav()},immediate:!0}}};e.default=_}).call(this,n("543d")["default"])}},[["db04","common/runtime","common/vendor"]]]);