1 |
- import{s as e,z as t,A as s,o as l,f as a,g as o,w as i,a6 as c,_ as n,m as d,k as r,u as p,v as u,i as f,l as _,r as g,F as m,ab as x,ac as C,G as k,H as b,I as y,j as h,J as M,K as v,L as j,n as L,x as w}from"./index-ba48620e.js";import{_ as S}from"./s-goods-item.32271aab.js";import{a as A,_ as I}from"./s-layout.04b95866.js";import{_ as G}from"./uni-load-more.966faf1b.js";import{_ as F}from"./s-empty.a75760f9.js";import{r as N}from"./useGoods.edb8879f.js";/* empty css */import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import"./points.c381a8e1.js";/* empty css */import"./phone-international-input.dd3ca29e.js";/* empty css */const B=z({__name:"goods-collect",setup(z){b((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 c.getFavoritePage({pageNo:T.pagination.pageNo,pageSize:T.pagination.pageSize});0===e&&(T.pagination.list=n.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},H=()=>{T.selectAll=!T.selectAll,T.selectAll?T.selectedCollectList=T.pagination.list.map((e=>e.spuId)):T.selectedCollectList=[]};async function J(){if(T.selectedCollectList){for(const e of T.selectedCollectList)await c.deleteFavorite(e);T.editMode=!1,T.selectedCollectList=[],T.selectAll=!1,N(T.pagination),await $()}}function K(){"noMore"!==T.loadStatus&&(T.pagination.pageNo++,$())}return s((()=>{K()})),l((()=>{$()})),(t,s)=>{const l=y,c=h,n=M,b=v,N=j,z=d(L("s-goods-item"),S),B=d(L("su-fixed"),A),$=d(L("uni-load-more"),G),O=d(L("s-empty"),F),P=d(L("s-layout"),I);return a(),o(P,{title:"商品收藏"},{default:i((()=>[r(c,{class:"cart-box ss-flex ss-flex-col ss-row-between"},{default:i((()=>[r(c,{class:"cart-header ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:i((()=>[r(c,{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(c,{class:"header-right"},{default:i((()=>[T.editMode&&T.pagination.total?(a(),o(n,{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(n,{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(c,{class:"cart-content"},{default:i((()=>[(a(!0),_(m,null,g(T.pagination.list,(t=>(a(),o(c,{class:"goods-box ss-r-10",key:t.id},{default:i((()=>[r(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=>q(t.spuId)},{default:i((()=>[r(b,{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(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}),x(r(B,{bottom:"",val:0,placeholder:""},{default:i((()=>[r(c,{class:"cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom"},{default:i((()=>[r(c,{class:"footer-left ss-flex ss-col-center"},{default:i((()=>[r(N,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:H},{default:i((()=>[r(b,{checked:T.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:k(H,["stop"])},null,8,["checked"]),r(c,null,{default:i((()=>[p(" 全选 ")])),_:1})])),_:1})])),_:1}),r(c,{class:"footer-right"},{default:i((()=>[r(n,{class:"ss-reset-button ui-BG-Main-Gradient pay-btn ss-font-28 ui-Shadow-Main",onClick:J},{default:i((()=>[p(" 取消收藏 ")])),_:1})])),_:1})])),_:1})])),_:1},512),[[C,T.editMode]])])),_:1}),T.pagination.total>0?(a(),o($,{key:0,status:T.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:K},null,8,["status"])):f("",!0),0===T.pagination.total?(a(),o(O,{key:1,text:"暂无收藏",icon:"/static/collect-empty.png"})):f("",!0)])),_:1})}}},[["__scopeId","data-v-bb241d57"]]);export{B as default};
|