import{R as p,a as j}from"./reward-Baf2bADU.js";import{d as A,r as C,G as y,g as i,J as G,c as g,k as r,K as J,e as n,z as v,w as o,t as c,x as _,b as K,F as q,y as H,_ as M}from"./index-CUnFTKV2.js";const O={class:"signconfig-table"},Q={key:1,class:"no-data"},W={key:0,class:"reward-list"},X={key:1,class:"no-data"},Y=A({__name:"SignConfigTable",props:{data:{},loading:{type:Boolean},total:{},page:{},pageSize:{},signType:{}},emits:["page-change","size-change","edit","edit-reward","delete","status-change","sort-change"],setup(u,{emit:w}){const m=u,d=w,h=C(m.page),f=C(m.pageSize);y(()=>m.page,t=>{h.value=t}),y(()=>m.pageSize,t=>{f.value=t});const z=t=>{switch(t){case p.Diamond:return"primary";case p.UUCoin:return"success";case p.DaDaCoin:return"warning";case p.Coupon:return"danger";default:return"info"}},k=t=>{var s;const a=j[t.rewardType]||"未知";return t.rewardType===p.Coupon?((s=t.coupon)==null?void 0:s.title)||`优惠券(ID:${t.rewardExtend})`:`${a}: ${t.rewardValue}`},S=t=>{d("page-change",t)},V=t=>{d("size-change",t)},T=t=>{d("edit",t)},x=t=>{d("edit-reward",t)},D=t=>{d("delete",t)},U=(t,a)=>{d("status-change",t,a)},R=(t,a)=>{d("sort-change",t,a)};return(t,a)=>{const s=i("el-table-column"),$=i("el-image"),B=i("el-tag"),E=i("el-input-number"),N=i("el-switch"),b=i("el-button"),P=i("el-table"),I=i("el-pagination"),L=G("loading");return r(),g("div",O,[J((r(),v(P,{data:u.data,border:"",stripe:""},{default:o(()=>[n(s,{prop:"id",label:"ID",width:"70",align:"center"}),n(s,{prop:"title",label:"标题","min-width":"120"},{default:o(({row:e})=>[c(_(e.title||"-"),1)]),_:1}),n(s,{label:"图标",width:"80",align:"center"},{default:o(({row:e})=>[e.icon?(r(),v($,{key:0,src:e.icon,"preview-src-list":[e.icon],fit:"cover",class:"icon-preview","preview-teleported":""},null,8,["src","preview-src-list"])):(r(),g("span",Q,"-"))]),_:1}),n(s,{label:"天数",width:"80",align:"center"},{default:o(({row:e})=>[K("span",null,_(e.day||"-"),1)]),_:1}),n(s,{label:"奖励信息","min-width":"200"},{default:o(({row:e})=>[e.rewards&&e.rewards.length>0?(r(),g("div",W,[(r(!0),g(q,null,H(e.rewards,(l,F)=>(r(),v(B,{key:F,type:z(l.rewardType),size:"small",class:"reward-tag"},{default:o(()=>[c(_(k(l)),1)]),_:2},1032,["type"]))),128))])):(r(),g("span",X,"暂无奖励"))]),_:1}),n(s,{label:"排序",width:"100",align:"center"},{default:o(({row:e})=>[n(E,{modelValue:e.sort,"onUpdate:modelValue":l=>e.sort=l,min:0,max:9999,size:"small","controls-position":"right",onChange:l=>R(e,l)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),n(s,{label:"状态",width:"80",align:"center"},{default:o(({row:e})=>[n(N,{modelValue:e.status,"onUpdate:modelValue":l=>e.status=l,"active-value":1,"inactive-value":0,onChange:l=>U(e,l)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),n(s,{label:"创建时间",width:"160",align:"center"},{default:o(({row:e})=>[c(_(e.createdAt||"-"),1)]),_:1}),n(s,{label:"操作",width:"180",align:"center",fixed:"right"},{default:o(({row:e})=>[n(b,{type:"primary",link:"",size:"small",onClick:l=>T(e)},{default:o(()=>[...a[2]||(a[2]=[c(" 编辑 ",-1)])]),_:1},8,["onClick"]),n(b,{type:"warning",link:"",size:"small",onClick:l=>x(e)},{default:o(()=>[...a[3]||(a[3]=[c(" 奖励 ",-1)])]),_:1},8,["onClick"]),n(b,{type:"danger",link:"",size:"small",onClick:l=>D(e)},{default:o(()=>[...a[4]||(a[4]=[c(" 删除 ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[L,u.loading]]),n(I,{"current-page":h.value,"onUpdate:currentPage":a[0]||(a[0]=e=>h.value=e),"page-size":f.value,"onUpdate:pageSize":a[1]||(a[1]=e=>f.value=e),"page-sizes":[10,20,50,100],total:u.total,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:V,onCurrentChange:S,class:"pagination"},null,8,["current-page","page-size","total"])])}}}),te=M(Y,[["__scopeId","data-v-bbfdefeb"]]);export{te as default};
