import{e as S,r,a8 as D,P as m,a3 as b,a4 as o,Q as w,F as V,f as e,I as v,H as C,ab as k,a9 as N,a5 as R}from"./vue-bf422dc1.js";import{u as A}from"./index-b02b5348.js";import{i as M,_ as P}from"./index-8db2df2c.js";import{M as h,l as T,I as $,F as E,B as H,e as O}from"./ui-ba7aaa7e.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";const Q=S({__name:"Login",setup(j){const x=M(),I={phone:"",username:"",verifyCode:"",checked:!1,password:""},z={phone:[{required:!0,message:"手机号必填",type:"error"}],username:[{required:!0,message:"",type:"error"}],password:[{required:!0,message:"密码必填",type:"error"}],verifyCode:[{required:!0,message:"验证码必填",type:"error"}]},p=r("password"),y=r(),s=r({...I}),n=r(!1),[c,F]=A(),U=D(),q=()=>{y.value.validate({fields:["phone"]}).then(u=>{u===!0&&F()})},f=r("登录"),_=r(!1),B=async u=>{if(u.validateResult===!0){f.value="登录中...",_.value=!0;const a=await x.login(s.value);a.code===1?(h.success("登陆成功"),U.push({path:"/merchant/workbench"})):(f.value="登录",h.error(a.msg),_.value=!1)}};return(u,a)=>{const d=T,i=$,l=E,g=H,L=O;return m(),b(L,{ref_key:"form",ref:y,class:R(["item-container",`login-${p.value}`]),data:s.value,rules:z,"label-width":"0",onSubmit:B},{default:o(()=>[p.value=="password"?(m(),w(V,{key:0},[e(l,{name:"username"},{default:o(()=>[e(i,{modelValue:s.value.username,"onUpdate:modelValue":a[0]||(a[0]=t=>s.value.username=t),size:"large",placeholder:"请输入账号/手机号/邮箱"},{"prefix-icon":o(()=>[e(d,{name:"user"})]),_:1},8,["modelValue"])]),_:1}),e(l,{name:"password"},{default:o(()=>[e(i,{modelValue:s.value.password,"onUpdate:modelValue":a[2]||(a[2]=t=>s.value.password=t),size:"large",type:n.value?"text":"password",clearable:"",placeholder:"请输入登录密码"},{"prefix-icon":o(()=>[e(d,{name:"lock-on"})]),"suffix-icon":o(()=>[e(d,{name:n.value?"browse":"browse-off",onClick:a[1]||(a[1]=t=>n.value=!n.value)},null,8,["name"])]),_:1},8,["modelValue","type"])]),_:1})],64)):(m(),w(V,{key:1},[e(l,{name:"phone"},{default:o(()=>[e(i,{modelValue:s.value.phone,"onUpdate:modelValue":a[3]||(a[3]=t=>s.value.phone=t),size:"large",placeholder:"请输入手机号码"},{"prefix-icon":o(()=>[e(d,{name:"mobile"})]),_:1},8,["modelValue"])]),_:1}),e(l,{class:"verification-code",name:"verifyCode"},{default:o(()=>[e(i,{modelValue:s.value.verifyCode,"onUpdate:modelValue":a[4]||(a[4]=t=>s.value.verifyCode=t),size:"large",placeholder:"请输入验证码"},null,8,["modelValue"]),e(g,{variant:"outline",disabled:v(c)>0,onClick:q},{default:o(()=>[C(k(v(c)==0?"发送验证码":`${v(c)}秒后可重发`),1)]),_:1},8,["disabled"])]),_:1})],64)),p.value!=="qrcode"?(m(),b(l,{key:2,class:"btn-container"},{default:o(()=>[e(g,{block:"",size:"large",type:"submit",disabled:_.value},{default:o(()=>[C(k(f.value),1)]),_:1},8,["disabled"])]),_:1})):N("",!0)]),_:1},8,["class","data"])}}});const oe=P(Q,[["__scopeId","data-v-75dd084f"]]);export{oe as default};
