import{d as q,r as R,v as A,g as n,z as B,k as N,w as l,e,b as m,t as f,x as b,l as z,R as F,_ as M}from"./index-CUnFTKV2.js";const S={class:"merchant-header"},T={class:"merchant-title"},j=q({__name:"AlipayMerchantForm",props:{modelValue:{},index:{},canDelete:{type:Boolean}},emits:["update:modelValue","delete","change"],setup(c,{expose:V,emit:x}){const g=c,i=x,_=R(),t=A({get:()=>g.modelValue,set:v=>i("update:modelValue",v)}),y={name:[{required:!0,message:"请输入商户名称",trigger:"blur"},{max:50,message:"商户名称不能超过50个字符",trigger:"blur"}],appId:[{required:!0,message:"请输入应用ID",trigger:"blur"},{max:32,message:"应用ID不能超过32个字符",trigger:"blur"}],privateKey:[{required:!0,message:"请输入应用私钥",trigger:"blur"}],publicKey:[{required:!0,message:"请输入支付宝公钥",trigger:"blur"}],weight:[{required:!0,message:"请输入权重",trigger:"blur"},{type:"number",min:1,max:100,message:"权重必须在1-100之间",trigger:"blur"}]},u=()=>{i("change")},h=()=>{i("delete",g.index)};return V({validate:async()=>{if(!_.value)return!1;try{return await _.value.validate(),!0}catch{return!1}}}),(v,a)=>{const w=n("el-tag"),I=n("el-icon"),k=n("el-button"),s=n("el-input"),r=n("el-form-item"),d=n("el-col"),p=n("el-row"),D=n("el-input-number"),K=n("el-switch"),C=n("el-form"),U=n("el-card");return N(),B(U,{class:"merchant-card",shadow:"hover"},{header:l(()=>[m("div",S,[m("span",T,[e(w,{type:t.value.is_enabled===1?"success":"info",size:"small"},{default:l(()=>[f(b(t.value.is_enabled===1?"已启用":"已禁用"),1)]),_:1},8,["type"]),f(" "+b(t.value.name||"新商户"),1)]),e(k,{type:"danger",link:"",disabled:!c.canDelete,onClick:h},{default:l(()=>[e(I,null,{default:l(()=>[e(z(F))]),_:1}),a[7]||(a[7]=f("删除 ",-1))]),_:1},8,["disabled"])])]),default:l(()=>[e(C,{ref_key:"formRef",ref:_,model:t.value,rules:y,"label-width":"100px",class:"merchant-form"},{default:l(()=>[e(p,{gutter:20},{default:l(()=>[e(d,{span:12},{default:l(()=>[e(r,{label:"商户名称",prop:"name"},{default:l(()=>[e(s,{modelValue:t.value.name,"onUpdate:modelValue":a[0]||(a[0]=o=>t.value.name=o),placeholder:"请输入商户名称",maxlength:"50",onInput:u},null,8,["modelValue"])]),_:1})]),_:1}),e(d,{span:12},{default:l(()=>[e(r,{label:"应用ID",prop:"appId"},{default:l(()=>[e(s,{modelValue:t.value.appId,"onUpdate:modelValue":a[1]||(a[1]=o=>t.value.appId=o),placeholder:"请输入支付宝应用ID(AppId)",maxlength:"32",onInput:u},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(p,{gutter:20},{default:l(()=>[e(d,{span:12},{default:l(()=>[e(r,{label:"权重",prop:"weight"},{default:l(()=>[e(D,{modelValue:t.value.weight,"onUpdate:modelValue":a[2]||(a[2]=o=>t.value.weight=o),min:1,max:100,placeholder:"请输入权重",onChange:u},null,8,["modelValue"]),a[8]||(a[8]=m("div",{class:"form-tip"},"权重越高，支付时被选中的概率越大",-1))]),_:1})]),_:1}),e(d,{span:12},{default:l(()=>[e(r,{label:"启用状态",prop:"is_enabled"},{default:l(()=>[e(K,{modelValue:t.value.is_enabled,"onUpdate:modelValue":a[3]||(a[3]=o=>t.value.is_enabled=o),"active-value":1,"inactive-value":0,"active-text":"启用","inactive-text":"禁用",onChange:u},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(p,{gutter:20},{default:l(()=>[e(d,{span:24},{default:l(()=>[e(r,{label:"应用私钥",prop:"privateKey"},{default:l(()=>[e(s,{modelValue:t.value.privateKey,"onUpdate:modelValue":a[4]||(a[4]=o=>t.value.privateKey=o),type:"textarea",rows:4,placeholder:"请输入应用私钥（RSA2私钥）",onInput:u},null,8,["modelValue"]),a[9]||(a[9]=m("div",{class:"form-tip"},"用于签名请求，请妥善保管",-1))]),_:1})]),_:1})]),_:1}),e(p,{gutter:20},{default:l(()=>[e(d,{span:24},{default:l(()=>[e(r,{label:"支付宝公钥",prop:"publicKey"},{default:l(()=>[e(s,{modelValue:t.value.publicKey,"onUpdate:modelValue":a[5]||(a[5]=o=>t.value.publicKey=o),type:"textarea",rows:4,placeholder:"请输入支付宝公钥",onInput:u},null,8,["modelValue"]),a[10]||(a[10]=m("div",{class:"form-tip"},"用于验证支付宝返回的签名",-1))]),_:1})]),_:1})]),_:1}),e(p,{gutter:20},{default:l(()=>[e(d,{span:24},{default:l(()=>[e(r,{label:"备注",prop:"remark"},{default:l(()=>[e(s,{modelValue:t.value.remark,"onUpdate:modelValue":a[6]||(a[6]=o=>t.value.remark=o),type:"textarea",rows:2,placeholder:"请输入备注信息（可选）",maxlength:"200","show-word-limit":"",onInput:u},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1})}}}),H=M(j,[["__scopeId","data-v-e5bdfc39"]]);export{H as default};
