var W=Object.defineProperty;var A=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var P=(s,t,e)=>t in s?W(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,M=(s,t)=>{for(var e in t||(t={}))q.call(t,e)&&P(s,e,t[e]);if(A)for(var e of A(t))J.call(t,e)&&P(s,e,t[e]);return s};var Y=(s,t,e)=>new Promise((w,b)=>{var $=l=>{try{i(e.next(l))}catch(y){b(y)}},I=l=>{try{i(e.throw(l))}catch(y){b(y)}},i=l=>l.done?w(l.value):Promise.resolve(l.value).then($,I);i((e=e.apply(s,t)).next())});import{u as Q,f as R,g as H}from"./index-2a45336b.js";import{u as U}from"./usePagination-7442a465.js";import X from"./EditDialog-c13e9915.js";import{a as Z,b as r,o as u,k as g,e as n,w as a,u as c,V as tt,E as k,G as x,i as f,d as L,F as E,c as N,aK as et,W as at,a5 as nt,aa as ot}from"./ant-design-vue-710243d9.js";import{a as st}from"./useEnum-4e87ed86.js";import"./tinymce-3184e0f1.js";import"./echarts-ca5d9323.js";import"./cropper-47c8e461.js";import"./lodash-es-7cb071db.js";import"./qrcode-bec2257a.js";import"./jschardet-bd496279.js";import"./useForm-269e95cd.js";import"./useSpining-af3901ce.js";const it={key:0},rt={key:1},ct={key:2},It=Object.assign({name:"lotteryRules"},{__name:"index",setup(s){const{t}=Q(),e=[{title:"所属区域",dataIndex:"areaId"},{title:"规则名称",dataIndex:"title"},{title:"开始时间",dataIndex:"startAt",width:180,align:"center"},{title:"结束时间",dataIndex:"endAt",width:180,align:"center"},{title:"消耗积分",dataIndex:"price",align:"center",width:110},{title:"备注",dataIndex:"reason",align:"center",ellipsis:!0},{title:"状态",dataIndex:"status",key:"introduce",width:100,align:"center"},{title:t("button.action"),key:"action",fixed:"right",width:100,align:"center"}],{listData:w,loading:b,showLoading:$,hideLoading:I,paginationState:i,resetPagination:l,searchFormData:y}=U(),S=Z();D();function D(){return Y(this,null,function*(){try{$();const{pageSize:o,current:d}=i,{success:h,data:p,total:C}=yield R.raffles.getProjectList(M({pageSize:o,current:d},y.value)).catch(()=>{throw new Error});I(),H("http.code.success")===h&&(w.value=p,i.total=C)}catch(o){I()}})}function T({id:o}){nt.confirm({title:t("pages.system.user.delTip"),content:t("button.confirm"),okText:t("button.confirm"),onOk:()=>new Promise((d,h)=>{Y(this,null,function*(){try{const{success:p}=yield R.raffles.delItem(o).catch(()=>{throw new Error});H("http.code.success")===p&&(d(),ot.success(t("component.message.success.delete")),yield D())}catch(p){h()}})})})}function V({current:o,pageSize:d}){i.current=o,i.pageSize=d,D()}function j(){return Y(this,null,function*(){yield D()})}return(o,d)=>{const h=r("a-button"),p=r("x-action-bar"),C=r("a-tag"),O=r("a-tooltip"),v=r("x-action-button"),B=r("a-table"),F=r("a-card"),z=r("a-col"),G=r("a-row");return u(),g(E,null,[n(G,{gutter:8,wrap:!1},{default:a(()=>[n(z,{flex:"auto"},{default:a(()=>[n(F,{type:"flex"},{default:a(()=>[n(p,{class:"mb-8-2"},{default:a(()=>[n(h,{type:"primary",onClick:d[0]||(d[0]=_=>o.$refs.editDialogRef.handleCreate())},{icon:a(()=>[n(c(tt))]),default:a(()=>[k(" 新增规则 ")]),_:1})]),_:1}),n(B,{columns:e,"data-source":c(w),bordered:"true",loading:c(b),pagination:c(i),scroll:{x:1e3},onChange:V},{bodyCell:a(({column:_,record:m})=>[_.dataIndex==="areaId"?(u(),g("span",it,x(c(st).getName(m.areaId)),1)):f("",!0),_.dataIndex==="startAt"?(u(),g("span",rt,x(c(L)(m.startAt).format("YYYY-MM-DD HH:mm:ss")),1)):f("",!0),_.dataIndex==="endAt"?(u(),g("span",ct,x(c(L)(m.endAt).format("YYYY-MM-DD HH:mm:ss")),1)):f("",!0),_.dataIndex==="status"?(u(),g(E,{key:3},[m.status==="enabled"?(u(),N(C,{key:0,color:"green"},{default:a(()=>[k("启用")]),_:1})):f("",!0),m.status==="disabled"?(u(),N(C,{key:1,color:"red"},{default:a(()=>[k("停用")]),_:1})):f("",!0)],64)):f("",!0),_.key==="action"?(u(),g(E,{key:4},[n(v,{onClick:K=>o.$refs.editDialogRef.handleEdit(m)},{default:a(()=>[n(O,null,{title:a(()=>[k(x(o.$t("pages.system.user.edit")),1)]),default:a(()=>[n(c(et))]),_:1})]),_:2},1032,["onClick"]),n(v,{onClick:K=>T(m)},{default:a(()=>[n(O,null,{title:a(()=>[k(x(o.$t("pages.system.delete")),1)]),default:a(()=>[n(c(at),{style:{color:"#ff4d4f"}})]),_:1})]),_:2},1032,["onClick"])],64)):f("",!0)]),_:1},8,["data-source","loading","pagination"])]),_:1})]),_:1})]),_:1}),n(X,{ref_key:"editDialogRef",ref:S,onOk:j},null,512)],64)}}});export{It as default};
