pages-index-category.7f85811f.js 5.6 KB

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