1 |
- import{_ as t}from"./su-tabs.1ce39404.js";import{s,v as o,o as a,x as e,e as r,f as i,w as l,_ as n,l as d,j as c,k as u,r as p,F as g,u as f,g as m,m as _,i as b,C as y,z as h,p as k,t as x,D as S}from"./index-9880b451.js";import{_ as w}from"./su-sticky.84aef901.js";import{d as v,_ as L}from"./s-layout.dfc5b0b5.js";import{_ as C}from"./s-goods-column.2324341a.js";import{_ as F}from"./uni-load-more.aac4524a.js";import{_ as j}from"./s-empty.74111684.js";import{r as G}from"./index.df38848e.js";import{S as z}from"./spu.3137f763.js";import{_ as O}from"./_plugin-vue_export-helper.1b428a4d.js";import"./useGoods.bdd1c2ea.js";/* empty css *//* empty css *//* empty css */const I=O({__name:"list",emits:["close","change"],setup(O,{emit:I}){const T=s.$platform.navbar,R=o({pagination:{list:[],total:0,pageNo:1,pageSize:6},currentSort:void 0,currentOrder:void 0,currentTab:0,curFilter:0,showFilter:!1,iconStatus:!1,keyword:"",categoryId:0,tabList:[{name:"综合推荐",list:[{label:"综合推荐"},{label:"价格升序",sort:"price",order:!0},{label:"价格降序",sort:"price",order:!1}]},{name:"销量",sort:"salesCount",order:!1},{name:"新品优先",value:"createTime",order:!1}],loadStatus:"",leftGoodsList:[],rightGoodsList:[]});let N=0,$=0,H=0;function M(t=0,s="left"){R.pagination.list[N]&&("left"===s?$+=t:H+=t,$<=H?R.leftGoodsList.push(R.pagination.list[N]):R.rightGoodsList.push(R.pagination.list[N]),N++)}function W(){G(R.pagination),R.leftGoodsList=[],R.rightGoodsList=[],N=0,$=0,H=0}function A(t){R.keyword=t,W(),P(R.currentSort,R.currentOrder)}function D(t){if(R.tabList[t.index].list)return R.currentTab=t.index,void(R.showFilter=!R.showFilter);R.showFilter=!1,t.index!==R.currentTab&&(R.currentTab=t.index,R.currentSort=t.sort,R.currentOrder=t.order,W(),P(t.sort,t.order))}async function P(){R.loadStatus="loading";const{code:t,data:s}=await z.getSpuPage({pageNo:R.pagination.pageNo,pageSize:R.pagination.pageSize,sortField:R.currentSort,sortAsc:R.currentOrder,categoryId:R.categoryId,keyword:R.keyword});0===t&&(R.pagination.list=n.concat(R.pagination.list,s.list),R.pagination.total=s.total,R.loadStatus=R.pagination.list.length<R.pagination.total?"more":"noMore",M())}function Y(){"noMore"!==R.loadStatus&&(R.pagination.pageNo++,P(R.currentSort,R.currentOrder))}return a((t=>{R.categoryId=t.categoryId,R.keyword=t.keyword,P(R.currentSort,R.currentOrder)})),e((()=>{Y()})),(o,a)=>{const e=d(_("su-tabs"),t),n=b,G=y,z=d(_("su-sticky"),w),O=d(_("su-popup"),v),I=d(_("s-goods-column"),C),N=S,$=d(_("uni-load-more"),F),H=d(_("s-empty"),j),Z=d(_("s-layout"),L);return r(),i(Z,{navbar:"normal",leftWidth:0,rightWidth:0,tools:"search",defaultSearch:R.keyword,onSearch:A},{default:l((()=>[c(z,{bgColor:"#fff"},{default:l((()=>[c(n,{class:"ss-flex"},{default:l((()=>[c(n,{class:"ss-flex-1"},{default:l((()=>[c(e,{list:R.tabList,scrollable:!1,onChange:D,current:R.currentTab},null,8,["list","current"])])),_:1}),c(n,{class:"list-icon",onClick:a[0]||(a[0]=t=>R.iconStatus=!R.iconStatus)},{default:l((()=>[R.iconStatus?(r(),i(G,{key:0,class:"sicon-goods-list"})):(r(),i(G,{key:1,class:"sicon-goods-card"}))])),_:1})])),_:1})])),_:1}),c(O,{show:R.showFilter,type:"top",round:"10",space:f(T)+38,backgroundColor:"#F6F6F6",zIndex:10,onClose:a[1]||(a[1]=t=>R.showFilter=!1)},{default:l((()=>[c(n,{class:"filter-list-box"},{default:l((()=>[(r(!0),u(g,null,p(R.tabList[R.currentTab].list,((t,s)=>(r(),i(n,{class:h(["filter-item",[{"filter-item-active":s===R.curFilter}]]),key:t.value,onClick:t=>{return o=s,void(R.currentSort!==R.tabList[0].list[o].sort||R.currentOrder!==R.tabList[0].list[o].order?(R.showFilter=!1,R.curFilter=o,R.tabList[0].name=R.tabList[0].list[o].label,R.currentSort=R.tabList[0].list[o].sort,R.currentOrder=R.tabList[0].list[o].order,W(),P()):R.showFilter=!1);var o}},{default:l((()=>[k(x(t.label),1)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1},8,["show","space"]),R.iconStatus&&R.pagination.total>0?(r(),i(n,{key:0,class:"goods-list ss-m-t-20"},{default:l((()=>[(r(!0),u(g,null,p(R.pagination.list,(t=>(r(),i(n,{class:"ss-p-l-20 ss-p-r-20 ss-m-b-20",key:t.id},{default:l((()=>[c(I,{class:"",size:"lg",data:t,topRadius:10,bottomRadius:10,onClick:o=>f(s).$router.go("/pages/goods/index",{id:t.id})},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})):m("",!0),!R.iconStatus&&R.pagination.total>0?(r(),i(n,{key:1,class:"ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"},{default:l((()=>[c(n,{class:"goods-list-box"},{default:l((()=>[(r(!0),u(g,null,p(R.leftGoodsList,(t=>(r(),i(n,{class:"left-list",key:t.id},{default:l((()=>[c(I,{class:"goods-md-box",size:"md",data:t,topRadius:10,bottomRadius:10,onClick:o=>f(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:a[2]||(a[2]=t=>M(t,"left"))},{cart:l((()=>[c(N,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1}),c(n,{class:"goods-list-box"},{default:l((()=>[(r(!0),u(g,null,p(R.rightGoodsList,(t=>(r(),i(n,{class:"right-list",key:t.id},{default:l((()=>[c(I,{class:"goods-md-box",size:"md",topRadius:10,bottomRadius:10,data:t,onClick:o=>f(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:a[3]||(a[3]=t=>M(t,"right"))},{cart:l((()=>[c(N,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):m("",!0),R.pagination.total>0?(r(),i($,{key:2,status:R.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:Y},null,8,["status"])):m("",!0),0===R.pagination.total?(r(),i(H,{key:3,icon:"/static/soldout-empty.png",text:"暂无商品"})):m("",!0)])),_:1},8,["defaultSearch"])}}},[["__scopeId","data-v-acd1fb34"]]);export{I as default};
|