index-865f27bd.js 16 KB

1
  1. import{aO as E,c as Q,b as Z,m as j,t as ee,d as P,ai as z,e as A,w as te,X as se,a as e,k as oe,r as H,x as R,A as i,C as w,V as k,z as ae,N as G,E as S,D as y,b4 as le,y as $,R as ne,F as J,U as ue,q as re,P as b,I as V,Q as ie,G as O,J as L}from"./index-5346b90b.js";import{i as ce}from"./icon-gift-94736468.js";import{M as de}from"./index-21b43179.js";import{M as pe}from"./index-bbc0018d.js";import{M as me}from"./index-fe6d6122.js";import{u as W,S as ge}from"./student-register-store-b2d04e3b.js";import{F as fe}from"./index-1ff19d65.js";import{R as _e,a as M}from"./index-f66a0748.js";import{T as B}from"./index-9ce5f238.js";import{P as U}from"./index-d0314496.js";import{F as x}from"./index-9cb66129.js";import{O as he}from"./index-c3b067d9.js";import{C as Y}from"./index-d40ba795.js";import{C as T}from"./index-088cbd90.js";import{I as q}from"./index-f99c3d9b.js";/* empty css */import"./index-3ac5f0cc.js";import"./Checker-84cc6b6c.js";function Se(s,l){const{days:c}=l;let{hours:a,minutes:n,seconds:u,milliseconds:_}=l;if(s.includes("DD")?s=s.replace("DD",E(c)):a+=c*24,s.includes("HH")?s=s.replace("HH",E(a)):n+=a*60,s.includes("mm")?s=s.replace("mm",E(n)):u+=n*60,s.includes("ss")?s=s.replace("ss",E(u)):_+=u*1e3,s.includes("S")){const g=E(_,3);s.includes("SSS")?s=s.replace("SSS",g):s.includes("SS")?s=s.replace("SS",g.slice(0,2)):s=s.replace("S",g.charAt(0))}return s}const[ye,Ce]=Q("count-down"),ve={time:Z(0),format:j("HH:mm:ss"),autoStart:ee,millisecond:Boolean};var be=P({name:ye,props:ve,emits:["change","finish"],setup(s,{emit:l,slots:c}){const{start:a,pause:n,reset:u,current:_}=z({time:+s.time,millisecond:s.millisecond,onChange:v=>l("change",v),onFinish:()=>l("finish")}),g=A(()=>Se(s.format,_.value)),C=()=>{u(+s.time),s.autoStart&&a()};return te(()=>s.time,C,{immediate:!0}),se({start:a,pause:n,reset:C}),()=>e("div",{role:"timer",class:Ce()},[c.default?c.default(_.value):g.value])}});const xe=oe(be),Fe="_studentSection_v4ks1_7",Ee="_goodsSection_v4ks1_25",Te="_titleTool_v4ks1_36",ke="_titleBuy_v4ks1_45",De="_goodsCell_v4ks1_52",we="_noSelected_v4ks1_57",Ae="_selected_v4ks1_58",Be="_img_v4ks1_78",Pe="_brandName_v4ks1_93",Ie="_model_v4ks1_104",Ne="_sbtnGroup_v4ks1_114",Ge="_btnDetail_v4ks1_126",Re="_btnVideo_v4ks1_127",Ve="_priceCell_v4ks1_167",Oe="_sPriceGroup_v4ks1_170",Le="_tg_v4ks1_178",Me="_giftCell_v4ks1_202",Ue="_gift_v4ks1_202",Ye="_iconGift_v4ks1_220",qe="_goodsEmpty_v4ks1_225",ze="_shopImg_v4ks1_233",He="_goodsContainer_v4ks1_237",$e="_tips_v4ks1_246",Je="_goSelect_v4ks1_251",We="_addButton_v4ks1_270",Xe="_paymentContainer_v4ks1_290",Ke="_needPrice_v4ks1_300",Qe="_allPrice_v4ks1_313",Ze="_videoPopup_v4ks1_333",o={"student-register":"_student-register_v4ks1_1",studentSection:Fe,goodsSection:Ee,titleTool:Te,titleBuy:ke,goodsCell:De,noSelected:we,selected:Ae,delete:"_delete_v4ks1_59",img:Be,brandName:Pe,model:Ie,sbtnGroup:Ne,btnDetail:Ge,btnVideo:Re,priceCell:Ve,sPriceGroup:Oe,tg:Le,giftCell:Me,gift:Ue,iconGift:Ye,goodsEmpty:qe,shopImg:ze,goodsContainer:He,tips:$e,goSelect:Je,addButton:We,paymentContainer:Xe,needPrice:Ke,allPrice:Qe,videoPopup:Ze},je=""+new URL("shop-empty-6c02d334.png",import.meta.url).href,et="_registerModal_1cilx_1",tt="_infoTitle_1cilx_7",st="_registerForm_1cilx_13",ot="_tips_1cilx_20",at="_codeText_1cilx_40",lt="_codeTextDisabled_1cilx_45",nt="_submitBtn_1cilx_48",ut="_radioSection_1cilx_58",rt="_radioItem_1cilx_65",f={registerModal:et,infoTitle:tt,registerForm:st,tips:ot,codeText:at,codeTextDisabled:lt,submitBtn:nt,radioSection:ut,radioItem:rt},it=""+new URL("info-title-1f45c1de.png",import.meta.url).href,ct=W(),X=[];for(let s=1;s<=40;s++)X.push({text:s+"班",value:s});const dt=P({name:"register-modal",props:{schoolId:{type:String,default:""},gradeYear:{type:String,default:""},schoolType:{type:String,default:""}},emits:["close","submit"],setup(s,{emit:l}){const c=H(),a=A(()=>{let r=[];const m=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],p=[{text:"六年级",value:6}],F=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return s.gradeYear==="FIVE_YEAR_SYSTEM"?r.push([...m]):s.gradeYear==="SIX_YEAR_SYSTEM"?r.push([...m,...p]):s.gradeYear==="THREE_YEAR_SYSTEM"?r.push([...F]):s.gradeYear==="FORE_YEAR_SYSTEM"?r.push([...p,...F]):r.push([...m,...p,...F]),r}),n=R({countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1}),u=R({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,ae(()=>{c.value.start()})},g=()=>{if(!G(u.username))return S("请输入正确的手机号码");n.imgCodeStatus=!0},C=A(()=>!!G(u.username)),v=()=>{n.countDownStatus=!0,c.value.reset()},t=async()=>{try{if(d())return;n.loading=!0;const{extra:r,...m}=u,{data:p}=await y.post("/edu-app/userlogin",{hideLoading:!1,requestType:"form",data:{...m,extra:JSON.stringify({...r,schoolId:s.schoolId})}});ct.setToken(p.token_type+" "+p.access_token),le(),l("close"),l("submit")}catch(r){}finally{n.loading=!1}},d=()=>{if(G(u.username))if(u.password)if(u.extra.nickname)if(u.extra.currentGradeNum){if(!u.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:it,class:f.infoTitle},null),e(fe,{labelAlign:"top",class:f.registerForm},{default:()=>[e(x,{clearable:!0,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",autocomplete:"off",modelValue:u.username,"onUpdate:modelValue":r=>u.username=r,maxlength:11},{label:()=>e("div",null,[i("联系方式(直接监护人)"),e("p",{class:f.tips},[i("手机号是音乐数字课堂的唯一登录账户")])])}),e(x,{center:!0,clearable:!0,label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:u.password,"onUpdate:modelValue":r=>u.password=r,maxlength:6},{button:()=>n.countDownStatus?e("span",{class:[f.codeText,C.value?"":f.codeTextDisabled],onClick:g},[i("获取验证码")]):e(xe,{ref:r=>c.value=r,"auto-start":!1,time:n.countDownTime,onFinish:v,format:"ss秒"},null)}),e(x,{clearable:!0,label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",maxlength:14,modelValue:u.extra.nickname,"onUpdate:modelValue":r=>u.extra.nickname=r},null),e(x,{clearable:!0,label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>e(_e,{"checked-color":"#ffcb75",modelValue:u.extra.gender,"onUpdate:modelValue":r=>u.extra.gender=r,direction:"horizontal"},{default:()=>[e(B,{size:"large",type:"primary",color:u.extra.gender!==1?"#EAEAEA":"#ffcb75",textColor:u.extra.gender!==1?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(M,{class:f.radioItem,name:1},null),i("男")]}),e(B,{size:"large",type:"primary",color:u.extra.gender!==0?"#EAEAEA":"#ffcb75",textColor:u.extra.gender!==0?"#AAA":"#5B2C03",class:f.radioSection,round:!0},{default:()=>[e(M,{class:f.radioItem,name:0},null),i("女")]})]})}),e(x,{clearable:!0,label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.gradeNumText,onClick:()=>n.gradeStatus=!0},null),e(x,{clearable:!0,label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:n.currentClassText,onClick:()=>n.classStatus=!0},null)]}),e(w,{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(me,{value:n.imgCodeStatus,"onUpdate:value":r=>n.imgCodeStatus=r,phone:u.username,onClose:()=>{n.imgCodeStatus=!1},onSendCode:_},null):null,e(k,{show:n.gradeStatus,"onUpdate:show":r=>n.gradeStatus=r,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[e(U,{showToolbar:!0,columns:a.value,onCancel:()=>n.gradeStatus=!1,onConfirm:r=>{const m=r.selectedOptions[0];u.extra.currentGradeNum=m.value,n.gradeNumText=m.text,n.gradeStatus=!1}},null)]}),e(k,{show:n.classStatus,"onUpdate:show":r=>n.classStatus=r,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[e(U,{showToolbar:!0,columns:X,onCancel:()=>n.classStatus=!1,onConfirm:r=>{const m=r.selectedOptions[0];u.extra.currentClass=m.value,n.currentClassText=m.text,n.classStatus=!1}},null)]})])}}),K=s=>{if(s===null)return null;const l=Object.assign({},s);return Object.keys(l).forEach(c=>l[c]=typeof s[c]=="object"?K(s[c]):s[c]),Array.isArray(s)?(l.length=s.length,Array.from(l)):l},pt="_wxPopupDialog_1sfd3_1",mt="_popupContainer_1sfd3_16",gt="_title1_1sfd3_22",ft="_popupTips_1sfd3_29",D={wxPopupDialog:pt,popupContainer:mt,title1:gt,popupTips:ft},_t=P({name:"m-wx-tip",props:{show:{type:Boolean,default:!0},title:{type:String,default:"温馨提示"},message:{type:String,default:"请使用微信打开"}},setup(s){const l=H(!1);return $(()=>{if(!ne().weixin&&s.show){l.value=!0;return}}),()=>e(J,null,[e(k,{show:l.value,"onUpdate:show":c=>l.value=c,round:!0,style:{width:"88%"},closeOnClickOverlay:!1,class:D.wxPopupDialog},{default:()=>[e("div",{class:D.popupContainer},[e("p",{class:D.title1},[s.title]),e("p",{class:D.popupTips},[s.message])])]})])}}),Gt=P({name:"student-register",setup(){const s=ue(),l=W(),c=re();l.setShoolId(s.query.sId);const a=R({schoolId:s.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(t){a.dialogMessage=`有待支付订单,请在${Math.ceil(t.total/1e3)}s后重试`},onFinish(){a.dialogStatus=!1}}),u=async()=>{let t=!1;try{const{data:d}=await y.get("/edu-app/userPaymentOrder/unpaid");if(!d.id)return!1;if(d.cancelPayment)return await y.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,t=!0}catch(d){}return t},_=async()=>{try{const{data:t}=await y.get("/edu-app/open/userOrder/registerGoods/"+a.schoolId,{noAuthorization:!0});l.setVip(t.details||[]),a.details=K(t.details||[]),a.bugGoods=t.bugGoods,a.schoolType=t.schoolType,a.gradeYear=t.gradeYear}catch(t){}},g=A(()=>{let t=0,d=0;return l.getVip.forEach(p=>{t+=Number(p.currentPrice),d+=Number(p.originalPrice)}),l.getGoods.forEach(p=>{t+=Number(p.price)*p.quantity,d+=Number(p.originalPrice)*p.quantity}),{amount:t,originAmount:d}}),C=t=>{ie({message:"是否删除该商品",confirmButtonColor:"#FF8633"}).then(()=>{l.deleteGoods(t.productSkuId)})},v=async()=>{try{a.submitLoading=!0;const t=O.get(L)||"";if(!(await y.post("/edu-app/open/user/verification",{noAuthorization:!0,data:{token:t}})).data){O.remove(L),l.deleteToken(),a.popupRegister=!0;return}if(await u())return;const m=await y.get("/edu-app/userPaymentOrder/registerStatus/"+a.schoolId),p=l.getVip,F=l.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})}),F.forEach(h=>{I.push({goodsId:h.productId,goodsNum:h.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:h.price,paymentCouponAmount:0,goodsSkuId:h.productSkuId})});const{data:N}=await y.post("/edu-app/userPaymentOrder/executeOrder",{hideLoading:!1,data:{bizId:a.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:g.value.amount||0,paymentCouponAmount:0,goodsInfos:I,orderName:"学生登记",orderDesc:"学生登记"}});c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify({...N.paymentConfig,paymentType:N.paymentType}),orderNo:N.orderNo}})}finally{a.submitLoading=!1}};return $(()=>{_()}),()=>e("div",{class:o["student-register"]},[e("div",{class:o.studentSection,style:{marginTop:"18px"}},[e("div",{class:o.titleTool},null),a.details.map(t=>e(Y,{class:o.goodsSection,onClick:()=>{l.selectedVip(t.goodsId)?l.deleteVip(t.goodsId):l.setVip([t])}},{default:()=>[e(T,{border:!1,class:o.goodsCell},{icon:()=>e(q,{class:o.img,src:t.goodsUrl},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[t.goodsName,e(B,{class:o.brandName},{default:()=>[i("12个月")]})]),e("p",{class:[o.model]},[t.description])]),e("i",{class:l.selectedVip(t.goodsId)?o.selected:o.noSelected},null)])}),e(T,{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(t.currentPrice)])]),t.currentPrice<t.originalPrice&&e("del",null,[i("¥"),b(t.originalPrice)])])}),t.membershipDays>0&&e(T,{border:!1,class:o.giftCell},{title:()=>e("div",{class:o.gift},[e("img",{src:ce,class:o.iconGift},null),i("现在购买赠送 "),e("span",null,[t.membershipDays||0]),i("天有效期")])})]}))]),a.bugGoods&&e(J,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:je,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(w,{class:o.goSelect,type:"primary",onClick:()=>{c.push("/goods-list")}},{default:()=>[i("进入商城选购"),e(V,{name:"arrow"},null)]})])]):l.getGoods.map(t=>e(Y,{class:o.goodsSection},{default:()=>[e(T,{border:!1,class:o.goodsCell},{icon:()=>e(q,{class:o.img,src:t.pic},null),title:()=>e("div",{class:o.section},[e("div",{class:o.sectionContent},[e("h2",null,[t.name,e(B,{class:o.brandName},{default:()=>[t.brandName]})]),e("p",{class:[o.model]},[i("规格:"),t.spDataJson]),e("p",{class:[o.model]},[t.productSn]),e(ge,{min:1,max:99,modelValue:t.quantity,"onUpdate:modelValue":d=>t.quantity=d},null)]),e("i",{class:o.delete,onClick:()=>C(t)},null)])}),e(T,{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(t.price)])]),t.price<t.originalPrice&&e("del",null,[i("¥"),b(t.originalPrice)])])})]}))]),l.getGoods&&l.getGoods.length>0&&e(w,{class:o.addButton,block:!0,onClick:()=>{c.push("/goods-list")}},{default:()=>[e(V,{name:"add-o"},null),i("进入商城选购")]})]),e(de,{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 t=l.getVip,d=l.getGoods;if(t.length<=0&&d.length<=0){setTimeout(()=>{S("请选择需要购买的商品")},100);return}l.getToken?v():a.popupRegister=!0}},[e(w,{disabled:a.submitLoading,loading:a.submitLoading},{default:()=>[i("确认购买")]})])])]}),e(k,{show:a.popupShow,"onUpdate:show":t=>a.popupShow=t,class:o.videoPopup},{default:()=>[a.popupShow&&e(pe,{src:"https://daya.ks3-cn-beijing.ksyun.com/202105/SWmqmvW.mp4"},null)]}),e(k,{show:a.popupRegister,"onUpdate:show":t=>a.popupRegister=t,class:o.registerPopup,position:"bottom",round:!0},{default:()=>[e(dt,{schoolId:a.schoolId,schoolType:a.schoolType,gradeYear:a.gradeYear,onClose:()=>a.popupRegister=!1,onSubmit:v},null)]}),e(he,{title:"提示",show:a.dialogStatus,"onUpdate:show":t=>a.dialogStatus=t,message:a.dialogMessage,allowHtml:!0,confirmButtonText:"继续支付",onConfirm:()=>{const t=a.dialogConfig.paymentConfig;c.push({path:"/order-detail",query:{pm:1,config:JSON.stringify(t.paymentConfig),orderNo:t.orderNo}}),n.pause()},onCancel:t=>{n.pause()}},null),e(_t,null,null)])}});export{Gt as default};