import{F as e,C as t,B as o,P as a,M as n,c as l,s as u,r}from"./utils-7ac10a5e.js";import{d as c,r as s,f as p,c as d,a as m,F as i,n as T}from"./index-7f5420bc.js";import{S as f}from"./index-f0b5c91e.js";const h=c({name:"the-submit",props:{type:{type:String,"default":""}},setup(c){const h=s(),S=p({typeStatus:!1,countDownTime:6e4,countDownStatus:!0,imgCodeStatus:!1,cooperateTenantName:null,cooperateTenantNature:null,cooperateTenantNatureTxt:null,contacts:null,phone:null,code:null}),_=()=>{S.countDownStatus=!1,T((()=>{h.value.start()}))},N=()=>{if(!l(S.phone))return u("请输入正确的手机号码");S.imgCodeStatus=!0},y=()=>{S.countDownStatus=!0,h.value.reset()},w=async()=>{try{if(!S.cooperateTenantNature)return u("请选择机构性质");if(!S.cooperateTenantName)return u("请填写机构名称");if(!S.contacts)return u("请填写联系人");if(!S.phone)return u("请输入联系电话");if(!l(S.phone))return u("请输入正确的手机号码");if(!S.code)return u("请输入验证码");await r.post("/api-admin/open/cooperateTenant/save",{data:{cooperateTenantName:S.cooperateTenantName,cooperateTenantNature:S.cooperateTenantNature,contacts:S.contacts,phone:S.phone,code:S.code}}),setTimeout((()=>{u("信息提交成功，我们会尽快与您联系"),S.cooperateTenantName=null,S.cooperateTenantNature=null,S.cooperateTenantNatureTxt=null,S.contacts=null,S.phone=null,S.code=null}),100)}catch(e){}};return()=>d(i,null,[d("div",{"class":["_fieldGroup_1cwrz_1","tenant"===c.type&&"_fieldTenant_1cwrz_43","classroom"===c.type&&"_fieldClassroom_1cwrz_50","technology"===c.type&&"_fieldTechnology_1cwrz_60"]},[d(e,{readonly:!0,isLink:!0,arrowDirection:"down",placeholder:"机构性质",border:!1,autocomplete:"off",modelValue:S.cooperateTenantNatureTxt,onClick:()=>S.typeStatus=!0},null),d(e,{type:"text",border:!1,placeholder:"机构名称",autocomplete:"off",maxlength:20,modelValue:S.cooperateTenantName,"onUpdate:modelValue":e=>S.cooperateTenantName=e},null),d(e,{type:"text",border:!1,placeholder:"联系人",autocomplete:"off",maxlength:20,modelValue:S.contacts,"onUpdate:modelValue":e=>S.contacts=e},null),d(e,{type:"number",maxlength:11,border:!1,placeholder:"联系电话",autocomplete:"off",modelValue:S.phone,"onUpdate:modelValue":e=>S.phone=e},null),d(e,{"class":"_smsField_1cwrz_16",type:"number",maxlength:6,border:!1,placeholder:"短信验证码",autocomplete:"off",modelValue:S.code,"onUpdate:modelValue":e=>S.code=e},{button:()=>S.countDownStatus?d("span",{"class":"_sendCms_1cwrz_19",onClick:N},[m("发送验证码")]):d(t,{ref:e=>h.value=e,"auto-start":!1,time:S.countDownTime,onFinish:y,format:"ss秒"},null)}),d(o,{block:!0,round:!0,"class":"_btnSubmit_1cwrz_33",onClick:w},{"default":()=>[m("确认提交")]}),d(f,{show:S.typeStatus,"onUpdate:show":e=>S.typeStatus=e,position:"bottom",round:!0},{"default":()=>[d(a,{columns:[{text:"中小学学校",value:"PRIMARY_AND_SECONDARY_SCHOOLS"},{text:"教培机构",value:"EDUCATIONAL_INSTITUTIONS"},{text:"音乐达人",value:"PLAYERS"},{text:"代理商",value:"AGENT"}],showToolbar:!0,onCancel:()=>S.typeStatus=!1,onConfirm:e=>{const t=e.selectedOptions[0];S.cooperateTenantNature=t.value,S.cooperateTenantNatureTxt=t.text,S.typeStatus=!1}},null)]})]),S.imgCodeStatus?d(n,{value:S.imgCodeStatus,"onUpdate:value":e=>S.imgCodeStatus=e,phone:S.phone,onClose:()=>{S.imgCodeStatus=!1},onSendCode:_},null):null])}});export{h as T};
