"use strict";const e=require("../../../../common/vendor.js"),r=require("../../../index.js"),o=require("../../../validate/form.js"),s=require("../../../hooks/useModal.js"),i=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")+a+(()=>"../../../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"))();const a=()=>"./phone-international-input.js",n={__name:"register",props:{agreeStatus:{type:Boolean,default:!1}},emits:["onConfirm"],setup(a,{emit:n}){const t=(e,r)=>{u.model.mobile=e,u.mobileErrorMsg=r},u=e.reactive({verifyUsername:!1,codeText:"获取验证码",mobileErrorMsg:"",usernameErrorMsg:"",model:{username:"",password:"",mobile:"",code:""},rules:{username:o.username,password:o.password,code:o.code}}),l=e.ref(null),m=n,p=a;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:o}=await i.AuthUtil.verifyUsername(r);o?(u.usernameErrorMsg="",u.verifyUsername=o):(u.usernameErrorMsg="已存在用户名!",u.verifyUsername=o)}async function f(){console.log(u.model);if(!(await e.unref(l).validate().catch((e=>{console.log("error: ",e)}))))return;if(!p.agreeStatus)return m("onConfirm",!0),void r.sheep.$helper.toast("请勾选同意");const o=e.index.getStorageSync("linkId");if(!o)return r.sheep.$helper.toast("您只能通过分享注册"),!1;u.model.linkId=o;const{code:a}=await i.AuthUtil.register(u.model);0===a&&s.closeAuthModal()}return(o,s)=>e.e({a:!u.verifyUsername},u.verifyUsername?{c:e.unref(r.sheep).$url.static("/static/images/chenggong.png")}:{b:e.unref(r.sheep).$url.static("/static/images/shibai.png")},{d:e.o(c),e:e.o((e=>u.model.username=e)),f:e.p({placeholder:"请输入用户名",inputBorder:!1,clearable:!1,modelValue:u.model.username}),g:e.p({name:"username",label:"用户名","error-message":u.usernameErrorMsg}),h:e.o((e=>u.model.password=e)),i:e.p({type:"password",placeholder:"请输入密码",inputBorder:!1,modelValue:u.model.password}),j:e.p({name:"password",label:"密码"}),k:e.o(t),l:e.p({"verify-username":u.verifyUsername}),m:e.p({name:"mobile",label:"手机号","error-message":u.mobileErrorMsg}),n:e.o((e=>u.model.code=e)),o:e.p({placeholder:"请输入验证码",inputBorder:!1,type:"number",maxlength:"4",modelValue:u.model.code}),p:e.p({name:"code",label:"验证码"}),q:e.sr(l,"b5ad59e6-0",{k:"smsLoginRef"}),r:e.o((e=>u.model=e)),s:e.p({rules:u.rules,validateTrigger:"bind",labelWidth:"140",labelAlign:"center",modelValue:u.model}),t:e.o(f)})}},t=e._export_sfc(n,[["__scopeId","data-v-b5ad59e6"]]);wx.createComponent(t);
