import{F as e,C as t,B as o,P as a,M as n}from"./index-65a114bb.js";import{c as l,s as u,r}from"./utils-c1b458cd.js";import{d as s,r as c,f as p,c as d,a as m,F as i,n as T}from"./index-c8146fd5.js";import{S as f}from"./index-74ab7d08.js";const h=s({name:"the-submit",props:{type:{type:String,"default":""}},setup(s){const h=c(),_=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(_.phone))return u("请输入正确的手机号码");_.imgCodeStatus=!0},y=()=>{_.countDownStatus=!0,h.value.reset()},v=async()=>{try{if(!_.cooperateTenantNature)return u("请选择机构性质");if(!_.cooperateTenantName)return u("请填写机构名称");if(!_.contacts)return u("请填写联系人");if(!_.phone)return u("请输入联系电话");if(!l(_.phone))return u("请输入正确的手机号码");if(!_.code)return u("请输入验证码");await r.post("/api-website/open/cooperateTenant/save",{data:{cooperateTenantName:_.cooperateTenantName,cooperateTenantNature:_.cooperateTenantNature,contacts:_.contacts,phone:_.phone,code:_.code}}),setTimeout((()=>{u("信息提交成功，我们会尽快与您联系"),_.cooperateTenantName=null,_.cooperateTenantNature=null,_.cooperateTenantNatureTxt=null,_.contacts=null,_.phone=null,_.code=null}),100)}catch(e){}};return()=>d(i,null,[d("div",{"class":["_fieldGroup_2k9vu_1","tenant"===s.type&&"_fieldTenant_2k9vu_46","classroom"===s.type&&"_fieldClassroom_2k9vu_59","technology"===s.type&&"_fieldTechnology_2k9vu_69","person"===s.type&&"_fieldPerson_2k9vu_70"]},[d(e,{readonly:!0,isLink:!0,arrowDirection:"down",placeholder:"机构性质",border:!1,autocomplete:"off",modelValue:_.cooperateTenantNatureTxt,onClick:()=>_.typeStatus=!0},null),d(e,{type:"text",border:!1,placeholder:"机构名称",autocomplete:"off",maxlength:20,modelValue:_.cooperateTenantName,"onUpdate:modelValue":e=>_.cooperateTenantName=e},null),d(e,{type:"text",border:!1,placeholder:"联系人",autocomplete:"off",maxlength:20,modelValue:_.contacts,"onUpdate:modelValue":e=>_.contacts=e},null),d(e,{type:"number",maxlength:11,border:!1,placeholder:"联系电话",autocomplete:"off",modelValue:_.phone,"onUpdate:modelValue":e=>_.phone=e},null),d(e,{"class":"_smsField_2k9vu_19",type:"number",maxlength:6,border:!1,placeholder:"短信验证码",autocomplete:"off",modelValue:_.code,"onUpdate:modelValue":e=>_.code=e},{button:()=>_.countDownStatus?d("span",{"class":"_sendCms_2k9vu_22",onClick:N},[m("发送验证码")]):d(t,{ref:e=>h.value=e,"auto-start":!1,time:_.countDownTime,onFinish:y,format:"ss秒"},null)}),d(o,{block:!0,round:!0,"class":"_btnSubmit_2k9vu_36",onClick:v},{"default":()=>[m("确认提交")]}),d(f,{show:_.typeStatus,"onUpdate:show":e=>_.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:()=>_.typeStatus=!1,onConfirm:e=>{const t=e.selectedOptions[0];_.cooperateTenantNature=t.value,_.cooperateTenantNatureTxt=t.text,_.typeStatus=!1}},null)]})]),_.imgCodeStatus?d(n,{value:_.imgCodeStatus,"onUpdate:value":e=>_.imgCodeStatus=e,phone:_.phone,onClose:()=>{_.imgCodeStatus=!1},onSendCode:S},null):null])}});export{h as T};
