import{d as E,r as I,H as k,z as B,c as m,a,w as o,a$ as C,B as r,J as D,O as U,h as d,K as M,L as N,b as f,bo as P,bp as A,i as F,C as V,o as u}from"./index-DqVhJ65C.js";/* empty css                *//* empty css                       *//* empty css                        *//* empty css                   */const K={class:"p-6"},O={class:"text-xs text-gray-400 mt-2"},R={key:0},S={key:1},T=E({__name:"Config",setup(j){const i=I(!1),t=k({yipay_api:"",yipay_pid:"",yipay_key:"",yipay_mode:"submit",wxpay_appid:"",wxpay_mchid:""}),b=async()=>{try{const s=await r.get("/admin/settings?group=payment");s.code===0&&(Object.assign(t,s.data),t.yipay_mode||(t.yipay_mode="submit"))}catch(s){console.error(s)}},c=async()=>{i.value=!0;try{await r.post("/admin/settings",{...t,__group__:"payment"}),V({message:"保存成功",type:"success",plain:!0})}catch(s){V({message:s.message,type:"error",plain:!0})}finally{i.value=!1}};return B(()=>{b()}),(s,e)=>{const _=U,p=N,n=M,y=A,g=P,x=F,w=D,v=C;return u(),m("div",K,[a(v,{shadow:"hover"},{header:o(()=>[...e[6]||(e[6]=[f("span",{class:"font-bold"},"支付参数配置",-1)])]),default:o(()=>[a(w,{"label-width":"140px",class:"max-w-xl mt-4"},{default:o(()=>[a(_,{"content-position":"left"},{default:o(()=>[...e[7]||(e[7]=[d("易支付 (YiPay)",-1)])]),_:1}),a(n,{label:"接口地址 (API)"},{default:o(()=>[a(p,{modelValue:t.yipay_api,"onUpdate:modelValue":e[0]||(e[0]=l=>t.yipay_api=l),placeholder:"http://pay.example.com/"},null,8,["modelValue"])]),_:1}),a(n,{label:"商户ID (PID)"},{default:o(()=>[a(p,{modelValue:t.yipay_pid,"onUpdate:modelValue":e[1]||(e[1]=l=>t.yipay_pid=l)},null,8,["modelValue"])]),_:1}),a(n,{label:"商户密钥 (Key)"},{default:o(()=>[a(p,{modelValue:t.yipay_key,"onUpdate:modelValue":e[2]||(e[2]=l=>t.yipay_key=l),type:"password","show-password":""},null,8,["modelValue"])]),_:1}),a(n,{label:"接口模式"},{default:o(()=>[a(g,{modelValue:t.yipay_mode,"onUpdate:modelValue":e[3]||(e[3]=l=>t.yipay_mode=l)},{default:o(()=>[a(y,{value:"submit"},{default:o(()=>[...e[8]||(e[8]=[d("Submit 跳转",-1)])]),_:1}),a(y,{value:"mapi"},{default:o(()=>[...e[9]||(e[9]=[d("MAPI 二维码",-1)])]),_:1})]),_:1},8,["modelValue"]),f("div",O,[t.yipay_mode==="submit"?(u(),m("span",R,"跳转到支付平台页面完成支付")):(u(),m("span",S,"在本页弹窗显示二维码，用户扫码支付"))])]),_:1}),a(_,{"content-position":"left"},{default:o(()=>[...e[10]||(e[10]=[d("微信支付 (Native)",-1)])]),_:1}),a(n,{label:"应用ID (AppID)"},{default:o(()=>[a(p,{modelValue:t.wxpay_appid,"onUpdate:modelValue":e[4]||(e[4]=l=>t.wxpay_appid=l)},null,8,["modelValue"])]),_:1}),a(n,{label:"商户号 (MchID)"},{default:o(()=>[a(p,{modelValue:t.wxpay_mchid,"onUpdate:modelValue":e[5]||(e[5]=l=>t.wxpay_mchid=l)},null,8,["modelValue"])]),_:1}),a(n,{class:"mt-8"},{default:o(()=>[a(x,{type:"primary",onClick:c,loading:i.value},{default:o(()=>[...e[11]||(e[11]=[d("保存全部配置",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})])}}});export{T as default};
