import{aw as T,c as q,b as Y,m as H,t as J,d as w,ax as X,e as B,w as Z,X as W,a as e,k as z,D as y,E as _,V as I,A as i,L as K,r as j,x as D,C as F,z as $,N as k,U as Q,q as ee,y as te,P as S,F as se,I as N,Q as oe}from"./index-ed139fac.js";import{M as ae}from"./index-f1e26006.js";import{M as ne}from"./index-676ee560.js";import{F as le,O as ue}from"./index-45abbb7d.js";import{R as V,C as x,u as U,S as ie}from"./student-register-store-526defb0.js";import{F as A}from"./index-de7c04aa.js";import{I as P}from"./index-ca907ff0.js";import{P as G}from"./index-5a7099d2.js";import{C as R}from"./index-6f2d46f6.js";import{C as E}from"./index-d85de42a.js";import{T as L}from"./index-e932f7f6.js";import"./plyr-424cfb91.js";import"./Checker-1823e16e.js";import"./index-317d14e0.js";import"./use-tab-status-fda437be.js";import"./index-4c35786a.js";function re(t,l){const{days:d}=l;let{hours:u,minutes:a,seconds:r,milliseconds:f}=l;if(t.includes("DD")?t=t.replace("DD",T(d)):u+=d*24,t.includes("HH")?t=t.replace("HH",T(u)):a+=u*60,t.includes("mm")?t=t.replace("mm",T(a)):r+=a*60,t.includes("ss")?t=t.replace("ss",T(r)):f+=r*1e3,t.includes("S")){const h=T(f,3);t.includes("SSS")?t=t.replace("SSS",h):t.includes("SS")?t=t.replace("SS",h.slice(0,2)):t=t.replace("S",h.charAt(0))}return t}const[de,ce]=q("count-down"),pe={time:Y(0),format:H("HH:mm:ss"),autoStart:J,millisecond:Boolean};var me=w({name:de,props:pe,emits:["change","finish"],setup(t,{emit:l,slots:d}){const{start:u,pause:a,reset:r,current:f}=X({time:+t.time,millisecond:t.millisecond,onChange:s=>l("change",s),onFinish:()=>l("finish")}),h=B(()=>re(t.format,f.value)),C=()=>{r(+t.time),t.autoStart&&u()};return Z(()=>t.time,C,{immediate:!0}),W({start:u,pause:a,reset:C}),()=>e("div",{role:"timer",class:ce()},[d.default?d.default(f.value):h.value])}});const ge=z(me),fe="_studentSection_3dvma_7",he="_goodsSection_3dvma_25",_e="_titleTool_3dvma_36",ye="_titleBuy_3dvma_45",Ce="_goodsCell_3dvma_52",Se="_noSelected_3dvma_57",ve="_selected_3dvma_58",be="_img_3dvma_78",Ae="_brandName_3dvma_91",Te="_model_3dvma_101",Ee="_sbtnGroup_3dvma_111",Ie="_btnDetail_3dvma_123",Fe="_btnVideo_3dvma_124",we="_priceCell_3dvma_164",xe="_sPriceGroup_3dvma_167",De="_tg_3dvma_175",Pe="_giftCell_3dvma_198",Be="_gift_3dvma_198",ke="_iconGift_3dvma_216",Ne="_goodsEmpty_3dvma_221",Ve="_shopImg_3dvma_230",Ge="_goodsContainer_3dvma_234",Re="_tips_3dvma_242",Le="_goSelect_3dvma_247",Ue="_addButton_3dvma_266",Oe="_paymentContainer_3dvma_285",Me="_needPrice_3dvma_295",qe="_allPrice_3dvma_308",Ye="_videoPopup_3dvma_327",o={"student-register":"_student-register_3dvma_1",studentSection:fe,goodsSection:he,titleTool:_e,titleBuy:ye,goodsCell:Ce,noSelected:Se,selected:ve,delete:"_delete_3dvma_59",img:be,brandName:Ae,model:Te,sbtnGroup:Ee,btnDetail:Ie,btnVideo:Fe,priceCell:we,sPriceGroup:xe,tg:De,giftCell:Pe,gift:Be,iconGift:ke,goodsEmpty:Ne,shopImg:Ve,goodsContainer:Ge,tips:Re,goSelect:Le,addButton:Ue,paymentContainer:Oe,needPrice:Me,allPrice:qe,videoPopup:Ye},He="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAjVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8DizOFAAAALnRSTlMA4Y3756eI8JND97N+3co6M+pPKBIE9vLFv2BaHxwYmG9qSiokDwwI1LmuoHNC7/yX5QAAAVdJREFUOMuFktuWgjAMRYMdLBYEFBDxgo7X8Zb//7zRHFiodMF+OjXbJgTonSjwx1rlTjHYncnKMXC4QXurtpJtNX+ivOOXs5pzGyf6cOIJ21DLdwet9GZjUHWvCtai6YV7/JToIUWPKHJgjeqZMc9NDsPXLOfXP8fy66SEtJVTkckhzZl/JSUanbEfOeRrAjeenZAWLMgjBhI3VHFY7AicFUZ9ZUz4d6Av1lcW1LNHhPjUfPedueKKe93NODWaVZOldiHyJTRLG/AP1ZyUbIEI65haJZpJMSXdLyWk+qW4umlplTKFm6qZ9N0ixahxSRcEzyKNUNJEw16pINr1SgFRNumT9s/o9UihvG3TLWGFXqcUIp/GHZLZE4gMc2iRAsb3DpaKeT4EIedVchXzAAIswxbgNDx+LIpBr4bUbTlhQi1iX30oU7JSbn101UWwpw7SQ5yU9MU/KOVbcXkB4UkAAAAASUVORK5CYII=",Je=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,Xe="_registerModal_ra8en_1",Ze="_infoTitle_ra8en_7",We="_registerForm_ra8en_13",ze="_tips_ra8en_20",Ke="_codeText_ra8en_40",je="_submitBtn_ra8en_45",v={registerModal:Xe,infoTitle:Ze,registerForm:We,tips:ze,codeText:Ke,submitBtn:je},$e=""+new URL("info-title-1f45c1de.png",import.meta.url).href,Qe="_imgCode_mq980_1",et="_codeTitle_mq980_4",tt="_img_mq980_1",st="_imgChange_mq980_16",ot="_field_mq980_23",at="_imgCodePopup_mq980_27",b={imgCode:Qe,codeTitle:et,img:tt,imgChange:st,field:ot,imgCodePopup:at},nt=w({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 y.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 y.post("/edu-app/open/verifyImgCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await y.post("/edu-app/open/sendSms",{requestType:"form",hideLoading:!0,data:{clientId:"cooleshow-student",type:"REGISTER",mobile:this.phone}}),setTimeout(()=>{_("验证码已发送")},100),this.$emit("close"),this.$emit("sendCode")}catch(t){this.code="",this.updateIdentifyingCode()}}},render(){return e(I,{show:this.showStatus,class:b.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:b.imgCode},[e("p",{class:b.codeTitle},[i("输入图形验证码")]),e(V,null,{default:()=>[e(x,{span:"14"},{default:()=>[e(A,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:b.field,autocomplete:"off"},null)]}),e(x,{span:"10",class:b.img},{default:()=>[e(P,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(K,{type:"spinner",size:"20"},null)})]})]}),e(V,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(x,{span:"10"},{default:()=>[e("span",{class:b.imgChange,onClick:()=>this.updateIdentifyingCode()},[i("看不清?换一换")])]})]})])]})}}),lt=U(),O=[];for(let t=1;t<=40;t++)O.push({text:t+"班",value:t});const ut=w({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(t,{emit:l}){const d=j(),u=B(()=>{let n=[];const p=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],c=[{text:"六年级",value:6}],g=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return t.gradeYear==="FIVE_YEAR_SYSTEM"?n.push([...p]):t.gradeYear==="SIX_YEAR_SYSTEM"?n.push([...p,...c]):t.gradeYear==="THREE_YEAR_SYSTEM"?n.push([...g]):t.gradeYear==="FORE_YEAR_SYSTEM"?n.push([...c,...g]):n.push([...p,...c,...g]),console.log(n,t.schoolType,t.gradeYear),n}),a=D({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),r=D({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:""},grant_type:"password",loginType:"SMS",password:"",username:""}),f=()=>{a.countDownStatus=!1,$(()=>{d.value.start()})},h=()=>{if(!k(r.username))return _("请输入正确的手机号码");a.imgCodeStatus=!0},C=()=>{a.countDownStatus=!0,d.value.reset()},s=async()=>{try{if(m())return;a.loading=!0;const{extra:n,...p}=r,{data:c}=await y.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...p,extra:JSON.stringify({...n,schoolId:t.schoolId})}});lt.setToken(c.token_type+" "+c.access_token),l("close"),l("submit")}catch(n){}finally{a.loading=!1}},m=()=>{if(k(r.username))if(r.password)if(r.extra.nickname)if(r.extra.currentGradeNum){if(!r.extra.currentClass)return _("请选择所在班级"),!0}else return _("请选择所在年级"),!0;else return _("请输入学生姓名"),!0;else return _("请输入验证码"),!0;else return _("请输入正确的手机号码"),!0;return!1};return()=>e("div",{class:v.registerModal},[e("img",{src:$e,class:v.infoTitle},null),e(le,{labelAlign:"top",class:v.registerForm},{default:()=>[e(A,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:r.username,"onUpdate:modelValue":n=>r.username=n,maxlength:11},{label:()=>e("div",null,[i("联系方式(直接监护人)"),e("p",{class:v.tips},[i("手机号是数字化器乐课堂的唯一登录账户")])])}),e(A,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:r.password,"onUpdate:modelValue":n=>r.password=n,maxlength:6},{button:()=>a.countDownStatus?e("span",{class:v.codeText,onClick:h},[i("获取验证码")]):e(ge,{ref:n=>d.value=n,"auto-start":!1,time:a.countDownTime,onFinish:C,format:"ss秒"},null)}),e(A,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:r.extra.nickname,"onUpdate:modelValue":n=>r.extra.nickname=n},null),e(A,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:a.gradeNumText,onClick:()=>a.gradeStatus=!0},null),e(A,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:a.currentClassText,onClick:()=>a.classStatus=!0},null)]}),e(ue,{center:!0,modelValue:a.modelValue,"onUpdate:modelValue":n=>a.modelValue=n,prototcolType:"REGISTER"},null),e(F,{type:"primary",class:v.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:s,disabled:a.loading,loading:a.loading},{default:()=>[i("确认")]}),a.imgCodeStatus?e(nt,{value:a.imgCodeStatus,"onUpdate:value":n=>a.imgCodeStatus=n,phone:r.username,onClose:()=>{a.imgCodeStatus=!1},onSendCode:f},null):null,e(I,{show:a.gradeStatus,"onUpdate:show":n=>a.gradeStatus=n,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(G,{showToolbar:!0,columns:u.value,onCancel:()=>a.gradeStatus=!1,onConfirm:n=>{const p=n.selectedOptions[0];r.extra.currentGradeNum=p.value,a.gradeNumText=p.text,a.gradeStatus=!1}},null)]}),e(I,{show:a.classStatus,"onUpdate:show":n=>a.classStatus=n,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(G,{showToolbar:!0,columns:O,onCancel:()=>a.classStatus=!1,onConfirm:n=>{const p=n.selectedOptions[0];r.extra.currentClass=p.value,a.currentClassText=p.text,a.classStatus=!1}},null)]})])}}),M=t=>{if(t===null)return null;const l=Object.assign({},t);return Object.keys(l).forEach(d=>l[d]=typeof t[d]=="object"?M(t[d]):t[d]),Array.isArray(t)?(l.length=t.length,Array.from(l)):l},Tt=w({name:"student-register",setup(){const t=Q(),l=U(),d=ee();l.setShoolId(t.query.sId);const u=D({schoolId:t.query.sId,popupShow:!1,popupRegister:!1,details:[],schoolType:"",gradeYear:"",bugGoods:!1,submitLoading:!1}),a=async()=>{try{const{data:s}=await y.get("/edu-app/userPaymentOrder/unpaid");s.id&&await y.post("/edu-app/userPaymentOrder/cancelPayment/"+s.orderNo)}catch(s){}},r=async()=>{try{const{data:s}=await y.get("/edu-app/open/userOrder/registerGoods/"+u.schoolId,{noAuthorization:!0});l.setVip(s.details||[]),u.details=M(s.details||[]),u.bugGoods=s.bugGoods,u.schoolType=s.schoolType,u.gradeYear=s.gradeYear}catch(s){}},f=B(()=>{let s=0,m=0;return l.getVip.forEach(c=>{s+=Number(c.currentPrice),m+=Number(c.originalPrice)}),l.getGoods.forEach(c=>{s+=Number(c.price)*c.quantity,m+=Number(c.originalPrice)*c.quantity}),{amount:s,originAmount:m}}),h=s=>{oe({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{console.log(s,"item"),l.deleteGoods(s.productSkuId)})},C=async()=>{try{u.submitLoading=!0,await a();const s=await y.get("/edu-app/userPaymentOrder/registerStatus/"+u.schoolId),m=l.getVip,n=l.getGoods;if(s.data.hasBuyCourse&&m.length>0){setTimeout(()=>{_("您已购买数字化器乐学练工具,请勿重复购买")},100);return}const p=[];m.forEach(g=>{p.push({goodsId:g.goodsId,goodsNum:1,goodsType:g.goodsType,paymentCashAmount:g.currentPrice,paymentCouponAmount:0})}),n.forEach(g=>{p.push({goodsId:g.productId,goodsNum:g.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:g.price,paymentCouponAmount:0,goodsSkuId:g.productSkuId})});const{data:c}=await y.post("/edu-app/userPaymentOrder/executeOrder",{hideLoading:!1,data:{paymentType:"adapay",bizId:u.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:f.value.amount||0,paymentCouponAmount:0,goodsInfos:p,orderName:"学生登记",orderDesc:"学生登记"}});d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...c.paymentConfig,paymentType:c.paymentType}),orderNo:c.orderNo}})}finally{u.submitLoading=!1}};return te(()=>{r()}),()=>e("div",{class:o["student-register"]},[e("div",{class:o.studentSection,style:{marginTop:"18px"}},[e("div",{class:o.titleTool},null),u.details.map(s=>e(R,{class:o.goodsSection,onClick:()=>{l.selectedVip(s.goodsId)?l.deleteVip(s.goodsId):l.setVip([s])}},{default:()=>[e(E,{border:!1,class:o.goodsCell},{icon:()=>e(P,{class:o.img,src:s.goodsUrl},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.goodsName,e(L,{class:o.brandName},{default:()=>[i("12个月")]})]),e("p",{class:[o.model]},[s.description]),e("div",{class:o.sbtnGroup},[e("span",{class:o.btnDetail,onClick:m=>{m.stopPropagation(),d.push("/student-digital-tools")}},[i("查看详情")]),e("span",{class:o.btnVideo,onClick:m=>{m.stopPropagation(),u.popupShow=!0}},[i("介绍视频")])])]),e("i",{class:l.selectedVip(s.goodsId)?o.selected:o.noSelected},null)])}),e(E,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),S(s.currentPrice)])]),s.currentPricee("div",{class:o.gift},[e("img",{src:He,class:o.iconGift},null),i("现在购买赠送 "),e("span",null,[s.membershipDays||0]),i("天有效期")])})]}))]),u.bugGoods&&e(se,null,[e("div",{class:o.studentSection},[e("div",{class:o.titleBuy},null),l.getGoods&&l.getGoods.length<=0?e("div",{class:o.goodsEmpty},[e("img",{src:Je,class:o.shopImg},null),e("div",{class:o.goodsContainer},[e("h2",null,[i("为你的"),e("span",null,[i("音乐之旅")]),i("做好准备")]),e("p",{class:o.tips},[i("快去选购乐器吧~")]),e(F,{class:o.goSelect,type:"primary",onClick:()=>{d.push("/goods-list")}},{default:()=>[i("进入商城选购"),e(N,{name:"arrow"},null)]})])]):l.getGoods.map((s,m)=>e(R,{class:o.goodsSection},{default:()=>[e(E,{border:!1,class:o.goodsCell},{icon:()=>e(P,{class:o.img,src:s.pic},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.name,e(L,{class:o.brandName},{default:()=>[s.brandName]})]),e("p",{class:[o.model]},[i("规格:"),s.spDataJson]),e("p",{class:[o.model]},[s.productSn]),e(ie,{min:1,max:99,modelValue:s.quantity,"onUpdate:modelValue":n=>s.quantity=n},null)]),e("i",{class:o.delete,onClick:()=>h(s)},null)])}),e(E,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),S(s.price)])]),s.price0&&e(F,{class:o.addButton,block:!0,onClick:()=>{d.push("/goods-list")}},{default:()=>[e(N,{name:"add-o"},null),i("进入商城选购")]})]),e(ae,{position:"bottom"},{default:()=>[e("div",{class:o.paymentContainer},[e("div",{class:o.payemntPrice},[e("span",{class:o.needPrice},[e("i",{style:"font-style: normal"},[i("¥ ")]),e("span",null,[S(f.value.amount)])]),e("del",{class:o.allPrice},[i("¥ "),S(f.value.originAmount)])]),e("div",{class:o.paymentBtn,onClick:()=>{const s=l.getVip,m=l.getGoods;if(s.length<=0&&m.length<=0){setTimeout(()=>{_("请选择需要购买的商品")},100);return}l.getToken?C():u.popupRegister=!0}},[e(F,{disabled:u.submitLoading,loading:u.submitLoading},{default:()=>[i("确认购买")]})])])]}),e(I,{show:u.popupShow,"onUpdate:show":s=>u.popupShow=s,class:o.videoPopup},{default:()=>[u.popupShow&&e(ne,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(I,{show:u.popupRegister,"onUpdate:show":s=>u.popupRegister=s,class:o.registerPopup,position:"bottom",round:!0},{default:()=>[e(ut,{schoolId:u.schoolId,schoolType:u.schoolType,gradeYear:u.gradeYear,onClose:()=>u.popupRegister=!1,onSubmit:C},null)]})])}});export{Tt as default};