index-a9462387.js 18 KB

1
  1. import{aO as D,c as j,b as ee,m as te,t as se,d as F,ah as z,e as k,w as oe,X as ne,a as e,k as ae,D as f,E as _,V as x,A as u,L as le,r as J,x as V,C as B,z as ie,N,aX as ue,y as W,R as re,F as X,U as ce,q as de,P as b,I as O,Q as pe,G as M,J as q}from"./index-42ec22ce.js";import{i as me}from"./icon-gift-94736468.js";import{M as ge}from"./index-19006cb1.js";import{M as fe}from"./index-2725c51d.js";import{O as he}from"./index-ea77886c.js";import{R as U,C as R,u as K,S as _e}from"./student-register-store-af904d17.js";import{F as v}from"./index-be639e22.js";import{I as L}from"./index-7ee8e38c.js";import{F as ye}from"./index-ffb0dd28.js";import{P as Y}from"./index-6b867ce2.js";import{O as Ce}from"./index-9544e564.js";import{C as $}from"./index-bb20b932.js";import{C as I}from"./index-3af5450f.js";import{T as H}from"./index-6f36b59e.js";/* empty css */import"./index-2d5240f7.js";import"./Checker-156decde.js";import"./index-ea24ed88.js";import"./use-tab-status-973d5a31.js";import"./index-ed7d4c15.js";function Se(t,l){const{days:c}=l;let{hours:n,minutes:a,seconds:r,milliseconds:h}=l;if(t.includes("DD")?t=t.replace("DD",D(c)):n+=c*24,t.includes("HH")?t=t.replace("HH",D(n)):a+=n*60,t.includes("mm")?t=t.replace("mm",D(a)):r+=a*60,t.includes("ss")?t=t.replace("ss",D(r)):h+=r*1e3,t.includes("S")){const g=D(h,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[Te,be]=j("count-down"),we={time:ee(0),format:te("HH:mm:ss"),autoStart:se,millisecond:Boolean};var ve=F({name:Te,props:we,emits:["change","finish"],setup(t,{emit:l,slots:c}){const{start:n,pause:a,reset:r,current:h}=z({time:+t.time,millisecond:t.millisecond,onChange:T=>l("change",T),onFinish:()=>l("finish")}),g=k(()=>Se(t.format,h.value)),S=()=>{r(+t.time),t.autoStart&&n()};return oe(()=>t.time,S,{immediate:!0}),ne({start:n,pause:a,reset:S}),()=>e("div",{role:"timer",class:be()},[c.default?c.default(h.value):g.value])}});const xe=ae(ve),Ee="_studentSection_1mcnc_7",De="_goodsSection_1mcnc_25",Ie="_titleTool_1mcnc_36",Fe="_titleBuy_1mcnc_45",Pe="_goodsCell_1mcnc_52",Be="_noSelected_1mcnc_57",ke="_selected_1mcnc_58",Ae="_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",He="_goodsEmpty_1mcnc_221",ze="_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",o={"student-register":"_student-register_1mcnc_1",studentSection:Ee,goodsSection:De,titleTool:Ie,titleBuy:Fe,goodsCell:Pe,noSelected:Be,selected:ke,delete:"_delete_1mcnc_59",img:Ae,brandName:Ge,model:Ne,sbtnGroup:Re,btnDetail:Ve,btnVideo:Le,priceCell:Oe,sPriceGroup:Me,tg:qe,giftCell:Ue,gift:Ye,iconGift:$e,goodsEmpty:He,shopImg:ze,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,st="_registerModal_hxtgy_1",ot="_infoTitle_hxtgy_7",nt="_registerForm_hxtgy_13",at="_tips_hxtgy_20",lt="_codeText_hxtgy_40",it="_codeTextDisabled_hxtgy_45",ut="_submitBtn_hxtgy_48",C={registerModal:st,infoTitle:ot,registerForm:nt,tips:at,codeText:lt,codeTextDisabled:it,submitBtn:ut},rt=""+new URL("info-title-1f45c1de.png",import.meta.url).href,ct="_imgCode_mq980_1",dt="_codeTitle_mq980_4",pt="_img_mq980_1",mt="_imgChange_mq980_16",gt="_field_mq980_23",ft="_imgCodePopup_mq980_27",w={imgCode:ct,codeTitle:dt,img:pt,imgChange:mt,field:gt,imgCodePopup:ft},ht=F({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 f.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 f.post("/edu-app/open/verifyImgCode",{requestType:"form",hideLoading:!0,data:{phone:this.phone,code:this.code}}),await f.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(x,{show:this.showStatus,class:w.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:w.imgCode},[e("p",{class:w.codeTitle},[u("输入图形验证码")]),e(U,null,{default:()=>[e(R,{span:"14"},{default:()=>[e(v,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:w.field,autocomplete:"off"},null)]}),e(R,{span:"10",class:w.img},{default:()=>[e(L,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(le,{type:"spinner",size:"20"},null)})]})]}),e(U,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(R,{span:"10"},{default:()=>[e("span",{class:w.imgChange,onClick:()=>this.updateIdentifyingCode()},[u("看不清?换一换")])]})]})])]})}}),_t=K(),Q=[];for(let t=1;t<=40;t++)Q.push({text:t+"班",value:t});const yt=F({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(t,{emit:l}){const c=J(),n=k(()=>{let i=[];const m=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],p=[{text:"六年级",value:6}],E=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return t.gradeYear==="FIVE_YEAR_SYSTEM"?i.push([...m]):t.gradeYear==="SIX_YEAR_SYSTEM"?i.push([...m,...p]):t.gradeYear==="THREE_YEAR_SYSTEM"?i.push([...E]):t.gradeYear==="FORE_YEAR_SYSTEM"?i.push([...p,...E]):i.push([...m,...p,...E]),i}),a=V({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),r=V({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:""},grant_type:"password",loginType:"SMS",password:"",username:""}),h=()=>{a.countDownStatus=!1,ie(()=>{c.value.start()})},g=()=>{if(!N(r.username))return _("请输入正确的手机号码");a.imgCodeStatus=!0},S=k(()=>!!N(r.username)),T=()=>{a.countDownStatus=!0,c.value.reset()},s=async()=>{try{if(d())return;a.loading=!0;const{extra:i,...m}=r,{data:p}=await f.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...m,extra:JSON.stringify({...i,schoolId:t.schoolId})}});_t.setToken(p.token_type+" "+p.access_token),ue(),l("close"),l("submit")}catch(i){}finally{a.loading=!1}},d=()=>{if(N(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:C.registerModal},[e("img",{src:rt,class:C.infoTitle},null),e(ye,{labelAlign:"top",class:C.registerForm},{default:()=>[e(v,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:r.username,"onUpdate:modelValue":i=>r.username=i,maxlength:11},{label:()=>e("div",null,[u("联系方式(直接监护人)"),e("p",{class:C.tips},[u("手机号是数字化器乐学练工具的唯一登录账户")])])}),e(v,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:r.password,"onUpdate:modelValue":i=>r.password=i,maxlength:6},{button:()=>a.countDownStatus?e("span",{class:[C.codeText,S.value?"":C.codeTextDisabled],onClick:g},[u("获取验证码")]):e(xe,{ref:i=>c.value=i,"auto-start":!1,time:a.countDownTime,onFinish:T,format:"ss秒"},null)}),e(v,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:r.extra.nickname,"onUpdate:modelValue":i=>r.extra.nickname=i},null),e(v,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:a.gradeNumText,onClick:()=>a.gradeStatus=!0},null),e(v,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:a.currentClassText,onClick:()=>a.classStatus=!0},null)]}),e(he,{center:!0,modelValue:a.modelValue,"onUpdate:modelValue":i=>a.modelValue=i,prototcolType:"REGISTER"},null),e(B,{type:"primary",class:C.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:s,disabled:a.loading,loading:a.loading},{default:()=>[u("确认")]}),a.imgCodeStatus?e(ht,{value:a.imgCodeStatus,"onUpdate:value":i=>a.imgCodeStatus=i,phone:r.username,onClose:()=>{a.imgCodeStatus=!1},onSendCode:h},null):null,e(x,{show:a.gradeStatus,"onUpdate:show":i=>a.gradeStatus=i,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(Y,{showToolbar:!0,columns:n.value,onCancel:()=>a.gradeStatus=!1,onConfirm:i=>{const m=i.selectedOptions[0];r.extra.currentGradeNum=m.value,a.gradeNumText=m.text,a.gradeStatus=!1}},null)]}),e(x,{show:a.classStatus,"onUpdate:show":i=>a.classStatus=i,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(Y,{showToolbar:!0,columns:Q,onCancel:()=>a.classStatus=!1,onConfirm:i=>{const m=i.selectedOptions[0];r.extra.currentClass=m.value,a.currentClassText=m.text,a.classStatus=!1}},null)]})])}}),Z=t=>{if(t===null)return null;const l=Object.assign({},t);return Object.keys(l).forEach(c=>l[c]=typeof t[c]=="object"?Z(t[c]):t[c]),Array.isArray(t)?(l.length=t.length,Array.from(l)):l},Ct="_wxPopupDialog_1sfd3_1",St="_popupContainer_1sfd3_16",Tt="_title1_1sfd3_22",bt="_popupTips_1sfd3_29",P={wxPopupDialog:Ct,popupContainer:St,title1:Tt,popupTips:bt},wt=F({name:"m-wx-tip",props:{show:{type:Boolean,default:!0},title:{type:String,default:"温馨提示"},message:{type:String,default:"请使用微信打开"}},setup(t){const l=J(!1);return W(()=>{if(!re().weixin&&t.show){l.value=!0;return}}),()=>e(X,null,[e(x,{show:l.value,"onUpdate:show":c=>l.value=c,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:P.wxPopupDialog},{default:()=>[e("div",{class:P.popupContainer},[e("p",{class:P.title1},[t.title]),e("p",{class:P.popupTips},[t.message])])]})])}}),$t=F({name:"student-register",setup(){const t=ce(),l=K(),c=de();l.setShoolId(t.query.sId);const n=V({schoolId:t.query.sId,popupShow:!1,popupRegister:!1,details:[],schoolType:"",gradeYear:"",bugGoods:!1,submitLoading:!1,dialogStatus:!1,dialogMessage:"",countDownTime:60*1e3,dialogConfig:{}}),a=z({time:n.countDownTime,onChange(s){n.dialogMessage=`有待支付订单,请在${Math.ceil(s.total/1e3)}s后重试`},onFinish(){n.dialogStatus=!1}}),r=async()=>{let s=!1;try{const{data:d}=await f.get("/edu-app/userPaymentOrder/unpaid");if(!d.id)return!1;if(d.cancelPayment)return await f.post("/edu-app/userPaymentOrder/cancelPayment/"+d.orderNo),!1;n.countDownTime=d.cancelTimes,a.reset(Number(d.cancelTimes)),a.start(),n.dialogMessage=`有待支付订单,请在${Math.ceil(a.current.value.total/1e3)}s后重试`,n.dialogStatus=!0,n.dialogConfig=d,s=!0}catch(d){}return s},h=async()=>{try{const{data:s}=await f.get("/edu-app/open/userOrder/registerGoods/"+n.schoolId,{noAuthorization:!0});l.setVip(s.details||[]),n.details=Z(s.details||[]),n.bugGoods=s.bugGoods,n.schoolType=s.schoolType,n.gradeYear=s.gradeYear}catch(s){}},g=k(()=>{let s=0,d=0;return l.getVip.forEach(p=>{s+=Number(p.currentPrice),d+=Number(p.originalPrice)}),l.getGoods.forEach(p=>{s+=Number(p.price)*p.quantity,d+=Number(p.originalPrice)*p.quantity}),{amount:s,originAmount:d}}),S=s=>{pe({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{l.deleteGoods(s.productSkuId)})},T=async()=>{try{n.submitLoading=!0;const s=M.get(q)||"";if(!(await f.post("/edu-app/open/user/verification",{noAuthorization:!0,data:{token:s}})).data){M.remove(q),l.deleteToken(),n.popupRegister=!0;return}if(await r())return;const m=await f.get("/edu-app/userPaymentOrder/registerStatus/"+n.schoolId),p=l.getVip,E=l.getGoods;if(m.data.hasBuyCourse&&p.length>0){setTimeout(()=>{_("您已购买数字化器乐学练工具,请勿重复购买")},100);return}const A=[];p.forEach(y=>{A.push({goodsId:y.goodsId,goodsNum:1,goodsType:y.goodsType,paymentCashAmount:y.currentPrice,paymentCouponAmount:0})}),E.forEach(y=>{A.push({goodsId:y.productId,goodsNum:y.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:y.price,paymentCouponAmount:0,goodsSkuId:y.productSkuId})});const{data:G}=await f.post("/edu-app/userPaymentOrder/executeOrder",{hideLoading:!1,data:{paymentType:"adapay",bizId:n.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:g.value.amount||0,paymentCouponAmount:0,goodsInfos:A,orderName:"学生登记",orderDesc:"学生登记"}});c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...G.paymentConfig,paymentType:G.paymentType}),orderNo:G.orderNo}})}finally{n.submitLoading=!1}};return W(()=>{h()}),()=>e("div",{class:o["student-register"]},[e("div",{class:o.studentSection,style:{marginTop:"18px"}},[e("div",{class:o.titleTool},null),n.details.map(s=>e($,{class:o.goodsSection,onClick:()=>{l.selectedVip(s.goodsId)?l.deleteVip(s.goodsId):l.setVip([s])}},{default:()=>[e(I,{border:!1,class:o.goodsCell},{icon:()=>e(L,{class:o.img,src:s.goodsUrl},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.goodsName,e(H,{class:o.brandName},{default:()=>[u("12个月")]})]),e("p",{class:[o.model]},[s.description]),e("div",{class:o.sbtnGroup},[e("span",{class:o.btnDetail,onClick:d=>{d.stopPropagation(),c.push("/student-digital-tools")}},[u("查看详情")]),e("span",{class:o.btnVideo,onClick:d=>{d.stopPropagation(),n.popupShow=!0}},[u("介绍视频")])])]),e("i",{class:l.selectedVip(s.goodsId)?o.selected:o.noSelected},null)])}),e(I,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[u("团购价:"),e("span",null,[e("i",null,[u("¥ ")]),b(s.currentPrice)])]),s.currentPrice<s.originalPrice&&e("del",null,[u("¥"),b(s.originalPrice)])])}),s.membershipDays>0&&e(I,{border:!1,class:o.giftCell},{title:()=>e("div",{class:o.gift},[e("img",{src:me,class:o.iconGift},null),u("现在购买赠送 "),e("span",null,[s.membershipDays||0]),u("天有效期")])})]}))]),n.bugGoods&&e(X,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:tt,class:o.shopImg},null),e("div",{class:o.goodsContainer},[e("h2",null,[u("为你的"),e("span",null,[u("音乐之旅")]),u("做好准备")]),e("p",{class:o.tips},[u("快去选购乐器吧~")]),e(B,{class:o.goSelect,type:"primary",onClick:()=>{c.push("/goods-list")}},{default:()=>[u("进入商城选购"),e(O,{name:"arrow"},null)]})])]):l.getGoods.map((s,d)=>e($,{class:o.goodsSection},{default:()=>[e(I,{border:!1,class:o.goodsCell},{icon:()=>e(L,{class:o.img,src:s.pic},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.name,e(H,{class:o.brandName},{default:()=>[s.brandName]})]),e("p",{class:[o.model]},[u("规格:"),s.spDataJson]),e("p",{class:[o.model]},[s.productSn]),e(_e,{min:1,max:99,modelValue:s.quantity,"onUpdate:modelValue":i=>s.quantity=i},null)]),e("i",{class:o.delete,onClick:()=>S(s)},null)])}),e(I,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[u("团购价:"),e("span",null,[e("i",null,[u("¥ ")]),b(s.price)])]),s.price<s.originalPrice&&e("del",null,[u("¥"),b(s.originalPrice)])])})]}))]),l.getGoods&&l.getGoods.length>0&&e(B,{class:o.addButton,block:!0,onClick:()=>{c.push("/goods-list")}},{default:()=>[e(O,{name:"add-o"},null),u("进入商城选购")]})]),e(ge,{position:"bottom"},{default:()=>[e("div",{class:o.paymentContainer},[e("div",{class:o.payemntPrice},[e("span",{class:o.needPrice},[e("i",{style:"font-style: normal"},[u("¥ ")]),e("span",null,[b(g.value.amount)])]),e("del",{class:o.allPrice},[u("¥ "),b(g.value.originAmount)])]),e("div",{class:o.paymentBtn,onClick:()=>{const s=l.getVip,d=l.getGoods;if(s.length<=0&&d.length<=0){setTimeout(()=>{_("请选择需要购买的商品")},100);return}l.getToken?T():n.popupRegister=!0}},[e(B,{disabled:n.submitLoading,loading:n.submitLoading},{default:()=>[u("确认购买")]})])])]}),e(x,{show:n.popupShow,"onUpdate:show":s=>n.popupShow=s,class:o.videoPopup},{default:()=>[n.popupShow&&e(fe,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(x,{show:n.popupRegister,"onUpdate:show":s=>n.popupRegister=s,class:o.registerPopup,position:"bottom",round:!0},{default:()=>[e(yt,{schoolId:n.schoolId,schoolType:n.schoolType,gradeYear:n.gradeYear,onClose:()=>n.popupRegister=!1,onSubmit:T},null)]}),e(Ce,{title:"提示",show:n.dialogStatus,"onUpdate:show":s=>n.dialogStatus=s,message:n.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const s=n.dialogConfig.paymentConfig;c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(s.paymentConfig),orderNo:s.orderNo}}),a.pause()},onCancel:s=>{a.pause()}},null),e(wt,null,null)])}});export{$t as default};