pages-user-goods-collect.37dd73da.js 4.7 KB

1
  1. import{s as e,z as t,A as s,o as l,f as a,g as o,w as i,a7 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 v,K as M,L as j,n as w,x as L}from"./index-a116b7fa.js";import{_ as S}from"./s-goods-item.e5b69bb0.js";import{a as A,_ as I}from"./s-layout.4ae51839.js";import{_ as G}from"./uni-load-more.2682655d.js";import{_ as z}from"./s-empty.4d7f5239.js";import{r as F}from"./useGoods.6b315a78.js";/* empty css */import{_ as N}from"./_plugin-vue_export-helper.1b428a4d.js";import"./points.c381a8e1.js";/* empty css */import"./phone-international-input.b9f6c8e6.js";/* empty css */const B=N({__name:"goods-collect",setup(N){b((e=>({"66c3ede2":L(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 H=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 c.deleteFavorite(e);T.editMode=!1,T.selectedCollectList=[],T.selectAll=!1,F(T.pagination),await $()}}function O(){"noMore"!==T.loadStatus&&(T.pagination.pageNo++,$())}return s((()=>{O()})),l((()=>{$()})),(t,s)=>{const l=y,c=h,n=v,b=M,F=j,N=d(w("s-goods-item"),S),B=d(w("su-fixed"),A),$=d(w("uni-load-more"),G),P=d(w("s-empty"),z),U=d(w("s-layout"),I);return a(),o(U,{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(F,{key:0,class:"check-box ss-flex ss-col-center ss-p-l-10",onClick:e=>H(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=>H(t.spuId)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])):f("",!0),r(N,{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}),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(F,{class:"check-box ss-flex ss-col-center ss-p-r-30",onClick:J},{default:i((()=>[r(b,{checked:T.selectAll,color:"var(--ui-BG-Main)",style:{transform:"scale(0.7)"},onClick:k(J,["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:K},{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: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{B as default};