import{d as M,r as v,a as R,o as U,g as s,J as E,K as j,z,k as I,w as l,e as t,b as n,t as _,x as g,l as J,Q as K,E as d,_ as O}from"./index-CUnFTKV2.js";import{r as Q,s as q}from"./config-J21_Zans.js";const A={class:"card-header"},F={class:"status-preview"},G=M({__name:"SystemTestCard",setup(H){const c=v(!1),u=v(!1),p=v(),a=R({enable_test:0,disable_wechat_pay:0,sign_multiple:1}),w={sign_multiple:[{type:"number",min:1,max:100,message:"签到倍数必须在1-100之间",trigger:"blur"}]},x=async()=>{var o;c.value=!0;try{const e=await Q();if((o=e.data)!=null&&o.value){const i=e.data.value;Object.assign(a,{enable_test:Number(i.enable_test)||0,disable_wechat_pay:Number(i.disable_wechat_pay)||0,sign_multiple:Number(i.sign_multiple)||1})}}catch(e){d.error("加载内测配置失败"),console.error("加载内测配置失败:",e)}finally{c.value=!1}},h=async()=>{if(p.value){try{await p.value.validate()}catch{d.warning("请检查表单填写是否正确");return}u.value=!0;try{const o={enable_test:String(a.enable_test),disable_wechat_pay:String(a.disable_wechat_pay),sign_multiple:String(a.sign_multiple)};await q(o),d.success("保存成功")}catch(o){d.error("保存失败"),console.error("保存内测配置失败:",o)}finally{u.value=!1}}};return U(()=>{x()}),(o,e)=>{const i=s("el-icon"),V=s("el-button"),S=s("el-alert"),y=s("el-switch"),m=s("el-form-item"),k=s("el-input-number"),C=s("el-divider"),f=s("el-tag"),b=s("el-descriptions-item"),D=s("el-descriptions"),N=s("el-form"),T=s("el-card"),B=E("loading");return j((I(),z(T,null,{header:l(()=>[n("div",A,[e[4]||(e[4]=n("span",null,"内测配置",-1)),t(V,{type:"primary",loading:u.value,onClick:h},{default:l(()=>[t(i,null,{default:l(()=>[t(J(K))]),_:1}),e[3]||(e[3]=_("保存配置 ",-1))]),_:1},8,["loading"])])]),default:l(()=>[t(N,{ref_key:"formRef",ref:p,model:a,rules:w,"label-width":"140px",class:"config-form"},{default:l(()=>[t(S,{title:"内测模式说明",type:"warning",closable:!1,"show-icon":"",style:{"margin-bottom":"20px"}},{default:l(()=>[...e[5]||(e[5]=[n("p",null,"开启内测模式后，系统将进入测试状态，请谨慎操作。",-1)])]),_:1}),t(m,{label:"内测开关",prop:"enable_test"},{default:l(()=>[t(y,{modelValue:a.enable_test,"onUpdate:modelValue":e[0]||(e[0]=r=>a.enable_test=r),"active-value":1,"inactive-value":0,"active-text":"开启","inactive-text":"关闭","inline-prompt":"",style:{"--el-switch-on-color":"#e6a23c","--el-switch-off-color":"#dcdfe6"}},null,8,["modelValue"]),e[6]||(e[6]=n("div",{class:"form-tip"},"开启后系统进入内测模式",-1))]),_:1}),t(m,{label:"禁用微信支付",prop:"disable_wechat_pay"},{default:l(()=>[t(y,{modelValue:a.disable_wechat_pay,"onUpdate:modelValue":e[1]||(e[1]=r=>a.disable_wechat_pay=r),"active-value":1,"inactive-value":0,"active-text":"禁用","inactive-text":"启用","inline-prompt":"",style:{"--el-switch-on-color":"#f56c6c","--el-switch-off-color":"#67c23a"}},null,8,["modelValue"]),e[7]||(e[7]=n("div",{class:"form-tip"},"禁用后用户无法使用微信支付",-1))]),_:1}),t(m,{label:"签到倍数",prop:"sign_multiple"},{default:l(()=>[t(k,{modelValue:a.sign_multiple,"onUpdate:modelValue":e[2]||(e[2]=r=>a.sign_multiple=r),modelModifiers:{number:!0},min:1,max:100,placeholder:"请输入签到倍数",style:{width:"200px"}},null,8,["modelValue"]),e[8]||(e[8]=n("div",{class:"form-tip"},"签到奖励倍数，默认为1",-1))]),_:1}),t(C,{"content-position":"left"},{default:l(()=>[...e[9]||(e[9]=[_("当前状态",-1)])]),_:1}),n("div",F,[t(D,{column:1,border:""},{default:l(()=>[t(b,{label:"内测模式"},{default:l(()=>[t(f,{type:a.enable_test===1?"warning":"success"},{default:l(()=>[_(g(a.enable_test===1?"已开启":"已关闭"),1)]),_:1},8,["type"])]),_:1}),t(b,{label:"微信支付"},{default:l(()=>[t(f,{type:a.disable_wechat_pay===1?"danger":"success"},{default:l(()=>[_(g(a.disable_wechat_pay===1?"已禁用":"已启用"),1)]),_:1},8,["type"])]),_:1}),t(b,{label:"签到倍数"},{default:l(()=>[t(f,{type:"info"},{default:l(()=>[_(g(a.sign_multiple)+"x",1)]),_:1})]),_:1})]),_:1})])]),_:1},8,["model"])]),_:1})),[[B,c.value]])}}}),W=O(G,[["__scopeId","data-v-144bcd61"]]);export{W as default};
