"use strict";const e=require("../../common/vendor.js"),t=require("../../sheep/index.js"),o=require("../../sheep/api/product/favorite.js"),s=require("../../sheep/util/index.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("s-goods-item")+e.resolveComponent("su-fixed")+e.resolveComponent("uni-load-more")+e.resolveComponent("s-empty")+e.resolveComponent("s-layout"))()}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 i={__name:"goods-collect",setup(i){e.useCssVars((t=>({"66c3ede2":e.unref(r)})));const r=t.sheep.$platform.navbar,a=e.reactive({pagination:{list:[],total:0,pageNo:1,pageSize:6},loadStatus:"",editMode:!1,selectedCollectList:[],selectAll:!1});async function p(){a.loadStatus="loading";const{code:t,data:s}=await o.FavoriteApi.getFavoritePage({pageNo:a.pagination.pageNo,pageSize:a.pagination.pageSize});0===t&&(a.pagination.list=e._.concat(a.pagination.list,s.list),a.pagination.total=s.total,a.loadStatus=a.pagination.list.length<a.pagination.total?"more":"noMore")}const l=e=>{a.selectedCollectList.includes(e)?a.selectedCollectList.splice(a.selectedCollectList.indexOf(e),1):a.selectedCollectList.push(e),a.selectAll=a.selectedCollectList.length===a.pagination.list.length},n=()=>{a.selectAll=!a.selectAll,a.selectAll?a.selectedCollectList=a.pagination.list.map((e=>e.spuId)):a.selectedCollectList=[]};async function d(){if(a.selectedCollectList){for(const e of a.selectedCollectList)await o.FavoriteApi.deleteFavorite(e);a.editMode=!1,a.selectedCollectList=[],a.selectAll=!1,s.resetPagination(a.pagination),await p()}}function c(){"noMore"!==a.loadStatus&&(a.pagination.pageNo++,p())}return e.onReachBottom((()=>{c()})),e.onLoad((()=>{p()})),(o,s)=>e.e({a:e.t(a.pagination.total),b:a.editMode&&a.pagination.total},a.editMode&&a.pagination.total?{c:e.o((e=>a.editMode=!1))}:{},{d:!a.editMode&&a.pagination.total},!a.editMode&&a.pagination.total?{e:e.o((e=>a.editMode=!0))}:{},{f:e.f(a.pagination.list,((o,s,i)=>e.e(a.editMode?{a:a.selectedCollectList.includes(o.spuId),b:e.o((e=>l(o.spuId)),o.id),c:e.o((e=>l(o.spuId)),o.id)}:{},{d:e.o((s=>e.unref(t.sheep).$router.go("/pages/goods/index",{id:o.spuId})),o.id),e:"bb241d57-1-"+i+",bb241d57-0",f:e.p({title:o.spuName,img:o.picUrl,price:o.price,priceColor:"#FF3000",titleWidth:400}),g:o.id}))),g:a.editMode,h:a.selectAll,i:e.o(n),j:e.o(n),k:e.o(d),l:a.editMode,m:e.p({bottom:!0,val:0,placeholder:!0}),n:a.pagination.total>0},a.pagination.total>0?{o:e.o(c),p:e.p({status:a.loadStatus,"content-text":{contentdown:"上拉加载更多"}})}:{},{q:0===a.pagination.total},0===a.pagination.total?{r:e.p({text:"暂无收藏",icon:"/static/collect-empty.png"})}:{},{s:e.s(o.__cssVars()),t:e.p({title:"商品收藏"})})}},r=e._export_sfc(i,[["__scopeId","data-v-bb241d57"]]);wx.createPage(r);
