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