advance.js 7.3 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/miaosha/advance/advance"],{2087:function(t,e,n){},"31d9":function(t,e,n){"use strict";var i,a=function(){var t=this,e=t.$createElement;t._self._c},r=[];n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return i}))},"48b3":function(t,e,n){"use strict";var i=n("2087"),a=n.n(i);a.a},9331:function(t,e,n){"use strict";n.r(e);var i=n("31d9"),a=n("e39d");for(var r in a)"default"!==r&&function(t){n.d(e,t,(function(){return a[t]}))}(r);n("48b3");var o,s=n("f0c5"),u=Object(s["a"])(a["default"],i["b"],i["c"],!1,null,"51d311eb",null,!1,i["a"],o);e["default"]=u.exports},dbf8:function(t,e,n){"use strict";(function(t){n("8748");i(n("66fd"));var e=i(n("9331"));function i(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},e39d:function(t,e,n){"use strict";n.r(e);var i=n("f8c9"),a=n.n(i);for(var r in i)"default"!==r&&function(t){n.d(e,t,(function(){return i[t]}))}(r);e["default"]=a.a},f8c9:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n("4795")),a=n("2f62");function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return l(t)||c(t)||u(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 u(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(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(t,e):void 0}}function c(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 m(t,e,n,i,a,r,o){try{var s=t[r](o),u=s.value}catch(c){return void n(c)}s.done?e(u):Promise.resolve(u).then(i,a)}function d(t){return function(){var e=this,n=arguments;return new Promise((function(i,a){var r=t.apply(e,n);function o(t){m(r,i,a,o,s,"next",t)}function s(t){m(r,i,a,o,s,"throw",t)}o(void 0)}))}}function f(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?f(Object(n),!0).forEach((function(e){g(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var v=function(){n.e("plugins/miaosha/components/app-scroll").then(function(){return resolve(n("5986"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("plugins/miaosha/components/app-text-time").then(function(){return resolve(n("40d3"))}.bind(null,n)).catch(n.oe)},_=function(){n.e("plugins/miaosha/components/app-product-list").then(function(){return resolve(n("29cd"))}.bind(null,n)).catch(n.oe)},y={name:"advance",data:function(){return{timeList:[],listIndex:0,goodsList:[],timeBool:!1,next_miaosha_date_time:"",page:1,over:!1,open_time:null,type:null,currentRoute:this.$platDiff.route(),tabbarbool:!1,html:"",time:-1,loadding:!0}},computed:h({},(0,a.mapState)({tabBarNavs:function(t){return t.mallConfig.navbar.navs}}),{},(0,a.mapGetters)("iPhoneX",{BotHeight:"getBotHeight"})),onShow:function(){var t=this;this.request({url:this.$api.miaosha.time_list,data:{}}).then((function(e){t.timeList=e.list,t.next_miaosha_date_time=e.next_miaosha_date_time,1===e.is_estimate&&t.timeList.push({label:"预告",type:2,open_time:0,status:0}),t.loadding=!1;var n=!1;t.timeList.map((function(e,i){1===e.status&&(t.listIndex=i,t.setGetTime(t.timeList[t.listIndex].date_time),n=!0,t.open_time=e.open_time,t.type=1,t.request({url:t.$api.miaosha.goods,data:{open_time:e.open_time,type:1,page:t.page}}).then((function(e){t.goodsList=e.list})))})),n||(t.listIndex=0,t.open_time=0,t.type=0,1===t.timeList.length?1===e.is_estimate?(t.timeBool=!0,t.request({url:t.$api.miaosha.goods,data:{open_time:t.timeList[0].open_time,type:2,page:t.page}}).then((function(e){t.goodsList=e.list}))):t.request({url:t.$api.miaosha.goods,data:{open_time:t.timeList[0].open_time,type:1,page:t.page}}).then((function(e){t.goodsList=e.list})):t.timeList.length>1&&(t.setGetTime(t.timeList[t.listIndex].date_time),t.open_time=t.timeList[0].open_time,t.type=1,t.request({url:t.$api.miaosha.goods,data:{open_time:t.timeList[0].open_time,type:1,page:t.page}}).then((function(e){t.goodsList=e.list}))))}))},onHide:function(){clearInterval(this.time)},onUnload:function(){clearInterval(this.time)},methods:{request:function(t){var e=this;return d(i.default.mark((function n(){var a,r,o;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return a=t.url,r=t.data,n.next=3,e.$request({url:a,data:r});case 3:if(o=n.sent,0!==o.code){n.next=6;break}return n.abrupt("return",o.data);case 6:case"end":return n.stop()}}),n)})))()},activeIndex:function(t,e){var n=this,i=1;this.over=!1,this.listIndex=t,this.page=1,2===e.type?(clearInterval(this.time),i=2,this.timeBool=!0):(this.setGetTime(this.timeList[this.listIndex].date_time),this.timeBool=!1),this.open_time=e.open_time,this.type=i,this.request({url:this.$api.miaosha.goods,data:{open_time:e.open_time,type:i,page:this.page}}).then((function(t){n.goodsList=t.list}))},setTime:function(t){for(var e=0;e<this.timeList.length;e++)this.timeList[e].open_time===t.open_time&&1===t.status&&(this.timeList[e].status=2)},b:function(){for(var t=this.currentRoute,e=0;e<this.tabBarNavs.length;e++)if(t.includes(this.tabBarNavs[e].url.split("?")[0]))return this.tabbarbool=!0;return this.tabbarbool=!1},setGetTime:function(t){var e=this;clearInterval(this.time);var n=new Date(t.replace(/-/g,"/")),i=n.getTime()-(new Date).getTime(),a=parseInt(i/1e3/60/60/24%30),r=parseInt(i/1e3/60/60%24),o=parseInt(i/1e3/60%60),s=parseInt(i/1e3%60);this.html=a>0?a+"天"+r+":"+(o<10?"0"+o:o)+":"+(s<10?"0"+s:s):r+":"+(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.setTime());var i=parseInt(t/1e3/60/60/24%30),a=parseInt(t/1e3/60/60%24),r=parseInt(t/1e3/60%60),o=parseInt(t/1e3%60);e.html=i>0?i+"天"+a+":"+(r<10?"0"+r:r)+":"+(o<10?"0"+o:o):a+":"+(r<10?"0"+r:r)+":"+(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})},components:{"app-scroll":v,"app-text-time":b,"app-product-list":_},onReachBottom:function(){var t=this;this.over||(this.page+=1,this.$request({url:this.$api.miaosha.goods,data:{open_time:this.open_time,type:this.type,page:this.page}}).then((function(e){0===e.code&&(e.data.list.length>0?t.goodsList=[].concat(o(t.goodsList),o(e.data.list)):t.over=!0)})))},watch:{tabBarNavs:{handler:function(){this.b()},immediate:!0}}};e.default=y}).call(this,n("543d")["default"])}},[["dbf8","common/runtime","common/vendor"]]]);