import{_ as e}from"./uv-navbar.31c484ad.js";import{f as a,M as t,o,c as s,w as l,a as i,u as r,h as c,t as n,b as u,r as d,F as p,A as m,R as f,k as v,g as _,d as j,m as g,K as k}from"./index-3714412c.js";import{o as h,r as y,u as C}from"./useRouter.f44141c1.js";import{_ as w,a as x}from"./uv-checkbox-group.93885f58.js";import{_ as b}from"./goods.46695bdd.js";import{_ as I,a as V}from"./uv-swipe-action.837380ab.js";import{_ as M}from"./card.65aaf97b.js";import{_ as L}from"./space.57299547.js";import{_ as N}from"./container.6fa82c89.js";import{_ as S}from"./layout.99605750.js";import{k as D,u as E,l as R}from"./product.d7200236.js";import{M as U}from"./index.7efe5fcf.js";import{u as A}from"./usePage.b4ec4df0.js";import{E as B}from"./index.573aa2d3.js";import{e as P}from"./收藏.f26ff3a3.js";import{u as F}from"./useInterface.f3e95e31.js";import{_ as J}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-status-bar.b515a02d.js";import"./uv-icon.c593f91d.js";import"./uv-button.14a976f7.js";import"./uv-loading-icon.8ba359c8.js";import"./good-attr-select.1541fb80.js";import"./uv-image.7b0e6bd2.js";import"./uv-transition.4f5b62a8.js";import"./index.d0119d7e.js";/* empty css                                                             */import"./api.966d6934.js";const K=J({__name:"collect",setup(J){const{goBack:K,push:W}=C(),{type:Y,refresh:Z,dataList:$}=A(D),{toast:q}=F(),z=a([{text:"删除",style:{backgroundColor:"#f56c6c"}}]),G=a(!1);const H=a([]),O=t({get:()=>r(H).length===r($).length?[1]:[],set:()=>{}});function Q(e){H.value=e.includes(1)?$.value.map((e=>e.id)):[]}const T=a();let X;function ee(e=!1,a){if(e)X=a;else if(r(H).length<=0)return q({title:"请先选择商品"});r(T).show()}function ae(){X?async function(){await E(X),await Z(),await q({title:"删除成功"})}():async function(){const e=[];r($).forEach((a=>{r(H).includes(a.id)&&e.push(a.productId)}));const a={category:"common",productIdList:e};await R(a),await Z(),await q({title:"删除成功"}),H.value=[],te()}()}function te(){X=void 0}return h((async e=>{Y.value="collect",await Z()})),(a,t)=>{const h=y(_("uv-navbar"),e),C=j,D=y(_("uv-checkbox"),w),E=y(_("goods"),b),R=y(_("uv-swipe-action-item"),I),A=y(_("card"),M),F=y(_("uv-checkbox-group"),x),J=y(_("space"),L),Y=y(_("uv-swipe-action"),V),Z=y(_("container"),N),q=y(_("layout"),S);return o(),s(q,null,{default:l((()=>[i(h,{fixed:!1,title:"我的收藏","left-arrow":"",onLeftClick:r(K)},null,8,["onLeftClick"]),i(C,{class:"top-option"},{default:l((()=>[i(C),i(C,{class:"btn",onClick:t[0]||(t[0]=e=>function(e=!0){H.value=[],G.value=e}(!G.value))},{default:l((()=>[c(n(G.value?"完成":"管理"),1)])),_:1})])),_:1}),i(Z,null,{default:l((()=>[i(Y,null,{default:l((()=>[i(J,{direction:"vertical",fill:""},{default:l((()=>[r($).length>0?(o(),s(F,{key:0,modelValue:H.value,"onUpdate:modelValue":t[1]||(t[1]=e=>H.value=e),shape:"circle",activeColor:"#ec6e47"},{default:l((()=>[(o(!0),u(p,null,d(r($),(e=>(o(),s(C,{class:"select-row",key:e.id},{default:l((()=>[G.value?(o(),s(D,{key:0,customStyle:{marginBottom:"8px"},name:e.id},null,8,["name"])):g("",!0),i(A,{onClick:a=>function(e){G.value&&k((()=>{const a=r(H).findIndex((a=>a===e.id));a>=0?r(H).splice(a,1):r(H).push(e.id)}))}(e)},{default:l((()=>[i(R,{disabled:G.value,options:z.value,onClick:a=>ee(!0,e)},{default:l((()=>[i(E,{list:"",data:e,storeName:e.storeName,price:e.price,stock:e.stock,interval:"true",desc:"3",showAction:"true",surplus:"200",priceMode:"primary",onClick:a=>r(W)({url:"/pages/goodsDetail/goodsDetail"},{data:{id:e.productId}})},null,8,["data","storeName","price","stock","onClick"])])),_:2},1032,["disabled","options","onClick"])])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1},8,["modelValue"])):(o(),s(B,{key:1,iconSrc:r(P)},{default:l((()=>[c(" 您还没有收藏的商品~ ")])),_:1},8,["iconSrc"]))])),_:1})])),_:1}),i(C,{class:"option-height"}),i(C,{class:"option-row",style:m({height:G.value?"100rpx":"0rpx"})},{default:l((()=>[i(C,{class:"left"},{default:l((()=>[i(F,{modelValue:r(O),"onUpdate:modelValue":t[2]||(t[2]=e=>f(O)?O.value=e:null),shape:"circle",activeColor:"#ec6e47",onChange:Q},{default:l((()=>[i(D,{shape:"circle",activeColor:"#ec6e47",name:1},{default:l((()=>[v("span",{class:"all-select"},"全选")])),_:1})])),_:1},8,["modelValue"])])),_:1}),i(C,{class:"button",onClick:t[3]||(t[3]=e=>ee(!1))},{default:l((()=>[c(" 删除 ")])),_:1})])),_:1},8,["style"])])),_:1}),i(U,{ref_key:"deleteModal",ref:T,content:"确认要删除所选内容吗？",onConfirm:ae,onCancel:te},null,512)])),_:1})}}},[["__scopeId","data-v-e7d27873"]]);export{K as default};
