import{D as U,_ as I,u as R,r as u,o as S,b as a,c as b,h as B,e as w,f as e,w as t,v,g as C,B as L,C as E,P as K,E as d}from"./index-BhwfcSvx.js";function N(l){return U.post("/login/account",l)}const M=l=>(L("data-v-4397c91e"),l=l(),E(),l),T={class:"body"},q={class:"login"},D=M(()=>w("div",{class:"title"},"里海收银系统 - 登录",-1)),P={__name:"index",setup(l){const p=R(),h=K(),y=u(null),_=u(null),n=u({account:"",password:"",terminal:3,scene:1}),i=()=>{if(!n.value.account)return d({message:"请填写账号",type:"error"});if(!n.value.password)return d({message:"请填写密码",type:"error"});N(n.value).then(s=>{var o;if((o=s.data)!=null&&o.token){if(!s.data.merchant||!s.data.merchant.service_phone)return d.error("请先完善商户信息");p.setToken(s.data.token),p.setUserInfo(s.data),h.push("/")}}).catch(s=>{})};return S(()=>{}),(s,o)=>{const k=a("User"),f=a("el-icon"),m=a("el-input"),c=a("el-form-item"),g=a("Lock"),x=a("el-button"),V=a("el-form");return b(),B("div",T,[w("div",q,[D,e(V,null,{default:t(()=>[e(c,null,{default:t(()=>[e(m,{ref_key:"accRef",ref:y,modelValue:n.value.account,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value.account=r),placeholder:"请输入账号",autofocus:!0,onKeydown:o[1]||(o[1]=v(r=>_.value.focus(),["enter"]))},{prefix:t(()=>[e(f,null,{default:t(()=>[e(k)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(m,{ref_key:"pwdRef",ref:_,modelValue:n.value.password,"onUpdate:modelValue":o[2]||(o[2]=r=>n.value.password=r),type:"password",placeholder:"请输入密码","show-password":"",onKeydown:v(i,["enter"])},{prefix:t(()=>[e(f,null,{default:t(()=>[e(g)]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(c,null,{default:t(()=>[e(x,{style:{width:"100%"},type:"primary",onClick:i},{default:t(()=>[C("登录")]),_:1})]),_:1})]),_:1})])])}}},j=I(P,[["__scopeId","data-v-4397c91e"]]);export{j as default};