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