1 |
- import{_ as t}from"./su-tabs.a383f815.js";import{s,y as o,o as a,z as e,e as i,f as r,w as l,_ as n,l as d,j as c,k as u,r as p,F as g,v as m,g as f,m as _,i as b,E as y,B as h,t as k,u as S,G as x}from"./index-b48a414d.js";import{_ as w}from"./su-sticky.aabc6a00.js";import{_ as v}from"./phone-international-input.feef99c7.js";import{_ as L}from"./s-goods-column.5d43688b.js";import{_ as j}from"./uni-load-more.647920f4.js";import{_ as F}from"./s-empty.6d3471cc.js";import{r as C,_ as G}from"./s-layout.d6dcdc81.js";import{S as z}from"./spu.3911022d.js";import{_ as O}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-badge.78cdef34.js";import"./points.c381a8e1.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,A=0;function H(t=0,s="left"){R.pagination.list[N]&&("left"===s?$+=t:A+=t,$<=A?R.leftGoodsList.push(R.pagination.list[N]):R.rightGoodsList.push(R.pagination.list[N]),N++)}function M(){C(R.pagination),R.leftGoodsList=[],R.rightGoodsList=[],N=0,$=0,A=0}function W(t){R.keyword=t,M(),E(R.currentSort,R.currentOrder)}function B(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,M(),E(t.sort,t.order))}async function E(){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",H())}function P(){"noMore"!==R.loadStatus&&(R.pagination.pageNo++,E(R.currentSort,R.currentOrder))}return a((t=>{R.categoryId=t.categoryId,R.keyword=t.keyword,E(R.currentSort,R.currentOrder)})),e((()=>{P()})),(o,a)=>{const e=d(_("su-tabs"),t),n=b,C=y,z=d(_("su-sticky"),w),O=d(_("su-popup"),v),I=d(_("s-goods-column"),L),N=x,$=d(_("uni-load-more"),j),A=d(_("s-empty"),F),q=d(_("s-layout"),G);return i(),r(q,{navbar:"normal",leftWidth:0,rightWidth:0,tools:"search",defaultSearch:R.keyword,onSearch:W},{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:B,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?(i(),r(C,{key:0,class:"sicon-goods-list"})):(i(),r(C,{key:1,class:"sicon-goods-card"}))])),_:1})])),_:1})])),_:1}),c(O,{show:R.showFilter,type:"top",round:"10",space:m(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((()=>[(i(!0),u(g,null,p(R.tabList[R.currentTab].list,((t,s)=>(i(),r(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,M(),E()):R.showFilter=!1);var o}},{default:l((()=>[k(S(t.label),1)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1},8,["show","space"]),R.iconStatus&&R.pagination.total>0?(i(),r(n,{key:0,class:"goods-list ss-m-t-20"},{default:l((()=>[(i(!0),u(g,null,p(R.pagination.list,(t=>(i(),r(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=>m(s).$router.go("/pages/goods/index",{id:t.id})},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})):f("",!0),!R.iconStatus&&R.pagination.total>0?(i(),r(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((()=>[(i(!0),u(g,null,p(R.leftGoodsList,(t=>(i(),r(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=>m(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:a[2]||(a[2]=t=>H(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((()=>[(i(!0),u(g,null,p(R.rightGoodsList,(t=>(i(),r(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=>m(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:a[3]||(a[3]=t=>H(t,"right"))},{cart:l((()=>[c(N,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):f("",!0),R.pagination.total>0?(i(),r($,{key:2,status:R.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:P},null,8,["status"])):f("",!0),0===R.pagination.total?(i(),r(A,{key:3,icon:"/static/soldout-empty.png",text:"暂无商品"})):f("",!0)])),_:1},8,["defaultSearch"])}}},[["__scopeId","data-v-acd1fb34"]]);export{I as default};
|