import{aP as v,c as K,b as Q,m as Z,t as j,d as P,ah as H,e as B,w as ee,X as te,a as e,k as oe,D as h,E as C,V as w,A as r,L as se,r as ae,x as V,C as A,z as ne,N,aY as ue,U as le,q as ie,y as re,P as F,F as ce,I as O,Q as de,G as M,J as q}from"./index-14ddd5b6.js";import{i as pe}from"./icon-gift-94736468.js";import{M as me}from"./index-be47b3ca.js";import{M as ge}from"./index-15d1c6e7.js";import{O as fe}from"./index-66b0b806.js";import{R as U,C as R,u as J,S as he}from"./student-register-store-5f7332c0.js";import{F as S}from"./index-81b20b5b.js";import{I as L}from"./index-2684893d.js";import{F as _e}from"./index-3413b8e5.js";import{R as Ce,a as Y}from"./index-d6da6585.js";import{T as I}from"./index-58ef3223.js";import{P as $}from"./index-048a663e.js";import{O as ye}from"./index-695fbc6c.js";import{C as z}from"./index-792cb44c.js";import{C as D}from"./index-db2455fb.js";/* empty css */import"./index-e3520ec4.js";import"./Checker-d381e792.js";function Se(t,u){const{days:d}=u;let{hours:a,minutes:n,seconds:i,milliseconds:_}=u;if(t.includes("DD")?t=t.replace("DD",v(d)):a+=d*24,t.includes("HH")?t=t.replace("HH",v(a)):n+=a*60,t.includes("mm")?t=t.replace("mm",v(n)):i+=n*60,t.includes("ss")?t=t.replace("ss",v(i)):_+=i*1e3,t.includes("S")){const g=v(_,3);t.includes("SSS")?t=t.replace("SSS",g):t.includes("SS")?t=t.replace("SS",g.slice(0,2)):t=t.replace("S",g.charAt(0))}return t}const[be,Ee]=K("count-down"),Fe={time:Q(0),format:Z("HH:mm:ss"),autoStart:j,millisecond:Boolean};var Te=P({name:be,props:Fe,emits:["change","finish"],setup(t,{emit:u,slots:d}){const{start:a,pause:n,reset:i,current:_}=H({time:+t.time,millisecond:t.millisecond,onChange:E=>u("change",E),onFinish:()=>u("finish")}),g=B(()=>Se(t.format,_.value)),b=()=>{i(+t.time),t.autoStart&&a()};return ee(()=>t.time,b,{immediate:!0}),te({start:a,pause:n,reset:b}),()=>e("div",{role:"timer",class:Ee()},[d.default?d.default(_.value):g.value])}});const xe=oe(Te),ve="_studentSection_1mcnc_7",De="_goodsSection_1mcnc_25",we="_titleTool_1mcnc_36",Ae="_titleBuy_1mcnc_45",Be="_goodsCell_1mcnc_52",Ie="_noSelected_1mcnc_57",Pe="_selected_1mcnc_58",ke="_img_1mcnc_78",Ge="_brandName_1mcnc_91",Ne="_model_1mcnc_101",Re="_sbtnGroup_1mcnc_111",Ve="_btnDetail_1mcnc_123",Le="_btnVideo_1mcnc_124",Oe="_priceCell_1mcnc_164",Me="_sPriceGroup_1mcnc_167",qe="_tg_1mcnc_175",Ue="_giftCell_1mcnc_198",Ye="_gift_1mcnc_198",$e="_iconGift_1mcnc_216",ze="_goodsEmpty_1mcnc_221",He="_shopImg_1mcnc_230",Je="_goodsContainer_1mcnc_234",We="_tips_1mcnc_242",Xe="_goSelect_1mcnc_247",Ke="_addButton_1mcnc_266",Qe="_paymentContainer_1mcnc_285",Ze="_needPrice_1mcnc_295",je="_allPrice_1mcnc_308",et="_videoPopup_1mcnc_327",s={"student-register":"_student-register_1mcnc_1",studentSection:ve,goodsSection:De,titleTool:we,titleBuy:Ae,goodsCell:Be,noSelected:Ie,selected:Pe,delete:"_delete_1mcnc_59",img:ke,brandName:Ge,model:Ne,sbtnGroup:Re,btnDetail:Ve,btnVideo:Le,priceCell:Oe,sPriceGroup:Me,tg:qe,giftCell:Ue,gift:Ye,iconGift:$e,goodsEmpty:ze,shopImg:He,goodsContainer:Je,tips:We,goSelect:Xe,addButton:Ke,paymentContainer:Qe,needPrice:Ze,allPrice:je,videoPopup:et},tt=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,ot="_registerModal_2xcbb_1",st="_infoTitle_2xcbb_7",at="_registerForm_2xcbb_13",nt="_tips_2xcbb_20",ut="_codeText_2xcbb_40",lt="_codeTextDisabled_2xcbb_45",it="_submitBtn_2xcbb_48",rt="_radioSection_2xcbb_58",ct="_radioItem_2xcbb_65",f={registerModal:ot,infoTitle:st,registerForm:at,tips:nt,codeText:ut,codeTextDisabled:lt,submitBtn:it,radioSection:rt,radioItem:ct},dt=""+new URL("info-title-1f45c1de.png",import.meta.url).href,pt="_imgCode_mq980_1",mt="_codeTitle_mq980_4",gt="_img_mq980_1",ft="_imgChange_mq980_16",ht="_field_mq980_23",_t="_imgCodePopup_mq980_27",T={imgCode:pt,codeTitle:mt,img:gt,imgChange:ft,field:ht,imgCodePopup:_t},Ct=P({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"}},emits:["close","sendCode"],data(){return{isSuffix:"/edu-app",showStatus:!1,identifyingCode:null,code:""}},mounted(){this.showStatus=this.value,this.sendImgCode()},watch:{value(t){this.showStatus=t},code(t){t.length>=4&&this.checkVerifyLoginImage()}},methods:{async sendImgCode(){const{data:t}=await h.get(this.isSuffix+"/open/sendImgCode",{requestType:"form",hideLoading:!0,params:{phone:this.phone}});this.identifyingCode=t},async updateIdentifyingCode(){this.sendImgCode()},async checkVerifyLoginImage(){try{if(this.code.length<4)return;await h.post("/edu-app/open/verifyImgCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await h.post("/edu-app/open/sendSms",{requestType:"form",hideLoading:!0,data:{clientId:"cooleshow-student",type:"REGISTER",mobile:this.phone}}),setTimeout(()=>{C("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(t){this.code="",this.updateIdentifyingCode()}}},render(){return e(w,{show:this.showStatus,class:T.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:T.imgCode},[e("p",{class:T.codeTitle},[r("输入图形验证码")]),e(U,null,{default:()=>[e(R,{span:"14"},{default:()=>[e(S,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:T.field,autocomplete:"off"},null)]}),e(R,{span:"10",class:T.img},{default:()=>[e(L,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(se,{type:"spinner",size:"20"},null)})]})]}),e(U,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(R,{span:"10"},{default:()=>[e("span",{class:T.imgChange,onClick:()=>this.updateIdentifyingCode()},[r("看不清?换一换")])]})]})])]})}}),yt=J(),W=[];for(let t=1;t<=40;t++)W.push({text:t+"班",value:t});const St=P({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(t,{emit:u}){const d=ae(),a=B(()=>{let l=[];const m=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],p=[{text:"六年级",value:6}],x=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return t.gradeYear==="FIVE_YEAR_SYSTEM"?l.push([...m]):t.gradeYear==="SIX_YEAR_SYSTEM"?l.push([...m,...p]):t.gradeYear==="THREE_YEAR_SYSTEM"?l.push([...x]):t.gradeYear==="FORE_YEAR_SYSTEM"?l.push([...p,...x]):l.push([...m,...p,...x]),l}),n=V({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),i=V({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:"",gender:1},grant_type:"password",loginType:"SMS",password:"",username:""}),_=()=>{n.countDownStatus=!1,ne(()=>{d.value.start()})},g=()=>{if(!N(i.username))return C("请输入正确的手机号码");n.imgCodeStatus=!0},b=B(()=>!!N(i.username)),E=()=>{n.countDownStatus=!0,d.value.reset()},o=async()=>{try{if(c())return;n.loading=!0;const{extra:l,...m}=i,{data:p}=await h.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...m,extra:JSON.stringify({...l,schoolId:t.schoolId})}});yt.setToken(p.token_type+" "+p.access_token),ue(),u("close"),u("submit")}catch(l){}finally{n.loading=!1}},c=()=>{if(N(i.username))if(i.password)if(i.extra.nickname)if(i.extra.currentGradeNum){if(!i.extra.currentClass)return C("请选择所在班级"),!0}else return C("请选择所在年级"),!0;else return C("请输入学生姓名"),!0;else return C("请输入验证码"),!0;else return C("请输入正确的手机号码"),!0;return!1};return()=>e("div",{class:f.registerModal},[e("img",{src:dt,class:f.infoTitle},null),e(_e,{labelAlign:"top",class:f.registerForm},{default:()=>[e(S,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:i.username,"onUpdate:modelValue":l=>i.username=l,maxlength:14},{label:()=>e("div",null,[r("联系方式(直接监护人)"),e("p",{class:f.tips},[r("手机号是数字化器乐学练工具的唯一登录账户")])])}),e(S,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:i.password,"onUpdate:modelValue":l=>i.password=l,maxlength:6},{button:()=>n.countDownStatus?e("span",{class:[f.codeText,b.value?"":f.codeTextDisabled],onClick:g},[r("获取验证码")]):e(xe,{ref:l=>d.value=l,"auto-start":!1,time:n.countDownTime,onFinish:E,format:"ss秒"},null)}),e(S,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:i.extra.nickname,"onUpdate:modelValue":l=>i.extra.nickname=l},null),e(S,{clearable:!0,label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>e(Ce,{"checked-color":"#ffcb75",modelValue:i.extra.gender,"onUpdate:modelValue":l=>i.extra.gender=l,direction:"horizontal"},{default:()=>[e(I,{size:"large",type:"primary",color:i.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:i.extra.gender!==1?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(Y,{class:f.radioItem,name:1},null),r("男")]}),e(I,{size:"large",type:"primary",color:i.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:i.extra.gender!==0?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(Y,{class:f.radioItem,name:0},null),r("女")]})]})}),e(S,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.gradeNumText,onClick:()=>n.gradeStatus=!0},null),e(S,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.currentClassText,onClick:()=>n.classStatus=!0},null)]}),e(fe,{center:!0,modelValue:n.modelValue,"onUpdate:modelValue":l=>n.modelValue=l,prototcolType:"REGISTER"},null),e(A,{type:"primary",class:f.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:o,disabled:n.loading,loading:n.loading},{default:()=>[r("确认")]}),n.imgCodeStatus?e(Ct,{value:n.imgCodeStatus,"onUpdate:value":l=>n.imgCodeStatus=l,phone:i.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:_},null):null,e(w,{show:n.gradeStatus,"onUpdate:show":l=>n.gradeStatus=l,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e($,{showToolbar:!0,columns:a.value,onCancel:()=>n.gradeStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];i.extra.currentGradeNum=m.value,n.gradeNumText=m.text,n.gradeStatus=!1}},null)]}),e(w,{show:n.classStatus,"onUpdate:show":l=>n.classStatus=l,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e($,{showToolbar:!0,columns:W,onCancel:()=>n.classStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];i.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),X=t=>{if(t===null)return null;const u=Object.assign({},t);return Object.keys(u).forEach(d=>u[d]=typeof t[d]=="object"?X(t[d]):t[d]),Array.isArray(t)?(u.length=t.length,Array.from(u)):u},Ot=P({name:"student-register",setup(){const t=le(),u=J(),d=ie();u.setShoolId(t.query.sId);const a=V({schoolId:t.query.sId,popupShow:!1,popupRegister:!1,details:[],schoolType:"",gradeYear:"",bugGoods:!1,submitLoading:!1,dialogStatus:!1,dialogMessage:"",countDownTime:60*1e3,dialogConfig:{}}),n=H({time:a.countDownTime,onChange(o){a.dialogMessage=`有待支付订单,请在${Math.ceil(o.total/1e3)}s后重试`},onFinish(){a.dialogStatus=!1}}),i=async()=>{let o=!1;try{const{data:c}=await h.get("/edu-app/userPaymentOrder/unpaid");if(!c.id)return!1;if(c.cancelPayment)return await h.post("/edu-app/userPaymentOrder/cancelPayment/"+c.orderNo),!1;a.countDownTime=c.cancelTimes,n.reset(Number(c.cancelTimes)),n.start(),a.dialogMessage=`有待支付订单,请在${Math.ceil(n.current.value.total/1e3)}s后重试`,a.dialogStatus=!0,a.dialogConfig=c,o=!0}catch(c){}return o},_=async()=>{try{const{data:o}=await h.get("/edu-app/open/userOrder/registerGoods/"+a.schoolId,{noAuthorization:!0});u.setVip(o.details||[]),a.details=X(o.details||[]),a.bugGoods=o.bugGoods,a.schoolType=o.schoolType,a.gradeYear=o.gradeYear}catch(o){}},g=B(()=>{let o=0,c=0;return u.getVip.forEach(p=>{o+=Number(p.currentPrice),c+=Number(p.originalPrice)}),u.getGoods.forEach(p=>{o+=Number(p.price)*p.quantity,c+=Number(p.originalPrice)*p.quantity}),{amount:o,originAmount:c}}),b=o=>{de({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{u.deleteGoods(o.productSkuId)})},E=async()=>{try{a.submitLoading=!0;const o=M.get(q)||"";if(!(await h.post("/edu-app/open/user/verification",{noAuthorization:!0,data:{token:o}})).data){M.remove(q),u.deleteToken(),a.popupRegister=!0;return}if(await i())return;const m=await h.get("/edu-app/userPaymentOrder/registerStatus/"+a.schoolId),p=u.getVip,x=u.getGoods;if(m.data.hasBuyCourse&&p.length>0){setTimeout(()=>{C("您已购买数字化器乐学练工具,请勿重复购买")},100);return}const k=[];p.forEach(y=>{k.push({goodsId:y.goodsId,goodsNum:1,goodsType:y.goodsType,paymentCashAmount:y.currentPrice,paymentCouponAmount:0})}),x.forEach(y=>{k.push({goodsId:y.productId,goodsNum:y.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:y.price,paymentCouponAmount:0,goodsSkuId:y.productSkuId})});const{data:G}=await h.post("/edu-app/userPaymentOrder/executeOrder",{hideLoading:!1,data:{paymentType:"adapay",bizId:a.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:g.value.amount||0,paymentCouponAmount:0,goodsInfos:k,orderName:"学生登记",orderDesc:"学生登记"}});d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...G.paymentConfig,paymentType:G.paymentType}),orderNo:G.orderNo}})}finally{a.submitLoading=!1}};return re(()=>{_()}),()=>e("div",{class:s["student-register"]},[e("div",{class:s.studentSection,style:{marginTop:"18px"}},[e("div",{class:s.titleTool},null),a.details.map(o=>e(z,{class:s.goodsSection,onClick:()=>{u.selectedVip(o.goodsId)?u.deleteVip(o.goodsId):u.setVip([o])}},{default:()=>[e(D,{border:!1,class:s.goodsCell},{icon:()=>e(L,{class:s.img,src:o.goodsUrl},null),title:()=>e("div",{class:s.section},[e("div",{class:s.sectionContent},[e("h2",null,[o.goodsName,e(I,{class:s.brandName},{default:()=>[r("12个月")]})]),e("p",{class:[s.model]},[o.description]),e("div",{class:s.sbtnGroup},[e("span",{class:s.btnDetail,onClick:c=>{c.stopPropagation(),d.push("/student-digital-tools")}},[r("查看详情")]),e("span",{class:s.btnVideo,onClick:c=>{c.stopPropagation(),a.popupShow=!0}},[r("介绍视频")])])]),e("i",{class:u.selectedVip(o.goodsId)?s.selected:s.noSelected},null)])}),e(D,{border:!1,class:s.priceCell},{title:()=>e("div",{class:s.sPriceGroup},[e("div",{class:s.tg},[r("团购价:"),e("span",null,[e("i",null,[r("¥ ")]),F(o.currentPrice)])]),o.currentPrice0&&e(D,{border:!1,class:s.giftCell},{title:()=>e("div",{class:s.gift},[e("img",{src:pe,class:s.iconGift},null),r("现在购买赠送 "),e("span",null,[o.membershipDays||0]),r("天有效期")])})]}))]),a.bugGoods&&e(ce,null,[e("div",{class:s.studentSection},[e("div",{class:s.titleBuy},null),u.getGoods&&u.getGoods.length<=0?e("div",{class:s.goodsEmpty},[e("img",{src:tt,class:s.shopImg},null),e("div",{class:s.goodsContainer},[e("h2",null,[r("为你的"),e("span",null,[r("音乐之旅")]),r("做好准备")]),e("p",{class:s.tips},[r("快去选购乐器吧~")]),e(A,{class:s.goSelect,type:"primary",onClick:()=>{d.push("/goods-list")}},{default:()=>[r("进入商城选购"),e(O,{name:"arrow"},null)]})])]):u.getGoods.map((o,c)=>e(z,{class:s.goodsSection},{default:()=>[e(D,{border:!1,class:s.goodsCell},{icon:()=>e(L,{class:s.img,src:o.pic},null),title:()=>e("div",{class:s.section},[e("div",{class:s.sectionContent},[e("h2",null,[o.name,e(I,{class:s.brandName},{default:()=>[o.brandName]})]),e("p",{class:[s.model]},[r("规格:"),o.spDataJson]),e("p",{class:[s.model]},[o.productSn]),e(he,{min:1,max:99,modelValue:o.quantity,"onUpdate:modelValue":l=>o.quantity=l},null)]),e("i",{class:s.delete,onClick:()=>b(o)},null)])}),e(D,{border:!1,class:s.priceCell},{title:()=>e("div",{class:s.sPriceGroup},[e("div",{class:s.tg},[r("团购价:"),e("span",null,[e("i",null,[r("¥ ")]),F(o.price)])]),o.price0&&e(A,{class:s.addButton,block:!0,onClick:()=>{d.push("/goods-list")}},{default:()=>[e(O,{name:"add-o"},null),r("进入商城选购")]})]),e(me,{position:"bottom"},{default:()=>[e("div",{class:s.paymentContainer},[e("div",{class:s.payemntPrice},[e("span",{class:s.needPrice},[e("i",{style:"font-style: normal"},[r("¥ ")]),e("span",null,[F(g.value.amount)])]),e("del",{class:s.allPrice},[r("¥ "),F(g.value.originAmount)])]),e("div",{class:s.paymentBtn,onClick:()=>{const o=u.getVip,c=u.getGoods;if(o.length<=0&&c.length<=0){setTimeout(()=>{C("请选择需要购买的商品")},100);return}u.getToken?E():a.popupRegister=!0}},[e(A,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[r("确认购买")]})])])]}),e(w,{show:a.popupShow,"onUpdate:show":o=>a.popupShow=o,class:s.videoPopup},{default:()=>[a.popupShow&&e(ge,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(w,{show:a.popupRegister,"onUpdate:show":o=>a.popupRegister=o,class:s.registerPopup,position:"bottom",round:!0},{default:()=>[e(St,{schoolId:a.schoolId,schoolType:a.schoolType,gradeYear:a.gradeYear,onClose:()=>a.popupRegister=!1,onSubmit:E},null)]}),e(ye,{title:"提示",show:a.dialogStatus,"onUpdate:show":o=>a.dialogStatus=o,message:a.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const o=a.dialogConfig.paymentConfig;d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(o.paymentConfig),orderNo:o.orderNo}}),n.pause()},onCancel:o=>{n.pause()}},null)])}});export{Ot as default};