pages-index-category.f9de6581.js 5.6 KB

1
  1. import{e as t,f as s,w as a,j as e,t as o,u as l,k as i,F as n,r as c,v as r,s as d,i as u,x as p,l as g,m as _,y as f,c as y,o as m,z as v,_ as x,A as b,g as k,S as h,B as j}from"./index-b48a414d.js";import{_ as w}from"./uni-load-more.647920f4.js";import{f as M,h as S,_ as C}from"./s-layout.d6dcdc81.js";import{_ as L}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as I}from"./s-goods-column.5d43688b.js";import{C as N}from"./category.3f44241a.js";import{S as z}from"./spu.3911022d.js";import"./phone-international-input.feef99c7.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: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=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: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=L({__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(M)(i.price)),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])])),_:2},1024)))),128))]})),_:1})])),_:1})}},[["__scopeId","data-v-0d556254"]]),O=L({__name:"category",setup(M){const L=f({style:"second_one",categoryList:[],activeMenu:0,pagination:{list:[],total:[],pageNo:1,pageSize:6},loadStatus:""}),{safeArea:I}=d.$platform.device,O=y((()=>I.height-44-50));const A=t=>{L.activeMenu=t,"first_one"!==L.style&&"first_two"!==L.style||(L.pagination.pageNo=1,L.pagination.list=[],L.pagination.total=0,q())};async function q(){L.loadStatus="loading";const t=await z.getSpuPage({categoryId:L.categoryList[L.activeMenu].id,pageNo:L.pagination.pageNo,pageSize:L.pagination.pageSize});0===t.code&&(L.pagination.list=x.concat(L.pagination.list,t.data.list),L.pagination.total=t.data.total,L.loadStatus=L.pagination.list.length<L.pagination.total?"more":"noMore")}function B(){"noMore"!==L.loadStatus&&(L.pagination.pageNo++,q())}return m((async()=>{await async function(){const{code:t,data:s}=await N.getCategoryList();0===t&&(L.categoryList=S(s))}(),"first_one"!==L.style&&"first_two"!==L.style||A(0)})),v((()=>{B()})),(f,y)=>{const m=u,v=h,x=p,M=g(_("uni-load-more"),w),S=g(_("s-layout"),C);return t(),s(S,{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:b([{height:O.value+"px"}])},{default:a((()=>{var u;return[e(v,{class:"side-menu-wrap","scroll-y":"",style:b([{height:O.value+"px"}])},{default:a((()=>[(t(!0),i(n,null,c(L.categoryList,((i,n)=>(t(),s(m,{class:j(["menu-item ss-flex",[{"menu-item-active":n===L.activeMenu}]]),key:i.id,onClick:t=>A(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=L.categoryList)?void 0:u.length)?(t(),s(v,{key:0,class:"goods-list-box","scroll-y":"",style:b([{height:O.value+"px"}])},{default:a((()=>[L.categoryList[L.activeMenu].picUrl?(t(),s(x,{key:0,class:"banner-img",src:r(d).$url.cdn(L.categoryList[L.activeMenu].picUrl),mode:"widthFix"},null,8,["src"])):k("",!0),"first_one"===L.style?(t(),s(F,{key:1,pagination:L.pagination},null,8,["pagination"])):k("",!0),"first_two"===L.style?(t(),s(U,{key:2,pagination:L.pagination},null,8,["pagination"])):k("",!0),"second_one"===L.style?(t(),s($,{key:3,data:L.categoryList,activeMenu:L.activeMenu},null,8,["data","activeMenu"])):k("",!0),("first_one"===L.style||"first_two"===L.style)&&L.pagination.total>0?(t(),s(M,{key:4,status:L.loadStatus,"content-text":{contentdown:"点击查看更多"},onClick:B},null,8,["status"])):k("",!0)])),_:1},8,["style"])):k("",!0)]})),_:1},8,["style"])])),_:1})])),_:1})}}},[["__scopeId","data-v-f26f3105"]]);export{O as default};