Files
2026-04-29 15:33:58 +08:00

1 line
5.0 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/mall/index"],{"0285":function(t,e,o){"use strict";o.d(e,"b",(function(){return n})),o.d(e,"c",(function(){return r})),o.d(e,"a",(function(){}));var n=function(){var t=this,e=t.$createElement,o=(t._self._c,t.loadEnd?t.__map(t.categoryList,(function(e,o){var n=t.__get_orig(e),r=t.selectParentCategory==e.id&&e.child&&e.child.length;return{$orig:n,g0:r}})):null),n=t.loadEnd?t.goodsList.length:null,r=Number(t.cartNumber);t.$mp.data=Object.assign({},{$root:{l0:o,g1:n,m0:r}})},r=[]},6888:function(t,e,o){},"6fe2":function(t,e,o){"use strict";o.r(e);var n=o("c121"),r=o.n(n);for(var i in n)["default"].indexOf(i)<0&&function(t){o.d(e,t,(function(){return n[t]}))}(i);e["default"]=r.a},"8b48":function(t,e,o){"use strict";var n=o("6888"),r=o.n(n);r.a},c121:function(t,e,o){"use strict";(function(t){var n=o("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(o("af34")),i=n(o("7ca3")),a=o("8f59");function c(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,n)}return o}var s={components:{carousel:function(){o.e("pages/component/carousel/carousel").then(function(){return resolve(o("b5fc"))}.bind(null,o)).catch(o.oe)}},data:function(){return{loadEnd:!1,carouselList:[],categoryList:[],selectParentCategory:0,selectChildCategory:0,goodsList:[],triggered:!1,scrollTop:0,oldScrollTop:0,page:1,hasMore:!1,limit:20,cartNumber:0}},computed:function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?c(Object(o),!0).forEach((function(e){(0,i.default)(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):c(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({},(0,a.mapState)({themeColor:function(t){return t.app.themeColor},shareImage:function(t){return t.app.shareImage},shareTitle:function(t){return t.app.shareTitle}})),onLoad:function(){var e=this;t.showLoading({title:"加载中"}),this.getCarousel(),this.getCategoay(),this.getGoodsList((function(){t.hideLoading(),e.loadEnd=!0}))},onShow:function(){t.getStorageSync("token")&&this.getCartNumber()},onShareAppMessage:function(){return{title:this.shareTitle,imageUrl:this.shareImage}},onShareTimeline:function(){return{title:this.shareTitle,imageUrl:this.shareImage}},methods:{getCarousel:function(){var e=this;this.$util.request("mall.carousel").then((function(o){1==o.code?e.carouselList=o.data:t.showToast({title:o.msg,icon:"none"})})).catch((function(t){console.error("获取轮播图",t)}))},getCategoay:function(){var e=this;this.$util.request("mall.categoay").then((function(o){1==o.code?e.categoryList=o.data:t.showToast({title:o.msg,icon:"none"})})).catch((function(t){console.error("获取商品分类",t)}))},getGoodsList:function(e){var o=this,n={page:this.page,limit:this.limit};0!=this.selectParentCategory&&(0==this.selectChildCategory?n.category_id=this.selectParentCategory:n.category_id=this.selectChildCategory),this.$util.request("mall.goodsList",n).then((function(n){if(e&&e(),1==n.code){var i=n.data.data;o.hasMore=o.page<n.data.total/o.limit,o.goodsList=1==o.page?i:[].concat((0,r.default)(o.goodsList),(0,r.default)(i))}else t.showToast({title:n.msg,icon:"none"})})).catch((function(t){console.error("获取商品列表",t)}))},changeParentCategory:function(t){var e=this;this.selectParentCategory=t,this.selectChildCategory=0,this.scrollTop=this.oldScrollTop,this.getGoodsList((function(){e.scrollTop=e.oldScrollTop=0}))},changeChildCategory:function(t){var e=this;this.selectChildCategory=t,this.scrollTop=this.oldScrollTop,this.getGoodsList((function(){e.scrollTop=e.oldScrollTop=0}))},onScrollBottom:function(){this.hasMore&&(this.page++,this.getGoodsList())},onScrollRefresh:function(){var e=this;this.page=1,this.triggered=!0,this.getGoodsList((function(){e.triggered=!1,t.stopPullDownRefresh()}))},onScroll:function(t){this.oldScrollTop=t.detail.scrollTop},toDetails:function(t){this.$util.toPage({mode:1,path:"/pagesMall/goods/details?id="+t})},getCartNumber:function(){var e=this;this.$util.request("mall.cartNumber").then((function(o){1==o.code?e.cartNumber=o.data.number||0:t.showToast({title:o.msg,icon:"none"})})).catch((function(t){console.error("获取购物车数量",t)}))},toShoppingCart:function(){this.$util.toPage({mode:1,path:"/pagesMall/cart/index"})}}};e.default=s}).call(this,o("df3c")["default"])},c5ec:function(t,e,o){"use strict";(function(t,e){var n=o("47a9");o("aa6c");n(o("3240"));var r=n(o("ed9b"));t.__webpack_require_UNI_MP_PLUGIN__=o,e(r.default)}).call(this,o("3223")["default"],o("df3c")["createPage"])},ed9b:function(t,e,o){"use strict";o.r(e);var n=o("0285"),r=o("6fe2");for(var i in r)["default"].indexOf(i)<0&&function(t){o.d(e,t,(function(){return r[t]}))}(i);o("8b48");var a=o("828b"),c=Object(a["a"])(r["default"],n["b"],n["c"],!1,null,null,null,!1,n["a"],void 0);e["default"]=c.exports}},[["c5ec","common/runtime","common/vendor"]]]);