import{r as e,o as l,n as a,c as t,b as s,d as o,e as u,f as i,w as n,q as c,g as r,l as d,t as v,v as h,x as m,h as p,i as f,F as g,k as _,y,p as w,S as x,z as b,A as k,B as C}from"./index-DVkgSHpn.js";import{_ as j}from"./el-navbar.DVIyjZEN.js";import{_ as V,b as z,a as U}from"./el-layout._U-vZTft.js";import{_ as A}from"./el-loading.BSG4bmSC.js";import{_ as E}from"./tabbar.CESuM5GW.js";import"./el-loading-icon.Bh3RKCou.js";const I=V({__name:"category",setup(V){const I=e(!0),R=e(0),S=e([]),T=e(0),$=e("menu-0"),q=e("item-0"),B=e(0);l((()=>{uni.$http.get("category/index").then((e=>{I.value=!1,e.code&&(S.value=e.data,a((()=>{X()})))}))}));const F=e(0),H=e=>{if(L.value.length<=0)return;let l=e.detail.scrollTop,a=B.value;l>=F.value?a+1<L.value.length&&l>=L.value[a]&&(B.value=a+1):a-1>=0&&l<L.value[a-1]&&(B.value=a-1),$.value="menu-"+B.value,F.value=l},L=e([]),P=e([]),X=()=>{let e=0;const l=c();l.selectAll(".goods-item").boundingClientRect().exec((l=>{l[0].forEach((l=>{e+=l.height,L.value.push(e)}))})),P.value=[];let a=0;l.select(".menu-item").boundingClientRect().exec((e=>{e[0].forEach((e=>{a+=e.height,P.value.push(a)}))}))},D=t((()=>{const{windowHeight:e}=_();return e-R.value-96}));return(e,l)=>{const a=s(o("el-navbar"),j),t=s(o("uni-icons"),z),c=y,_=w,V=x,F=C,L=s(o("el-loading"),A),P=s(o("tabbar"),E),X=s(o("el-layout"),U);return u(),i(X,null,{default:n((()=>[r(a,{top:R.value,"onUpdate:top":l[0]||(l[0]=e=>R.value=e),placeholder:!0,fixed:!0,showLeft:!1,border:!1,title:"分类"},null,8,["top"]),r(_,{class:"wrapper"},{default:n((()=>[r(_,{class:"search-box"},{default:n((()=>[r(_,{class:"search",onClick:l[1]||(l[1]=e=>d(v)("pages/search/index"))},{default:n((()=>[r(t,{type:"search",size:"18"}),r(c,null,{default:n((()=>[h("请输入关键字")])),_:1})])),_:1})])),_:1}),r(_,{class:"category-wrap"},{default:n((()=>[r(V,{class:"menu",style:m([{overflow:"hidden"},{height:D.value+"px"}]),"scroll-with-animation":"true","scroll-y":"true","scroll-top":T.value,"scroll-into-view":$.value},{default:n((()=>[(u(!0),p(g,null,f(S.value,((e,l)=>(u(),i(_,{key:l,class:b(["menu-item",{active:B.value==l}]),onClick:e=>(e=>{B.value=e,q.value="item-"+e})(l),id:"menu-"+l},{default:n((()=>[h(k(e.title),1)])),_:2},1032,["class","onClick","id"])))),128))])),_:1},8,["style","scroll-top","scroll-into-view"]),r(V,{class:"right","scroll-into-view":q.value,"scroll-with-animation":"true","scroll-y":"true",style:m([{overflow:"hidden"},{height:D.value+"px"}]),onScroll:H},{default:n((()=>[(u(!0),p(g,null,f(S.value,((e,l)=>(u(),i(_,{key:l,class:"s-list goods-item",id:"item-"+l},{default:n((()=>[r(c,{class:"s-item"},{default:n((()=>[h(k(e.title),1)])),_:2},1024),r(_,{class:"t-list"},{default:n((()=>[(u(!0),p(g,null,f(e.children,((e,l)=>(u(),i(_,{onClick:l=>d(v)(`pages/goods/index?id=${e.id}`),class:"t-item",key:l},{default:n((()=>[r(F,{src:e.photo},null,8,["src"]),r(_,{class:"children-text"},{default:n((()=>[r(c,null,{default:n((()=>[h(k(e.title),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:2},1024)])),_:2},1032,["id"])))),128))])),_:1},8,["scroll-into-view","style"])])),_:1})])),_:1}),r(L,{modelValue:I.value,"onUpdate:modelValue":l[2]||(l[2]=e=>I.value=e),zIndex:"1000"},null,8,["modelValue"]),r(P)])),_:1})}}},[["__scopeId","data-v-fe365c95"]]);export{I as default};
//# sourceMappingURL=pages-index-category.CMoRg0Q5.js.map
