import{s as e,y as t,z as s,o as l,e as a,f as o,w as i,_ as c,l as n,j as d,t as r,u as p,g as u,k as f,r as _,F as g,a5 as m,a6 as C,C as x,D as k,E as y,i as b,G as h,H as v,I as M,m as j,v as w}from"./index-9aa72eed.js";import{_ as L}from"./s-goods-item.61fdff9d.js";import{a as S,_ as A}from"./s-layout.bffb18b8.js";import{_ as I}from"./uni-load-more.93dce372.js";import{_ as F}from"./s-empty.3adf8b58.js";import{F as G}from"./favorite.e7c34479.js";import{r as N}from"./useGoods.ce02ada2.js";/* empty css                                                                      */import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css                                                                     */import"./form.c66b5271.js";/* empty css                                                                */const B=z({__name:"goods-collect",setup(z){k((e=>({"66c3ede2":w(B)})));const B=e.$platform.navbar,T=t({pagination:{list:[],total:0,pageNo:1,pageSize:6},loadStatus:"",editMode:!1,selectedCollectList:[],selectAll:!1});async function $(){T.loadStatus="loading";const{code:e,data:t}=await G.getFavoritePage({pageNo:T.pagination.pageNo,pageSize:T.pagination.pageSize});0===e&&(T.pagination.list=c.concat(T.pagination.list,t.list),T.pagination.total=t.total,T.loadStatus=T.pagination.list.length<T.pagination.total?"more":"noMore")}const D=e=>{T.selectedCollectList.includes(e)?T.selectedCollectList.splice(T.selectedCollectList.indexOf(e),1):T.selectedCollectList.push(e),T.selectAll=T.selectedCollectList.length===T.pagination.list.length},E=()=>{T.selectAll=!T.selectAll,T.selectAll?T.selectedCollectList=T.pagination.list.map((e=>e.spuId)):T.selectedCollectList=[]};async function H(){if(T.selectedCollectList){for(const e of T.selectedCollectList)await G.deleteFavorite(e);T.editMode=!1,T.selectedCollectList=[],T.selectAll=!1,N(T.pagination),await $()}}function O(){"noMore"!==T.loadStatus&&(T.pagination.pageNo++,$())}return s((()=>{O()})),l((()=>{$()})),(t,s)=>{const l=y,c=b,k=h,G=v,N=M,z=n(j("s-goods-item"),L),B=n(j("su-fixed"),S),$=n(j("uni-load-more"),I),P=n(j("s-empty"),F),U=n(j("s-layout"),A);return a(),o(U,{title:"商品收藏"},{default:i((()=>[d(c,{class:"cart-box ss-flex ss-flex-col ss-row-between"},{default:i((()=>[d(c,{class:"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:i((()=>[d(c,{class:"header-left ss-flex ss-col-center ss-font-26"},{default:i((()=>[r(" 共 "),d(l,{class:"goods-number ui-TC-Main ss-flex"},{default:i((()=>[r(p(T.pagination.total),1)])),_:1}),r(" 件商品 ")])),_:1}),d(c,{class:"header-right"},{default:i((()=>[T.editMode&&T.pagination.total?(a(),o(k,{key:0,class:"ss-reset-button",onClick:s[0]||(s[0]=e=>T.editMode=!1)},{default:i((()=>[r(" 取消 ")])),_:1})):u("",!0),!T.editMode&&T.pagination.total?(a(),o(k,{key:1,class:"ss-reset-button ui-TC-Main",onClick:s[1]||(s[1]=e=>T.editMode=!0)},{default:i((()=>[r(" 编辑 ")])),_:1})):u("",!0)])),_:1})])),_:1}),d(c,{class:"cart-content"},{default:i((()=>[(a(!0),f(g,null,_(T.pagination.list,(t=>(a(),o(c,{class:"goods-box ss-r-10",key:t.id},{default:i((()=>[d(c,{class:"ss-flex ss-col-center"},{default:i((()=>[T.editMode?(a(),o(N,{key:0,class:"check-box ss-flex ss-col-center ss-p-l-10",onClick:e=>D(t.spuId)},{default:i((()=>[d(G,{checked:T.selectedCollectList.includes(t.spuId),color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:x((e=>D(t.spuId)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])):u("",!0),d(z,{title:t.spuName,img:t.picUrl,price:t.price,priceColor:"#FF3000",titleWidth:400,onClick:s=>w(e).$router.go("/pages/goods/index",{id:t.spuId})},null,8,["title","img","price","onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1}),m(d(B,{bottom:"",val:0,placeholder:""},{default:i((()=>[d(c,{class:"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"},{default:i((()=>[d(c,{class:"footer-left ss-flex ss-col-center"},{default:i((()=>[d(N,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:E},{default:i((()=>[d(G,{checked:T.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:x(E,["stop"])},null,8,["checked"]),d(c,null,{default:i((()=>[r(" 全选 ")])),_:1})])),_:1})])),_:1}),d(c,{class:"footer-right"},{default:i((()=>[d(k,{class:"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main",onClick:H},{default:i((()=>[r(" 取消收藏 ")])),_:1})])),_:1})])),_:1})])),_:1},512),[[C,T.editMode]])])),_:1}),T.pagination.total>0?(a(),o($,{key:0,status:T.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:O},null,8,["status"])):u("",!0),0===T.pagination.total?(a(),o(P,{key:1,text:"暂无收藏",icon:"/static/collect-empty.png"})):u("",!0)])),_:1})}}},[["__scopeId","data-v-bb241d57"]]);export{B as default};
