import{s as e,B as t,C as s,o as l,f as a,g as o,w as i,a9 as n,_ as c,q as d,n as r,m as p,t as u,i as f,p as _,r as g,F as m,ad as C,ae as x,I as k,J as y,K as b,l as h,L as M,M as v,N as j,u as w,z as L}from"./index-007bf156.js";import{_ as S}from"./s-goods-item.8ceb696e.js";import{a as A,_ as I}from"./s-layout.19bedb43.js";import{_ as N}from"./uni-load-more.4c025ab2.js";import{_ as z}from"./s-empty.df9577ad.js";import{r as B}from"./useGoods.ac3bf93e.js";/* empty css                                                                      */import{_ as F}from"./_plugin-vue_export-helper.1b428a4d.js";import"./points.c381a8e1.js";/* empty css                                                                     */import"./phone-international-input.3617e4e0.js";/* empty css                                                                */const G=F({__name:"goods-collect",setup(F){y((e=>({"66c3ede2":L(G)})));const G=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 n.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 q=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},J=()=>{T.selectAll=!T.selectAll,T.selectAll?T.selectedCollectList=T.pagination.list.map((e=>e.spuId)):T.selectedCollectList=[]};async function K(){if(T.selectedCollectList){for(const e of T.selectedCollectList)await n.deleteFavorite(e);T.editMode=!1,T.selectedCollectList=[],T.selectAll=!1,B(T.pagination),await $()}}function O(){"noMore"!==T.loadStatus&&(T.pagination.pageNo++,$())}return s((()=>{O()})),l((()=>{$()})),(t,s)=>{const l=b,n=h,c=M,y=v,B=j,F=d(w("s-goods-item"),S),G=d(w("su-fixed"),A),$=d(w("uni-load-more"),N),P=d(w("s-empty"),z),U=d(w("s-layout"),I);return a(),o(U,{title:"商品收藏"},{default:i((()=>[r(n,{class:"cart-box ss-flex ss-flex-col ss-row-between"},{default:i((()=>[r(n,{class:"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:i((()=>[r(n,{class:"header-left ss-flex ss-col-center ss-font-26"},{default:i((()=>[p(" 共 "),r(l,{class:"goods-number ui-TC-Main ss-flex"},{default:i((()=>[p(u(T.pagination.total),1)])),_:1}),p(" 件商品 ")])),_:1}),r(n,{class:"header-right"},{default:i((()=>[T.editMode&&T.pagination.total?(a(),o(c,{key:0,class:"ss-reset-button",onClick:s[0]||(s[0]=e=>T.editMode=!1)},{default:i((()=>[p(" 取消 ")])),_:1})):f("",!0),!T.editMode&&T.pagination.total?(a(),o(c,{key:1,class:"ss-reset-button ui-TC-Main",onClick:s[1]||(s[1]=e=>T.editMode=!0)},{default:i((()=>[p(" 编辑 ")])),_:1})):f("",!0)])),_:1})])),_:1}),r(n,{class:"cart-content"},{default:i((()=>[(a(!0),_(m,null,g(T.pagination.list,(t=>(a(),o(n,{class:"goods-box ss-r-10",key:t.id},{default:i((()=>[r(n,{class:"ss-flex ss-col-center"},{default:i((()=>[T.editMode?(a(),o(B,{key:0,class:"check-box ss-flex ss-col-center ss-p-l-10",onClick:e=>q(t.spuId)},{default:i((()=>[r(y,{checked:T.selectedCollectList.includes(t.spuId),color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:k((e=>q(t.spuId)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])):f("",!0),r(F,{title:t.spuName,img:t.picUrl,price:t.price,priceColor:"#FF3000",titleWidth:400,onClick:s=>L(e).$router.go("/pages/goods/index",{id:t.spuId})},null,8,["title","img","price","onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1}),C(r(G,{bottom:"",val:0,placeholder:""},{default:i((()=>[r(n,{class:"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"},{default:i((()=>[r(n,{class:"footer-left ss-flex ss-col-center"},{default:i((()=>[r(B,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:J},{default:i((()=>[r(y,{checked:T.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:k(J,["stop"])},null,8,["checked"]),r(n,null,{default:i((()=>[p(" 全选 ")])),_:1})])),_:1})])),_:1}),r(n,{class:"footer-right"},{default:i((()=>[r(c,{class:"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main",onClick:K},{default:i((()=>[p(" 取消收藏 ")])),_:1})])),_:1})])),_:1})])),_:1},512),[[x,T.editMode]])])),_:1}),T.pagination.total>0?(a(),o($,{key:0,status:T.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:O},null,8,["status"])):f("",!0),0===T.pagination.total?(a(),o(P,{key:1,text:"暂无收藏",icon:"/static/collect-empty.png"})):f("",!0)])),_:1})}}},[["__scopeId","data-v-bb241d57"]]);export{G as default};
