import{e as L,a8 as $,r as m,l as I,o as N,d as M,P as x,a3 as U,a4 as o,f as s,I as v,H as f,a7 as C,Q as K,ab as j,a9 as A}from"./vue-bf422dc1.js";import{l as E}from"./category-c9a07555.js";import{c as H,e as Q,f as q}from"./coupon-a6db8847.js";import{R as F}from"./index-fb16f061.js";import{p as J}from"./global-0d825ba6.js";import{u as O,_ as W}from"./index-8db2df2c.js";import{s as X,t as Y}from"./constant-b61c1b97.js";import{m as S,M as i,l as Z,B as ee,d as te,S as ae,j as oe,b as se}from"./ui-ba7aaa7e.js";import"./no-list-e2f85d5e.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";import"./date-20546ee0.js";const ne={class:"category-header c-flex"},le={class:"l"},re={key:0,class:"selected-count"},ce={class:"r c-flex"},ie={name:"GoodsCouponTrash"},de=L({...ie,setup(ue){const k=$(),T=O(),V="id",_=m([]),r=m({defaultPageSize:15,total:0,defaultCurrent:1}),d=I({cate_id:"",status:""}),h=m(!1),u=async()=>{h.value=!0;const t={...d,page:r.value.defaultCurrent,limit:r.value.defaultPageSize};try{const{data:e}=await H(t);_.value=e.list,r.value={...r.value,total:e.total}}catch(e){console.log(e)}finally{h.value=!1}},y=m([]),B=async()=>{const{data:t}=await E();y.value=t.list};N(()=>{u(),B()});const P=(t,e)=>{r.value.defaultCurrent=t.current,r.value.defaultPageSize=t.pageSize,u()},l=m([]),g=t=>{l.value=t},b=t=>{t>0&&g(t);const e=S({header:"提醒",body:"确定要恢复吗？",confirmBtn:"确认",onConfirm:({e:p})=>{e.hide();const a={ids:l.value};Q(a).then(n=>{n.code===1?(i.success("恢复成功"),l.value=[],u()):i.error(`恢复失败：${n.msg}`)}).catch(n=>{i.error("恢复失败")})},onClose:({e:p,trigger:a})=>{e.hide()}})},w=t=>{t>0&&g(t);const e=S({header:"提醒",body:"确定要清空吗？清空后将无法恢复",confirmBtn:"确认",onConfirm:({e:p})=>{e.hide();const a={id:l.value};q(a).then(n=>{n.code===1?(i.success("操作成功"),l.value=[],u()):i.error(`操作失败：${n.msg}`)}).catch(n=>{i.error("操作失败")})},onClose:({e:p,trigger:a})=>{e.hide()}})},D=M(()=>({offsetTop:T.isUseTabsRouter?48:0,container:`.${J}-layout`}));return(t,e)=>{const p=Z,a=ee,n=te,R=ae,z=oe,G=se;return x(),U(G,{title:"优惠券回收站",class:"basic-container",bordered:!1},{actions:o(()=>[s(a,{variant:"text",theme:"default",onClick:e[0]||(e[0]=c=>v(k).push("/merchant/goods/coupon"))},{icon:o(()=>[s(p,{name:"rollback"})]),default:o(()=>[f(" 返回 ")]),_:1})]),default:o(()=>[C("div",ne,[C("div",le,[s(a,{variant:"base",disabled:!l.value.length,onClick:b},{default:o(()=>[f(" 批量恢复 ")]),_:1},8,["disabled"]),s(a,{variant:"base",theme:"danger",onClick:w},{default:o(()=>[f(" 清空回收站 ")]),_:1}),l.value.length?(x(),K("p",re,"已选"+j(l.value.length)+"项",1)):A("",!0)]),C("div",ce,[s(R,null,{default:o(()=>[s(n,{modelValue:d.cate_id,"onUpdate:modelValue":e[1]||(e[1]=c=>d.cate_id=c),placeholder:"全部分类",type:"search",clearable:"",options:y.value},null,8,["modelValue","options"]),s(n,{modelValue:d.status,"onUpdate:modelValue":e[2]||(e[2]=c=>d.status=c),placeholder:"全部状态",type:"search",clearable:"",options:v(X)},null,8,["modelValue","options"]),s(a,{theme:"default",variant:"outline",onClick:u},{default:o(()=>[f("查询")]),_:1})]),_:1})])]),s(z,{data:_.value,columns:v(Y),"row-key":V,"vertical-align":"top",hover:_.value.length>0,pagination:r.value,loading:h.value,"header-affixed-top":D.value,"table-layout":"auto","max-height":"100%",onPageChange:P,onSelectChange:g},{operation:o(({row:c})=>[s(a,{size:"small",variant:"outline",shape:"round",theme:"success",onClick:pe=>b([c.id])},{default:o(()=>[f("恢复")]),_:2},1032,["onClick"])]),empty:o(()=>[s(F,{title:"",tip:"优惠券回收站为空",type:"list"})]),_:1},8,["data","columns","hover","pagination","loading","header-affixed-top"])]),_:1})}}});const Pe=W(de,[["__scopeId","data-v-01562529"]]);export{Pe as default};
