index-43a67e5a.js 17 KB

1
  1. import{aO as x,c as j,b as ee,m as te,t as se,d as B,aX as z,e as A,w as oe,X as ae,a as e,k as ne,D as f,E as _,V as w,A as i,L as ue,r as J,x as V,C as P,z as le,N,y as W,R as ie,F as X,U as re,q as de,P as T,I as O,Q as ce,G as M,J as q}from"./index-cdf11909.js";import{i as pe}from"./icon-gift-94736468.js";import{M as me}from"./index-c17afa64.js";import{M as ge}from"./index-cdfac2ba.js";import{O as fe}from"./index-6e6f35e2.js";import{R as U,C as R,u as K,S as he}from"./student-register-store-3b4392db.js";import{F}from"./index-7eee6745.js";import{I as L}from"./index-32a200e7.js";import{F as _e}from"./index-46afd470.js";import{P as Y}from"./index-26bc7c20.js";import{O as Ce}from"./index-2df11364.js";import{C as $}from"./index-6c46527c.js";import{C as D}from"./index-49bb73f8.js";import{T as H}from"./index-6cf6d69d.js";/* empty css */import"./index-9c6fefa8.js";import"./Checker-0768fc53.js";function ye(t,u){const{days:d}=u;let{hours:a,minutes:n,seconds:r,milliseconds:h}=u;if(t.includes("DD")?t=t.replace("DD",x(d)):a+=d*24,t.includes("HH")?t=t.replace("HH",x(a)):n+=a*60,t.includes("mm")?t=t.replace("mm",x(n)):r+=n*60,t.includes("ss")?t=t.replace("ss",x(r)):h+=r*1e3,t.includes("S")){const g=x(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]=j("count-down"),Te={time:ee(0),format:te("HH:mm:ss"),autoStart:se,millisecond:Boolean};var be=B({name:Se,props:Te,emits:["change","finish"],setup(t,{emit:u,slots:d}){const{start:a,pause:n,reset:r,current:h}=z({time:+t.time,millisecond:t.millisecond,onChange:v=>u("change",v),onFinish:()=>u("finish")}),g=A(()=>ye(t.format,h.value)),S=()=>{r(+t.time),t.autoStart&&a()};return oe(()=>t.time,S,{immediate:!0}),ae({start:a,pause:n,reset:S}),()=>e("div",{role:"timer",class:ve()},[d.default?d.default(h.value):g.value])}});const Fe=ne(be),we="_studentSection_3dvma_7",Ee="_goodsSection_3dvma_25",xe="_titleTool_3dvma_36",De="_titleBuy_3dvma_45",Be="_goodsCell_3dvma_52",Ie="_noSelected_3dvma_57",Pe="_selected_3dvma_58",Ae="_img_3dvma_78",ke="_brandName_3dvma_91",Ge="_model_3dvma_101",Ne="_sbtnGroup_3dvma_111",Re="_btnDetail_3dvma_123",Ve="_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:we,goodsSection:Ee,titleTool:xe,titleBuy:De,goodsCell:Be,noSelected:Ie,selected:Pe,delete:"_delete_3dvma_59",img:Ae,brandName:ke,model:Ge,sbtnGroup:Ne,btnDetail:Re,btnVideo:Ve,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",ut="_codeTextDisabled_hxtgy_45",lt="_submitBtn_hxtgy_48",y={registerModal:tt,infoTitle:st,registerForm:ot,tips:at,codeText:nt,codeTextDisabled:ut,submitBtn:lt},it=""+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=B({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(w,{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(U,null,{default:()=>[e(R,{span:"14"},{default:()=>[e(F,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:b.field,autocomplete:"off"},null)]}),e(R,{span:"10",class:b.img},{default:()=>[e(L,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(ue,{type:"spinner",size:"20"},null)})]})]}),e(U,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(R,{span:"10"},{default:()=>[e("span",{class:b.imgChange,onClick:()=>this.updateIdentifyingCode()},[i("看不清?换一换")])]})]})])]})}}),ht=K(),Q=[];for(let t=1;t<=40;t++)Q.push({text:t+"班",value:t});const _t=B({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=J(),a=A(()=>{let l=[];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"?l.push([...m]):t.gradeYear==="SIX_YEAR_SYSTEM"?l.push([...m,...p]):t.gradeYear==="THREE_YEAR_SYSTEM"?l.push([...E]):t.gradeYear==="FORE_YEAR_SYSTEM"?l.push([...p,...E]):l.push([...m,...p,...E]),l}),n=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=()=>{n.countDownStatus=!1,le(()=>{d.value.start()})},g=()=>{if(!N(r.username))return _("请输入正确的手机号码");n.imgCodeStatus=!0},S=A(()=>!!N(r.username)),v=()=>{n.countDownStatus=!0,d.value.reset()},s=async()=>{try{if(c())return;n.loading=!0;const{extra:l,...m}=r,{data:p}=await f.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...m,extra:JSON.stringify({...l,schoolId:t.schoolId})}});ht.setToken(p.token_type+" "+p.access_token),u("close"),u("submit")}catch(l){}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:y.registerModal},[e("img",{src:it,class:y.infoTitle},null),e(_e,{labelAlign:"top",class:y.registerForm},{default:()=>[e(F,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:r.username,"onUpdate:modelValue":l=>r.username=l,maxlength:11},{label:()=>e("div",null,[i("联系方式(直接监护人)"),e("p",{class:y.tips},[i("手机号是数字化器乐学练工具的唯一登录账户")])])}),e(F,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:r.password,"onUpdate:modelValue":l=>r.password=l,maxlength:6},{button:()=>n.countDownStatus?e("span",{class:[y.codeText,S.value?"":y.codeTextDisabled],onClick:g},[i("获取验证码")]):e(Fe,{ref:l=>d.value=l,"auto-start":!1,time:n.countDownTime,onFinish:v,format:"ss秒"},null)}),e(F,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:r.extra.nickname,"onUpdate:modelValue":l=>r.extra.nickname=l},null),e(F,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.gradeNumText,onClick:()=>n.gradeStatus=!0},null),e(F,{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(P,{type:"primary",class:y.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:s,disabled:n.loading,loading:n.loading},{default:()=>[i("确认")]}),n.imgCodeStatus?e(ft,{value:n.imgCodeStatus,"onUpdate:value":l=>n.imgCodeStatus=l,phone:r.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:h},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(Y,{showToolbar:!0,columns:a.value,onCancel:()=>n.gradeStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];r.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(Y,{showToolbar:!0,columns:Q,onCancel:()=>n.classStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];r.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),Z=t=>{if(t===null)return null;const u=Object.assign({},t);return Object.keys(u).forEach(d=>u[d]=typeof t[d]=="object"?Z(t[d]):t[d]),Array.isArray(t)?(u.length=t.length,Array.from(u)):u},Ct="_wxPopupDialog_1sfd3_1",yt="_popupContainer_1sfd3_16",St="_title1_1sfd3_22",vt="_popupTips_1sfd3_29",I={wxPopupDialog:Ct,popupContainer:yt,title1:St,popupTips:vt},Tt=B({name:"m-wx-tip",props:{show:{type:Boolean,default:!0},title:{type:String,default:"温馨提示"},message:{type:String,default:"请使用微信打开"}},setup(t){const u=J(!1);return W(()=>{if(!ie().weixin&&t.show){u.value=!0;return}}),()=>e(X,null,[e(w,{show:u.value,"onUpdate:show":d=>u.value=d,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:I.wxPopupDialog},{default:()=>[e("div",{class:I.popupContainer},[e("p",{class:I.title1},[t.title]),e("p",{class:I.popupTips},[t.message])])]})])}}),Mt=B({name:"student-register",setup(){const t=re(),u=K(),d=de();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=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});u.setVip(s.details||[]),a.details=Z(s.details||[]),a.bugGoods=s.bugGoods,a.schoolType=s.schoolType,a.gradeYear=s.gradeYear}catch(s){}},g=A(()=>{let s=0,c=0;return u.getVip.forEach(p=>{s+=Number(p.currentPrice),c+=Number(p.originalPrice)}),u.getGoods.forEach(p=>{s+=Number(p.price)*p.quantity,c+=Number(p.originalPrice)*p.quantity}),{amount:s,originAmount:c}}),S=s=>{ce({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{u.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),u.deleteToken(),a.popupRegister=!0;return}if(await r())return;const m=await f.get("/edu-app/userPaymentOrder/registerStatus/"+a.schoolId),p=u.getVip,E=u.getGoods;if(m.data.hasBuyCourse&&p.length>0){setTimeout(()=>{_("您已购买数字化器乐学练工具,请勿重复购买")},100);return}const k=[];p.forEach(C=>{k.push({goodsId:C.goodsId,goodsNum:1,goodsType:C.goodsType,paymentCashAmount:C.currentPrice,paymentCouponAmount:0})}),E.forEach(C=>{k.push({goodsId:C.productId,goodsNum:C.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:C.price,paymentCouponAmount:0,goodsSkuId:C.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: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 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:()=>{u.selectedVip(s.goodsId)?u.deleteVip(s.goodsId):u.setVip([s])}},{default:()=>[e(D,{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:()=>[i("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")}},[i("查看详情")]),e("span",{class:o.btnVideo,onClick:c=>{c.stopPropagation(),a.popupShow=!0}},[i("介绍视频")])])]),e("i",{class:u.selectedVip(s.goodsId)?o.selected:o.noSelected},null)])}),e(D,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),T(s.currentPrice)])]),s.currentPrice<s.originalPrice&&e("del",null,[i("¥"),T(s.originalPrice)])])}),s.membershipDays>0&&e(D,{border:!1,class:o.giftCell},{title:()=>e("div",{class:o.gift},[e("img",{src:pe,class:o.iconGift},null),i("现在购买赠送 "),e("span",null,[s.membershipDays||0]),i("天有效期")])})]}))]),a.bugGoods&&e(X,null,[e("div",{class:o.studentSection},[e("div",{class:o.titleBuy},null),u.getGoods&&u.getGoods.length<=0?e("div",{class:o.goodsEmpty},[e("img",{src:et,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(P,{class:o.goSelect,type:"primary",onClick:()=>{d.push("/goods-list")}},{default:()=>[i("进入商城选购"),e(O,{name:"arrow"},null)]})])]):u.getGoods.map((s,c)=>e($,{class:o.goodsSection},{default:()=>[e(D,{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]},[i("规格:"),s.spDataJson]),e("p",{class:[o.model]},[s.productSn]),e(he,{min:1,max:99,modelValue:s.quantity,"onUpdate:modelValue":l=>s.quantity=l},null)]),e("i",{class:o.delete,onClick:()=>S(s)},null)])}),e(D,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),T(s.price)])]),s.price<s.originalPrice&&e("del",null,[i("¥"),T(s.originalPrice)])])})]}))]),u.getGoods&&u.getGoods.length>0&&e(P,{class:o.addButton,block:!0,onClick:()=>{d.push("/goods-list")}},{default:()=>[e(O,{name:"add-o"},null),i("进入商城选购")]})]),e(me,{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,[T(g.value.amount)])]),e("del",{class:o.allPrice},[i("¥ "),T(g.value.originAmount)])]),e("div",{class:o.paymentBtn,onClick:()=>{const s=u.getVip,c=u.getGoods;if(s.length<=0&&c.length<=0){setTimeout(()=>{_("请选择需要购买的商品")},100);return}u.getToken?v():a.popupRegister=!0}},[e(P,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[i("确认购买")]})])])]}),e(w,{show:a.popupShow,"onUpdate:show":s=>a.popupShow=s,class:o.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":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(Ce,{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{Mt as default};