index.js 5.6 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/advance/index/index"],{"040d":function(e,t,n){"use strict";n.r(t);var r=n("09ee"),a=n("d48c");for(var i in a)"default"!==i&&function(e){n.d(t,e,(function(){return a[e]}))}(i);n("a636");var o,c=n("f0c5"),u=Object(c["a"])(a["default"],r["b"],r["c"],!1,null,"d8c79d42",null,!1,r["a"],o);t["default"]=u.exports},"09ee":function(e,t,n){"use strict";var r;n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return r}));var a=function(){var e=this,t=e.$createElement;e._self._c},i=[]},1863:function(e,t,n){},a636:function(e,t,n){"use strict";var r=n("1863"),a=n.n(r);a.a},d1bd:function(e,t,n){"use strict";(function(e){n("2d0a");r(n("66fd"));var t=r(n("040d"));function r(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,n("543d")["createPage"])},d48c:function(e,t,n){"use strict";n.r(t);var r=n("f264"),a=n.n(r);for(var i in r)"default"!==i&&function(e){n.d(t,e,(function(){return r[e]}))}(i);t["default"]=a.a},f264:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=i(n("a34a")),a=n("2f62");function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){return p(e)||d(e)||f(e)||l()}function l(){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 f(e,t){if(e){if("string"===typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function d(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function p(e){if(Array.isArray(e))return h(e)}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,a,i,o){try{var c=e[i](o),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,a)}function m(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){v(i,r,a,o,c,"next",e)}function c(e){v(i,r,a,o,c,"throw",e)}o(void 0)}))}}var g=function(){n.e("plugins/advance/components/search-input").then(function(){return resolve(n("267f"))}.bind(null,n)).catch(n.oe)},b=function(){n.e("plugins/advance/components/index-swipe").then(function(){return resolve(n("adca"))}.bind(null,n)).catch(n.oe)},y=function(){n.e("plugins/advance/components/index-product-list").then(function(){return resolve(n("28c0"))}.bind(null,n)).catch(n.oe)},w={name:"index",data:function(){return{product_list:[],picture_list:[],page_count:1,interval:null,page:1}},onHide:function(){clearInterval(this.interval)},onUnload:function(){clearInterval(this.interval)},onLoad:function(){var e=this;this.$commonLoad.onload(),this.requestBanner().then((function(){e.requestList()})),wx.showShareMenu({menus:["shareAppMessage","shareTimeline"]})},methods:{cutoffTime:function(e){var t=this,n=(new Date).getTime();e.map((function(r,a){var i=new Date(r.advanceGoods.end_prepayment_at.replace(/-/g,"/")).getTime(),o=i-n;if(o>0){var c=parseInt(o/1e3/60/60/24),u=parseInt(o/1e3/60/60%24),s=parseInt(o/1e3/60%60),l=parseInt(o/1e3%60);c>0?t.$set(e[a],"html","".concat(c,"天").concat(u,":").concat(s<10?"0"+s:s,":").concat(l<10?"0"+l:l)):t.$set(e[a],"html","".concat(u,":").concat(s<10?"0"+s:s,":").concat(l<10?"0"+l:l))}else t.$delete(e,a),t.product_list.length<10&&t.page_count>1&&(t.product_list=[],t.requestList())}))},set_interval:function(){var e=this;clearInterval(this.interval),this.cutoffTime(this.product_list),this.interval=setInterval((function(){e.cutoffTime(e.product_list)}),1e3)},requestList:function(){var e=this;return m(r.default.mark((function t(){var n,a;return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$request({url:e.$api.advance.goods,method:"get",data:{page:e.page}});case 2:n=t.sent,0===n.code&&((a=e.product_list).push.apply(a,s(n.data.list)),e.page_count=n.data.pagination.page_count,e.set_interval());case 4:case"end":return t.stop()}}),t)})))()},requestBanner:function(){var e=this;return m(r.default.mark((function t(){return r.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.$request({url:e.$api.advance.banner,method:"get"}).then((function(t){0===t.code&&(e.picture_list=t.data.list)}));case 1:case"end":return t.stop()}}),t)})))()}},components:{"search-input":g,"index-swipe":b,"product-list":y},onShareAppMessage:function(){return this.$shareAppMessage({path:"/plugins/advance/index/index",title:this.$children[0].navigationBarTitle})},onShareTimeline:function(){return this.$shareTimeline({title:this.$children[0].navigationBarTitle,query:{}})},computed:c({},(0,a.mapGetters)("mallConfig",{getTheme:"getTheme"})),onReachBottom:function(){this.page<this.page_count&&(this.page++,this.requestList())}};t.default=w}},[["d1bd","common/runtime","common/vendor"]]]);