import{M as A}from"./index.dfdc0704.js";import{_ as q}from"./ActivitySelect.vue_vue_type_script_setup_true_lang.5af17dcb.js";import{S as R}from"./index.de7bcb5e.js";import{u as T}from"./useInstance.233fbdde.js";import{az as p,d as $,r as c,b as z,p as v,c as r,e as E,k as y,i as a,h as l,u,A as C,q as I,a2 as P,m,E as B}from"./index.0308b213.js";const le=n=>p.get("addon/vote.web.vote_sponsor/list",{params:n}),j=n=>p.get(`addon/vote.web.vote_sponsor/detail?id=${n}`),G=n=>p.post("addon/vote.web.vote_sponsor/add",n),H=n=>p.post("addon/vote.web.vote_sponsor/edit",n),ue=n=>p.post("addon/vote.web.vote_sponsor/delete",{id:n}),J=m("\u56FE\u7247"),K=m("\u8DF3\u8F6C\u8DEF\u5F84"),O=m("\u9009\u62E9\u7B2C\u4E09\u65B9\u94FE\u63A5"),Q=m("\u63D0\u4EA4"),W=m("\u53D6\u6D88"),te=$({props:{modelValue:{type:Boolean,default:!0},id:{type:Number,default:0}},emits:["update:modelValue","onClose"],setup(n,{emit:D}){const g=n,{global:w}=T(),F=c(!1),U=c();let e=z({id:0,name:"",image:"",content:"",sponsor_url_type:1,sponsor_url:"",displayorder:0,vote_activity_id:""});const S=d=>{j(d).then(o=>{e.name=o.data.name,e.image=o.data.image,e.content=o.data.content,e.displayorder=o.data.displayorder,e.sponsor_url_type=o.data.sponsor_url_type,e.sponsor_url=o.data.sponsor_url,e.vote_activity_id=o.data.vote_activity_id})};v(()=>g.modelValue,d=>{F.value=d});const k=()=>{e.id>0?H(e).then(()=>{B({message:"\u4FEE\u6539\u8D5E\u52A9\u5546\u6210\u529F",type:"success"}),_()}):G(e).then(()=>{B({message:"\u65B0\u589E\u8D5E\u52A9\u5546\u6210\u529F",type:"success"}),_()})};let i=c(!1);const x=()=>{i.value=!0},N=d=>{d.type==1?e.url=d.miniProgram:d.type==2?e.url=d.webview:d.type==3&&(e.url=d.phone)},h=d=>{e.url=d};v(()=>g.id,d=>{e.id=d,e.id>0&&S(d)},{immediate:!0});const _=()=>{D("update:modelValue",!1),D("onClose"),w.$resetForm(U.value,e)};return(d,o)=>{const s=r("el-form-item"),f=r("el-input"),b=r("el-radio"),L=r("el-radio-group"),V=r("el-button"),M=r("el-dialog");return E(),y(M,{modelValue:F.value,"onUpdate:modelValue":o[9]||(o[9]=t=>F.value=t),title:n.id?"\u7F16\u8F91\u8D5E\u52A9\u5546":"\u65B0\u589E\u8D5E\u52A9\u5546",width:"50%",onClose:_},{default:a(()=>[l(u(P),{model:u(e),"label-width":"120px"},{default:a(()=>[l(s,{class:"tn-el-form-item",label:"\u6D3B\u52A8"},{default:a(()=>[l(q,{modelValue:u(e).vote_activity_id,"onUpdate:modelValue":o[0]||(o[0]=t=>u(e).vote_activity_id=t)},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8D5E\u52A9\u5546\u540D\u79F0"},{default:a(()=>[l(f,{modelValue:u(e).name,"onUpdate:modelValue":o[1]||(o[1]=t=>u(e).name=t),placeholder:"\u8BF7\u8F93\u5165\u8D5E\u52A9\u5546\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8D5E\u52A9\u5546\u56FE\u7247"},{default:a(()=>[l(A,{modelValue:u(e).image,"onUpdate:modelValue":o[2]||(o[2]=t=>u(e).image=t),limit:1},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8D5E\u52A9\u5546\u63CF\u8FF0"},{default:a(()=>[l(f,{modelValue:u(e).content,"onUpdate:modelValue":o[3]||(o[3]=t=>u(e).content=t),placeholder:"\u8BF7\u8F93\u5165\u8D5E\u52A9\u5546\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u8D5E\u52A9\u5546\u94FE\u63A5\u7C7B\u578B"},{default:a(()=>[l(L,{modelValue:u(e).sponsor_url_type,"onUpdate:modelValue":o[4]||(o[4]=t=>u(e).sponsor_url_type=t)},{default:a(()=>[l(b,{label:1},{default:a(()=>[J]),_:1}),l(b,{label:2},{default:a(()=>[K]),_:1})]),_:1},8,["modelValue"])]),_:1}),u(e).sponsor_url_type==2?(E(),y(s,{key:0,label:"\u8DF3\u8F6C\u8DEF\u5F84"},{default:a(()=>[l(f,{modelValue:u(e).sponsor_url,"onUpdate:modelValue":o[5]||(o[5]=t=>u(e).sponsor_url=t),placeholder:"\u8BF7\u8F93\u5165\u8DF3\u8F6C\u8DEF\u5F84\u94FE\u63A5"},{append:a(()=>[l(V,{type:"primary",onClick:x},{default:a(()=>[O]),_:1})]),_:1},8,["modelValue"])]),_:1})):C("",!0),u(e).sponsor_url_type==1?(E(),y(s,{key:1,label:"\u56FE\u7247\u94FE\u63A5"},{default:a(()=>[l(A,{modelValue:u(e).sponsor_url,"onUpdate:modelValue":o[6]||(o[6]=t=>u(e).sponsor_url=t),limit:1},null,8,["modelValue"])]),_:1})):C("",!0),l(s,{label:"\u6392\u5E8F"},{default:a(()=>[l(f,{modelValue:u(e).displayorder,"onUpdate:modelValue":o[7]||(o[7]=t=>u(e).displayorder=t),placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1}),l(s,null,{default:a(()=>[l(u(R),{modelValue:u(i),"onUpdate:modelValue":o[8]||(o[8]=t=>I(i)?i.value=t:i=t),onConfirmAll:N,onChange:h,url:u(e).sponsor_url},null,8,["modelValue","url"])]),_:1}),l(s,null,{default:a(()=>[l(V,{type:"primary",onClick:k},{default:a(()=>[Q]),_:1}),l(V,{onClick:_},{default:a(()=>[W]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{te as _,ue as d,le as g};
