import{s as e,C as t,D as s,p as l,o,e as a,w as c,_ as i,b as d,i as n,y as r,z as u,k as p,f as _,h as g,F as f,a4 as m,a5 as C,j as x,H as k,A as y,m as b,B as h,I as L,J as M,d as v,u as w}from"./index-520dfaee.js";import{_ as j}from"./s-goods-item.cceb2670.js";import{b as A,a as S}from"./s-layout.5146c957.js";import{_ as B}from"./uni-load-more.ba4f287c.js";import{_ as G}from"./s-empty.b6c95127.js";/* empty css                                                                      */import{_ as T}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css                                                                     *//* empty css                                                                */const $=T({__name:"goods-collect",setup(T){k((e=>({"308597b7":w($)})));const $=e.$platform.navbar,F={data:[],current_page:1,total:1,last_page:1},I=t({pagination:{data:[],current_page:1,total:1,last_page:1},loadStatus:"",editMode:!1,selectedCollectList:[],selectAll:!1});async function O(t=1,s=10){I.loadStatus="loading";let l=await e.$api.user.goodsLog.list({type:"favorite",list_rows:s,page:t});if(1===l.code){let e=i.concat(I.pagination.data,l.data.data);I.pagination={...l.data,data:e},I.pagination.current_page<I.pagination.last_page?I.loadStatus="more":I.loadStatus="noMore"}}const z=e=>{I.selectedCollectList.includes(e)?I.selectedCollectList.splice(I.selectedCollectList.indexOf(e),1):I.selectedCollectList.push(e),I.selectAll=I.selectedCollectList.length===I.pagination.data.length},D=()=>{I.selectAll=!I.selectAll,I.selectAll?I.pagination.data.forEach((e=>{I.selectedCollectList.includes(e.goods_id)&&I.selectedCollectList.splice(I.selectedCollectList.indexOf(e.goods_id),1),I.selectedCollectList.push(e.goods_id)})):I.selectedCollectList=[]};async function E(){if(I.selectedCollectList){I.selectedCollectList=I.selectedCollectList.toString();const{code:t}=await e.$api.user.favorite.cancel(I.selectedCollectList);1===t&&(I.editMode=!1,I.selectedCollectList=[],I.selectAll=!1,I.pagination=F,O())}}function H(){"noMore"!==I.loadStatus&&O(I.pagination.current_page+1)}return s((()=>{H()})),l((()=>{O()})),(t,s)=>{const l=y,i=b,k=h,T=L,$=M,F=d(v("s-goods-item"),j),O=d(v("su-fixed"),A),J=d(v("uni-load-more"),B),W=d(v("s-empty"),G),q=d(v("s-layout"),S);return o(),a(q,{title:"商品收藏"},{default:c((()=>[n(i,{class:"cart-box ss-flex ss-flex-col ss-row-between"},{default:c((()=>[n(i,{class:"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:c((()=>[n(i,{class:"header-left ss-flex ss-col-center ss-font-26"},{default:c((()=>[r(" 共 "),n(l,{class:"goods-number ui-TC-Main ss-flex"},{default:c((()=>[r(u(I.pagination.total),1)])),_:1}),r(" 件商品 ")])),_:1}),n(i,{class:"header-right"},{default:c((()=>[I.editMode&&I.pagination.total?(o(),a(k,{key:0,class:"ss-reset-button",onClick:s[0]||(s[0]=e=>I.editMode=!1)},{default:c((()=>[r(" 取消 ")])),_:1})):p("",!0),!I.editMode&&I.pagination.total?(o(),a(k,{key:1,class:"ss-reset-button ui-TC-Main",onClick:s[1]||(s[1]=e=>I.editMode=!0)},{default:c((()=>[r("编辑")])),_:1})):p("",!0)])),_:1})])),_:1}),n(i,{class:"cart-content"},{default:c((()=>[(o(!0),_(f,null,g(I.pagination.data,(t=>(o(),a(i,{class:"goods-box ss-r-10 ss-m-b-14",key:t.id},{default:c((()=>[n(i,{class:"ss-flex ss-col-center"},{default:c((()=>[I.editMode?(o(),a($,{key:0,class:"check-box ss-flex ss-col-center ss-p-l-10",onClick:e=>z(t.goods_id)},{default:c((()=>[n(T,{checked:I.selectedCollectList.includes(t.goods_id),color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:x((e=>z(t.goods_id)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])):p("",!0),n(F,{title:t.goods.title,img:t.goods.image,price:t.goods.price[0],skuText:t.goods.subtitle,priceColor:"#FF3000",titleWidth:400,onClick:s=>w(e).$router.go("/pages/goods/index",{id:t.goods_id})},null,8,["title","img","price","skuText","onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1}),m(n(O,{bottom:"",val:0,placeholder:""},{default:c((()=>[n(i,{class:"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"},{default:c((()=>[n(i,{class:"footer-left ss-flex ss-col-center"},{default:c((()=>[n($,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:D},{default:c((()=>[n(T,{checked:I.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:x(D,["stop"])},null,8,["checked","onClick"]),n(i,null,{default:c((()=>[r(" 全选 ")])),_:1})])),_:1})])),_:1}),n(i,{class:"footer-right"},{default:c((()=>[n(k,{class:"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main",onClick:E},{default:c((()=>[r("取消收藏")])),_:1})])),_:1})])),_:1})])),_:1},512),[[C,I.editMode]])])),_:1}),I.pagination.total>0?(o(),a(J,{key:0,status:I.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:H},null,8,["status"])):p("",!0),0===I.pagination.total?(o(),a(W,{key:1,text:"暂无收藏",icon:"/static/collect-empty.png"})):p("",!0)])),_:1})}}},[["__scopeId","data-v-d8330616"]]);export{$ as default};
