var H=Object.defineProperty;var L=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var R=(i,t,e)=>t in i?H(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t)=>{for(var e in t||(t={}))J.call(t,e)&&R(i,e,t[e]);if(L)for(var e of L(t))Q.call(t,e)&&R(i,e,t[e]);return i};var C=(i,t,e)=>new Promise((y,w)=>{var I=c=>{try{r(e.next(c))}catch(f){w(f)}},b=c=>{try{r(e.throw(c))}catch(f){w(f)}},r=c=>c.done?y(c.value):Promise.resolve(c.value).then(I,b);r((e=e.apply(i,t)).next())});import{u as U,f as T,g as P}from"./index-2a45336b.js";import{u as X}from"./usePagination-7442a465.js";import Y from"./EditDialog-b4c9663f.js";import{a as Z,b as s,o as m,k as $,e as n,w as a,u as d,V as tt,E as _,c as E,i as h,F as O,G as V,aK as et,W as at,a5 as nt,aa as ot}from"./ant-design-vue-710243d9.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 yt=Object.assign({name:"lotteryProduct"},{__name:"index",setup(i){const{t}=U(),e=[{title:"奖品图片",dataIndex:"img",width:120,align:"center"},{title:"奖品名称",dataIndex:"name"},{title:"抽中限制",dataIndex:"maxNum",width:120,align:"center"},{title:"中奖率",dataIndex:"probability",width:100,align:"center"},{title:"已抽中数",dataIndex:"realNum",align:"center",ellipsis:!0},{title:"所属规则",dataIndex:"raffleName",align:"center",width:110},{title:"奖品状态",dataIndex:"status",width:100,align:"center"},{title:t("button.action"),key:"action",fixed:"right",width:100,align:"center"}],{listData:y,loading:w,showLoading:I,hideLoading:b,paginationState:r,resetPagination:c,searchFormData:f}=X(),F=Z();k();function k(){return C(this,null,function*(){try{I();const{pageSize:o,current:l}=r,{success:p,data:u,total:D}=yield T.raffleProduct.getProjectList(S({pageSize:o,current:l},f.value)).catch(()=>{throw new Error});b(),P("http.code.success")===p&&(y.value=u,r.total=D)}catch(o){b()}})}function j({id:o}){nt.confirm({title:t("pages.system.user.delTip"),content:t("button.confirm"),okText:t("button.confirm"),onOk:()=>new Promise((l,p)=>{C(this,null,function*(){try{const{success:u}=yield T.raffleProduct.delItem(o).catch(()=>{throw new Error});P("http.code.success")===u&&(l(),ot.success(t("component.message.success.delete")),yield k())}catch(u){p()}})})})}function z({current:o,pageSize:l}){r.current=o,r.pageSize=l,k()}function G(){return C(this,null,function*(){yield k()})}return(o,l)=>{const p=s("a-button"),u=s("x-action-bar"),D=s("a-image"),v=s("a-tag"),N=s("a-tooltip"),B=s("x-action-button"),K=s("a-table"),M=s("a-card"),W=s("a-col"),q=s("a-row");return m(),$(O,null,[n(q,{gutter:8,wrap:!1},{default:a(()=>[n(W,{flex:"auto"},{default:a(()=>[n(M,{type:"flex"},{default:a(()=>[n(u,{class:"mb-8-2"},{default:a(()=>[n(p,{type:"primary",onClick:l[0]||(l[0]=x=>o.$refs.editDialogRef.handleCreate())},{icon:a(()=>[n(d(tt))]),default:a(()=>[_(" 新增奖品 ")]),_:1})]),_:1}),n(K,{columns:e,"data-source":d(y),bordered:"true",loading:d(w),pagination:d(r),scroll:{x:1e3},onChange:z},{bodyCell:a(({column:x,record:g})=>[x.dataIndex==="img"?(m(),E(D,{key:0,width:60,src:d(P)("http.apiBasic")+g.img||o.$imageErr.imgErr},null,8,["src"])):h("",!0),x.dataIndex==="status"?(m(),$(O,{key:1},[g.status==="enabled"?(m(),E(v,{key:0,color:"green"},{default:a(()=>[_("启用")]),_:1})):h("",!0),g.status==="disabled"?(m(),E(v,{key:1,color:"red"},{default:a(()=>[_("停用")]),_:1})):h("",!0)],64)):h("",!0),x.key==="action"?(m(),$(O,{key:2},[n(B,{onClick:A=>o.$refs.editDialogRef.handleEdit(g)},{default:a(()=>[n(N,null,{title:a(()=>[_(V(o.$t("pages.system.user.edit")),1)]),default:a(()=>[n(d(et))]),_:1})]),_:2},1032,["onClick"]),n(B,{onClick:A=>j(g)},{default:a(()=>[n(N,null,{title:a(()=>[_(V(o.$t("pages.system.delete")),1)]),default:a(()=>[n(d(at),{style:{color:"#ff4d4f"}})]),_:1})]),_:2},1032,["onClick"])],64)):h("",!0)]),_:1},8,["data-source","loading","pagination"])]),_:1})]),_:1})]),_:1}),n(Y,{ref_key:"editDialogRef",ref:F,onOk:G},null,512)],64)}}});export{yt as default};
