1 |
- import{s as e,v as t,x as s,o as l,e as a,f as o,w as i,_ as c,l as n,j as d,p as r,t as p,g as u,k as f,r as _,F as g,aa as m,ab as x,A as C,B as k,C as y,i as b,D as h,E as v,G as M,m as j,u as w}from"./index-9880b451.js";import{_ as L}from"./s-goods-item.f5d79fd7.js";import{a as S,_ as A}from"./s-layout.dfc5b0b5.js";import{_ as F}from"./uni-load-more.aac4524a.js";import{_ as G}from"./s-empty.74111684.js";import{F as I}from"./favorite.390dabed.js";import{r as N}from"./index.df38848e.js";/* empty css */import{_ as B}from"./_plugin-vue_export-helper.1b428a4d.js";import"./useGoods.bdd1c2ea.js";/* empty css *//* empty css */const z=B({__name:"goods-collect",setup(B){k((e=>({"016d8d2c":w(z)})));const z=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 I.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 O(){if(T.selectedCollectList){for(const e of T.selectedCollectList)await I.deleteFavorite(e);T.editMode=!1,T.selectedCollectList=[],T.selectAll=!1,N(T.pagination),await $()}}function P(){"noMore"!==T.loadStatus&&(T.pagination.pageNo++,$())}return s((()=>{P()})),l((()=>{$()})),(t,s)=>{const l=y,c=b,k=h,I=v,N=M,B=n(j("s-goods-item"),L),z=n(j("su-fixed"),S),$=n(j("uni-load-more"),F),U=n(j("s-empty"),G),W=n(j("s-layout"),A);return a(),o(W,{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 ss-m-b-14",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(I,{checked:T.selectedCollectList.includes(t.spuId),color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},onClick:C((e=>D(t.spuId)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])):u("",!0),d(B,{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(z,{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(I,{checked:T.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:C(E,["stop"])},null,8,["checked","onClick"]),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:O},{default:i((()=>[r(" 取消收藏 ")])),_:1})])),_:1})])),_:1})])),_:1},512),[[x,T.editMode]])])),_:1}),T.pagination.total>0?(a(),o($,{key:0,status:T.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:P},null,8,["status"])):u("",!0),0===T.pagination.total?(a(),o(U,{key:1,text:"暂无收藏",icon:"/static/collect-empty.png"})):u("",!0)])),_:1})}}},[["__scopeId","data-v-43e16939"]]);export{z as default};
|