import{t as e}from"./_plugin-vue2_normalizer-BHc2Ljhs.js";import{s as t}from"./logger-m2skRwRe.js";import{n}from"./vuex.esm-CDgO7zd-.js";var r=e({name:`RegisterIndex`,components:{register:e({name:`RegisterIndex`,data(){return{loading:!1,form:{username:``,email:``,fullname:``,phoneNumber:``,password:``,passwordConfirm:``}}},computed:{rules(){return{username:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`},{min:4,message:this.$t(`VALIDATE_USERNAME_MIN`),trigger:`blur`},{pattern:/^[a-z0-9_]+$/,message:this.$t(`VALIDATE_USERNAME_INVALID`),trigger:`blur`}],email:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`},{type:`email`,message:this.$t(`VALIDATE_EMAIL_INVALID`),trigger:`blur`}],fullname:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`}],phoneNumber:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`},{pattern:/^[0-9]{9,11}$/,message:this.$t(`VALIDATE_PHONE_INVALID`),trigger:`blur`}],password:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`},{min:6,message:this.$t(`VALIDATE_PASSWORD_MIN`),trigger:`blur`}],passwordConfirm:[{required:!0,message:this.$t(`VALIDATE_FIELD_REQUIRED`),trigger:`blur`},{validator:(e,t,n)=>{t===this.form.password?n():n(Error(this.$t(`VALIDATE_PASSWORD_NOT_MATCH`)))},trigger:`blur`}]}}},methods:{...n([`UserRegister`]),goToLogin(){this.RouterPath(`/login`)},async registerSubmit(){if(await new Promise(e=>{this.$refs.registerForm.validate(t=>e(t))})){this.loading=!0;try{let e=await this.UserRegister({email:this.form.email,username:this.form.username,password:this.form.password,fullname:this.form.fullname,phoneNumber:this.form.phoneNumber,trialRequest:!1});if(!e.success)throw this.$Message.error(e.msg||this.$t(`REGISTER_ERROR_PLEASE_RETRY`)),{msg:`REGISTER_ERROR`,result:e};this.$Message.success(e.msg||this.$t(`REGISTER_SUCCESS_PLEASE_LOGIN`)),this.RouterPath(`/login`)}catch(e){t.error({msg:`REGISTER_ERROR`,error:e})}this.loading=!1}}}},function(){var e=this,t=e._self._c;return t(`div`,{staticClass:`auth-wrap`},[e.isUsePopup?e._e():t(`div`,{staticClass:`auth-logo-wrap`},[t(`img`,{staticClass:`auth-logo`,attrs:{src:e.configApp.logoDark,alt:`AutoShopee`}})]),t(`Card`,{staticClass:`auth-card`,attrs:{"dis-hover":``}},[t(`p`,{staticClass:`auth-card__title`,attrs:{slot:`title`},slot:`title`},[e._v(` `+e._s(e.$t(`BTN_REGISTER`))+` `)]),t(`Form`,{ref:`registerForm`,attrs:{model:e.form,rules:e.rules}},[t(`FormItem`,{attrs:{prop:`username`}},[t(`Input`,{attrs:{placeholder:e.$t(`USERNAME`),prefix:`ios-person`,size:`large`},model:{value:e.form.username,callback:function(t){e.$set(e.form,`username`,t)},expression:`form.username`}})],1),t(`FormItem`,{attrs:{prop:`fullname`}},[t(`Input`,{attrs:{placeholder:e.$t(`REGISTER_FULLNAME`),prefix:`ios-contact`,size:`large`},model:{value:e.form.fullname,callback:function(t){e.$set(e.form,`fullname`,t)},expression:`form.fullname`}})],1),t(`FormItem`,{attrs:{prop:`email`}},[t(`Input`,{attrs:{placeholder:e.$t(`SHOP_EMAIL`),prefix:`ios-mail`,size:`large`},model:{value:e.form.email,callback:function(t){e.$set(e.form,`email`,t)},expression:`form.email`}})],1),t(`FormItem`,{attrs:{prop:`phoneNumber`}},[t(`Input`,{attrs:{placeholder:e.$t(`SHOP_PHONE_NUMBER`),prefix:`ios-call`,size:`large`},model:{value:e.form.phoneNumber,callback:function(t){e.$set(e.form,`phoneNumber`,t)},expression:`form.phoneNumber`}})],1),t(`FormItem`,{attrs:{prop:`password`}},[t(`Input`,{attrs:{type:`password`,placeholder:e.$t(`PASSWORD`),prefix:`ios-lock`,size:`large`,password:``},model:{value:e.form.password,callback:function(t){e.$set(e.form,`password`,t)},expression:`form.password`}})],1),t(`FormItem`,{attrs:{prop:`passwordConfirm`}},[t(`Input`,{attrs:{type:`password`,placeholder:e.$t(`REGISTER_PASSWORD_CONFIRM`),prefix:`ios-lock`,size:`large`,password:``},model:{value:e.form.passwordConfirm,callback:function(t){e.$set(e.form,`passwordConfirm`,t)},expression:`form.passwordConfirm`}})],1),t(`FormItem`,{staticClass:`mb-0`},[t(`Button`,{attrs:{type:`primary`,long:``,size:`large`,loading:e.loading},on:{click:e.registerSubmit}},[e._v(` `+e._s(e.$t(`GO_REGISTER`))+` `)])],1)],1),t(`Divider`,{attrs:{plain:``}},[e._v(` `+e._s(e.$t(`REGISTER_OR`))+` `)]),t(`Button`,{attrs:{long:``},on:{click:e.goToLogin}},[e._v(` `+e._s(e.$t(`BTN_LOGIN`))+` `)])],1)],1)},[],!1,null,`eb9de261`,null,null).exports}},function(){var e=this,t=e._self._c;return t(`div`,[t(`Row`,[t(`Col`,{attrs:{span:e.isUsePopup?12:6,offset:e.isUsePopup?6:9}},[t(`register`)],1)],1)],1)},[],!1,null,null,null,null).exports;export{r as default};