import{z as b,r as u,A as f,B as g,C as s,H as o,L as v,Q as _,F as x,as as i,G as h,I as B,J as P,K as q,am as N,au as U}from"./index.57f87f80.js";import{Q as F}from"./QForm.88a95d5e.js";import{u as I}from"./use-quasar.76201f90.js";import{R as V}from"./tools.0e16bec7.js";const S={key:0,class:"q-pa-md text-right"},H={__name:"ChangePasswordPage",props:["type"],setup(k){const n=k,t=I();P();const R=q(),c=b(),d=u(""),l=u(""),p=u(""),m=[V.required,V.password];function C(r){return r==l.value||"\u786E\u8BA4\u5BC6\u7801\u4E0E\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4"}const y=u(null);function Q(){y.value.validate().then(r=>{if(!r)return!1;t.loading.show(),N[n.type=="pwd"?"changePassword":"changePayPassword"]({password_old:d.value,password:l.value,password_confirmation:p.value}).then(e=>{t.notify({type:"positive",message:e.message||"\u4FEE\u6539\u6210\u529F"}),c.refresh().then(w=>{R.back()})}).catch(e=>{t.notify({type:"negative",message:e.message})}).finally(()=>{t.loading.hide()})})}return(r,e)=>{const w=U("page-layout");return f(),g(w,{class:""},{"header-right":s(()=>[o(_,{flat:"",dense:"",onClick:Q},{default:s(()=>[v("\u4FDD\u5B58")]),_:1})]),default:s(()=>[o(F,{ref_key:"formRef",ref:y,class:"q-pa-md bg-white"},{default:s(()=>[n.type=="pwd"||x(c).user.has_pay_password?(f(),g(i,{key:0,modelValue:d.value,"onUpdate:modelValue":e[0]||(e[0]=a=>d.value=a),label:"\u65E7\u5BC6\u7801",rules:[m[0]],type:"password"},null,8,["modelValue","rules"])):h("",!0),o(i,{modelValue:l.value,"onUpdate:modelValue":e[1]||(e[1]=a=>l.value=a),label:"\u65B0\u5BC6\u7801",rules:m,type:"password"},null,8,["modelValue"]),o(i,{modelValue:p.value,"onUpdate:modelValue":e[2]||(e[2]=a=>p.value=a),label:"\u786E\u8BA4\u5BC6\u7801",rules:[...m,C],type:"password"},null,8,["modelValue","rules"])]),_:1},512),n.type=="pwd"?(f(),B("div",S,[o(_,{color:"primary",flat:"",dense:"",to:"/my/forget"},{default:s(()=>[v("\u5FD8\u8BB0\u5BC6\u7801\uFF1F")]),_:1})])):h("",!0)]),_:1})}}};export{H as default};