"use strict";const e=require("../../common/vendor.js"),t=require("../../sheep/index.js"),i=require("../../sheep/api/product/category.js"),s=require("../../sheep/api/product/spu.js"),r=require("../../sheep/util/index.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.js"),require("../../sheep/platform/index.js"),require("../../sheep/platform/provider/wechat/index.js"),require("../../sheep/platform/provider/wechat/miniProgram.js"),require("../../sheep/api/member/auth.js"),require("../../sheep/api/member/social.js"),require("../../sheep/api/member/user.js"),require("../../sheep/platform/provider/apple/index.js"),require("../../sheep/platform/share.js"),require("../../sheep/router/index.js"),require("../../sheep/hooks/useModal.js"),require("../../sheep/helper/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.js"),require("../../sheep/helper/throttle.js"),require("../../sheep/platform/pay.js"),require("../../sheep/api/pay/order.js"),require("../../sheep/store/user.js"),require("../../sheep/store/cart.js"),require("../../sheep/api/trade/cart.js"),require("../../sheep/api/pay/wallet.js"),require("../../sheep/api/trade/order.js"),require("../../sheep/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/zIndex.js"),!Array){(e.resolveComponent("uni-load-more")+e.resolveComponent("s-layout"))()}Math||(a+n+o+(()=>"../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../../sheep/components/s-layout/s-layout.js"))();const o=()=>"./components/second-one.js",a=()=>"./components/first-one.js",n=()=>"./components/first-two.js",p={__name:"category",setup(o){const a=e.reactive({style:"second_one",categoryList:[],activeMenu:0,pagination:{list:[],total:[],pageNo:1,pageSize:6},loadStatus:""}),{safeArea:n}=t.sheep.$platform.device,p=e.computed((()=>n.height-44-50));const u=e=>{a.activeMenu=e,"first_one"!==a.style&&"first_two"!==a.style||(a.pagination.pageNo=1,a.pagination.list=[],a.pagination.total=0,l())};async function l(){a.loadStatus="loading";const t=await s.SpuApi.getSpuPage({categoryId:a.categoryList[a.activeMenu].id,pageNo:a.pagination.pageNo,pageSize:a.pagination.pageSize});0===t.code&&(a.pagination.list=e._.concat(a.pagination.list,t.data.list),a.pagination.total=t.data.total,a.loadStatus=a.pagination.list.length<a.pagination.total?"more":"noMore")}function c(){"noMore"!==a.loadStatus&&(a.pagination.pageNo++,l())}return e.onLoad((async()=>{await async function(){const{code:e,data:t}=await i.CategoryApi.getCategoryList();0===e&&(a.categoryList=r.handleTree(t))}(),"first_one"!==a.style&&"first_two"!==a.style||u(0)})),e.onReachBottom((()=>{c()})),(i,s)=>{var r,o;return e.e({a:e.f(a.categoryList,((t,i,s)=>({a:e.t(t.name),b:t.id,c:e.n({"menu-item-active":i===a.activeMenu}),d:e.o((e=>u(i)),t.id)}))),b:e.s({height:p.value+"px"}),c:null==(r=a.categoryList)?void 0:r.length},(null==(o=a.categoryList)?void 0:o.length)?e.e({d:a.categoryList[a.activeMenu].picUrl},a.categoryList[a.activeMenu].picUrl?{e:e.unref(t.sheep).$url.cdn(a.categoryList[a.activeMenu].picUrl)}:{},{f:"first_one"===a.style},"first_one"===a.style?{g:e.p({pagination:a.pagination})}:{},{h:"first_two"===a.style},"first_two"===a.style?{i:e.p({pagination:a.pagination})}:{},{j:"second_one"===a.style},"second_one"===a.style?{k:e.p({data:a.categoryList,activeMenu:a.activeMenu})}:{},{l:("first_one"===a.style||"first_two"===a.style)&&a.pagination.total>0},("first_one"===a.style||"first_two"===a.style)&&a.pagination.total>0?{m:e.o(c),n:e.p({status:a.loadStatus,"content-text":{contentdown:"点击查看更多"}})}:{},{o:e.s({height:p.value+"px"})}):{},{p:e.s({height:p.value+"px"}),q:e.p({title:"分类",tabbar:"/pages/index/category",bgStyle:{color:"#fff"}})})}}},u=e._export_sfc(p,[["__scopeId","data-v-f26f3105"]]);wx.createPage(u);
