import{M as D}from"./index.dfdc0704.js";import{_ as A}from"./ActivitySelect.vue_vue_type_script_setup_true_lang.5af17dcb.js";import{u as U}from"./useInstance.233fbdde.js";import{az as s,d as G,r as V,b as k,p as C,c as r,e as x,k as M,i as d,h as o,u as l,a2 as $,m as g,E as F}from"./index.0308b213.js";const j=a=>s.get("addon/vote.web.vote_gift/list",{params:a}),L=a=>s.get(`addon/vote.web.vote_gift/detail?id=${a}`),N=a=>s.post("addon/vote.web.vote_gift/add",a),h=a=>s.post("addon/vote.web.vote_gift/edit",a),H=a=>s.post("addon/vote.web.vote_gift/delete",{id:a}),q=g("\u63D0\u4EA4"),z=g("\u53D6\u6D88"),J=G({props:{modelValue:{type:Boolean,default:!1},id:{default:0}},emits:["update:modelValue","onClose"],setup(a,{emit:c}){const _=a,{global:b}=U(),f=V(!1),y=V();let e=k({id:0,name:"",price:0,vote:0,displayorder:0,icon:"",vote_activity_id:""});const E=i=>{L(i).then(t=>{e.name=t.data.name,e.price=t.data.price,e.vote=t.data.vote,e.displayorder=t.data.displayorder,e.icon=t.data.icon,e.vote_activity_id=t.data.vote_activity_id})};C(()=>_.modelValue,i=>{f.value=i});const B=()=>{e.id>0?h(e).then(()=>{F({message:"\u4FEE\u6539\u793C\u7269\u6570\u636E\u6210\u529F",type:"success"}),m()}):N(e).then(()=>{F({message:"\u65B0\u589E\u793C\u7269\u6570\u636E\u6210\u529F",type:"success"}),m()})};C(()=>_.id,i=>{e.id=i,i&&E(i)},{immediate:!0});const m=()=>{c("update:modelValue",!1),c("onClose"),b.$resetForm(y.value,e)};return(i,t)=>{const n=r("el-form-item"),p=r("el-input"),v=r("el-button"),w=r("el-dialog");return x(),M(w,{modelValue:f.value,"onUpdate:modelValue":t[6]||(t[6]=u=>f.value=u),title:a.id?"\u7F16\u8F91\u793C\u7269":"\u65B0\u589E\u793C\u7269",width:"50%",onClose:m},{default:d(()=>[o(l($),{model:l(e),"label-width":"120px"},{default:d(()=>[o(n,{class:"tn-el-form-item",label:"\u6D3B\u52A8"},{default:d(()=>[o(A,{modelValue:l(e).vote_activity_id,"onUpdate:modelValue":t[0]||(t[0]=u=>l(e).vote_activity_id=u)},null,8,["modelValue"])]),_:1}),o(n,{label:"\u793C\u7269\u540D\u79F0"},{default:d(()=>[o(p,{modelValue:l(e).name,"onUpdate:modelValue":t[1]||(t[1]=u=>l(e).name=u),placeholder:"\u8BF7\u8F93\u5165\u793C\u7269\u540D\u79F0"},null,8,["modelValue"])]),_:1}),o(n,{label:"\u793C\u7269\u4EF7\u683C"},{default:d(()=>[o(p,{modelValue:l(e).price,"onUpdate:modelValue":t[2]||(t[2]=u=>l(e).price=u),placeholder:"\u8BF7\u8F93\u5165\u793C\u7269\u4EF7\u683C"},null,8,["modelValue"])]),_:1}),o(n,{label:"\u793C\u7269\u7968\u6570"},{default:d(()=>[o(p,{modelValue:l(e).vote,"onUpdate:modelValue":t[3]||(t[3]=u=>l(e).vote=u),placeholder:"\u8BF7\u8F93\u5165\u793C\u7269\u7968\u6570"},null,8,["modelValue"])]),_:1}),o(n,{label:"\u793C\u7269\u56FE\u6807"},{default:d(()=>[o(D,{modelValue:l(e).icon,"onUpdate:modelValue":t[4]||(t[4]=u=>l(e).icon=u),limit:1},null,8,["modelValue"])]),_:1}),o(n,{label:"\u6392\u5E8F"},{default:d(()=>[o(p,{modelValue:l(e).displayorder,"onUpdate:modelValue":t[5]||(t[5]=u=>l(e).displayorder=u),placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1}),o(n,null,{default:d(()=>[o(v,{type:"primary",onClick:B},{default:d(()=>[q]),_:1}),o(v,{onClick:m},{default:d(()=>[z]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{J as _,H as d,j as g};
