
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.github.io
 */

import{_ as U}from"./index.vue_vue_type_script_setup_true_lang-BTce45WY.js";import{d as K,m as P,r as f,a as w,p as d,g as A,c as k,b as e,w as a,h as q,e as i,G as _,j as N,_ as M,k as h}from"./index-nGFMSQGw.js";import{a as g}from"./config-CYXO1pNF.js";const B=i("div",{class:"flex items-center gap-4"},"微信支付设置",-1),j=i("div",{class:"text-sm/6"},[i("div",null," 同时开启多个支付，将以微信支付作为最高优先级，在pc端会调用 native 支付，在微信环境内将调用 Jsapi 支付。 "),i("div",null," 请确认微信支付已经申请了支付权限，支付通知地址为： https://您的域名/api/pay/notify。 ")],-1),$=K({__name:"wechat",setup(D){const l=P({payWechatStatus:"",payWeChatMchId:"",payWeChatAppId:"",payWeChatSecret:"",payWeChatNotifyUrl:"",payWeChatPublicKey:"",payWeChatPrivateKey:""}),C=f({payWechatStatus:[{required:!0,trigger:"change",message:"请选择当前支付开启状态"}],payWeChatSecret:[{required:!0,trigger:"blur",message:"请填写支付Secret秘钥"}],payWeChatMchId:[{required:!0,trigger:"blur",message:"请填写商户号"}],payWeChatAppId:[{required:!0,trigger:"blur",message:"请填写AppId"}],payWeChatNotifyUrl:[{required:!0,trigger:"blur",message:"请填写支付通知地址"}],payWeChatPublicKey:[{required:!0,trigger:"blur",message:"请填写支付公钥信息（cert.pem文件）"}],payWeChatPrivateKey:[{required:!0,trigger:"blur",message:"请填写支付私钥地址（key.pem文件）"}]}),c=f();async function m(){const r=await g.queryConfig({keys:["payWeChatSecret","payWeChatNotifyUrl","payWeChatAppId","payWechatStatus","payWeChatMchId","payWeChatPublicKey","payWeChatPrivateKey"]});Object.assign(l,r.data)}function W(){var r;(r=c.value)==null||r.validate(async t=>{if(t){try{await g.setConfig({settings:b(l)}),_.success("变更配置信息成功")}catch{}m()}else _.error("请填写完整信息")})}function b(r){return Object.keys(r).map(t=>({configKey:t,configVal:r[t]}))}return w(()=>{m()}),(r,t)=>{const y=N,x=M,V=U,v=d("el-switch"),p=d("el-form-item"),u=d("el-col"),n=d("el-row"),s=d("el-input"),I=d("el-form"),S=d("el-card");return A(),k("div",null,[e(V,null,{title:a(()=>[B]),content:a(()=>[j]),default:a(()=>[e(x,{outline:"",onClick:W},{default:a(()=>[e(y,{name:"i-ri:file-text-line"}),q(" 保存设置 ")]),_:1})]),_:1}),e(S,{style:{margin:"20px"}},{default:a(()=>[e(I,{ref_key:"formRef",ref:c,rules:C.value,model:l,"label-width":"140px"},{default:a(()=>[e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"启用当前支付",prop:"payWechatStatus"},{default:a(()=>[e(v,{modelValue:l.payWechatStatus,"onUpdate:modelValue":t[0]||(t[0]=o=>l.payWechatStatus=o),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"商户ID",prop:"payWeChatMchId"},{default:a(()=>[e(s,{modelValue:l.payWeChatMchId,"onUpdate:modelValue":t[1]||(t[1]=o=>l.payWeChatMchId=o),placeholder:"请填写商户ID",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"AppId",prop:"payWeChatAppId"},{default:a(()=>[e(s,{modelValue:l.payWeChatAppId,"onUpdate:modelValue":t[2]||(t[2]=o=>l.payWeChatAppId=o),placeholder:"请填写AppId",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"商户秘钥",prop:"payWeChatSecret"},{default:a(()=>[e(s,{modelValue:l.payWeChatSecret,"onUpdate:modelValue":t[3]||(t[3]=o=>l.payWeChatSecret=o),placeholder:"请填写Secret秘钥",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"支付通知地址",prop:"payWeChatNotifyUrl"},{default:a(()=>[e(s,{modelValue:l.payWeChatNotifyUrl,"onUpdate:modelValue":t[4]||(t[4]=o=>l.payWeChatNotifyUrl=o),placeholder:"请填写支付通知地址",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"公钥地址",prop:"payWeChatPublicKey"},{default:a(()=>[e(s,{modelValue:l.payWeChatPublicKey,"onUpdate:modelValue":t[5]||(t[5]=o=>l.payWeChatPublicKey=o),type:"textarea",rows:6,placeholder:"请填写支付公钥信息（cert.pem文件）",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(n,null,{default:a(()=>[e(u,{xs:24,md:20,lg:15,xl:12},{default:a(()=>[e(p,{label:"私钥地址",prop:"payWeChatPrivateKey"},{default:a(()=>[e(s,{modelValue:l.payWeChatPrivateKey,"onUpdate:modelValue":t[6]||(t[6]=o=>l.payWeChatPrivateKey=o),type:"textarea",rows:6,placeholder:"请填写支付私钥地址（key.pem文件）",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof h=="function"&&h($);export{$ as default};
