2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
"use strict";var e=(e,t,o)=>new Promise(((i,l)=>{var s=e=>{try{n(o.next(e))}catch(t){l(t)}},a=e=>{try{n(o.throw(e))}catch(t){l(t)}},n=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,a);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 s={__name:"goods-collect",setup(s){t.useCssVars((e=>({"5a4ec6be":t.unref(a)})));const a=o.sheep.$platform.navbar,n=t.reactive({pagination:{list:[],total:0,pageNo:1,pageSize:6},loadStatus:"",editMode:!1,selectedCollectList:[],selectAll:!1});function c(){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 d=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},p=()=>{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 c()}}))}function u(){"noMore"!==n.loadStatus&&(n.pagination.pageNo++,c())}return t.onReachBottom((()=>{u()})),t.onLoad((()=>{c()})),(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=>d(e.spuId)),e.id),c:t.o((t=>d(e.spuId)),e.id)}:{},{d:t.o((i=>t.unref(o.sheep).$router.go("/modules/mall/goods/index",{id:e.spuId})),e.id),e:"23c7c5ce-2-"+l+",23c7c5ce-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(p),j:t.o(p),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())})}},a=t._export_sfc(s,[["__scopeId","data-v-23c7c5ce"]]);wx.createPage(a);
|