index-b11ea821.js 18 KB

1
  1. import{i as j}from"./icon-gift-94736468.js";import{M as ee}from"./index-af64acee.js";import{M as te}from"./index-64d2d989.js";import{aM as D,c as se,b as oe,m as ae,t as ne,d as I,aV as z,e as k,w as le,X as ie,a as e,k as ue,C as f,D as _,U as x,z as u,L as re,r as J,q as R,A as B,y as de,N,x as W,R as ce,F as X,P as T,I as O,V as pe,E as me,Q as ge,G as M,J as q}from"./index-4c545b37.js";import{O as fe}from"./index-2954fde0.js";import{R as U,C as V,u as K,S as he}from"./student-register-store-6f74ad11.js";import{F as w}from"./index-75d34d09.js";import{I as L}from"./index-491e72d1.js";import{F as _e}from"./index-d84dd160.js";import{P as Y}from"./index-216fc10a.js";import{O as ye}from"./index-ce63ce34.js";import{C as $}from"./index-ab217299.js";import{C as F}from"./index-0989d7f4.js";import{T as H}from"./index-9bda6e9a.js";/* empty css */import"./index-4a396091.js";import"./Checker-36a21aaf.js";import"./index-6ad8726f.js";import"./use-tab-status-50c6104b.js";import"./index-bb4c6970.js";function Ce(t,l){const{days:d}=l;let{hours:a,minutes:n,seconds:r,milliseconds:h}=l;if(t.includes("DD")?t=t.replace("DD",D(d)):a+=d*24,t.includes("HH")?t=t.replace("HH",D(a)):n+=a*60,t.includes("mm")?t=t.replace("mm",D(n)):r+=n*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[Se,ve]=se("count-down"),Te={time:oe(0),format:ae("HH:mm:ss"),autoStart:ne,millisecond:Boolean};var be=I({name:Se,props:Te,emits:["change","finish"],setup(t,{emit:l,slots:d}){const{start:a,pause:n,reset:r,current:h}=z({time:+t.time,millisecond:t.millisecond,onChange:v=>l("change",v),onFinish:()=>l("finish")}),g=k(()=>Ce(t.format,h.value)),S=()=>{r(+t.time),t.autoStart&&a()};return le(()=>t.time,S,{immediate:!0}),ie({start:a,pause:n,reset:S}),()=>e("div",{role:"timer",class:ve()},[d.default?d.default(h.value):g.value])}});const we=ue(be),xe="_studentSection_3dvma_7",Ee="_goodsSection_3dvma_25",De="_titleTool_3dvma_36",Fe="_titleBuy_3dvma_45",Ie="_goodsCell_3dvma_52",Pe="_noSelected_3dvma_57",Be="_selected_3dvma_58",ke="_img_3dvma_78",Ae="_brandName_3dvma_91",Ge="_model_3dvma_101",Ne="_sbtnGroup_3dvma_111",Ve="_btnDetail_3dvma_123",Re="_btnVideo_3dvma_124",Le="_priceCell_3dvma_164",Oe="_sPriceGroup_3dvma_167",Me="_tg_3dvma_175",qe="_giftCell_3dvma_198",Ue="_gift_3dvma_198",Ye="_iconGift_3dvma_216",$e="_goodsEmpty_3dvma_221",He="_shopImg_3dvma_230",ze="_goodsContainer_3dvma_234",Je="_tips_3dvma_242",We="_goSelect_3dvma_247",Xe="_addButton_3dvma_266",Ke="_paymentContainer_3dvma_285",Qe="_needPrice_3dvma_295",Ze="_allPrice_3dvma_308",je="_videoPopup_3dvma_327",o={"student-register":"_student-register_3dvma_1",studentSection:xe,goodsSection:Ee,titleTool:De,titleBuy:Fe,goodsCell:Ie,noSelected:Pe,selected:Be,delete:"_delete_3dvma_59",img:ke,brandName:Ae,model:Ge,sbtnGroup:Ne,btnDetail:Ve,btnVideo:Re,priceCell:Le,sPriceGroup:Oe,tg:Me,giftCell:qe,gift:Ue,iconGift:Ye,goodsEmpty:$e,shopImg:He,goodsContainer:ze,tips:Je,goSelect:We,addButton:Xe,paymentContainer:Ke,needPrice:Qe,allPrice:Ze,videoPopup:je},et=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,tt="_registerModal_hxtgy_1",st="_infoTitle_hxtgy_7",ot="_registerForm_hxtgy_13",at="_tips_hxtgy_20",nt="_codeText_hxtgy_40",lt="_codeTextDisabled_hxtgy_45",it="_submitBtn_hxtgy_48",C={registerModal:tt,infoTitle:st,registerForm:ot,tips:at,codeText:nt,codeTextDisabled:lt,submitBtn:it},ut=""+new URL("info-title-1f45c1de.png",import.meta.url).href,rt="_imgCode_mq980_1",dt="_codeTitle_mq980_4",ct="_img_mq980_1",pt="_imgChange_mq980_16",mt="_field_mq980_23",gt="_imgCodePopup_mq980_27",b={imgCode:rt,codeTitle:dt,img:ct,imgChange:pt,field:mt,imgCodePopup:gt},ft=I({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:b.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:b.imgCode},[e("p",{class:b.codeTitle},[u("输入图形验证码")]),e(U,null,{default:()=>[e(V,{span:"14"},{default:()=>[e(w,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:b.field,autocomplete:"off"},null)]}),e(V,{span:"10",class:b.img},{default:()=>[e(L,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(re,{type:"spinner",size:"20"},null)})]})]}),e(U,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(V,{span:"10"},{default:()=>[e("span",{class:b.imgChange,onClick:()=>this.updateIdentifyingCode()},[u("看不清?换一换")])]})]})])]})}}),ht=K(),Q=[];for(let t=1;t<=40;t++)Q.push({text:t+"班",value:t});const _t=I({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(),a=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}),n=R({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),r=R({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:""},grant_type:"password",loginType:"SMS",password:"",username:""}),h=()=>{n.countDownStatus=!1,de(()=>{d.value.start()})},g=()=>{if(!N(r.username))return _("请输入正确的手机号码");n.imgCodeStatus=!0},S=k(()=>!!N(r.username)),v=()=>{n.countDownStatus=!0,d.value.reset()},s=async()=>{try{if(c())return;n.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})}});ht.setToken(p.token_type+" "+p.access_token),l("close"),l("submit")}catch(i){}finally{n.loading=!1}},c=()=>{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:ut,class:C.infoTitle},null),e(_e,{labelAlign:"top",class:C.registerForm},{default:()=>[e(w,{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(w,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:r.password,"onUpdate:modelValue":i=>r.password=i,maxlength:6},{button:()=>n.countDownStatus?e("span",{class:[C.codeText,S.value?"":C.codeTextDisabled],onClick:g},[u("获取验证码")]):e(we,{ref:i=>d.value=i,"auto-start":!1,time:n.countDownTime,onFinish:v,format:"ss秒"},null)}),e(w,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:r.extra.nickname,"onUpdate:modelValue":i=>r.extra.nickname=i},null),e(w,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.gradeNumText,onClick:()=>n.gradeStatus=!0},null),e(w,{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":i=>n.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:n.loading,loading:n.loading},{default:()=>[u("确认")]}),n.imgCodeStatus?e(ft,{value:n.imgCodeStatus,"onUpdate:value":i=>n.imgCodeStatus=i,phone:r.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:h},null):null,e(x,{show:n.gradeStatus,"onUpdate:show":i=>n.gradeStatus=i,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(Y,{showToolbar:!0,columns:a.value,onCancel:()=>n.gradeStatus=!1,onConfirm:i=>{const m=i.selectedOptions[0];r.extra.currentGradeNum=m.value,n.gradeNumText=m.text,n.gradeStatus=!1}},null)]}),e(x,{show:n.classStatus,"onUpdate:show":i=>n.classStatus=i,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(Y,{showToolbar:!0,columns:Q,onCancel:()=>n.classStatus=!1,onConfirm:i=>{const m=i.selectedOptions[0];r.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),Z=t=>{if(t===null)return null;const l=Object.assign({},t);return Object.keys(l).forEach(d=>l[d]=typeof t[d]=="object"?Z(t[d]):t[d]),Array.isArray(t)?(l.length=t.length,Array.from(l)):l},yt="_wxPopupDialog_1sfd3_1",Ct="_popupContainer_1sfd3_16",St="_title1_1sfd3_22",vt="_popupTips_1sfd3_29",P={wxPopupDialog:yt,popupContainer:Ct,title1:St,popupTips:vt},Tt=I({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(!ce().weixin&&t.show){l.value=!0;return}}),()=>e(X,null,[e(x,{show:l.value,"onUpdate:show":d=>l.value=d,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])])]})])}}),Yt=I({name:"student-register",setup(){const t=pe(),l=K(),d=me();l.setShoolId(t.query.sId);const a=R({schoolId:t.query.sId,popupShow:!1,popupRegister:!1,details:[],schoolType:"",gradeYear:"",bugGoods:!1,submitLoading:!1,dialogStatus:!1,dialogMessage:"",countDownTime:60*1e3,dialogConfig:{}}),n=z({time:a.countDownTime,onChange(s){a.dialogMessage=`有待支付订单,请在${Math.ceil(s.total/1e3)}s后重试`},onFinish(){a.dialogStatus=!1}}),r=async()=>{let s=!1;try{const{data:c}=await f.get("/edu-app/userPaymentOrder/unpaid");if(!c.id)return!1;if(c.cancelPayment)return await f.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,s=!0}catch(c){}return s},h=async()=>{try{const{data:s}=await f.get("/edu-app/open/userOrder/registerGoods/"+a.schoolId,{noAuthorization:!0});l.setVip(s.details||[]),a.details=Z(s.details||[]),a.bugGoods=s.bugGoods,a.schoolType=s.schoolType,a.gradeYear=s.gradeYear}catch(s){}},g=k(()=>{let s=0,c=0;return l.getVip.forEach(p=>{s+=Number(p.currentPrice),c+=Number(p.originalPrice)}),l.getGoods.forEach(p=>{s+=Number(p.price)*p.quantity,c+=Number(p.originalPrice)*p.quantity}),{amount:s,originAmount:c}}),S=s=>{ge({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{l.deleteGoods(s.productSkuId)})},v=async()=>{try{a.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(),a.popupRegister=!0;return}if(await r())return;const m=await f.get("/edu-app/userPaymentOrder/registerStatus/"+a.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:a.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:g.value.amount||0,paymentCouponAmount:0,goodsInfos:A,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 W(()=>{h()}),()=>e("div",{class:o["student-register"]},[e("div",{class:o.studentSection,style:{marginTop:"18px"}},[e("div",{class:o.titleTool},null),a.details.map(s=>e($,{class:o.goodsSection,onClick:()=>{l.selectedVip(s.goodsId)?l.deleteVip(s.goodsId):l.setVip([s])}},{default:()=>[e(F,{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:c=>{c.stopPropagation(),d.push("/student-digital-tools")}},[u("查看详情")]),e("span",{class:o.btnVideo,onClick:c=>{c.stopPropagation(),a.popupShow=!0}},[u("介绍视频")])])]),e("i",{class:l.selectedVip(s.goodsId)?o.selected:o.noSelected},null)])}),e(F,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[u("团购价:"),e("span",null,[e("i",null,[u("¥ ")]),T(s.currentPrice)])]),s.currentPrice<s.originalPrice&&e("del",null,[u("¥"),T(s.originalPrice)])])}),s.membershipDays>0&&e(F,{border:!1,class:o.giftCell},{title:()=>e("div",{class:o.gift},[e("img",{src:j,class:o.iconGift},null),u("现在购买赠送 "),e("span",null,[s.membershipDays||0]),u("天有效期")])})]}))]),a.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:et,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:()=>{d.push("/goods-list")}},{default:()=>[u("进入商城选购"),e(O,{name:"arrow"},null)]})])]):l.getGoods.map((s,c)=>e($,{class:o.goodsSection},{default:()=>[e(F,{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(he,{min:1,max:99,modelValue:s.quantity,"onUpdate:modelValue":i=>s.quantity=i},null)]),e("i",{class:o.delete,onClick:()=>S(s)},null)])}),e(F,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[u("团购价:"),e("span",null,[e("i",null,[u("¥ ")]),T(s.price)])]),s.price<s.originalPrice&&e("del",null,[u("¥"),T(s.originalPrice)])])})]}))]),l.getGoods&&l.getGoods.length>0&&e(B,{class:o.addButton,block:!0,onClick:()=>{d.push("/goods-list")}},{default:()=>[e(O,{name:"add-o"},null),u("进入商城选购")]})]),e(ee,{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,[T(g.value.amount)])]),e("del",{class:o.allPrice},[u("¥ "),T(g.value.originAmount)])]),e("div",{class:o.paymentBtn,onClick:()=>{const s=l.getVip,c=l.getGoods;if(s.length<=0&&c.length<=0){setTimeout(()=>{_("请选择需要购买的商品")},100);return}l.getToken?v():a.popupRegister=!0}},[e(B,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[u("确认购买")]})])])]}),e(x,{show:a.popupShow,"onUpdate:show":s=>a.popupShow=s,class:o.videoPopup},{default:()=>[a.popupShow&&e(te,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(x,{show:a.popupRegister,"onUpdate:show":s=>a.popupRegister=s,class:o.registerPopup,position:"bottom",round:!0},{default:()=>[e(_t,{schoolId:a.schoolId,schoolType:a.schoolType,gradeYear:a.gradeYear,onClose:()=>a.popupRegister=!1,onSubmit:v},null)]}),e(ye,{title:"提示",show:a.dialogStatus,"onUpdate:show":s=>a.dialogStatus=s,message:a.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const s=a.dialogConfig.paymentConfig;d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(s.paymentConfig),orderNo:s.orderNo}}),n.pause()},onCancel:s=>{n.pause()}},null),e(Tt,null,null)])}});export{Yt as default};