import{a as D,e as F}from"./collection-65c798c4.js";import{M as m,I as M,F as h,g as A,R as I,e as P,f as q}from"./ui-ba7aaa7e.js";import{e as B,l as C,r as c,P as E,a3 as S,a4 as n,f as l}from"./vue-bf422dc1.js";const T={name:"AdminMenuEditPopup"},O=B({...T,emits:["success"],setup(j,{expose:f,emit:_}){const b=[{label:"启用",value:1},{label:"禁用",value:0}],i={id:0,title:"",code:"",show_name:"",account_fields:"",applyurl:"",status:1,is_available:1,sort:0,lowrate:0,type:1,paytype:""},a=C({...i}),u=c(!1),d=c("添加打款渠道"),v=o=>{if(o)d.value="编辑打款渠道",V(o);else{d.value="添加打款渠道";for(const e in i)a[e]=i[e]}u.value=!0},V=async o=>{const{data:e}=await D({id:o});for(const s in a)e[s]!=null&&e[s]!==void 0&&(a[s]=e[s])};f({init:v});const y={name:[{required:!0,message:"必填",type:"error"}],title:[{required:!0,message:"必填",type:"error"}]},g=_,p=c(),w=async()=>{const o=await p.value.validate();if(typeof o!="object"&&o)try{const e=await F(a);e.code===1?(m.success(e.msg),u.value=!1,g("success")):m.error(e.msg)}catch(e){m.error(e.msg)}};return(o,e)=>{const s=M,r=h,U=A,k=I,x=P,R=q;return E(),S(R,{visible:u.value,"onUpdate:visible":e[5]||(e[5]=t=>u.value=t),"close-on-overlay-click":!1,"destroy-on-close":!0,header:d.value,"on-confirm":w},{default:n(()=>[l(x,{ref_key:"formRef",ref:p,"label-align":"left",data:a,rules:y,"label-width":80},{default:n(()=>[l(r,{label:"接口名称",name:"title"},{default:n(()=>[l(s,{modelValue:a.title,"onUpdate:modelValue":e[0]||(e[0]=t=>a.title=t),clearable:"",placeholder:"请输入接口名称"},null,8,["modelValue"])]),_:1}),l(r,{label:"代码接口",name:"code",tips:"请输入接口名称(英文标识)，必须是home/settlement里的文件名"},{default:n(()=>[l(s,{modelValue:a.code,"onUpdate:modelValue":e[1]||(e[1]=t=>a.code=t),clearable:"",placeholder:"请输入接口名称(英文标识)"},null,8,["modelValue"])]),_:1}),l(r,{label:"显示名称",name:"show_name"},{default:n(()=>[l(s,{modelValue:a.show_name,"onUpdate:modelValue":e[2]||(e[2]=t=>a.show_name=t),clearable:"",placeholder:"显示名称"},null,8,["modelValue"])]),_:1}),l(r,{label:"账户字段",name:"account_fields"},{default:n(()=>[l(U,{modelValue:a.account_fields,"onUpdate:modelValue":e[3]||(e[3]=t=>a.account_fields=t),clearable:"",placeholder:"用户添加渠道账户所需的字段，用“|”分割字段,用:分隔名称，如：应用号:appid|应用秘钥:appsecret"},null,8,["modelValue"])]),_:1}),l(r,{label:"状态",name:"status"},{default:n(()=>[l(k,{modelValue:a.status,"onUpdate:modelValue":e[4]||(e[4]=t=>a.status=t),options:b},null,8,["modelValue"])]),_:1})]),_:1},8,["data"])]),_:1},8,["visible","header"])}}});export{O as _};
