index-6da8b794.js 16 KB

1
  1. import{aP as T,c as J,b as W,m as X,t as K,d as N,ah as q,e as v,w as Q,X as Z,a as e,k as j,r as ee,x as G,A as i,C as A,V as B,z as te,N as k,E as S,D as C,aY as oe,U as se,q as ae,y as ne,P as E,F as ue,I as R,Q as le,G as V,J as L}from"./index-a890cc58.js";import{i as re}from"./icon-gift-94736468.js";import{M as ie}from"./index-063ac654.js";import{M as ce}from"./index-b0f89b26.js";import{O as de}from"./index-30437c8c.js";import{M as pe}from"./index-ac852b17.js";import{u as z,S as me}from"./student-register-store-c341e218.js";import{F as ge}from"./index-3369ec7a.js";import{R as fe,a as M}from"./index-5116aff3.js";import{T as w}from"./index-a2e64ebf.js";import{P as O}from"./index-56347a11.js";import{F}from"./index-5929a3eb.js";import{O as _e}from"./index-380a8ca3.js";import{C as Y}from"./index-2acfe5f2.js";import{C as D}from"./index-46403f33.js";import{I as U}from"./index-3819b2ef.js";/* empty css */import"./index-6ddd35ab.js";import"./Checker-f7dfba56.js";import"./index-e8c4b787.js";function he(o,u){const{days:d}=u;let{hours:a,minutes:n,seconds:r,milliseconds:_}=u;if(o.includes("DD")?o=o.replace("DD",T(d)):a+=d*24,o.includes("HH")?o=o.replace("HH",T(a)):n+=a*60,o.includes("mm")?o=o.replace("mm",T(n)):r+=n*60,o.includes("ss")?o=o.replace("ss",T(r)):_+=r*1e3,o.includes("S")){const g=T(_,3);o.includes("SSS")?o=o.replace("SSS",g):o.includes("SS")?o=o.replace("SS",g.slice(0,2)):o=o.replace("S",g.charAt(0))}return o}const[Se,Ce]=J("count-down"),ye={time:W(0),format:X("HH:mm:ss"),autoStart:K,millisecond:Boolean};var be=N({name:Se,props:ye,emits:["change","finish"],setup(o,{emit:u,slots:d}){const{start:a,pause:n,reset:r,current:_}=q({time:+o.time,millisecond:o.millisecond,onChange:b=>u("change",b),onFinish:()=>u("finish")}),g=v(()=>he(o.format,_.value)),y=()=>{r(+o.time),o.autoStart&&a()};return Q(()=>o.time,y,{immediate:!0}),Z({start:a,pause:n,reset:y}),()=>e("div",{role:"timer",class:Ce()},[d.default?d.default(_.value):g.value])}});const Ee=j(be),Fe="_studentSection_1mcnc_7",xe="_goodsSection_1mcnc_25",Te="_titleTool_1mcnc_36",De="_titleBuy_1mcnc_45",Ae="_goodsCell_1mcnc_52",ve="_noSelected_1mcnc_57",Be="_selected_1mcnc_58",we="_img_1mcnc_78",Ie="_brandName_1mcnc_91",Pe="_model_1mcnc_101",ke="_sbtnGroup_1mcnc_111",Ge="_btnDetail_1mcnc_123",Ne="_btnVideo_1mcnc_124",Re="_priceCell_1mcnc_164",Ve="_sPriceGroup_1mcnc_167",Le="_tg_1mcnc_175",Me="_giftCell_1mcnc_198",Oe="_gift_1mcnc_198",Ye="_iconGift_1mcnc_216",Ue="_goodsEmpty_1mcnc_221",qe="_shopImg_1mcnc_230",ze="_goodsContainer_1mcnc_234",He="_tips_1mcnc_242",$e="_goSelect_1mcnc_247",Je="_addButton_1mcnc_266",We="_paymentContainer_1mcnc_285",Xe="_needPrice_1mcnc_295",Ke="_allPrice_1mcnc_308",Qe="_videoPopup_1mcnc_327",s={"student-register":"_student-register_1mcnc_1",studentSection:Fe,goodsSection:xe,titleTool:Te,titleBuy:De,goodsCell:Ae,noSelected:ve,selected:Be,delete:"_delete_1mcnc_59",img:we,brandName:Ie,model:Pe,sbtnGroup:ke,btnDetail:Ge,btnVideo:Ne,priceCell:Re,sPriceGroup:Ve,tg:Le,giftCell:Me,gift:Oe,iconGift:Ye,goodsEmpty:Ue,shopImg:qe,goodsContainer:ze,tips:He,goSelect:$e,addButton:Je,paymentContainer:We,needPrice:Xe,allPrice:Ke,videoPopup:Qe},Ze=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,je="_registerModal_2xcbb_1",et="_infoTitle_2xcbb_7",tt="_registerForm_2xcbb_13",ot="_tips_2xcbb_20",st="_codeText_2xcbb_40",at="_codeTextDisabled_2xcbb_45",nt="_submitBtn_2xcbb_48",ut="_radioSection_2xcbb_58",lt="_radioItem_2xcbb_65",f={registerModal:je,infoTitle:et,registerForm:tt,tips:ot,codeText:st,codeTextDisabled:at,submitBtn:nt,radioSection:ut,radioItem:lt},rt=""+new URL("info-title-1f45c1de.png",import.meta.url).href,it=z(),H=[];for(let o=1;o<=40;o++)H.push({text:o+"班",value:o});const ct=N({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(o,{emit:u}){const d=ee(),a=v(()=>{let l=[];const m=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],p=[{text:"六年级",value:6}],x=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return o.gradeYear==="FIVE_YEAR_SYSTEM"?l.push([...m]):o.gradeYear==="SIX_YEAR_SYSTEM"?l.push([...m,...p]):o.gradeYear==="THREE_YEAR_SYSTEM"?l.push([...x]):o.gradeYear==="FORE_YEAR_SYSTEM"?l.push([...p,...x]):l.push([...m,...p,...x]),l}),n=G({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),r=G({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:"",gender:1},grant_type:"password",loginType:"SMS",password:"",username:""}),_=()=>{n.countDownStatus=!1,te(()=>{d.value.start()})},g=()=>{if(!k(r.username))return S("请输入正确的手机号码");n.imgCodeStatus=!0},y=v(()=>!!k(r.username)),b=()=>{n.countDownStatus=!0,d.value.reset()},t=async()=>{try{if(c())return;n.loading=!0;const{extra:l,...m}=r,{data:p}=await C.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...m,extra:JSON.stringify({...l,schoolId:o.schoolId})}});it.setToken(p.token_type+" "+p.access_token),oe(),u("close"),u("submit")}catch(l){}finally{n.loading=!1}},c=()=>{if(k(r.username))if(r.password)if(r.extra.nickname)if(r.extra.currentGradeNum){if(!r.extra.currentClass)return S("请选择所在班级"),!0}else return S("请选择所在年级"),!0;else return S("请输入学生姓名"),!0;else return S("请输入验证码"),!0;else return S("请输入正确的手机号码"),!0;return!1};return()=>e("div",{class:f.registerModal},[e("img",{src:rt,class:f.infoTitle},null),e(ge,{labelAlign:"top",class:f.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:f.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:[f.codeText,y.value?"":f.codeTextDisabled],onClick:g},[i("获取验证码")]):e(Ee,{ref:l=>d.value=l,"auto-start":!1,time:n.countDownTime,onFinish:b,format:"ss秒"},null)}),e(F,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",maxlength:14,modelValue:r.extra.nickname,"onUpdate:modelValue":l=>r.extra.nickname=l},null),e(F,{clearable:!0,label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>e(fe,{"checked-color":"#ffcb75",modelValue:r.extra.gender,"onUpdate:modelValue":l=>r.extra.gender=l,direction:"horizontal"},{default:()=>[e(w,{size:"large",type:"primary",color:r.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:r.extra.gender!==1?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(M,{class:f.radioItem,name:1},null),i("男")]}),e(w,{size:"large",type:"primary",color:r.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:r.extra.gender!==0?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(M,{class:f.radioItem,name:0},null),i("女")]})]})}),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(de,{center:!0,modelValue:n.modelValue,"onUpdate:modelValue":l=>n.modelValue=l,prototcolType:"REGISTER"},null),e(A,{type:"primary",class:f.submitBtn,color:"linear-gradient(121deg, #FFD892 0%, #FFCB75 100%)",block:!0,onClick:t,disabled:n.loading,loading:n.loading},{default:()=>[i("确认")]}),n.imgCodeStatus?e(pe,{value:n.imgCodeStatus,"onUpdate:value":l=>n.imgCodeStatus=l,phone:r.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:_},null):null,e(B,{show:n.gradeStatus,"onUpdate:show":l=>n.gradeStatus=l,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(O,{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(B,{show:n.classStatus,"onUpdate:show":l=>n.classStatus=l,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(O,{showToolbar:!0,columns:H,onCancel:()=>n.classStatus=!1,onConfirm:l=>{const m=l.selectedOptions[0];r.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),$=o=>{if(o===null)return null;const u=Object.assign({},o);return Object.keys(u).forEach(d=>u[d]=typeof o[d]=="object"?$(o[d]):o[d]),Array.isArray(o)?(u.length=o.length,Array.from(u)):u},It=N({name:"student-register",setup(){const o=se(),u=z(),d=ae();u.setShoolId(o.query.sId);const a=G({schoolId:o.query.sId,popupShow:!1,popupRegister:!1,details:[],schoolType:"",gradeYear:"",bugGoods:!1,submitLoading:!1,dialogStatus:!1,dialogMessage:"",countDownTime:60*1e3,dialogConfig:{}}),n=q({time:a.countDownTime,onChange(t){a.dialogMessage=`有待支付订单,请在${Math.ceil(t.total/1e3)}s后重试`},onFinish(){a.dialogStatus=!1}}),r=async()=>{let t=!1;try{const{data:c}=await C.get("/edu-app/userPaymentOrder/unpaid");if(!c.id)return!1;if(c.cancelPayment)return await C.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,t=!0}catch(c){}return t},_=async()=>{try{const{data:t}=await C.get("/edu-app/open/userOrder/registerGoods/"+a.schoolId,{noAuthorization:!0});u.setVip(t.details||[]),a.details=$(t.details||[]),a.bugGoods=t.bugGoods,a.schoolType=t.schoolType,a.gradeYear=t.gradeYear}catch(t){}},g=v(()=>{let t=0,c=0;return u.getVip.forEach(p=>{t+=Number(p.currentPrice),c+=Number(p.originalPrice)}),u.getGoods.forEach(p=>{t+=Number(p.price)*p.quantity,c+=Number(p.originalPrice)*p.quantity}),{amount:t,originAmount:c}}),y=t=>{le({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{u.deleteGoods(t.productSkuId)})},b=async()=>{try{a.submitLoading=!0;const t=V.get(L)||"";if(!(await C.post("/edu-app/open/user/verification",{noAuthorization:!0,data:{token:t}})).data){V.remove(L),u.deleteToken(),a.popupRegister=!0;return}if(await r())return;const m=await C.get("/edu-app/userPaymentOrder/registerStatus/"+a.schoolId),p=u.getVip,x=u.getGoods;if(m.data.hasBuyCourse&&p.length>0){setTimeout(()=>{S("您已购买数字化器乐学练工具,请勿重复购买")},100);return}const I=[];p.forEach(h=>{I.push({goodsId:h.goodsId,goodsNum:1,goodsType:h.goodsType,paymentCashAmount:h.currentPrice,paymentCouponAmount:0})}),x.forEach(h=>{I.push({goodsId:h.productId,goodsNum:h.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:h.price,paymentCouponAmount:0,goodsSkuId:h.productSkuId})});const{data:P}=await C.post("/edu-app/userPaymentOrder/executeOrder",{hideLoading:!1,data:{paymentType:"adapay",bizId:a.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:g.value.amount||0,paymentCouponAmount:0,goodsInfos:I,orderName:"学生登记",orderDesc:"学生登记"}});d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...P.paymentConfig,paymentType:P.paymentType}),orderNo:P.orderNo}})}finally{a.submitLoading=!1}};return ne(()=>{_()}),()=>e("div",{class:s["student-register"]},[e("div",{class:s.studentSection,style:{marginTop:"18px"}},[e("div",{class:s.titleTool},null),a.details.map(t=>e(Y,{class:s.goodsSection,onClick:()=>{u.selectedVip(t.goodsId)?u.deleteVip(t.goodsId):u.setVip([t])}},{default:()=>[e(D,{border:!1,class:s.goodsCell},{icon:()=>e(U,{class:s.img,src:t.goodsUrl},null),title:()=>e("div",{class:s.section},[e("div",{class:s.sectionContent},[e("h2",null,[t.goodsName,e(w,{class:s.brandName},{default:()=>[i("12个月")]})]),e("p",{class:[s.model]},[t.description]),e("div",{class:s.sbtnGroup},[e("span",{class:s.btnDetail,onClick:c=>{c.stopPropagation(),d.push("/student-digital-tools")}},[i("查看详情")]),e("span",{class:s.btnVideo,onClick:c=>{c.stopPropagation(),a.popupShow=!0}},[i("介绍视频")])])]),e("i",{class:u.selectedVip(t.goodsId)?s.selected:s.noSelected},null)])}),e(D,{border:!1,class:s.priceCell},{title:()=>e("div",{class:s.sPriceGroup},[e("div",{class:s.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),E(t.currentPrice)])]),t.currentPrice<t.originalPrice&&e("del",null,[i("¥"),E(t.originalPrice)])])}),t.membershipDays>0&&e(D,{border:!1,class:s.giftCell},{title:()=>e("div",{class:s.gift},[e("img",{src:re,class:s.iconGift},null),i("现在购买赠送 "),e("span",null,[t.membershipDays||0]),i("天有效期")])})]}))]),a.bugGoods&&e(ue,null,[e("div",{class:s.studentSection},[e("div",{class:s.titleBuy},null),u.getGoods&&u.getGoods.length<=0?e("div",{class:s.goodsEmpty},[e("img",{src:Ze,class:s.shopImg},null),e("div",{class:s.goodsContainer},[e("h2",null,[i("为你的"),e("span",null,[i("音乐之旅")]),i("做好准备")]),e("p",{class:s.tips},[i("快去选购乐器吧~")]),e(A,{class:s.goSelect,type:"primary",onClick:()=>{d.push("/goods-list")}},{default:()=>[i("进入商城选购"),e(R,{name:"arrow"},null)]})])]):u.getGoods.map((t,c)=>e(Y,{class:s.goodsSection},{default:()=>[e(D,{border:!1,class:s.goodsCell},{icon:()=>e(U,{class:s.img,src:t.pic},null),title:()=>e("div",{class:s.section},[e("div",{class:s.sectionContent},[e("h2",null,[t.name,e(w,{class:s.brandName},{default:()=>[t.brandName]})]),e("p",{class:[s.model]},[i("规格:"),t.spDataJson]),e("p",{class:[s.model]},[t.productSn]),e(me,{min:1,max:99,modelValue:t.quantity,"onUpdate:modelValue":l=>t.quantity=l},null)]),e("i",{class:s.delete,onClick:()=>y(t)},null)])}),e(D,{border:!1,class:s.priceCell},{title:()=>e("div",{class:s.sPriceGroup},[e("div",{class:s.tg},[i("团购价:"),e("span",null,[e("i",null,[i("¥ ")]),E(t.price)])]),t.price<t.originalPrice&&e("del",null,[i("¥"),E(t.originalPrice)])])})]}))]),u.getGoods&&u.getGoods.length>0&&e(A,{class:s.addButton,block:!0,onClick:()=>{d.push("/goods-list")}},{default:()=>[e(R,{name:"add-o"},null),i("进入商城选购")]})]),e(ie,{position:"bottom"},{default:()=>[e("div",{class:s.paymentContainer},[e("div",{class:s.payemntPrice},[e("span",{class:s.needPrice},[e("i",{style:"font-style: normal"},[i("¥ ")]),e("span",null,[E(g.value.amount)])]),e("del",{class:s.allPrice},[i("¥ "),E(g.value.originAmount)])]),e("div",{class:s.paymentBtn,onClick:()=>{const t=u.getVip,c=u.getGoods;if(t.length<=0&&c.length<=0){setTimeout(()=>{S("请选择需要购买的商品")},100);return}u.getToken?b():a.popupRegister=!0}},[e(A,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[i("确认购买")]})])])]}),e(B,{show:a.popupShow,"onUpdate:show":t=>a.popupShow=t,class:s.videoPopup},{default:()=>[a.popupShow&&e(ce,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(B,{show:a.popupRegister,"onUpdate:show":t=>a.popupRegister=t,class:s.registerPopup,position:"bottom",round:!0},{default:()=>[e(ct,{schoolId:a.schoolId,schoolType:a.schoolType,gradeYear:a.gradeYear,onClose:()=>a.popupRegister=!1,onSubmit:b},null)]}),e(_e,{title:"提示",show:a.dialogStatus,"onUpdate:show":t=>a.dialogStatus=t,message:a.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const t=a.dialogConfig.paymentConfig;d.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(t.paymentConfig),orderNo:t.orderNo}}),n.pause()},onCancel:t=>{n.pause()}},null)])}});export{It as default};