acdr-ui/dist/build/mp-weixin/modules/mall/user/goods-collect.js

2 lines
3.2 KiB
JavaScript
Raw Normal View History

2024-10-01 09:15:35 +08:00
"use strict";var e=(e,t,o)=>new Promise(((i,l)=>{var a=e=>{try{n(o.next(e))}catch(t){l(t)}},s=e=>{try{n(o.throw(e))}catch(t){l(t)}},n=e=>e.done?i(e.value):Promise.resolve(e.value).then(a,s);n((o=o.apply(e,t)).next())}));const t=require("../../../common/vendor.js"),o=require("../sheep/index.js"),i=require("../sheep/api/product/favorite.js"),l=require("../sheep/util/index.js");if(!Array){(t.resolveComponent("s-goods-item")+t.resolveComponent("su-fixed")+t.resolveComponent("uni-load-more")+t.resolveComponent("s-empty")+t.resolveComponent("s-layout")+t.resolveComponent("layout-default-uni"))()}Math||((()=>"../sheep/components/s-goods-item/s-goods-item.js")+(()=>"../sheep/ui/su-fixed/su-fixed.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 a={__name:"goods-collect",setup(a){t.useCssVars((e=>({"2691d545":t.unref(s)})));const s=o.sheep.$platform.navbar,n=t.reactive({pagination:{list:[],total:0,pageNo:1,pageSize:6},loadStatus:"",editMode:!1,selectedCollectList:[],selectAll:!1});function d(){return e(this,null,(function*(){n.loadStatus="loading";const{code:e,data:o}=yield i.FavoriteApi.getFavoritePage({pageNo:n.pagination.pageNo,pageSize:n.pagination.pageSize});0===e&&(n.pagination.list=t.lodash.concat(n.pagination.list,o.list),n.pagination.total=o.total,n.loadStatus=n.pagination.list.length<n.pagination.total?"more":"noMore")}))}const p=e=>{n.selectedCollectList.includes(e)?n.selectedCollectList.splice(n.selectedCollectList.indexOf(e),1):n.selectedCollectList.push(e),n.selectAll=n.selectedCollectList.length===n.pagination.list.length},c=()=>{n.selectAll=!n.selectAll,n.selectAll?n.selectedCollectList=n.pagination.list.map((e=>e.spuId)):n.selectedCollectList=[]};function r(){return e(this,null,(function*(){if(n.selectedCollectList){for(const e of n.selectedCollectList)yield i.FavoriteApi.deleteFavorite(e);n.editMode=!1,n.selectedCollectList=[],n.selectAll=!1,l.resetPagination(n.pagination),yield d()}}))}function u(){"noMore"!==n.loadStatus&&(n.pagination.pageNo++,d())}return t.onReachBottom((()=>{u()})),t.onLoad((()=>{d()})),(e,i)=>t.e({a:t.t(n.pagination.total),b:n.editMode&&n.pagination.total},n.editMode&&n.pagination.total?{c:t.o((e=>n.editMode=!1))}:{},{d:!n.editMode&&n.pagination.total},!n.editMode&&n.pagination.total?{e:t.o((e=>n.editMode=!0))}:{},{f:t.f(n.pagination.list,((e,i,l)=>t.e(n.editMode?{a:n.selectedCollectList.includes(e.spuId),b:t.o((t=>p(e.spuId)),e.id),c:t.o((t=>p(e.spuId)),e.id)}:{},{d:t.o((i=>t.unref(o.sheep).$router.go("/modules/mall/goods/index",{id:e.spuId})),e.id),e:"a6b579be-2-"+l+",a6b579be-1",f:t.p({title:e.spuName,img:e.picUrl,price:e.price,priceColor:"#FF3000",titleWidth:400}),g:e.id}))),g:n.editMode,h:n.selectAll,i:t.o(c),j:t.o(c),k:t.o(r),l:n.editMode,m:t.p({bottom:!0,val:0,placeholder:!0}),n:n.pagination.total>0},n.pagination.total>0?{o:t.o(u),p:t.p({status:n.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{q:0===n.pagination.total},0===n.pagination.total?{r:t.p({text:"暂无收藏",icon:"/static/collect-empty.png"})}:{},{s:t.p({title:"商品收藏"}),t:t.s(e.__cssVars())})}},s=t._export_sfc(a,[["__scopeId","data-v-a6b579be"]]);wx.createPage(s);