list.js 5.8 KB

1
  1. "use strict";const e=require("../../common/vendor.js"),t=require("../../sheep/index.js"),r=require("../../sheep/util/index.js"),o=require("../../sheep/api/product/spu.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.js"),require("../../sheep/platform/index.js"),require("../../sheep/platform/provider/wechat/index.js"),require("../../sheep/platform/provider/wechat/miniProgram.js"),require("../../sheep/api/member/auth.js"),require("../../sheep/api/member/social.js"),require("../../sheep/api/member/user.js"),require("../../sheep/platform/provider/apple/index.js"),require("../../sheep/platform/share.js"),require("../../sheep/router/index.js"),require("../../sheep/hooks/useModal.js"),require("../../sheep/helper/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.js"),require("../../sheep/helper/throttle.js"),require("../../sheep/platform/pay.js"),require("../../sheep/api/pay/order.js"),require("../../sheep/store/user.js"),require("../../sheep/store/cart.js"),require("../../sheep/api/trade/cart.js"),require("../../sheep/api/pay/wallet.js"),require("../../sheep/api/trade/order.js"),require("../../sheep/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/zIndex.js"),!Array){(e.resolveComponent("su-tabs")+e.resolveComponent("su-sticky")+e.resolveComponent("su-popup")+e.resolveComponent("s-goods-column")+e.resolveComponent("uni-load-more")+e.resolveComponent("s-empty")+e.resolveComponent("s-layout"))()}Math||((()=>"../../sheep/ui/su-tabs/su-tabs.js")+(()=>"../../sheep/ui/su-sticky/su-sticky.js")+(()=>"../../sheep/ui/su-popup/su-popup.js")+(()=>"../../sheep/components/s-goods-column/s-goods-column.js")+(()=>"../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js")+(()=>"../../sheep/components/s-empty/s-empty.js")+(()=>"../../sheep/components/s-layout/s-layout.js"))();const s={__name:"list",emits:["close","change"],setup(s,{emit:i}){const a=t.sheep.$platform.navbar,n=e.reactive({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 p=0,u=0,d=0;function l(e=0,t="left"){n.pagination.list[p]&&("left"===t?u+=e:d+=e,u<=d?n.leftGoodsList.push(n.pagination.list[p]):n.rightGoodsList.push(n.pagination.list[p]),p++)}function c(){r.resetPagination(n.pagination),n.leftGoodsList=[],n.rightGoodsList=[],p=0,u=0,d=0}function h(e){n.keyword=e,c(),m(n.currentSort,n.currentOrder)}function g(e){if(n.tabList[e.index].list)return n.currentTab=e.index,void(n.showFilter=!n.showFilter);n.showFilter=!1,e.index!==n.currentTab&&(n.currentTab=e.index,n.currentSort=e.sort,n.currentOrder=e.order,c(),m(e.sort,e.order))}async function m(){n.loadStatus="loading";const{code:t,data:r}=await o.SpuApi.getSpuPage({pageNo:n.pagination.pageNo,pageSize:n.pagination.pageSize,sortField:n.currentSort,sortAsc:n.currentOrder,categoryId:n.categoryId,keyword:n.keyword});0===t&&(n.pagination.list=e._.concat(n.pagination.list,r.list),n.pagination.total=r.total,n.loadStatus=n.pagination.list.length<n.pagination.total?"more":"noMore",l())}function b(){"noMore"!==n.loadStatus&&(n.pagination.pageNo++,m(n.currentSort,n.currentOrder))}return e.onLoad((e=>{n.categoryId=e.categoryId,n.keyword=e.keyword,m(n.currentSort,n.currentOrder)})),e.onReachBottom((()=>{b()})),(r,o)=>e.e({a:e.o(g),b:e.p({list:n.tabList,scrollable:!1,current:n.currentTab}),c:n.iconStatus},(n.iconStatus,{}),{d:e.o((e=>n.iconStatus=!n.iconStatus)),e:e.p({bgColor:"#fff"}),f:e.f(n.tabList[n.currentTab].list,((t,r,o)=>({a:e.t(t.label),b:t.value,c:e.n({"filter-item-active":r===n.curFilter}),d:e.o((e=>{return t=r,void(n.currentSort!==n.tabList[0].list[t].sort||n.currentOrder!==n.tabList[0].list[t].order?(n.showFilter=!1,n.curFilter=t,n.tabList[0].name=n.tabList[0].list[t].label,n.currentSort=n.tabList[0].list[t].sort,n.currentOrder=n.tabList[0].list[t].order,c(),m()):n.showFilter=!1);var t}),t.value)}))),g:e.o((e=>n.showFilter=!1)),h:e.p({show:n.showFilter,type:"top",round:"10",space:e.unref(a)+38,backgroundColor:"#F6F6F6",zIndex:10}),i:n.iconStatus&&n.pagination.total>0},n.iconStatus&&n.pagination.total>0?{j:e.f(n.pagination.list,((r,o,s)=>({a:e.o((o=>e.unref(t.sheep).$router.go("/pages/goods/index",{id:r.id})),r.id),b:"acd1fb34-4-"+s+",acd1fb34-0",c:e.p({size:"lg",data:r,topRadius:10,bottomRadius:10}),d:r.id})))}:{},{k:!n.iconStatus&&n.pagination.total>0},!n.iconStatus&&n.pagination.total>0?{l:e.f(n.leftGoodsList,((r,o,s)=>({a:e.o((o=>e.unref(t.sheep).$router.go("/pages/goods/index",{id:r.id})),r.id),b:e.o((e=>l(e,"left")),r.id),c:"acd1fb34-5-"+s+",acd1fb34-0",d:e.p({size:"md",data:r,topRadius:10,bottomRadius:10}),e:r.id}))),m:e.f(n.rightGoodsList,((r,o,s)=>({a:e.o((o=>e.unref(t.sheep).$router.go("/pages/goods/index",{id:r.id})),r.id),b:e.o((e=>l(e,"right")),r.id),c:"acd1fb34-6-"+s+",acd1fb34-0",d:e.p({size:"md",topRadius:10,bottomRadius:10,data:r}),e:r.id})))}:{},{n:n.pagination.total>0},n.pagination.total>0?{o:e.o(b),p:e.p({status:n.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{q:0===n.pagination.total},0===n.pagination.total?{r:e.p({icon:"/static/soldout-empty.png",text:"暂无商品"})}:{},{s:e.o(h),t:e.p({navbar:"normal",leftWidth:0,rightWidth:0,tools:"search",defaultSearch:n.keyword})})}},i=e._export_sfc(s,[["__scopeId","data-v-acd1fb34"]]);wx.createPage(i);