1 |
- import{d as Z,r as D,P as ee,q as te,x as F,ag as ae,e as A,y as oe,D as c,a as o,A as d,W as M,C as se,R as T,S as P,z as re,M as S,N as m,bj as ne,J as ue,K as le,X as ie}from"./index-869d77fb.js";import{i as ce}from"./icon-gift-20293d47.js";import{M as de}from"./index-b9d9d40c.js";import{u as pe}from"./student-register-store-a294a38a.js";import{d as me}from"./deep-clone-c0d00fc2.js";import{C as fe,M as ge}from"./index-4a265525.js";import{O}from"./index-b286ae32.js";import{P as he,Q as ye,U as we,b as Te}from"./user-auth-8e7edf72.js";import{O as Se}from"./index-ba9324bc.js";import{M as Ce}from"./index-3eb77ad0.js";import{M as _e}from"./index-b693844b.js";import{F as xe}from"./index-988f61a4.js";import{F as f}from"./index-0153d173.js";import{R as Fe,a as R}from"./index-62365511.js";import{T as G}from"./index-70d6770d.js";import{P as k}from"./index-6f985828.js";import"./index-8150a3e4.js";import"./index-e76f2a88.js";import"./index-cff93552.js";import"./index-1c6c2ec0.js";import"./index-32adfdfb.js";import"./browser-e949d08f.js";import"./index-155c29c2.js";import"./Checker-4ac02e10.js";const Ae="_registerModal_81pmp_1",Ee="_registerModalSection_81pmp_6",Ie="_infoTitle_81pmp_11",be="_registerForm_81pmp_17",ve="_fieldTipsGroup_81pmp_24",Be="_fieldTips_81pmp_24",Ne="_tips_81pmp_36",De="_username_81pmp_43",Me="_countDown_81pmp_51",Pe="_codeText_81pmp_68",Oe="_memberNumer_81pmp_72",Re="_iconGift_81pmp_85",Ge="_paymentContainer_81pmp_95",ke="_giftTip_81pmp_105",Ve="_needPrice_81pmp_109",Ue="_allPrice_81pmp_124",qe="_radioSection_81pmp_143",Le="_radioItem_81pmp_152",n={registerModal:Ae,registerModalSection:Ee,infoTitle:Ie,registerForm:be,fieldTipsGroup:ve,fieldTips:Be,tips:Ne,username:De,countDown:Me,codeText:Pe,memberNumer:Oe,iconGift:Re,paymentContainer:Ge,giftTip:ke,needPrice:Ve,allPrice:Ue,radioSection:qe,radioItem:Le},Ye=""+new URL("r-title-3544dc16.png",import.meta.url).href,$e=""+new URL("gift-tip-43b54b61.png",import.meta.url).href,g=pe(),E=[];for(let p=1;p<=40;p++)E.push({text:p+"班",value:p});const gt=Z({name:"register-modal",setup(){const p=D(),I=ee(),b=te(),C=D([]),t=F({schoolId:I.query.schoolId,countDownStatus:!0,countDownTime:1e3*120,modelValue:!1,imgCodeStatus:!1,gradeNumText:"",currentClassText:"",gradeStatus:!1,classStatus:!1,loading:!1,details:{},schoolType:"",gradeYear:"",bugGoods:!1,registerType:"",giftVipDay:0,dialogStatus:!1,dialogMessage:"",dialogConfirmStatus:!1,paymentType:"",contract_sign:!1,countDownTimePay:60*1e3,dialogConfig:{},showMore:!0,showOtherSchool:!1,showOtherMessage:"",showTips:!1,showButton:!1,showMessage:"请使用微信打开"}),r=F({showQrcode:!1,qrCodeUrl:"",pay_channel:"",orderInfo:{},authShow:!1,orderNo:null,config:{},paymentStatus:!1,orderTimer:null}),s=F({autoRegister:!0,client_id:"cooleshow-student",client_secret:"cooleshow-student",extra:{nickname:"",currentGradeNum:"",currentClass:"",gender:1,registerType:null,giftVipDay:0},grant_type:"password",loginType:"SMS",password:"",username:""}),h=ae({time:t.countDownTimePay,onChange(e){t.dialogMessage=`有待支付订单,请在${Math.ceil(e.total/1e3)}s后重试`},onFinish(){t.dialogStatus=!1}}),V=()=>{t.countDownStatus=!1,re(()=>{p.value.start()})},U=()=>{if(!S(s.username))return m("请输入正确的手机号码");t.imgCodeStatus=!0},q=A(()=>!!S(s.username)),v=A(()=>r.orderInfo.orderType),L=()=>{t.countDownStatus=!0,p.value.reset()},B=async(e=!1)=>{var a;try{if(Y())return;t.loading=!0;const{extra:u,...i}=s;if(!e){const w=await c.get(`/edu-app/open/student/studentSchool?mobile=${s.username}&code=${s.password}&type=REGISTER`);if(w&&w.schoolId!==t.schoolId){t.showOtherSchool=!0,t.showOtherMessage=`您已绑定【${t.details.schoolName||""}】,提交后将更换到【${(a=w.data)==null?void 0:a.schoolName}】,是否确认提交?`;return}}const l=await c.post("/edu-app/userlogin",{requestType:"form",data:{...i,extra:JSON.stringify({...u,schoolId:t.schoolId})}});if(l.code!==200)l.code===5436?(t.showTips=!0,t.showMessage="二维码已经失效,详情请咨询学校老师",t.showButton=!1):l.code===5435&&(t.showTips=!0,t.showMessage=l.message,t.showButton=!0);else{g.setToken(l.data.token_type+" "+l.data.access_token),ne();const w=await c.get("/edu-app/user/getUserInfo",{requestType:"form"});ue(w.data),await H()}}catch(u){}finally{t.loading=!1}},Y=()=>{if(S(s.username))if(s.password)if(s.extra.nickname)if(s.extra.currentGradeNum){if(!s.extra.currentClass)return m("请选择所在班级"),!0}else return m("请选择所在年级"),!0;else return m("请输入学生姓名"),!0;else return m("请输入验证码"),!0;else return m("请输入正确的手机号码"),!0;return!1},$=()=>{let e=[];const a=[{text:"一年级",value:1},{text:"二年级",value:2},{text:"三年级",value:3},{text:"四年级",value:4},{text:"五年级",value:5}],u=[{text:"六年级",value:6}],i=[{text:"七年级",value:7},{text:"八年级",value:8},{text:"九年级",value:9}];return t.gradeYear==="FIVE_YEAR_SYSTEM"?e.push([...a]):t.gradeYear==="SIX_YEAR_SYSTEM"?e.push([...a,...u]):t.gradeYear==="THREE_YEAR_SYSTEM"?e.push([...i]):t.gradeYear==="FORE_YEAR_SYSTEM"?e.push([...u,...i]):e.push([...a,...u,...i]),e},z=async()=>{try{const{data:e}=await c.get("/edu-app/open/userOrder/registerGoods/"+t.schoolId,{noAuthorization:!0});g.setVip(e.details||[]);const a=me(e.details||[]);if(a.length>0&&(t.giftVipDay=a[0].membershipDays),t.bugGoods=e.bugGoods,t.schoolType=e.schoolType,t.gradeYear=e.gradeYear,t.registerType=e.registerType,s.extra.giftVipDay=t.giftVipDay,s.extra.registerType=t.registerType,P().weixin){if(e.schoolStatus===0&&t.schoolId=="1770035687490105346"){t.showTips=!0,t.showMessage="团购时间已截止,感谢您的参与",t.showButton=!1;return}if(e.registerType!=="BUG_GOODS"||e.schoolStatus===0){t.showTips=!0,t.showMessage="二维码已经失效,详情请咨询学校老师",t.showButton=!1;return}}else t.showTips=!0}catch(e){}},y=A(()=>{let e=0,a=0;return g.getVip.forEach(i=>{e+=Number(i.currentPrice),a+=Number(i.originalPrice)}),{amount:e,originAmount:a}}),H=async()=>{try{if(await Q())return;const a=await c.get("/edu-app/userPaymentOrder/registerStatus/"+t.schoolId),u=g.getVip;if(a.data.hasBuyCourse&&u.length>0){t.dialogConfirmStatus=!0;return}await _()}catch(e){}},Q=async()=>{let e=!1;try{const{data:a}=await c.get("/edu-app/userPaymentOrder/unpaid");if(!a.id)return!1;if(a.cancelPayment)return await c.post("/edu-app/userPaymentOrder/cancelPayment/"+a.orderNo),!1;t.countDownTime=a.cancelTimes,h.reset(Number(a.cancelTimes)),h.start(),t.dialogMessage=`有待支付订单,请在${Math.ceil(h.current.value.total/1e3)}s后重试`,t.dialogStatus=!0,t.dialogConfig=a,e=!0}catch(a){}return e},_=async()=>{try{const e=g.getVip,a=g.getGoods,u=[];e.forEach(l=>{u.push({giftVipDay:l.membershipDays,goodsId:l.goodsId,goodsNum:1,goodsType:l.goodsType,paymentCashAmount:l.currentPrice,paymentCouponAmount:0})}),a.forEach(l=>{u.push({goodsId:l.productId,goodsNum:l.quantity,goodsType:"INSTRUMENTS",paymentCashAmount:l.price,paymentCouponAmount:0,goodsSkuId:l.productSkuId})});const i=await c.post("/edu-app/userPaymentOrder/executeOrder",{data:{registerType:t.registerType,paymentType:t.paymentType,bizId:t.schoolId,orderType:"SCHOOL_REGISTER",paymentCashAmount:y.value.amount||0,paymentCouponAmount:0,goodsInfos:u,orderName:"学生登记",orderDesc:"学生登记"}});i.code===5436?(t.showTips=!0,t.showMessage="二维码已经失效,详情请咨询学校老师",t.showButton=!1):i.code===5435?(t.showTips=!0,t.showMessage=i.message,t.showButton=!0):(r.config={...i.data.paymentConfig,paymentType:i.data.paymentType},r.orderNo=i.data.orderNo,await N())}catch(e){console.log(e,"any")}},N=async()=>{try{const e=le.user.data;if(t.contract_sign&&(!(e!=null&&e.account.realName)||!(e!=null&&e.account.idCardNo))){r.authShow=!0;return}const{data:a}=await c.post("/edu-app/userPaymentOrder/updateReceiveAddress",{data:{orderNo:r.orderNo,orderType:"SCHOOL_REGISTER"}});r.pay_channel=a.paymentChannel,a.status!=="WAIT_PAY"&&a.status!=="PAYING"?b.replace({path:"/payment-result",query:{orderNo:r.orderNo}}):W()}catch(e){}},W=()=>{const e=r.pay_channel;if(e){const a=Te(r.pay_channel);x({payCode:a,pay_channel:e})}else v.value==="VIP"?r.paymentStatus=!0:x({payCode:"payResult",pay_channel:"wx_pub"})},x=e=>{const a=r.config;r.pay_channel=e.pay_channel;const u=ie.stringify({pay_channel:e.pay_channel,wxAppId:a.wxAppId,alipayAppId:a.alipayAppId,paymentType:t.paymentType,body:a.body,price:a.price,orderNo:a.merOrderNo,userId:a.userId});e.payCode==="payResult"?window.location.href=window.location.origin+"/classroom-app/#/payResult?"+u:(r.qrCodeUrl=window.location.origin+"/classroom-app/#/payDefine?"+u,r.showQrcode=!0,r.paymentStatus=!1,setTimeout(()=>{X()},300))},J=async()=>{try{await c.post("/edu-app/userPaymentOrder/cancelPayment/"+r.orderNo)}catch(e){}},X=async()=>{const e=setInterval(async()=>{if(I.name!="student-register-form"){clearInterval(e);return}r.orderTimer=e;try{const{data:a}=await c.post("/edu-app/open/userOrder/paymentStatus/"+r.orderNo,{hideLoading:!0});a.status!=="WAIT_PAY"&&a.status!=="PAYING"&&(r.showQrcode=!1,clearInterval(r.orderTimer),setTimeout(()=>{b.replace({path:"/payment-result",query:{orderNo:r.orderNo}})},100))}catch(a){clearInterval(r.orderTimer)}},5e3)},j=()=>{r.authShow=!1,_()},K=async()=>{if(!(s.password.length!==6||!S(s.username)))try{const{data:e}=await c.get(`/edu-app/open/student/studentInfo?mobile=${s.username}&code=${s.password}&type=REGISTER`);if(e){s.extra.nickname||(s.extra.nickname=e.nickname),s.extra.currentGradeNum||(s.extra.currentGradeNum=e.currentGradeNum),s.extra.currentClass||(s.extra.currentClass=e.currentClass),s.extra.gender=s.extra.gender!==e.gender?e.gender:s.extra.gender,E.forEach(u=>{u.value===e.currentClass&&(t.currentClassText=u.text)});const a=C.value[0]||[];a==null||a.forEach(u=>{u.value===e.currentGradeNum&&(t.gradeNumText=u.text)})}}catch(e){}};return oe(async()=>{try{const{data:e}=await c.get("/edu-app/open/paramConfig/queryByParamNameList",{requestType:"form",params:{paramNames:"payment_service_provider,contract_sign"}});e&&Array.isArray(e)&&e.forEach(a=>{a.paramName==="contract_sign"?t.contract_sign=a.paramValue==="1":a.paramName==="payment_service_provider"&&(t.paymentType=a.paramValue||"")}),await z()}catch(e){}C.value=$()}),()=>o("div",{class:n.registerModal},[o("div",{class:n.registerModalSection},[o("img",{src:Ye,class:n.infoTitle},null),o(xe,{labelAlign:"left",class:n.registerForm},{default:()=>[o(f,{clearable:!1,label:"联系方式(直接监护人)",placeholder:"请输入手机号码",type:"tel",required:!0,autocomplete:"off",inputAlign:"right",class:n.username,modelValue:s.username,"onUpdate:modelValue":e=>s.username=e,border:!1,maxlength:11},{label:()=>o("div",null,[d("联系方式"),o("p",{class:n.tips},[d("(直接监护人)")])])}),o("div",{class:["van-hairline--bottom",n.fieldTipsGroup]},[o("div",{class:[n.fieldTips]},[d("手机号是音乐数字课堂的唯一登录账户")])]),o(f,{center:!0,clearable:!1,required:!0,inputAlign:"right",label:"验证码",placeholder:"请输入验证码",autocomplete:"off",type:"number",modelValue:s.password,"onUpdate:modelValue":[e=>s.password=e,e=>{K()}],maxlength:6},{button:()=>t.countDownStatus?o("span",{class:[n.codeText,q.value?"":n.codeTextDisabled],onClick:U},[d("获取验证码")]):o(fe,{ref:e=>p.value=e,"auto-start":!1,class:n.countDown,time:t.countDownTime,onFinish:L,format:"ss秒后重试"},null)}),o(f,{clearable:!1,required:!0,inputAlign:"right",label:"学生姓名",placeholder:"请输入学生姓名",autocomplete:"off",maxlength:14,modelValue:s.extra.nickname,"onUpdate:modelValue":e=>s.extra.nickname=e},null),o(f,{clearable:!1,required:!0,inputAlign:"right",label:"学生性别",placeholder:"请选择性别",autocomplete:"off"},{input:()=>o(Fe,{"checked-color":"linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)",modelValue:s.extra.gender,"onUpdate:modelValue":e=>s.extra.gender=e,direction:"horizontal"},{default:()=>[o(G,{size:"large",type:"primary",color:s.extra.gender!==1?"#F5F6FA":"linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)",textColor:s.extra.gender!==1?"#626264":"#fff",class:n.radioSection},{default:()=>[o(R,{class:n.radioItem,name:1},null),d("男")]}),o(G,{size:"large",type:"primary",color:s.extra.gender!==0?"#F5F6FA":"linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)",textColor:s.extra.gender!==0?"#626264":"#fff",class:n.radioSection},{default:()=>[o(R,{class:n.radioItem,name:0},null),d("女")]})]})}),o(f,{clearable:!1,required:!0,inputAlign:"right",label:"所在年级",placeholder:"请选择年级",isLink:!0,readonly:!0,clickable:!1,modelValue:t.gradeNumText,onClick:()=>t.gradeStatus=!0},null),o(f,{clearable:!1,required:!0,inputAlign:"right",label:"所在班级",placeholder:"请选择班级",isLink:!0,readonly:!0,clickable:!1,modelValue:t.currentClassText,onClick:()=>t.classStatus=!0},null),t.giftVipDay>0&&o("div",{class:n.memberNumer},[o("img",{src:ce,class:n.iconGift},null),o("p",null,[d("注册成功即可获得乐器AI学练工具"),o("span",null,[t.giftVipDay||0]),d("天有效期")])])]}),o(Ce,{position:"bottom"},{default:()=>[o("div",{class:n.paymentContainer},[o("div",{class:n.payemntPrice},[o("img",{src:$e,class:n.giftTip},null),o("div",null,[o("span",{class:n.needPrice},[o("i",{style:"font-style: normal"},[d("¥ ")]),o("span",null,[M(y.value.amount)]),o("i",{style:"font-style: normal"},[d("/年")])]),y.value.originAmount>y.value.amount?o("del",{class:n.allPrice},[d("¥ "),M(y.value.originAmount)]):""])]),o("div",{class:n.paymentBtn,onClick:()=>B()},[o(se,{round:!0,disabled:t.loading,loading:t.loading},{default:()=>[d("立即支付")]})])])]})]),t.imgCodeStatus?o(de,{value:t.imgCodeStatus,"onUpdate:value":e=>t.imgCodeStatus=e,phone:s.username,type:"REGISTER",onClose:()=>{t.imgCodeStatus=!1},onSendCode:V},null):null,o(T,{show:t.gradeStatus,"onUpdate:show":e=>t.gradeStatus=e,position:"bottom",round:!0,safeAreaInsetBottom:!0,lazyRender:!1,class:"popupBottomSearch"},{default:()=>[o(k,{showToolbar:!0,columns:C.value,onCancel:()=>t.gradeStatus=!1,onConfirm:e=>{const a=e.selectedOptions[0];s.extra.currentGradeNum=a.value,t.gradeNumText=a.text,t.gradeStatus=!1}},null)]}),o(T,{show:t.classStatus,"onUpdate:show":e=>t.classStatus=e,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[o(k,{showToolbar:!0,columns:E,onCancel:()=>t.classStatus=!1,onConfirm:e=>{const a=e.selectedOptions[0];s.extra.currentClass=a.value,t.currentClassText=a.text,t.classStatus=!1}},null)]}),o(O,{title:"提示",show:t.dialogConfirmStatus,"onUpdate:show":e=>t.dialogConfirmStatus=e,message:"已购买会员,是否确认购买?",primaryColor:"#FF8057",allowHtml:!0,confirmButtonText:"确定",showCancelButton:!0,onConfirm:async()=>{await _()}},null),o(O,{title:"提示",show:t.dialogStatus,"onUpdate:show":e=>t.dialogStatus=e,message:t.dialogMessage,allowHtml:!0,primaryColor:"#FF8057",confirmButtonText:"继续支付",onConfirm:async()=>{h.pause();const e=t.dialogConfig.paymentConfig;r.config=e==null?void 0:e.paymentConfig,r.orderNo=e==null?void 0:e.orderNo,await N()},onCancel:e=>{h.pause()}},null),o(T,{show:r.paymentStatus,closeOnClickOverlay:!1,position:"bottom",round:!0,closeOnPopstate:!0,safeAreaInsetBottom:!0,style:{minHeight:"30%"}},{default:()=>[o(he,{paymentConfig:r.orderInfo,onClose:()=>r.paymentStatus=!1,onBackOut:J,onConfirm:e=>x(e)},null)]}),o(T,{show:r.showQrcode,"onUpdate:show":e=>r.showQrcode=e,round:!0,onClose:()=>{clearInterval(r.orderTimer)}},{default:()=>[o(ye,{url:r.qrCodeUrl,pay_channel:r.pay_channel,orderType:v.value},null)]}),o(Se,{modelValue:r.authShow,"onUpdate:modelValue":e=>r.authShow=e},{default:()=>[o(we,{onSuccess:j,hideHeader:!P().isApp},null)]}),o(ge,{show:t.showTips,message:t.showMessage,showButton:t.showButton,buttonText:"刷新",onConfirm:()=>window.location.reload()},null),o(_e,{show:t.showOtherSchool,messageAlign:"left",message:t.showOtherMessage,showCancelButton:!0,onCancel:()=>t.showOtherSchool=!1,onConfirm:()=>{t.showOtherSchool=!1,B(!0)}},null)])}});export{gt as default};
|