pages-goods-list.af3f2bd1.js 5.8 KB

1
  1. import{_ as t}from"./su-tabs.40b9ec30.js";import{s,z as o,o as a,A as e,f as i,g as r,w as l,S as n,_ as d,m as c,k as u,l as p,r as g,F as f,x as m,i as _,n as b,j as y,I as h,E as k,u as x,v as S,J as w}from"./index-ba48620e.js";import{_ as v}from"./su-sticky.f4f657b5.js";import{_ as L}from"./phone-international-input.dd3ca29e.js";import{_ as j}from"./s-goods-column.8dd4e061.js";import{_ as F}from"./uni-load-more.966faf1b.js";import{_ as C}from"./s-empty.a75760f9.js";import{_ as G}from"./s-layout.04b95866.js";import{r as z}from"./useGoods.edb8879f.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-badge.539e0aa6.js";import"./points.c381a8e1.js";/* empty css *//* empty css *//* empty css */const O=I({__name:"list",emits:["close","change"],setup(I,{emit:O}){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(){z(R.pagination),R.leftGoodsList=[],R.rightGoodsList=[],N=0,$=0,A=0}function W(t){R.keyword=t,M(),E(R.currentSort,R.currentOrder)}function q(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 n.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=d.concat(R.pagination.list,s.list),R.pagination.total=s.total,R.loadStatus=R.pagination.list.length<R.pagination.total?"more":"noMore",H())}function J(){"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((()=>{J()})),(o,a)=>{const e=c(b("su-tabs"),t),n=y,d=h,z=c(b("su-sticky"),v),I=c(b("su-popup"),L),O=c(b("s-goods-column"),j),N=w,$=c(b("uni-load-more"),F),A=c(b("s-empty"),C),P=c(b("s-layout"),G);return i(),r(P,{navbar:"normal",leftWidth:0,rightWidth:0,tools:"search",defaultSearch:R.keyword,onSearch:W},{default:l((()=>[u(z,{bgColor:"#fff"},{default:l((()=>[u(n,{class:"ss-flex"},{default:l((()=>[u(n,{class:"ss-flex-1"},{default:l((()=>[u(e,{list:R.tabList,scrollable:!1,onChange:q,current:R.currentTab},null,8,["list","current"])])),_:1}),u(n,{class:"list-icon",onClick:a[0]||(a[0]=t=>R.iconStatus=!R.iconStatus)},{default:l((()=>[R.iconStatus?(i(),r(d,{key:0,class:"sicon-goods-list"})):(i(),r(d,{key:1,class:"sicon-goods-card"}))])),_:1})])),_:1})])),_:1}),u(I,{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((()=>[u(n,{class:"filter-list-box"},{default:l((()=>[(i(!0),p(f,null,g(R.tabList[R.currentTab].list,((t,s)=>(i(),r(n,{class:k(["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((()=>[x(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),p(f,null,g(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((()=>[u(O,{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})):_("",!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((()=>[u(n,{class:"goods-list-box"},{default:l((()=>[(i(!0),p(f,null,g(R.leftGoodsList,(t=>(i(),r(n,{class:"left-list",key:t.id},{default:l((()=>[u(O,{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((()=>[u(N,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1}),u(n,{class:"goods-list-box"},{default:l((()=>[(i(!0),p(f,null,g(R.rightGoodsList,(t=>(i(),r(n,{class:"right-list",key:t.id},{default:l((()=>[u(O,{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((()=>[u(N,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):_("",!0),R.pagination.total>0?(i(),r($,{key:2,status:R.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:J},null,8,["status"])):_("",!0),0===R.pagination.total?(i(),r(A,{key:3,icon:"/static/soldout-empty.png",text:"暂无商品"})):_("",!0)])),_:1},8,["defaultSearch"])}}},[["__scopeId","data-v-acd1fb34"]]);export{O as default};