1 |
- import{_ as t}from"./su-tabs.CkDiSi2G.js";import{s,v as e,t as o,o as a,m as r,a as i,b as n,d as l,w as d,S as c,_ as u,e as p,f as m,x as _,y as g,F as f,u as h,z as b,i as y,l as x,L as k,g as v,j as S,O as I}from"./index-dGICJBA1.js";import{_ as w}from"./su-sticky.CEebsJqd.js";import{_ as L}from"./phone-international-input.vue_vue_type_style_index_0_scoped_0f0268ff_lang.DfrFtxCM.js";import{_ as j}from"./s-goods-column.BYZ6z7oE.js";import{_ as C}from"./uni-load-more.OaCK512J.js";import{_ as F}from"./s-empty.DZWZVG5X.js";import{_ as G}from"./s-layout.2n749i-h.js";import{r as O}from"./useGoods.jFp9m3ab.js";import{_ as z}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-badge.CrEKSPHb.js";import"./uni-icons.BZJC71FJ.js";/* empty css */import"./s-layout.vue_vue_type_style_index_0_scoped_c1143e8c_lang.C9LLV9dD.js";/* empty css */import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.BkXbqiPQ.js";/* empty css */import"./s-menu-tools.BHmVopdZ.js";import"./s-search-block.DW-gs1wX.js";import"./phone-international-input.BSO1ObdH.js";const T=z({__name:"list",emits:["close","change"],setup(z,{emit:T}){const R=s.$platform.navbar,A=e({pagination:{list:[],total:0,pageNo:1,pageSize:6},currentSort:void 0,currentOrder:void 0,currentTab:0,currentArea:0,curFilter:0,showFilter:!1,iconStatus:!1,keyword:"",categoryId:0,areaId:1,merchantId:void 0,shopId:void 0,tabList:[{name:o("common.recommended"),list:[{label:o("common.recommended")},{label:o("common.price_asc"),sort:"price",order:!0},{label:o("common.price_desc"),sort:"price",order:!1}]},{name:o("common.sales"),sort:"salesCount",order:!1},{name:o("common.newest"),value:"createTime",order:!1}],areaList:[{name:"红积分商品",value:1},{name:"绿积分商品",value:2}],loadStatus:"",leftGoodsList:[],rightGoodsList:[]});let N=0,$=0,H=0;function M(t=0,s="left"){A.pagination.list[N]&&("left"===s?$+=t:H+=t,$<=H?A.leftGoodsList.push(A.pagination.list[N]):A.rightGoodsList.push(A.pagination.list[N]),N++)}function P(){O(A.pagination),A.leftGoodsList=[],A.rightGoodsList=[],N=0,$=0,H=0}function W(t){A.keyword=t,P(),E(A.currentSort,A.currentOrder)}function q(t){if(A.tabList[t.index].list)return A.currentTab=t.index,void(A.showFilter=!A.showFilter);A.showFilter=!1,t.index!==A.currentTab&&(A.currentTab=t.index,A.currentSort=t.sort,A.currentOrder=t.order,P(),E(t.sort,t.order))}function B(t){A.currentArea=t.index,A.areaId=t.value,P(),E(A.currentSort,A.currentOrder)}async function E(){A.loadStatus="loading";const t={pageNo:A.pagination.pageNo,pageSize:A.pagination.pageSize,sortField:A.currentSort,sortAsc:A.currentOrder,categoryId:A.categoryId,keyword:A.keyword,areaId:A.areaId};"undefined"!==A.merchantId&&"undefined"!==A.shopId&&(t.merchantId=A.merchantId,t.shopId=A.shopId);const{code:s,data:e}=await c.getSpuPage(t);0===s&&(A.pagination.list=u.concat(A.pagination.list,e.list),A.pagination.total=e.total,A.loadStatus=A.pagination.list.length<A.pagination.total?"more":"noMore",M())}function J(){"noMore"!==A.loadStatus&&(A.pagination.pageNo++,E(A.currentSort,A.currentOrder))}return a((t=>{A.categoryId=t.categoryId,A.keyword=t.keyword,t.merchantId&&t.shopId&&(A.merchantId=t.merchantId,A.shopId=t.shopId),E(A.currentSort,A.currentOrder)})),r((()=>{J()})),(e,o)=>{const a=i(n("su-tabs"),t),r=y,c=x,u=i(n("su-sticky"),w),O=i(n("su-popup"),L),z=i(n("s-goods-column"),j),T=I,N=i(n("uni-load-more"),C),$=i(n("s-empty"),F),H=i(n("s-layout"),G);return p(),l(H,{navbar:"normal",leftWidth:0,rightWidth:0,tools:"search",defaultSearch:A.keyword,onSearch:W},{default:d((()=>[m(u,{bgColor:"#fff"},{default:d((()=>[m(r,{class:"ss-flex"},{default:d((()=>[m(r,{class:"ss-flex-1"},{default:d((()=>[m(a,{list:A.tabList,scrollable:!1,onChange:q,current:A.currentTab},null,8,["list","current"])])),_:1}),m(r,{class:"list-icon",onClick:o[0]||(o[0]=t=>A.iconStatus=!A.iconStatus)},{default:d((()=>[A.iconStatus?(p(),l(c,{key:0,class:"sicon-goods-list"})):(p(),l(c,{key:1,class:"sicon-goods-card"}))])),_:1})])),_:1})])),_:1}),m(u,{bgColor:"#fff"},{default:d((()=>[m(r,{class:"ss-flex"},{default:d((()=>[m(r,{class:"ss-flex-1"},{default:d((()=>[m(a,{list:A.areaList,scrollable:!1,onChange:B,current:A.currentArea},null,8,["list","current"])])),_:1})])),_:1})])),_:1}),m(O,{show:A.showFilter,type:"top",round:"10",space:h(R)+80,backgroundColor:"#F6F6F6",zIndex:10,onClose:o[1]||(o[1]=t=>A.showFilter=!1)},{default:d((()=>[m(r,{class:"filter-list-box"},{default:d((()=>[(p(!0),_(f,null,g(A.tabList[A.currentTab].list,((t,s)=>(p(),l(r,{class:k(["filter-item",[{"filter-item-active":s===A.curFilter}]]),key:t.value,onClick:t=>{return e=s,void(A.currentSort!==A.tabList[0].list[e].sort||A.currentOrder!==A.tabList[0].list[e].order?(A.showFilter=!1,A.curFilter=e,A.tabList[0].name=A.tabList[0].list[e].label,A.currentSort=A.tabList[0].list[e].sort,A.currentOrder=A.tabList[0].list[e].order,P(),E()):A.showFilter=!1);var e}},{default:d((()=>[v(S(t.label),1)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1},8,["show","space"]),A.iconStatus&&A.pagination.total>0?(p(),l(r,{key:0,class:"goods-list ss-m-t-20"},{default:d((()=>[(p(!0),_(f,null,g(A.pagination.list,(t=>(p(),l(r,{class:"ss-p-l-20 ss-p-r-20 ss-m-b-20",key:t.id},{default:d((()=>[m(z,{class:"",size:"lg",data:t,topRadius:10,bottomRadius:10,onClick:e=>h(s).$router.go("/pages/goods/index",{id:t.id})},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})):b("",!0),!A.iconStatus&&A.pagination.total>0?(p(),l(r,{key:1,class:"ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"},{default:d((()=>[m(r,{class:"goods-list-box"},{default:d((()=>[(p(!0),_(f,null,g(A.leftGoodsList,(t=>(p(),l(r,{class:"left-list",key:t.id},{default:d((()=>[m(z,{class:"goods-md-box",size:"md",data:t,topRadius:10,bottomRadius:10,onClick:e=>h(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:o[2]||(o[2]=t=>M(t,"left"))},{cart:d((()=>[m(T,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1}),m(r,{class:"goods-list-box"},{default:d((()=>[(p(!0),_(f,null,g(A.rightGoodsList,(t=>(p(),l(r,{class:"right-list",key:t.id},{default:d((()=>[m(z,{class:"goods-md-box",size:"md",topRadius:10,bottomRadius:10,data:t,onClick:e=>h(s).$router.go("/pages/goods/index",{id:t.id}),onGetHeight:o[3]||(o[3]=t=>M(t,"right"))},{cart:d((()=>[m(T,{class:"ss-reset-button cart-btn"})])),_:2},1032,["data","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):b("",!0),A.pagination.total>0?(p(),l(N,{key:2,status:A.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:J},null,8,["status"])):b("",!0),0===A.pagination.total?(p(),l($,{key:3,icon:"/static/soldout-empty.png",text:"暂无商品"})):b("",!0)])),_:1},8,["defaultSearch"])}}},[["__scopeId","data-v-3677f7ca"]]);export{T as default};
|