1 |
- import{aM as D,c as X,b as K,m as Q,t as Z,d as A,aV as H,e as I,w as j,X as ee,a as e,k as te,D as f,E as _,V as x,A as i,L as se,r as oe,x as V,C as B,z as ae,N as G,U as ne,q as ue,y as le,P as b,F as ie,I as L,Q as re,G as O,J as M}from"./index-900a3811.js";import{i as de}from"./icon-gift-94736468.js";import{M as ce}from"./index-5d2148f2.js";import{M as pe}from"./index-03b1d35c.js";import{O as me}from"./index-0cfa88f6.js";import{R as q,C as N,u as z,S as ge}from"./student-register-store-19406637.js";import{F as T}from"./index-5ed4e54b.js";import{I as R}from"./index-27f9f1c0.js";import{F as fe}from"./index-42d3a11a.js";import{P as U}from"./index-e552ce5c.js";import{O as he}from"./index-2e9e1f1f.js";import{C as Y}from"./index-b33cf3d7.js";import{C as w}from"./index-e813119a.js";import{T as $}from"./index-2efd90ab.js";/* empty css */import"./index-9e378e29.js";import"./Checker-fcac4f5f.js";function _e(t,u){const{days:c}=u;let{hours:a,minutes:n,seconds:r,milliseconds:h}=u;if(t.includes("DD")?t=t.replace("DD",D(c)):a+=c*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[Ce,ye]=X("count-down"),Se={time:K(0),format:Q("HH:mm:ss"),autoStart:Z,millisecond:Boolean};var ve=A({name:Ce,props:Se,emits:["change","finish"],setup(t,{emit:u,slots:c}){const{start:a,pause:n,reset:r,current:h}=H({time:+t.time,millisecond:t.millisecond,onChange:v=>u("change",v),onFinish:()=>u("finish")}),g=I(()=>_e(t.format,h.value)),S=()=>{r(+t.time),t.autoStart&&a()};return j(()=>t.time,S,{immediate:!0}),ee({start:a,pause:n,reset:S}),()=>e("div",{role:"timer",class:ye()},[c.default?c.default(h.value):g.value])}});const be=te(ve),Fe="_studentSection_3dvma_7",Te="_goodsSection_3dvma_25",Ee="_titleTool_3dvma_36",De="_titleBuy_3dvma_45",we="_goodsCell_3dvma_52",xe="_noSelected_3dvma_57",Be="_selected_3dvma_58",Ie="_img_3dvma_78",Ae="_brandName_3dvma_91",Pe="_model_3dvma_101",ke="_sbtnGroup_3dvma_111",Ge="_btnDetail_3dvma_123",Ne="_btnVideo_3dvma_124",Ve="_priceCell_3dvma_164",Re="_sPriceGroup_3dvma_167",Le="_tg_3dvma_175",Oe="_giftCell_3dvma_198",Me="_gift_3dvma_198",qe="_iconGift_3dvma_216",Ue="_goodsEmpty_3dvma_221",Ye="_shopImg_3dvma_230",$e="_goodsContainer_3dvma_234",He="_tips_3dvma_242",ze="_goSelect_3dvma_247",Je="_addButton_3dvma_266",We="_paymentContainer_3dvma_285",Xe="_needPrice_3dvma_295",Ke="_allPrice_3dvma_308",Qe="_videoPopup_3dvma_327",o={"student-register":"_student-register_3dvma_1",studentSection:Fe,goodsSection:Te,titleTool:Ee,titleBuy:De,goodsCell:we,noSelected:xe,selected:Be,delete:"_delete_3dvma_59",img:Ie,brandName:Ae,model:Pe,sbtnGroup:ke,btnDetail:Ge,btnVideo:Ne,priceCell:Ve,sPriceGroup:Re,tg:Le,giftCell:Oe,gift:Me,iconGift:qe,goodsEmpty:Ue,shopImg:Ye,goodsContainer:$e,tips:He,goSelect:ze,addButton:Je,paymentContainer:We,needPrice:Xe,allPrice:Ke,videoPopup:Qe},Ze=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,je="_registerModal_hxtgy_1",et="_infoTitle_hxtgy_7",tt="_registerForm_hxtgy_13",st="_tips_hxtgy_20",ot="_codeText_hxtgy_40",at="_codeTextDisabled_hxtgy_45",nt="_submitBtn_hxtgy_48",y={registerModal:je,infoTitle:et,registerForm:tt,tips:st,codeText:ot,codeTextDisabled:at,submitBtn:nt},ut=""+new URL("info-title-1f45c1de.png",import.meta.url).href,lt="_imgCode_mq980_1",it="_codeTitle_mq980_4",rt="_img_mq980_1",dt="_imgChange_mq980_16",ct="_field_mq980_23",pt="_imgCodePopup_mq980_27",F={imgCode:lt,codeTitle:it,img:rt,imgChange:dt,field:ct,imgCodePopup:pt},mt=A({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:F.imgCodePopup,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[e("div",{class:F.imgCode},[e("p",{class:F.codeTitle},[i("输入图形验证码")]),e(q,null,{default:()=>[e(N,{span:"14"},{default:()=>[e(T,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":t=>this.code=t,class:F.field,autocomplete:"off"},null)]}),e(N,{span:"10",class:F.img},{default:()=>[e(R,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>e(se,{type:"spinner",size:"20"},null)})]})]}),e(q,{style:{display:"flex",justifyContent:"end"}},{default:()=>[e(N,{span:"10"},{default:()=>[e("span",{class:F.imgChange,onClick:()=>this.updateIdentifyingCode()},[i("看不清?换一换")])]})]})])]})}}),gt=z(),J=[];for(let t=1;t<=40;t++)J.push({text:t+"班",value:t});const ft=A({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(t,{emit:u}){const c=oe(),a=I(()=>{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,ae(()=>{c.value.start()})},g=()=>{if(!G(r.username))return _("请输入正确的手机号码");n.imgCodeStatus=!0},S=I(()=>!!G(r.username)),v=()=>{n.countDownStatus=!0,c.value.reset()},s=async()=>{try{if(d())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})}});gt.setToken(p.token_type+" "+p.access_token),u("close"),u("submit")}catch(l){}finally{n.loading=!1}},d=()=>{if(G(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:ut,class:y.infoTitle},null),e(fe,{labelAlign:"top",class:y.registerForm},{default:()=>[e(T,{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(T,{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(be,{ref:l=>c.value=l,"auto-start":!1,time:n.countDownTime,onFinish:v,format:"ss秒"},null)}),e(T,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",modelValue:r.extra.nickname,"onUpdate:modelValue":l=>r.extra.nickname=l},null),e(T,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.gradeNumText,onClick:()=>n.gradeStatus=!0},null),e(T,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.currentClassText,onClick:()=>n.classStatus=!0},null)]}),e(me,{center:!0,modelValue:n.modelValue,"onUpdate:modelValue":l=>n.modelValue=l,prototcolType:"REGISTER"},null),e(B,{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(mt,{value:n.imgCodeStatus,"onUpdate:value":l=>n.imgCodeStatus=l,phone:r.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:h},null):null,e(x,{show:n.gradeStatus,"onUpdate:show":l=>n.gradeStatus=l,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(U,{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(x,{show:n.classStatus,"onUpdate:show":l=>n.classStatus=l,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(U,{showToolbar:!0,columns:J,onCancel:()=>n.classStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];r.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),W=t=>{if(t===null)return null;const u=Object.assign({},t);return Object.keys(u).forEach(c=>u[c]=typeof t[c]=="object"?W(t[c]):t[c]),Array.isArray(t)?(u.length=t.length,Array.from(u)):u},kt=A({name:"student-register",setup(){const t=ne(),u=z(),c=ue();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(s){a.dialogMessage=`有待支付订单,请在${Math.ceil(s.total/1e3)}s后重试`},onFinish(){a.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;a.countDownTime=d.cancelTimes,n.reset(Number(d.cancelTimes)),n.start(),a.dialogMessage=`有待支付订单,请在${Math.ceil(n.current.value.total/1e3)}s后重试`,a.dialogStatus=!0,a.dialogConfig=d,s=!0}catch(d){}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=W(s.details||[]),a.bugGoods=s.bugGoods,a.schoolType=s.schoolType,a.gradeYear=s.gradeYear}catch(s){}},g=I(()=>{let s=0,d=0;return u.getVip.forEach(p=>{s+=Number(p.currentPrice),d+=Number(p.originalPrice)}),u.getGoods.forEach(p=>{s+=Number(p.price)*p.quantity,d+=Number(p.originalPrice)*p.quantity}),{amount:s,originAmount:d}}),S=s=>{re({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{u.deleteGoods(s.productSkuId)})},v=async()=>{try{a.submitLoading=!0;const s=O.get(M)||"";if(!(await f.post("/edu-app/open/user/verification",{noAuthorization:!0,data:{token:s}})).data){O.remove(M),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 P=[];p.forEach(C=>{P.push({goodsId:C.goodsId,goodsNum:1,goodsType:C.goodsType,paymentCashAmount:C.currentPrice,paymentCouponAmount:0})}),E.forEach(C=>{P.push({goodsId:C.productId,goodsNum:C.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:C.price,paymentCouponAmount:0,goodsSkuId:C.productSkuId})});const{data:k}=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:P,orderName:"学生登记",orderDesc:"学生登记"}});c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...k.paymentConfig,paymentType:k.paymentType}),orderNo:k.orderNo}})}finally{a.submitLoading=!1}};return le(()=>{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(Y,{class:o.goodsSection,onClick:()=>{u.selectedVip(s.goodsId)?u.deleteVip(s.goodsId):u.setVip([s])}},{default:()=>[e(w,{border:!1,class:o.goodsCell},{icon:()=>e(R,{class:o.img,src:s.goodsUrl},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.goodsName,e($,{class:o.brandName},{default:()=>[i("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")}},[i("查看详情")]),e("span",{class:o.btnVideo,onClick:d=>{d.stopPropagation(),a.popupShow=!0}},[i("介绍视频")])])]),e("i",{class:u.selectedVip(s.goodsId)?o.selected:o.noSelected},null)])}),e(w,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),b(s.currentPrice)])]),s.currentPrice<s.originalPrice&&e("del",null,[i("¥"),b(s.originalPrice)])])}),s.membershipDays>0&&e(w,{border:!1,class:o.giftCell},{title:()=>e("div",{class:o.gift},[e("img",{src:de,class:o.iconGift},null),i("现在购买赠送 "),e("span",null,[s.membershipDays||0]),i("天有效期")])})]}))]),a.bugGoods&&e(ie,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:Ze,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(B,{class:o.goSelect,type:"primary",onClick:()=>{c.push("/goods-list")}},{default:()=>[i("进入商城选购"),e(L,{name:"arrow"},null)]})])]):u.getGoods.map((s,d)=>e(Y,{class:o.goodsSection},{default:()=>[e(w,{border:!1,class:o.goodsCell},{icon:()=>e(R,{class:o.img,src:s.pic},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[s.name,e($,{class:o.brandName},{default:()=>[s.brandName]})]),e("p",{class:[o.model]},[i("规格:"),s.spDataJson]),e("p",{class:[o.model]},[s.productSn]),e(ge,{min:1,max:99,modelValue:s.quantity,"onUpdate:modelValue":l=>s.quantity=l},null)]),e("i",{class:o.delete,onClick:()=>S(s)},null)])}),e(w,{border:!1,class:o.priceCell},{title:()=>e("div",{class:o.sPriceGroup},[e("div",{class:o.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),b(s.price)])]),s.price<s.originalPrice&&e("del",null,[i("¥"),b(s.originalPrice)])])})]}))]),u.getGoods&&u.getGoods.length>0&&e(B,{class:o.addButton,block:!0,onClick:()=>{c.push("/goods-list")}},{default:()=>[e(L,{name:"add-o"},null),i("进入商城选购")]})]),e(ce,{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,[b(g.value.amount)])]),e("del",{class:o.allPrice},[i("¥ "),b(g.value.originAmount)])]),e("div",{class:o.paymentBtn,onClick:()=>{const s=u.getVip,d=u.getGoods;if(s.length<=0&&d.length<=0){setTimeout(()=>{_("请选择需要购买的商品")},100);return}u.getToken?v():a.popupRegister=!0}},[e(B,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[i("确认购买")]})])])]}),e(x,{show:a.popupShow,"onUpdate:show":s=>a.popupShow=s,class:o.videoPopup},{default:()=>[a.popupShow&&e(pe,{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(ft,{schoolId:a.schoolId,schoolType:a.schoolType,gradeYear:a.gradeYear,onClose:()=>a.popupRegister=!1,onSubmit:v},null)]}),e(he,{title:"提示",show:a.dialogStatus,"onUpdate:show":s=>a.dialogStatus=s,message:a.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const s=a.dialogConfig.paymentConfig;c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(s.paymentConfig),orderNo:s.orderNo}}),n.pause()},onCancel:s=>{n.pause()}},null)])}});export{kt as default};
|