import{d as F,r as c,a as A,o as T,g as o,J as j,c as k,k as g,e as t,w as l,K as q,z as C,b as _,x as m,t as p,l as I,C as J,D as K,E as L,_ as R}from"./index-CUnFTKV2.js";import G from"./RankPrizeFormDialog-AN21QmBs.js";import{e as H,f as O}from"./rank-XE5cpzWb.js";const Q={class:"page-container"},W={class:"card-header"},X={key:1},Y={class:"price"},Z={class:"cost-price"},ee=F({__name:"month",setup(te){const f=c(!1),y=c([]),b=c(0),s=A({page:1,pageSize:20}),u=c(!1),v=c(!1),z=c(null),d=async()=>{f.value=!0;try{const n=await H(s);y.value=n.data.list,b.value=n.data.total}finally{f.value=!1}},w=n=>{s.page=n,d()},x=n=>{s.pageSize=n,s.page=1,d()},S=()=>{v.value=!1,z.value=null,u.value=!0},D=n=>{v.value=!0,z.value={...n},u.value=!0},P=async n=>{try{await K.confirm(`确定要删除排名第 ${n.rank} 的奖品 "${n.title}" 吗？删除后不可恢复！`,"删除确认",{type:"warning"}),await O(n.id),L.success("删除成功"),d()}catch{}};return T(()=>{d()}),(n,a)=>{const V=o("el-icon"),h=o("el-button"),i=o("el-table-column"),E=o("el-image"),U=o("el-tag"),B=o("el-table"),M=o("el-pagination"),N=o("el-card"),$=j("loading");return g(),k("div",Q,[t(N,null,{header:l(()=>[_("div",W,[a[4]||(a[4]=_("span",null,"月榜奖品管理",-1)),t(h,{type:"primary",onClick:S},{default:l(()=>[t(V,null,{default:l(()=>[t(I(J))]),_:1}),a[3]||(a[3]=p("添加奖品 ",-1))]),_:1})])]),default:l(()=>[q((g(),C(B,{data:y.value,border:"",stripe:""},{default:l(()=>[t(i,{prop:"rank",label:"排名",width:"80",align:"center"}),t(i,{prop:"title",label:"奖品名称","min-width":"150"}),t(i,{label:"奖品图片",width:"100",align:"center"},{default:l(({row:e})=>[e.imgUrl?(g(),C(E,{key:0,src:e.imgUrl,"preview-src-list":[e.imgUrl],fit:"cover",class:"prize-image","preview-teleported":""},null,8,["src","preview-src-list"])):(g(),k("span",X,"-"))]),_:1}),t(i,{label:"售价",width:"100",align:"right"},{default:l(({row:e})=>{var r;return[_("span",Y,"¥"+m(((r=e.price)==null?void 0:r.toFixed(2))||"0.00"),1)]}),_:1}),t(i,{label:"采购价",width:"100",align:"right"},{default:l(({row:e})=>{var r;return[_("span",Z,"¥"+m(((r=e.costPrice)==null?void 0:r.toFixed(2))||"0.00"),1)]}),_:1}),t(i,{label:"奖赏类型",width:"120",align:"center"},{default:l(({row:e})=>[t(U,{size:"small"},{default:l(()=>[p(m(e.prizeTypeName||"-"),1)]),_:2},1024)]),_:1}),t(i,{label:"创建时间",width:"160",align:"center"},{default:l(({row:e})=>[p(m(e.createdAt||"-"),1)]),_:1}),t(i,{label:"操作",width:"150",align:"center",fixed:"right"},{default:l(({row:e})=>[t(h,{type:"primary",link:"",size:"small",onClick:r=>D(e)},{default:l(()=>[...a[5]||(a[5]=[p(" 编辑 ",-1)])]),_:1},8,["onClick"]),t(h,{type:"danger",link:"",size:"small",onClick:r=>P(e)},{default:l(()=>[...a[6]||(a[6]=[p(" 删除 ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[$,f.value]]),t(M,{"current-page":s.page,"onUpdate:currentPage":a[0]||(a[0]=e=>s.page=e),"page-size":s.pageSize,"onUpdate:pageSize":a[1]||(a[1]=e=>s.pageSize=e),"page-sizes":[10,20,50,100],total:b.value,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:x,onCurrentChange:w,class:"pagination"},null,8,["current-page","page-size","total"])]),_:1}),t(G,{modelValue:u.value,"onUpdate:modelValue":a[2]||(a[2]=e=>u.value=e),prize:z.value,"is-edit":v.value,type:"month",onSuccess:d},null,8,["modelValue","prize","is-edit"])])}}}),se=R(ee,[["__scopeId","data-v-249707dc"]]);export{se as default};
