"use strict";const e=require("../../../../common/vendor.js"),r=require("../../../index.js"),i=require("../../../validate/form.js"),o=require("../../../hooks/useModal.js"),s=require("../../../api/member/auth.js");if(require("../../../url/index.js"),require("../../../store/index.js"),require("../../../store/app.js"),require("../../../api/promotion/diy.js"),require("../../../request/index.js"),require("../../../config/index.js"),require("../../../platform/index.js"),require("../../../platform/provider/wechat/index.js"),require("../../../platform/provider/wechat/miniProgram.js"),require("../../../api/member/social.js"),require("../../../api/member/user.js"),require("../../../platform/provider/apple/index.js"),require("../../../platform/share.js"),require("../../../router/index.js"),require("../../../helper/throttle.js"),require("../../../platform/pay.js"),require("../../../helper/index.js"),require("../../../helper/test.js"),require("../../../helper/digit.js"),require("../../../api/pay/order.js"),require("../../../store/user.js"),require("../../../store/cart.js"),require("../../../api/trade/cart.js"),require("../../../api/pay/wallet.js"),require("../../../api/trade/order.js"),require("../../../api/promotion/coupon.js"),require("../../../store/sys.js"),require("../../../store/modal.js"),require("../../../config/zIndex.js"),require("../../../api/member/signin.js"),!Array){(e.resolveComponent("uni-easyinput")+e.resolveComponent("uni-forms-item")+e.resolveComponent("uni-forms"))()}Math||((()=>"../../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"../../../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js")+n+(()=>"../../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"))();const n=()=>"./phone-international-input.js",a={__name:"sms-login",props:{agreeStatus:{type:Boolean,default:!1}},emits:["onConfirm"],setup(n,{emit:a}){const t=(e,r)=>{p.model.mobile=e,p.mobileErrorMsg=r},u=e.ref(null),m=a,l=n,p=e.reactive({verifyUsername:!0,usernameErrorMsg:"",isMobileEnd:!1,codeText:"获取验证码",mobileErrorMsg:"",model:{username:"",mobile:"",code:""},rules:{username:i.username,code:i.code,mobile:i.mobile}});let d=e.ref("");async function c(e){const r=e.detail.value;if(""==r||r==d.value)return!1;d.value=r;const{data:i}=await s.AuthUtil.verifyUsername(r);i?(p.usernameErrorMsg="请输入正确的用户名!",p.verifyUsername=i):(p.usernameErrorMsg="",p.verifyUsername=i)}async function f(){const i=e.index.getStorageSync("linkId");i&&(p.model.linkId=i);if(!(await e.unref(u).validate().catch((e=>{console.log("error: ",e)}))))return;if(!l.agreeStatus)return m("onConfirm",!0),void r.sheep.$helper.toast("请勾选同意");const{code:n}=await s.AuthUtil.smsLogin(p.model);0===n&&o.closeAuthModal()}return(i,o)=>e.e({a:p.verifyUsername},p.verifyUsername?{b:e.unref(r.sheep).$url.static("/static/images/shibai.png")}:{c:e.unref(r.sheep).$url.static("/static/images/chenggong.png")},{d:e.o(c),e:e.o((e=>p.model.username=e)),f:e.p({placeholder:"请输入用户名",inputBorder:!1,clearable:!1,modelValue:p.model.username}),g:e.p({name:"username",label:"用户名","error-message":p.usernameErrorMsg}),h:e.o(t),i:e.p({"verify-username":!p.verifyUsername}),j:e.p({name:"mobile",label:"手机号","error-message":p.mobileErrorMsg}),k:e.o((e=>p.model.code=e)),l:e.p({placeholder:"请输入验证码",inputBorder:!1,type:"number",maxlength:"4",modelValue:p.model.code}),m:e.p({name:"code",label:"验证码"}),n:e.sr(u,"2ebe60f2-0",{k:"smsLoginRef"}),o:e.o((e=>p.model=e)),p:e.p({rules:p.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",modelValue:p.model}),q:e.o(f)})}},t=e._export_sfc(a,[["__scopeId","data-v-2ebe60f2"]]);wx.createComponent(t);
