pages-index-category.9208c486.js 5.6 KB

1
  1. import{f as t,g as s,w as e,k as a,u as o,v as l,l as i,F as n,r as c,x as d,s as r,j as u,y as p,m as g,n as _,z as f,c as y,o as m,A as v,C as x,S as b,_ as k,B as h,i as w,D as j,E as M}from"./index-a116b7fa.js";import{_ as S}from"./uni-load-more.2682655d.js";import{_ as C}from"./s-layout.4ae51839.js";import{_ as L}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as I}from"./s-goods-column.67cd78e3.js";import{f as N,h as z}from"./useGoods.6b315a78.js";import"./phone-international-input.b9f6c8e6.js";import"./points.c381a8e1.js";/* empty css *//* empty css *//* empty css */const $=L({__name:"second-one",props:{data:{type:Object,default:()=>({})},activeMenu:[Number,String]},setup(g){const _=g;return(f,y)=>{const m=u,v=p;return t(),s(m,null,{default:e((()=>[a(m,{class:"title-box ss-flex ss-col-center ss-row-center ss-p-b-30"},{default:e((()=>[a(m,{class:"title-line-left"}),a(m,{class:"title-text ss-p-x-20"},{default:e((()=>[o(l(_.data[g.activeMenu].name),1)])),_:1}),a(m,{class:"title-line-right"})])),_:1}),a(m,{class:"goods-item-box ss-flex ss-flex-wrap ss-p-b-20"},{default:e((()=>[(t(!0),i(n,null,c(_.data[g.activeMenu].children,(i=>(t(),s(m,{class:"goods-item",key:i.id,onClick:t=>d(r).$router.go("/pages/goods/list",{categoryId:i.id})},{default:e((()=>[a(v,{class:"goods-img",src:i.picUrl,mode:"aspectFill"},null,8,["src"]),a(m,{class:"ss-p-10"},{default:e((()=>[a(m,{class:"goods-title ss-line-1"},{default:e((()=>[o(l(i.name),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})}}},[["__scopeId","data-v-b2688911"]]),F=L({__name:"first-one",props:{pagination:Object},setup:o=>(l,p)=>{const f=g(_("s-goods-column"),I),y=u;return t(),s(y,{class:"ss-flex-col"},{default:e((()=>[(t(!0),i(n,null,c(o.pagination.list,(o=>(t(),s(y,{class:"goods-box",key:o.id},{default:e((()=>[a(f,{size:"sl",data:o,onClick:t=>d(r).$router.go("/pages/goods/index",{id:o.id})},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})}},[["__scopeId","data-v-13cff1a5"]]),U=L({__name:"first-two",props:{pagination:Object},setup:g=>(_,f)=>{const y=p,m=u;return t(),s(m,null,{default:e((()=>[a(m,{class:"ss-flex flex-wrap"},{default:e((()=>{var u;return[(t(!0),i(n,null,c(null==(u=g.pagination)?void 0:u.list,(i=>(t(),s(m,{class:"goods-box",key:i.id},{default:e((()=>[a(m,{onClick:t=>d(r).$router.go("/pages/goods/index",{id:i.id})},{default:e((()=>[a(m,{class:"goods-img"},{default:e((()=>[a(y,{class:"goods-img",src:i.picUrl,mode:"aspectFit"},null,8,["src"])])),_:2},1024),a(m,{class:"goods-content"},{default:e((()=>[a(m,{class:"goods-title ss-line-1 ss-m-b-28"},{default:e((()=>[o(l(i.title),1)])),_:2},1024),a(m,{class:"goods-price"},{default:e((()=>[o("¥"+l(d(N)(i.price)),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])])),_:2},1024)))),128))]})),_:1})])),_:1})}},[["__scopeId","data-v-0d556254"]]),O=L({__name:"category",setup(L){const I=f({style:"second_one",categoryList:[],activeMenu:0,pagination:{list:[],total:[],pageNo:1,pageSize:6},loadStatus:""}),{safeArea:N}=r.$platform.device,O=y((()=>N.height-44-50));const A=t=>{I.activeMenu=t,"first_one"!==I.style&&"first_two"!==I.style||(I.pagination.pageNo=1,I.pagination.list=[],I.pagination.total=0,q())};async function q(){I.loadStatus="loading";const t=await b.getSpuPage({categoryId:I.categoryList[I.activeMenu].id,pageNo:I.pagination.pageNo,pageSize:I.pagination.pageSize});0===t.code&&(I.pagination.list=k.concat(I.pagination.list,t.data.list),I.pagination.total=t.data.total,I.loadStatus=I.pagination.list.length<I.pagination.total?"more":"noMore")}function B(){"noMore"!==I.loadStatus&&(I.pagination.pageNo++,q())}return m((async()=>{await async function(){const{code:t,data:s}=await x.getCategoryList();0===t&&(I.categoryList=z(s))}(),"first_one"!==I.style&&"first_two"!==I.style||A(0)})),v((()=>{B()})),(f,y)=>{const m=u,v=j,x=p,b=g(_("uni-load-more"),S),k=g(_("s-layout"),C);return t(),s(k,{title:"分类",tabbar:"/pages/index/category",bgStyle:{color:"#fff"}},{default:e((()=>[a(m,{class:"s-category"},{default:e((()=>[a(m,{class:"three-level-wrap ss-flex ss-col-top",style:h([{height:O.value+"px"}])},{default:e((()=>{var u;return[a(v,{class:"side-menu-wrap","scroll-y":"",style:h([{height:O.value+"px"}])},{default:e((()=>[(t(!0),i(n,null,c(I.categoryList,((i,n)=>(t(),s(m,{class:M(["menu-item ss-flex",[{"menu-item-active":n===I.activeMenu}]]),key:i.id,onClick:t=>A(n)},{default:e((()=>[a(m,{class:"menu-title ss-line-1"},{default:e((()=>[o(l(i.name),1)])),_:2},1024)])),_:2},1032,["class","onClick"])))),128))])),_:1},8,["style"]),(null==(u=I.categoryList)?void 0:u.length)?(t(),s(v,{key:0,class:"goods-list-box","scroll-y":"",style:h([{height:O.value+"px"}])},{default:e((()=>[I.categoryList[I.activeMenu].picUrl?(t(),s(x,{key:0,class:"banner-img",src:d(r).$url.cdn(I.categoryList[I.activeMenu].picUrl),mode:"widthFix"},null,8,["src"])):w("",!0),"first_one"===I.style?(t(),s(F,{key:1,pagination:I.pagination},null,8,["pagination"])):w("",!0),"first_two"===I.style?(t(),s(U,{key:2,pagination:I.pagination},null,8,["pagination"])):w("",!0),"second_one"===I.style?(t(),s($,{key:3,data:I.categoryList,activeMenu:I.activeMenu},null,8,["data","activeMenu"])):w("",!0),("first_one"===I.style||"first_two"===I.style)&&I.pagination.total>0?(t(),s(b,{key:4,status:I.loadStatus,"content-text":{contentdown:"点击查看更多"},onClick:B},null,8,["status"])):w("",!0)])),_:1},8,["style"])):w("",!0)]})),_:1},8,["style"])])),_:1})])),_:1})}}},[["__scopeId","data-v-f26f3105"]]);export{O as default};