index.tsx 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115
  1. import {
  2. Image,
  3. Cell,
  4. Tag,
  5. Button,
  6. Popup,
  7. showToast,
  8. Form,
  9. Field,
  10. CountDown,
  11. RadioGroup,
  12. Radio,
  13. Picker,
  14. closeToast,
  15. Popover
  16. } from 'vant';
  17. import {
  18. computed,
  19. defineComponent,
  20. nextTick,
  21. onMounted,
  22. onUnmounted,
  23. reactive,
  24. ref
  25. } from 'vue';
  26. import qs from 'query-string';
  27. import {
  28. state as baseState,
  29. goWechatAuth,
  30. setLogin,
  31. setLoginInit
  32. } from '@/state';
  33. import styles from './index.module.less';
  34. import MSticky from '@/components/m-sticky';
  35. // import MVideo from '@/components/m-video';
  36. import { useRoute, useRouter } from 'vue-router';
  37. import { useStudentRegisterStore } from '@/store/modules/student-register-store';
  38. import request from '@/helpers/request';
  39. import requestStudent from './request';
  40. import { browser, checkPhone, getUrlCode, moneyFormat } from '@/helpers/utils';
  41. import deepClone from '@/helpers/deep-clone';
  42. import OWxTip from '@/components/m-wx-tip';
  43. import MDialog from '@/components/m-dialog';
  44. // import f1 from './images/new/f-1.png';
  45. // import f2 from './images/new/f-2.png';
  46. // import f3 from './images/new/f-3.png';
  47. // import iconTip2 from './images/new/icon-tip2.png';
  48. // import functionBg from './images/new/function-bg.png';
  49. import tuangou from './images/new/tuangou.png';
  50. import icon3 from './images/new/icon-3.png';
  51. import icon5 from './images/new/icon-5.png';
  52. import icon6 from './images/new/icon-6.png';
  53. import giftTip from './images/new/icon-4.png';
  54. import iconGift from './images/new/icon-gift.png';
  55. import dayjs from 'dayjs';
  56. // import MMessageTip from '@/components/m-message-tip';
  57. import { CurrentTime, useCountDown } from '@vant/use';
  58. import Payment from '../adapay/payment';
  59. import QrcodePayment from './qrcode-payment';
  60. import MImgCode from '@/components/m-img-code';
  61. import { beforeSubmit } from './order-state';
  62. import { useInterval, useIntervalFn } from '@vueuse/core';
  63. import MPopup from '@/components/m-popup';
  64. import UserAuth from './component/user-auth';
  65. import MMessageTip from '@/components/m-message-tip';
  66. import SelectStudent from './modal/select-student';
  67. const classList: any = [];
  68. for (let i = 1; i <= 40; i++) {
  69. classList.push({ text: i + '班', value: i });
  70. }
  71. const GRADE_ENUM = {
  72. '1': '一年级',
  73. '2': '二年级',
  74. '3': '三年级',
  75. '4': '四年级',
  76. '5': '五年级',
  77. '6': '六年级',
  78. '7': '七年级',
  79. '8': '八年级',
  80. '9': '九年级'
  81. } as any;
  82. const getGradeList = (gradeYear: string, instrumentCode?: string) => {
  83. let tempList: any = [];
  84. const five = [
  85. { text: '一年级', value: 1, instrumentCode },
  86. { text: '二年级', value: 2, instrumentCode },
  87. { text: '三年级', value: 3, instrumentCode },
  88. { text: '四年级', value: 4, instrumentCode },
  89. { text: '五年级', value: 5, instrumentCode }
  90. ];
  91. const one = [{ text: '六年级', value: 6, instrumentCode }];
  92. const three = [
  93. { text: '七年级', value: 7, instrumentCode },
  94. { text: '八年级', value: 8, instrumentCode },
  95. { text: '九年级', value: 9, instrumentCode }
  96. ];
  97. if (gradeYear === 'FIVE_YEAR_SYSTEM') {
  98. tempList.push(...[...five]);
  99. } else if (gradeYear === 'SIX_YEAR_SYSTEM') {
  100. tempList.push(...[...five, ...one]);
  101. } else if (gradeYear === 'THREE_YEAR_SYSTEM') {
  102. tempList.push(...[...three]);
  103. } else if (gradeYear === 'FORE_YEAR_SYSTEM') {
  104. tempList.push(...[...one, ...three]);
  105. } else {
  106. tempList.push(...[...five, ...one, ...three]);
  107. }
  108. return tempList;
  109. };
  110. export default defineComponent({
  111. name: 'student-register',
  112. setup() {
  113. const route = useRoute();
  114. const studentRegisterStore = useStudentRegisterStore();
  115. const router = useRouter();
  116. // 初始化学校编号
  117. studentRegisterStore.setShoolId(route.query.sId as any);
  118. const countDownRef = ref();
  119. const mstickyRef = ref();
  120. const forms = reactive({
  121. schoolId: route.query.sId as any,
  122. paymentType: '', // 支付类型
  123. multi_user_limit: 1, // 限制注册学生数量
  124. // popupShow: false,
  125. registerDetails: {} as any,
  126. details: [] as any[],
  127. // schoolType: '', // 学校类型
  128. gradeYear: '', // 学制
  129. schoolInstrumentSetType: null as any,
  130. // bugGoods: false, // 是否购买AI
  131. isRegister: 'create' as 'create' | 'update' | '', // 是否注册学生
  132. isTipRegister: false, // 是否显示名字不一致 - 默认显示
  133. isChangeSchool: false, // 是否切换学校
  134. registerType: '', // 报名类型
  135. detailVip: {} as any,
  136. giftVipDay: 0, // 赠送天数
  137. submitLoading: false,
  138. // showMore: true,
  139. showTips: false,
  140. showButton: false,
  141. showMessage: '请使用微信扫描二维码',
  142. countDownStatus: true,
  143. countDownTime: 1000 * 120, // 倒计时时间
  144. // modelValue: false, // 是否选中协议
  145. imgCodeStatus: false,
  146. gradeNumText: '',
  147. currentClassText: '',
  148. gradeStatus: false,
  149. classStatus: false,
  150. loading: false,
  151. dialogStatus: false,
  152. dialogMessage: '',
  153. confirmButtonText: '确定',
  154. cancelButtonText: '取消',
  155. messageAlign: 'center' as 'left' | 'center' | 'right',
  156. tipStatus: true,
  157. dialogConfirmStatus: false,
  158. contract_sign: false, // 是否实名认证
  159. countDownTimePay: 60 * 1000,
  160. dialogConfig: {} as any,
  161. showSelectStudent: false, // 选择学生
  162. studentList: [], // 手机号关联学生列表
  163. studentItem: {} as any, // 选择的学生
  164. joinType: 'digitalize' as 'digitalize' | 'tradition',
  165. gradeList: [] as any,
  166. classList: [] as any,
  167. saveUserId: null as any,
  168. saveId: null as any,
  169. openId: null as any,
  170. code: null as any,
  171. intervalFnRef: null as any, // 页面订时器
  172. registerExpireTime: null as any, // 结束时间
  173. instrumentCode: null as any, // 乐器编码
  174. activeOverTime: 0, // 活动结束时间
  175. activeOverStatus: true, // 活动是否结束 默认已结束
  176. gradePopupShow: false,
  177. gradePopupIndex: [] as any, // 年级下拉索引
  178. classPopupShow: false,
  179. classPopupIndex: [] as any // 班级下拉索引
  180. });
  181. const otherParams = reactive({
  182. showOtherSchool: false,
  183. showCloseButton: true, // 是否显示关闭按钮
  184. showOtherMessage: '',
  185. /** limit 超限制,change 更换学生,nickname 名称不一致 member 会员购买, payment 支付方式 */
  186. otherType: '' as 'limit' | 'change' | 'nickname' | 'member' | 'payment',
  187. showCancelButton: true,
  188. cancelButtonColor: '',
  189. cancelButtonText: '取消',
  190. showConfirmButton: true,
  191. confirmButtonColor: '',
  192. confirmButtonText: '确定',
  193. messageAlign: 'left' as 'center' | 'left' | 'right'
  194. });
  195. const state = reactive({
  196. showQrcode: false,
  197. qrCodeUrl: '',
  198. pay_channel: '',
  199. orderInfo: {} as any, // 订单信息
  200. authShow: false,
  201. orderNo: null as any,
  202. config: {} as any,
  203. paymentStatus: false,
  204. orderTimer: null as any
  205. });
  206. /*
  207. 新用户:
  208. autoRegister: true
  209. loginType: 'SMS'
  210. 已存在用户:
  211. autoRegister: false
  212. loginType: 'TOKEN'
  213. password: xxx
  214. */
  215. const studentInfo = reactive({
  216. autoRegister: true,
  217. multiUser: true, // 是否为多用户
  218. client_id: 'cooleshow-student',
  219. client_secret: 'cooleshow-student',
  220. extra: {
  221. nickname: '',
  222. currentGradeNum: '' as any,
  223. currentClass: '' as any,
  224. gender: 1 as any,
  225. registerType: null as any, // 报名类型
  226. giftVipDay: 0 // 赠送会员天数
  227. },
  228. grant_type: 'password',
  229. loginType: 'SMS',
  230. password: '',
  231. username: ''
  232. });
  233. // 页面定时
  234. const pageTimer = useInterval(1000, { controls: true });
  235. pageTimer.pause();
  236. const overCountDown = useCountDown({
  237. time: forms.activeOverTime,
  238. onFinish() {
  239. forms.activeOverStatus = true;
  240. if (forms.submitLoading) return;
  241. applyOver();
  242. }
  243. });
  244. /** 报名结束提示 */
  245. const applyOver = () => {
  246. forms.showTips = true;
  247. forms.showMessage = '团购时间已截止,感谢您的参与';
  248. forms.showButton = false;
  249. forms.intervalFnRef?.pause();
  250. };
  251. const onCodeSend = () => {
  252. forms.countDownStatus = false;
  253. nextTick(() => {
  254. countDownRef.value.start();
  255. });
  256. };
  257. const onSendCode = () => {
  258. // 发送验证码
  259. if (!checkPhone(studentInfo.username)) {
  260. return showToast('请输入正确的手机号码');
  261. }
  262. forms.imgCodeStatus = true;
  263. };
  264. const validatePhone = computed(() => {
  265. return checkPhone(studentInfo.username) ? true : false;
  266. });
  267. const onFinished = () => {
  268. forms.countDownStatus = true;
  269. countDownRef.value.reset();
  270. };
  271. const orderType = computed(() => {
  272. return state.orderInfo.orderType;
  273. });
  274. const getRegisterGoods = async () => {
  275. try {
  276. const { data } = await request.get(
  277. '/edu-app/open/userOrder/registerGoods/' + forms.schoolId,
  278. {
  279. noAuthorization: true // 是否请求接口的时候添加toekn
  280. }
  281. );
  282. // 默认选中商品
  283. studentRegisterStore.setVip(data.details || []);
  284. forms.details = deepClone(data.details || []);
  285. forms.registerDetails = data;
  286. forms.registerExpireTime = data.registerExpireTime; // '2024-03-27 17:33:52'; //
  287. if (forms.registerExpireTime) {
  288. if (dayjs(new Date()).isBefore(forms.registerExpireTime)) {
  289. // 活动没有结束
  290. forms.activeOverStatus = false;
  291. // 默认返回毫秒
  292. forms.activeOverTime = dayjs(forms.registerExpireTime).diff(
  293. dayjs(new Date())
  294. );
  295. overCountDown.reset(forms.activeOverTime);
  296. overCountDown.start();
  297. } else {
  298. applyOver();
  299. forms.activeOverStatus = true;
  300. }
  301. }
  302. if (forms.details.length > 0) {
  303. forms.detailVip = forms.details[0];
  304. // forms.giftVipDay = forms.details[0].membershipDays;
  305. }
  306. forms.giftVipDay = data.giftVipDay || 0;
  307. forms.gradeYear = data.gradeYear;
  308. forms.schoolInstrumentSetType = data.schoolInstrumentSetType;
  309. forms.registerType = data.registerType;
  310. studentInfo.extra.registerType = data.registerType;
  311. const schoolInstrumentList = data.schoolInstrumentList || [];
  312. if (data.schoolInstrumentSetType === 'SCHOOL') {
  313. const instrumentCode = schoolInstrumentList[0]?.instrumentCode;
  314. forms.gradeList = getGradeList(data.gradeYear, instrumentCode);
  315. forms.classList = classList;
  316. } else if (data.schoolInstrumentSetType === 'GRADE') {
  317. schoolInstrumentList.forEach((item: any) => {
  318. forms.gradeList.push({
  319. text: GRADE_ENUM[item.gradeNum],
  320. value: item.gradeNum,
  321. instrumentId: item.instrumentId,
  322. instrumentCode: item.instrumentCode
  323. });
  324. });
  325. forms.gradeList.sort((a: any, b: any) => a.value - b.value);
  326. forms.classList = classList;
  327. } else if (data.schoolInstrumentSetType === 'CLASS') {
  328. // 班级
  329. const tempGradeList: any[] = [];
  330. schoolInstrumentList.forEach((item: any) => {
  331. if (!tempGradeList.includes(item.gradeNum)) {
  332. tempGradeList.push(item.gradeNum);
  333. }
  334. });
  335. const lastGradeList: any[] = [];
  336. tempGradeList.forEach((temp: any) => {
  337. const list = {
  338. text: GRADE_ENUM[temp],
  339. value: temp,
  340. instrumentId: '',
  341. instrumentCode: '',
  342. instrumentName: '',
  343. classList: [] as any
  344. };
  345. schoolInstrumentList.forEach((item: any) => {
  346. if (temp === item.gradeNum) {
  347. list.instrumentId = item.instrumentId;
  348. list.instrumentCode = item.instrumentCode;
  349. list.instrumentName = item.instrumentName;
  350. list.classList.push({
  351. text: item.classNum + '班',
  352. value: item.classNum,
  353. instrumentCode: item.instrumentCode
  354. });
  355. }
  356. });
  357. // 排序班级
  358. list.classList.sort((a: any, b: any) => a.value - b.value);
  359. lastGradeList.push(list);
  360. });
  361. lastGradeList.sort((a: any, b: any) => a.value - b.value);
  362. forms.gradeList = lastGradeList;
  363. forms.classList = [];
  364. } else {
  365. forms.gradeList = getGradeList(data.gradeYear);
  366. forms.classList = classList;
  367. }
  368. if (browser().weixin) {
  369. // if (
  370. // data.schoolStatus === 0 &&
  371. // forms.schoolId == '1770035687490105346'
  372. // ) {
  373. // forms.showTips = true;
  374. // forms.showMessage = '团购时间已截止,感谢您的参与';
  375. // forms.showButton = false;
  376. // return;
  377. // }
  378. if (data.registerType !== 'BUG_GOODS' || data.schoolStatus === 0) {
  379. forms.showTips = true;
  380. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  381. forms.showButton = false;
  382. return;
  383. }
  384. } else {
  385. forms.showTips = true;
  386. return;
  387. }
  388. // 判断是否有倒计时,倒计时是滞结束
  389. if (!forms.registerExpireTime || !forms.activeOverStatus) {
  390. pagePointInit();
  391. }
  392. } catch {}
  393. };
  394. // 计算金额
  395. const calcPrice = computed(() => {
  396. let amount: number = 0; //现价
  397. let originAmount: number = 0; // 原价
  398. const vipList: any[] = studentRegisterStore.getVip;
  399. vipList.forEach((vip: any) => {
  400. amount +=
  401. forms.joinType === 'digitalize' ? Number(vip.currentPrice) : 0;
  402. originAmount += Number(vip.originalPrice);
  403. });
  404. // const goodsList: any[] = studentRegisterStore.getGoods;
  405. // goodsList.forEach((good: any) => {
  406. // amount += Number(good.price) * good.quantity;
  407. // originAmount += Number(good.originalPrice) * good.quantity;
  408. // });
  409. return {
  410. amount,
  411. originAmount
  412. };
  413. });
  414. // 格式化提示状态
  415. const changeTipStatus = (register: boolean, school: boolean) => {
  416. forms.isTipRegister = register;
  417. forms.isChangeSchool = school;
  418. };
  419. const checkForm = (status = true) => {
  420. if (!checkPhone(studentInfo.username)) {
  421. status && showToast('请输入正确的手机号码');
  422. return true;
  423. } else if (!studentInfo.password) {
  424. status && showToast('请输入验证码');
  425. return true;
  426. } else if (!studentInfo.extra.nickname) {
  427. status && showToast('请输入学生姓名');
  428. return true;
  429. } else if (![0, 1].includes(studentInfo.extra.gender)) {
  430. status && showToast('请选择性别');
  431. return true;
  432. } else if (!studentInfo.extra.currentGradeNum) {
  433. status && showToast('请选择所在年级');
  434. return true;
  435. } else if (!studentInfo.extra.currentClass) {
  436. status && showToast('请选择所在班级');
  437. return true;
  438. }
  439. return false;
  440. };
  441. //
  442. const checkSubmit = () => {
  443. const { extra } = studentInfo;
  444. // console.log(
  445. // forms.studentItem.nickname,
  446. // extra.nickname,
  447. // forms.isRegister,
  448. // forms.isTipRegister,
  449. // 'isRegister'
  450. // );
  451. if (
  452. forms.studentItem.nickname !== extra.nickname &&
  453. forms.isTipRegister
  454. ) {
  455. otherParams.showOtherMessage =
  456. '学生姓名与上次提交信息不一致,请确认修改学生信息或创建新的学生账号';
  457. otherParams.showOtherSchool = true;
  458. otherParams.showCancelButton = true;
  459. otherParams.showCloseButton = true;
  460. otherParams.cancelButtonColor =
  461. 'linear-gradient( 224deg, #3FE1E6 0%, #00CDD4 100%)';
  462. otherParams.cancelButtonText = '新建学生';
  463. otherParams.confirmButtonColor =
  464. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  465. otherParams.confirmButtonText = '修改信息';
  466. otherParams.otherType = 'nickname';
  467. otherParams.messageAlign = 'left';
  468. return true;
  469. }
  470. // 判断新建学员是否上限了
  471. if (
  472. forms.isRegister === 'create' &&
  473. forms.studentList.length >= forms.multi_user_limit
  474. ) {
  475. otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
  476. otherParams.showOtherSchool = true;
  477. otherParams.showCancelButton = false;
  478. otherParams.showCloseButton = true;
  479. otherParams.confirmButtonColor =
  480. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  481. otherParams.confirmButtonText = '我知道了';
  482. otherParams.otherType = 'limit';
  483. otherParams.messageAlign = 'center';
  484. return true;
  485. }
  486. // 判断是否为同一个学校
  487. if (
  488. forms.studentItem.schoolId &&
  489. forms.studentItem.schoolId !== forms.registerDetails.schoolId &&
  490. !forms.isChangeSchool &&
  491. forms.isRegister === 'update'
  492. ) {
  493. otherParams.showOtherMessage = `您已绑定<span style="color: #2B85FF">【${
  494. forms.studentItem?.schoolName || ''
  495. }】</span>,提交后将更换到
  496. <span style="color: #2B85FF">【${
  497. forms.registerDetails.schoolName || ''
  498. }】</span>
  499. ,是否确认提交?`;
  500. otherParams.showOtherSchool = true;
  501. otherParams.showCloseButton = false;
  502. otherParams.showCancelButton = true;
  503. otherParams.cancelButtonColor = '';
  504. otherParams.cancelButtonText = '取消';
  505. otherParams.confirmButtonColor = '';
  506. otherParams.confirmButtonText = '确定';
  507. otherParams.otherType = 'change';
  508. otherParams.messageAlign = 'left';
  509. return true;
  510. }
  511. return false;
  512. };
  513. /**
  514. * 登记成功之后购买
  515. */
  516. const onSubmit = async () => {
  517. forms.submitLoading = true;
  518. try {
  519. if (checkForm() || checkSubmit()) {
  520. forms.submitLoading = false;
  521. return;
  522. }
  523. const { extra, loginType, autoRegister, password, multiUser, ...res } =
  524. studentInfo;
  525. /*
  526. 新用户:
  527. autoRegister: true
  528. loginType: 'SMS'
  529. 已存在用户:
  530. autoRegister: false
  531. loginType: 'TOKEN'
  532. password: xxx
  533. */
  534. let tLoginType = loginType,
  535. tAutoRegister = autoRegister,
  536. tPassword = password,
  537. tMultiUser = multiUser;
  538. if (forms.isRegister === 'update') {
  539. tLoginType = 'TOKEN';
  540. tAutoRegister = false;
  541. tPassword = forms.studentItem.token;
  542. tMultiUser = false;
  543. }
  544. const result = await request.post('/edu-app/userlogin', {
  545. requestType: 'form',
  546. data: {
  547. loginType: tLoginType,
  548. autoRegister: tAutoRegister,
  549. password: tPassword,
  550. multiUser: tMultiUser,
  551. ...res,
  552. extra: JSON.stringify({
  553. ...extra,
  554. giftVipDay:
  555. forms.detailVip.membershipDays || 0 + forms.giftVipDay || 0,
  556. schoolId: forms.schoolId
  557. })
  558. }
  559. });
  560. if (result.code !== 200) {
  561. if (result.code === 5436) {
  562. forms.showTips = true;
  563. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  564. forms.showButton = false;
  565. } else if (result.code === 5435) {
  566. forms.showTips = true;
  567. forms.showMessage = result.message;
  568. forms.showButton = true;
  569. } else if (result.code === 5437) {
  570. forms.showTips = true;
  571. forms.showMessage = '团购时间已截止,感谢您的参与'; //result.message;
  572. forms.showButton = false;
  573. }
  574. } else {
  575. studentRegisterStore.setToken(
  576. result.data.token_type + ' ' + result.data.access_token
  577. );
  578. setLoginInit();
  579. let joinType = 'NOT_REGISTER';
  580. if (forms.joinType === 'digitalize') {
  581. joinType = 'SELECT_INSTRUMENT';
  582. }
  583. if (forms.joinType === 'tradition') {
  584. joinType = 'NOT_BUY_INSTRUMENT';
  585. }
  586. // 更新时间
  587. const id = await updateStat(
  588. pageTimer.counter.value,
  589. joinType,
  590. result.data.userId,
  591. forms.schoolId
  592. );
  593. forms.saveId = id;
  594. forms.saveUserId = id;
  595. pageTimer.counter.value = 0;
  596. // 获取用户信息
  597. const res = await request.get('/edu-app/user/getUserInfo', {
  598. requestType: 'form'
  599. });
  600. setLogin(res.data);
  601. await onRegisterSubmit();
  602. }
  603. } catch {
  604. // 重置信息 - 如果是新建则不提示
  605. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  606. } finally {
  607. forms.submitLoading = false;
  608. }
  609. };
  610. const updateStudentInfo = async () => {
  611. try {
  612. const { extra, username } = studentInfo;
  613. const registerResult = await request.post('/edu-app/student/register', {
  614. data: {
  615. schoolId: forms.schoolId,
  616. clientType: 'STUDENT',
  617. schoolVerify: true,
  618. ...extra,
  619. giftVipDay:
  620. forms.detailVip.membershipDays || 0 + forms.giftVipDay || 0,
  621. mobile: username,
  622. newRegUser: forms.isRegister === 'create' ? true : false
  623. }
  624. });
  625. if (registerResult.code !== 200) {
  626. if (registerResult.code === 5436) {
  627. forms.showTips = true;
  628. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  629. forms.showButton = false;
  630. } else if (registerResult.code === 5435) {
  631. forms.showTips = true;
  632. forms.showMessage = registerResult.message;
  633. forms.showButton = true;
  634. } else if (registerResult.code === 5437) {
  635. forms.showTips = true;
  636. forms.showMessage = '团购时间已截止,感谢您的参与'; //result.message;
  637. forms.showButton = false;
  638. }
  639. return false;
  640. } else {
  641. return true;
  642. }
  643. } catch {}
  644. };
  645. // 登记成功之后购买
  646. const onRegisterSubmit = async () => {
  647. try {
  648. // 请求是否有待支付订单,如果有则自动关闭
  649. const status = await paymentOrderUnpaid();
  650. if (status) return;
  651. const schoolInfo = await request.get(
  652. '/edu-app/userPaymentOrder/registerStatus/' + forms.schoolId
  653. );
  654. const vipList = studentRegisterStore.getVip;
  655. // 传统方式
  656. if (forms.joinType === 'tradition') {
  657. const updateStatus = await updateStudentInfo();
  658. if (!updateStatus) return;
  659. setTimeout(() => {
  660. showToast('报名成功');
  661. // router.push('/download');
  662. }, 100);
  663. setTimeout(() => {
  664. if (browser().weixin) {
  665. // 关闭微信
  666. (window as any).WeixinJSBridge.call('closeWindow');
  667. }
  668. }, 1000);
  669. return;
  670. }
  671. if (schoolInfo.data.hasBuyCourse && vipList.length > 0) {
  672. // forms.dialogConfirmStatus = true;
  673. otherParams.showOtherMessage = `该学员已购买会员,是否再次购买?`;
  674. otherParams.showOtherSchool = true;
  675. otherParams.showCloseButton = false;
  676. otherParams.showCancelButton = true;
  677. otherParams.cancelButtonColor = '';
  678. otherParams.cancelButtonText = '取消';
  679. otherParams.confirmButtonColor = '';
  680. otherParams.confirmButtonText = '确定';
  681. otherParams.otherType = 'member';
  682. otherParams.messageAlign = 'center';
  683. return;
  684. }
  685. await paymentContinue();
  686. } catch {
  687. // 重置信息 - 如果是新建则不提示
  688. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  689. }
  690. };
  691. const getUserInfos = async () => {
  692. if (
  693. studentInfo.password.length !== 6 ||
  694. !checkPhone(studentInfo.username)
  695. ) {
  696. return;
  697. }
  698. try {
  699. // 15907120131;
  700. const { data } = await request.get(
  701. `/edu-app/open/student/studentInfo?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
  702. );
  703. forms.studentList = data || [];
  704. if (forms.studentList.length > 0) {
  705. const firstStudent: any = forms.studentList[0];
  706. forms.studentItem = firstStudent;
  707. studentInfo.extra.nickname = firstStudent.nickname;
  708. const tempGrade: any = forms.gradeList || [];
  709. tempGrade?.forEach((i: any) => {
  710. if (i.value === firstStudent.currentGradeNum) {
  711. forms.instrumentCode = i.instrumentCode;
  712. forms.gradeNumText = i.text;
  713. studentInfo.extra.currentGradeNum = firstStudent.currentGradeNum;
  714. if (forms.schoolInstrumentSetType === 'CLASS') {
  715. forms.classList = i.classList;
  716. }
  717. }
  718. });
  719. forms.classList.forEach((i: any) => {
  720. if (i.value === firstStudent.currentClass) {
  721. forms.currentClassText = i.text;
  722. studentInfo.extra.currentClass = firstStudent.currentClass;
  723. }
  724. });
  725. studentInfo.extra.gender = firstStudent.gender;
  726. forms.isRegister = 'update';
  727. changeTipStatus(true, false);
  728. } else {
  729. forms.isRegister = 'create';
  730. changeTipStatus(false, false);
  731. forms.studentItem = [];
  732. }
  733. } catch {
  734. //
  735. }
  736. };
  737. // 查询未支付订单
  738. const paymentOrderUnpaid = async () => {
  739. let result = false;
  740. try {
  741. const { data } = await request.get(
  742. '/edu-app/userPaymentOrder/schoolRegisterOrder?schoolId=' +
  743. forms.schoolId
  744. );
  745. // 判断是否有待支付订单
  746. if (data && data.length > 0) {
  747. let isPadding = false; // 是否有待支付订单
  748. let paddingConfig = {} as any;
  749. let paddingData = {} as any;
  750. let isFinal = false; // 是否有完成订单
  751. let finalConfig = {} as any;
  752. data.forEach((element: any) => {
  753. // 判断是否待支付
  754. if (element.status === 'PAYING' || element.status === 'WAIT_PAY') {
  755. isPadding = true;
  756. paddingConfig = element.paymentConfig;
  757. paddingData = element;
  758. }
  759. if (
  760. element.status === 'PAID' ||
  761. element.status === 'PART_REFUNDED' ||
  762. element.status === 'REFUNDED'
  763. ) {
  764. isFinal = true;
  765. finalConfig = element.paymentConfig;
  766. }
  767. });
  768. // 60s 关单提示文案
  769. // 判断是否有完成订单 并且选择 自备
  770. if (isFinal && forms.joinType === 'tradition') {
  771. // const studentResult = await updateStudentInfo();
  772. // if (!studentResult) return;
  773. setTimeout(() => {
  774. showToast('您已报名成功,请勿重复报名');
  775. }, 100);
  776. return true;
  777. }
  778. // 提交报名信息时,判断该手机号是否存在待支付订单,若存则判断本次提交的报名方式,若本次提交的是团购则提示【您有待支付的报名订单,是否继续支付 重新下单/继续支付】,点击重新下单时,关闭老订单,创建新订单;若本次提交的是自备,则提示 【您有数字化方式报名的待支付订单,请关闭订单后重新报名 取消/关闭】取消则停留在当前界面,关闭则关闭订单,并停留在当前界面,用户需要再次点击报名按钮提交信息
  779. if (isPadding && forms.joinType === 'tradition') {
  780. // forms.dialogStatus = true;
  781. // forms.dialogMessage =
  782. // '您有数字化方式报名的待支付订单,请关闭订单后重新报名';
  783. // forms.cancelButtonText = '取消';
  784. // forms.confirmButtonText = '关闭';
  785. // forms.dialogConfig = paddingConfig;
  786. // forms.messageAlign = 'left';
  787. forms.dialogConfig = paddingConfig;
  788. const cancelStatus = await cancelPaymentOrder();
  789. if (cancelStatus) {
  790. onSubmit();
  791. }
  792. // 重新下单 - 先关闭订单
  793. // resetOrderPayment();
  794. return true;
  795. }
  796. if (isPadding && forms.joinType === 'digitalize') {
  797. // 最终确认,有待支付订单直接去支付,没有则才会创建订单
  798. // state.config = paddingConfig?.paymentConfig;
  799. // state.orderNo = paddingConfig?.orderNo;
  800. // const updateStatus = await updateStudentInfo();
  801. // if (!updateStatus) return;
  802. // await lastSubmit();
  803. // 为了处理,有待支付订单,然后后台改了金额,会导致金额不一致
  804. forms.dialogConfig = paddingConfig;
  805. const cancelStatus = await cancelPaymentOrder();
  806. if (cancelStatus) {
  807. await paymentContinue();
  808. }
  809. return true;
  810. }
  811. return false;
  812. } else {
  813. return false;
  814. }
  815. } catch {
  816. // 重置信息 - 如果是新建则不提示
  817. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  818. }
  819. return result;
  820. };
  821. // 重新下单
  822. const resetOrderPayment = async () => {
  823. try {
  824. const orderNo = forms.dialogConfig?.orderNo;
  825. if (!orderNo) return;
  826. await request.post(
  827. '/edu-app/userPaymentOrder/cancelPayment/' + orderNo
  828. );
  829. await onRegisterSubmit();
  830. } catch {
  831. //
  832. }
  833. };
  834. // 取消订单
  835. const cancelPaymentOrder = async () => {
  836. try {
  837. const orderNo = forms.dialogConfig?.orderNo;
  838. if (!orderNo) return;
  839. await request.post(
  840. '/edu-app/userPaymentOrder/cancelPayment/' + orderNo
  841. );
  842. return true;
  843. } catch {
  844. return false;
  845. }
  846. };
  847. const paymentContinue = async () => {
  848. try {
  849. const vipList = studentRegisterStore.getVip;
  850. // const goodsList = studentRegisterStore.getGoods;
  851. const params: any[] = [];
  852. vipList.forEach((vip: any) => {
  853. params.push({
  854. giftVipDay: vip.membershipDays,
  855. goodsId: vip.goodsId,
  856. goodsNum: 1,
  857. goodsType: vip.goodsType,
  858. paymentCashAmount: vip.currentPrice, // 现金支付金额
  859. paymentCouponAmount: 0 // 优惠券金额
  860. });
  861. });
  862. // goodsList.forEach((goods: any) => {
  863. // params.push({
  864. // goodsId: goods.productId,
  865. // goodsNum: goods.quantity,
  866. // goodsType: 'INSTRUMENTS',
  867. // paymentCashAmount: goods.price, // 现金支付金额
  868. // paymentCouponAmount: 0, // 优惠券金额
  869. // goodsSkuId: goods.productSkuId
  870. // });
  871. // });
  872. // 创建订单
  873. const updateStatus = await updateStudentInfo();
  874. // console.log(updateStatus, 'updateStatus');
  875. if (!updateStatus) return;
  876. const result = await request.post(
  877. '/edu-app/userPaymentOrder/executeOrder',
  878. {
  879. // hideLoading: false,
  880. data: {
  881. buryId: forms.saveUserId,
  882. registerType: forms.registerType,
  883. paymentType: forms.paymentType,
  884. bizId: forms.schoolId, // 乐团编号
  885. orderType: 'SCHOOL_REGISTER',
  886. paymentCashAmount: calcPrice.value.amount || 0,
  887. paymentCouponAmount: 0,
  888. goodsInfos: params,
  889. orderName: '学生登记',
  890. orderDesc: '学生登记'
  891. }
  892. }
  893. );
  894. if (result.code === 5436) {
  895. forms.showTips = true;
  896. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  897. forms.showButton = false;
  898. } else if (result.code === 5435) {
  899. forms.showTips = true;
  900. forms.showMessage = result.message;
  901. forms.showButton = true;
  902. } else {
  903. state.config = {
  904. ...result.data.paymentConfig,
  905. paymentType: result.data.paymentType
  906. };
  907. state.orderNo = result.data.orderNo;
  908. await lastSubmit();
  909. }
  910. } catch (e: any) {
  911. console.log(e, 'any');
  912. // 重置信息 - 如果是新建则不提示
  913. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  914. }
  915. };
  916. const lastSubmit = async () => {
  917. try {
  918. const users = baseState.user.data;
  919. // 判断是否需要实名认证, 姓名,卡号 - 参数设置可以控制
  920. if (
  921. forms.contract_sign &&
  922. (!users?.account.realName || !users?.account.idCardNo)
  923. ) {
  924. state.authShow = true;
  925. return;
  926. }
  927. const { data } = await request.post(
  928. '/edu-app/userPaymentOrder/updateReceiveAddress',
  929. {
  930. // hideLoading: false,
  931. data: {
  932. orderNo: state.orderNo,
  933. orderType: 'SCHOOL_REGISTER'
  934. }
  935. }
  936. );
  937. state.pay_channel = data.paymentChannel;
  938. if (data.status !== 'WAIT_PAY' && data.status !== 'PAYING') {
  939. router.replace({
  940. path: '/payment-result',
  941. query: {
  942. orderNo: state.orderNo
  943. }
  944. });
  945. } else {
  946. onCallback();
  947. }
  948. } catch {
  949. // 重置信息 - 如果是新建则不提示
  950. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  951. }
  952. };
  953. /**
  954. * @description 回调,判断是否有支付渠道,如果有则直接去支付
  955. * @returns void
  956. */
  957. const onCallback = () => {
  958. const pt = state.pay_channel;
  959. // 判断是否有支付方式
  960. if (pt) {
  961. const payCode: string = beforeSubmit(state.pay_channel);
  962. onConfirm({
  963. payCode,
  964. pay_channel: pt
  965. });
  966. } else {
  967. if (orderType.value === 'VIP') {
  968. state.paymentStatus = true;
  969. } else {
  970. // 直接去拉取微信支付
  971. onConfirm({
  972. payCode: 'payResult',
  973. pay_channel: 'wx_pub'
  974. });
  975. }
  976. }
  977. };
  978. const onConfirm = (val: any) => {
  979. const config: any = state.config;
  980. state.pay_channel = val.pay_channel;
  981. const params = qs.stringify({
  982. pay_channel: val.pay_channel,
  983. wxAppId: config.wxAppId,
  984. alipayAppId: config.alipayAppId,
  985. paymentType: forms.paymentType,
  986. body: config.body,
  987. price: config.price,
  988. orderNo: config.merOrderNo,
  989. userId: config.userId
  990. });
  991. // console.log(params, state.config);
  992. // return;
  993. if (val.payCode === 'payResult') {
  994. window.location.href =
  995. window.location.origin + '/classroom-app/#/payResult?' + params;
  996. } else {
  997. state.qrCodeUrl =
  998. window.location.origin + '/classroom-app/#/payDefine?' + params;
  999. state.showQrcode = true;
  1000. state.paymentStatus = false;
  1001. setTimeout(() => {
  1002. getPaymentOrderStatus();
  1003. }, 300);
  1004. }
  1005. };
  1006. // 放弃支付时,则取消订单
  1007. const onBackOut = async () => {
  1008. try {
  1009. await request.post(
  1010. '/edu-app/userPaymentOrder/cancelPayment/' + state.orderNo
  1011. );
  1012. // router.back();
  1013. } catch {
  1014. //
  1015. }
  1016. };
  1017. // 轮询查询订单状态
  1018. const getPaymentOrderStatus = async () => {
  1019. // 循环查询订单
  1020. // const orderNo = state.orderNo
  1021. const orderTimer = setInterval(async () => {
  1022. // 判断是否在当前路由,如果不是则清除定时器
  1023. if (route.name != 'student-register-form') {
  1024. clearInterval(orderTimer);
  1025. return;
  1026. }
  1027. state.orderTimer = orderTimer;
  1028. try {
  1029. const { data } = await request.post(
  1030. '/edu-app/open/userOrder/paymentStatus/' + state.orderNo,
  1031. {
  1032. hideLoading: true
  1033. }
  1034. );
  1035. if (data.status !== 'WAIT_PAY' && data.status !== 'PAYING') {
  1036. // 默认关闭支付二维码弹窗
  1037. state.showQrcode = false;
  1038. clearInterval(state.orderTimer);
  1039. setTimeout(() => {
  1040. router.replace({
  1041. path: '/payment-result',
  1042. query: {
  1043. orderNo: state.orderNo
  1044. }
  1045. });
  1046. }, 100);
  1047. }
  1048. } catch {
  1049. //
  1050. clearInterval(state.orderTimer);
  1051. }
  1052. }, 5000);
  1053. };
  1054. // 实名认证成功
  1055. const onAuthSuccess = () => {
  1056. //
  1057. state.authShow = false;
  1058. paymentContinue(); // 实名成功后自动支付
  1059. };
  1060. /**
  1061. * 页面停留时间
  1062. * @param pageBrowseTime 停留时间
  1063. * @param joinType 加入方式
  1064. * @param userId 用户编号
  1065. * @param schoolId 学校编号
  1066. */
  1067. const updateStat = async (
  1068. pageBrowseTime = 5,
  1069. joinType?: string,
  1070. userId?: string,
  1071. schoolId?: string
  1072. ) => {
  1073. try {
  1074. const { data } = await requestStudent.post(
  1075. '/edu-app/open/studentRegisterPointRecord/update',
  1076. {
  1077. data: {
  1078. id: forms.saveId,
  1079. useTime: pageBrowseTime, // 固定10秒
  1080. joinType,
  1081. userId,
  1082. schoolId
  1083. }
  1084. }
  1085. );
  1086. forms.saveId = data;
  1087. return data;
  1088. } catch {
  1089. //
  1090. }
  1091. };
  1092. const getAppIdAndCode = async (url?: string) => {
  1093. try {
  1094. const { data } = await request.get(
  1095. '/edu-app/open/paramConfig/wechatAppId'
  1096. );
  1097. // 判断是否有微信appId
  1098. if (data) {
  1099. closeToast();
  1100. goWechatAuth(data, url);
  1101. }
  1102. } catch {
  1103. //
  1104. }
  1105. };
  1106. if (browser().weixin) {
  1107. //授权
  1108. const openId = sessionStorage.getItem('active-open-id');
  1109. forms.openId = openId;
  1110. const code = getUrlCode();
  1111. if (!code) {
  1112. const newUrl =
  1113. window.location.origin +
  1114. window.location.pathname +
  1115. '#' +
  1116. route.path +
  1117. '?' +
  1118. qs.stringify({
  1119. ...route.query
  1120. });
  1121. getAppIdAndCode(newUrl);
  1122. return '';
  1123. } else {
  1124. forms.code = code;
  1125. }
  1126. }
  1127. const formatTimerTo = (num: number): string => {
  1128. if (num > 9) {
  1129. return num + '';
  1130. } else {
  1131. return '0' + num;
  1132. }
  1133. };
  1134. const pagePointInit = async () => {
  1135. try {
  1136. // 判断是否获取微信code码
  1137. if (!forms.code) return;
  1138. const { data } = await request.post(
  1139. '/edu-app/open/studentRegisterPointRecord/save',
  1140. {
  1141. data: {
  1142. code: forms.code,
  1143. schoolId: forms.schoolId,
  1144. openId: forms.openId
  1145. }
  1146. }
  1147. );
  1148. forms.saveId = data.id;
  1149. forms.openId = data.openId;
  1150. sessionStorage.setItem('active-open-id', data.openId);
  1151. // 间隔多少时间同步数据
  1152. forms.intervalFnRef = useIntervalFn(async () => {
  1153. // 页面时间恢复
  1154. pageTimer.counter.value = 0;
  1155. pageTimer.resume();
  1156. // 同步数据时先进行有效时间进行保存
  1157. await updateStat();
  1158. }, 5000);
  1159. } catch {}
  1160. };
  1161. /** 手机号变更时清空验证码信息,用户信息 */
  1162. const phoneChangeEmptyInfo = () => {
  1163. studentInfo.password = '';
  1164. studentInfo.extra.nickname = '';
  1165. studentInfo.extra.currentGradeNum = '';
  1166. studentInfo.extra.currentClass = '';
  1167. studentInfo.extra.gender = 1;
  1168. forms.currentClassText = '';
  1169. forms.gradeNumText = '';
  1170. forms.studentList = []; // 手机号关联学生列表
  1171. forms.studentItem = {}; // 选择的学生
  1172. forms.isRegister = 'create'; // 是否注册学生
  1173. forms.isTipRegister = false; // 是否显示名字不一致 - 默认显示
  1174. forms.isChangeSchool = false; // 是否切换学校
  1175. };
  1176. onMounted(async () => {
  1177. try {
  1178. // 获取支付类型
  1179. const { data } = await request.get(
  1180. '/edu-app/open/paramConfig/queryByParamNameList',
  1181. {
  1182. requestType: 'form',
  1183. params: {
  1184. paramNames:
  1185. 'payment_service_provider,contract_sign,multi_user_limit'
  1186. }
  1187. }
  1188. );
  1189. if (data && Array.isArray(data)) {
  1190. data.forEach((item: any) => {
  1191. if (item.paramName === 'contract_sign') {
  1192. forms.contract_sign = item.paramValue === '1' ? true : false;
  1193. } else if (item.paramName === 'payment_service_provider') {
  1194. forms.paymentType = item.paramValue || '';
  1195. } else if (item.paramName === 'multi_user_limit') {
  1196. forms.multi_user_limit = item.paramValue
  1197. ? Number(item.paramValue)
  1198. : 1;
  1199. }
  1200. });
  1201. }
  1202. await getRegisterGoods();
  1203. } catch {}
  1204. });
  1205. onUnmounted(() => {
  1206. forms.intervalFnRef?.pause(); // 暂停回调
  1207. });
  1208. return () => (
  1209. <div class={styles['student-register']}>
  1210. <div class={styles.studentRegisterContainer}>
  1211. {!forms.activeOverStatus && (
  1212. <div class={styles.countdownSection}>
  1213. <div class={styles.timer}>
  1214. <img src={icon3} class={styles.timerTitle} />
  1215. <div class={styles.timerAll}>
  1216. <span>{formatTimerTo(overCountDown.current.value.days)}</span>
  1217. <span>
  1218. {formatTimerTo(overCountDown.current.value.hours)}
  1219. </span>
  1220. <span>
  1221. {formatTimerTo(overCountDown.current.value.minutes)}
  1222. </span>
  1223. <span>
  1224. {formatTimerTo(overCountDown.current.value.seconds)}
  1225. </span>
  1226. </div>
  1227. </div>
  1228. <div class={styles.timerTip}>
  1229. 为了确保您能顺利参与学习,请在规定时间内报名
  1230. </div>
  1231. </div>
  1232. )}
  1233. <div
  1234. class={[
  1235. styles.studentSection,
  1236. styles.studentSectionForm,
  1237. styles.noSendDay
  1238. ]}>
  1239. {/* <div class={styles.title1}></div> */}
  1240. <Form labelAlign="left" class={styles.registerForm}>
  1241. <Field
  1242. clearable={false}
  1243. label="联系方式(直接监护人)"
  1244. placeholder="请输入手机号码"
  1245. type="tel"
  1246. required
  1247. autocomplete="off"
  1248. inputAlign="right"
  1249. class={styles.username}
  1250. v-model={studentInfo.username}
  1251. border={false}
  1252. maxlength={11}
  1253. onUpdate:modelValue={() => {
  1254. phoneChangeEmptyInfo();
  1255. }}>
  1256. {{
  1257. label: () => (
  1258. <div>
  1259. 联系方式
  1260. {/* (直接监护人) */}
  1261. <p class={styles.tips}>(直接监护人)</p>
  1262. </div>
  1263. )
  1264. }}
  1265. </Field>
  1266. <div class={['van-hairline--bottom', styles.fieldTipsGroup]}>
  1267. <div class={[styles.fieldTips]}>
  1268. <i class={styles.iconQuestion}></i>
  1269. 手机号是音乐数字课堂的唯一登录账户
  1270. </div>
  1271. </div>
  1272. <Field
  1273. center
  1274. clearable={false}
  1275. required
  1276. inputAlign="right"
  1277. label="验证码"
  1278. placeholder="请输入验证码"
  1279. autocomplete="off"
  1280. type="number"
  1281. v-model={studentInfo.password}
  1282. maxlength={6}
  1283. onUpdate:modelValue={(val: any) => {
  1284. getUserInfos();
  1285. }}>
  1286. {{
  1287. button: () =>
  1288. forms.countDownStatus ? (
  1289. <span
  1290. class={[
  1291. styles.codeText,
  1292. !validatePhone.value ? styles.codeTextDisabled : ''
  1293. ]}
  1294. onClick={onSendCode}>
  1295. 获取验证码
  1296. </span>
  1297. ) : (
  1298. <CountDown
  1299. ref={(el: any) => (countDownRef.value = el)}
  1300. auto-start={false}
  1301. class={styles.countDown}
  1302. time={forms.countDownTime}
  1303. onFinish={onFinished}
  1304. format="ss秒后重试"
  1305. />
  1306. )
  1307. }}
  1308. </Field>
  1309. {/* 大于等于2,则可以切换学生 */}
  1310. {/* {forms.studentList.length > 1 && (
  1311. <div
  1312. class={[
  1313. styles.selectStudentGroup,
  1314. forms.showSelectStudent && styles.selectStudentGroupChecked
  1315. ]}
  1316. onClick={() => (forms.showSelectStudent = true)}>
  1317. <i
  1318. class={[
  1319. styles.studentIcon,
  1320. !forms.studentItem.userId && styles.studentIconAdd
  1321. ]}></i>
  1322. <span>
  1323. {forms.studentItem.userId
  1324. ? forms.studentItem.nickname
  1325. : '新增学生'}
  1326. </span>
  1327. </div>
  1328. )} */}
  1329. <Field
  1330. clearable={false}
  1331. required
  1332. inputAlign="right"
  1333. label="学生姓名"
  1334. placeholder="请输入学生姓名"
  1335. autocomplete="off"
  1336. maxlength={14}
  1337. v-model={studentInfo.extra.nickname}>
  1338. {{
  1339. extra: () =>
  1340. forms.studentList.length > 1 && (
  1341. <div
  1342. class={[
  1343. styles.selectStudentGroup,
  1344. forms.showSelectStudent &&
  1345. styles.selectStudentGroupChecked
  1346. ]}
  1347. onClick={() => (forms.showSelectStudent = true)}>
  1348. <span>
  1349. {forms.studentItem.userId ? '切换' : '新增'}
  1350. </span>
  1351. </div>
  1352. )
  1353. }}
  1354. </Field>
  1355. <Field
  1356. clearable={false}
  1357. required
  1358. inputAlign="right"
  1359. label="学生性别"
  1360. placeholder="请选择性别"
  1361. autocomplete="off"
  1362. // v-model={studentInfo.extra.nickname}
  1363. >
  1364. {{
  1365. input: () => (
  1366. <RadioGroup
  1367. checked-color="linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)"
  1368. v-model={studentInfo.extra.gender}
  1369. direction="horizontal">
  1370. <Tag
  1371. size="large"
  1372. type="primary"
  1373. color={
  1374. !(studentInfo.extra.gender === 1)
  1375. ? '#F5F6FA'
  1376. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  1377. }
  1378. textColor={
  1379. !(studentInfo.extra.gender === 1) ? '#626264' : '#fff'
  1380. }
  1381. class={styles.radioSection}>
  1382. <Radio class={styles.radioItem} name={1}></Radio>男
  1383. </Tag>
  1384. <Tag
  1385. size="large"
  1386. type="primary"
  1387. color={
  1388. !(studentInfo.extra.gender === 0)
  1389. ? '#F5F6FA'
  1390. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  1391. }
  1392. textColor={
  1393. !(studentInfo.extra.gender === 0) ? '#626264' : '#fff'
  1394. }
  1395. class={styles.radioSection}>
  1396. <Radio class={styles.radioItem} name={0}></Radio>女
  1397. </Tag>
  1398. </RadioGroup>
  1399. )
  1400. }}
  1401. </Field>
  1402. <Field
  1403. clearable={false}
  1404. required
  1405. inputAlign="right"
  1406. label="所在年级"
  1407. placeholder="请选择年级"
  1408. isLink
  1409. readonly
  1410. clickable={false}
  1411. modelValue={forms.gradeNumText}
  1412. onClick={() => {
  1413. forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  1414. forms.gradeStatus = true;
  1415. }}
  1416. />
  1417. <Field
  1418. clearable={false}
  1419. required
  1420. inputAlign="right"
  1421. label="所在班级"
  1422. placeholder="请选择班级"
  1423. isLink
  1424. readonly
  1425. clickable={false}
  1426. modelValue={forms.currentClassText}
  1427. onClick={() => {
  1428. if (
  1429. forms.schoolInstrumentSetType === 'CLASS' &&
  1430. forms.classList.length <= 0
  1431. ) {
  1432. showToast('请先选择年级');
  1433. return;
  1434. }
  1435. forms.classPopupIndex = [studentInfo.extra.currentClass];
  1436. forms.classStatus = true;
  1437. }}
  1438. />
  1439. {/* {forms.giftVipDay > 0 ? (
  1440. <div class={styles.memberNumer}>
  1441. <img src={iconGift} class={styles.iconGift} />
  1442. <p>
  1443. 注册成功即可获得乐器AI学练工具
  1444. <span>{forms.giftVipDay || 0}</span>天有效期
  1445. </p>
  1446. </div>
  1447. ) : (
  1448. ''
  1449. )} */}
  1450. </Form>
  1451. </div>
  1452. {/* <div class={styles.studentSection}>
  1453. <div class={styles.title2}></div>
  1454. <div class={styles.goodsGroup}>
  1455. <div
  1456. class={[
  1457. styles.goodsItem,
  1458. styles.digitalize,
  1459. forms.joinType === 'digitalize' && styles.checked
  1460. ]}
  1461. onClick={() => {
  1462. //
  1463. if (checkForm()) {
  1464. showToast('请将资料填写完整');
  1465. return;
  1466. }
  1467. forms.joinType = 'digitalize';
  1468. nextTick(() => {
  1469. mstickyRef.value?.onChnageHeight();
  1470. setTimeout(() => {
  1471. window.scrollTo(0, 1000);
  1472. }, 50);
  1473. });
  1474. }}>
  1475. <div class={styles.goodsInner}>
  1476. <i class={styles.proposalTip}></i>
  1477. 数字化方式
  1478. </div>
  1479. </div>
  1480. <div
  1481. class={[
  1482. styles.goodsItem,
  1483. styles.tradition,
  1484. forms.joinType === 'tradition' && styles.checked1
  1485. ]}
  1486. onClick={() => {
  1487. if (checkForm()) {
  1488. showToast('请将资料填写完整');
  1489. return;
  1490. }
  1491. forms.joinType = 'tradition';
  1492. nextTick(() => {
  1493. mstickyRef.value?.onChnageHeight();
  1494. setTimeout(() => {
  1495. window.scrollTo(0, 1000);
  1496. }, 50);
  1497. });
  1498. }}>
  1499. <div class={styles.goodsInner}>传统方式</div>
  1500. </div>
  1501. </div>
  1502. </div> */}
  1503. <div class={[styles.goodsExtra]}>
  1504. {/* <i class={styles.iconArrow}></i> */}
  1505. <Cell
  1506. border={false}
  1507. class={styles.goodsCell}
  1508. center
  1509. onClick={() => {
  1510. // console.log(forms.joinType, 'joinType');
  1511. if (forms.joinType === 'digitalize') {
  1512. otherParams.showOtherMessage = `没有陪练工具,将无法实现同步练习`;
  1513. otherParams.showOtherSchool = true;
  1514. otherParams.showCloseButton = true;
  1515. otherParams.showCancelButton = true;
  1516. otherParams.cancelButtonColor = '';
  1517. otherParams.cancelButtonText = '确认取消';
  1518. otherParams.confirmButtonColor = '';
  1519. otherParams.confirmButtonText = '放弃取消';
  1520. otherParams.otherType = 'payment';
  1521. otherParams.messageAlign = 'center';
  1522. } else if (forms.joinType === 'tradition') {
  1523. forms.joinType = 'digitalize';
  1524. }
  1525. }}>
  1526. {{
  1527. icon: () => (
  1528. <div class={styles.checkedGroup}>
  1529. <i
  1530. class={[
  1531. styles.iconChecked,
  1532. forms.joinType === 'digitalize' && styles.selected
  1533. ]}></i>
  1534. {/* {forms.tipStatus && <i class={styles.showBg}></i>} */}
  1535. {forms.joinType === 'digitalize' && (
  1536. <i class={styles.showBg}></i>
  1537. )}
  1538. </div>
  1539. ),
  1540. title: () => (
  1541. <div class={styles.section}>
  1542. <Image
  1543. class={styles.img}
  1544. src={forms.detailVip.goodsUrl || tuangou}
  1545. />
  1546. <div class={styles.sectionContent}>
  1547. <img src={icon5} class={styles.goodsName} />
  1548. {/* <h2>
  1549. <img src={icon5} class={styles.goodsName} />
  1550. </h2>
  1551. <p class={[styles.model]}>
  1552. <p>
  1553. <i></i>解决学生不会练、不知练的对错
  1554. </p>
  1555. <p>
  1556. <i></i>家长无法辅导、无需再额外请老师
  1557. </p>
  1558. </p>
  1559. <img src={icon6} class={styles.sendInstrument} /> */}
  1560. </div>
  1561. </div>
  1562. )
  1563. }}
  1564. </Cell>
  1565. {/* {forms.detailVip.membershipDays ? (
  1566. <div class={styles.memberNumer}>
  1567. <img src={iconGift} class={styles.iconGift} />
  1568. <p>
  1569. 现在购买赠送乐器AI学练工具
  1570. <span>{forms.detailVip.membershipDays || 0}</span>天有效期
  1571. </p>
  1572. </div>
  1573. ) : (
  1574. ''
  1575. )} */}
  1576. </div>
  1577. {/* {forms.joinType === 'tradition' && (
  1578. <div class={styles.goodsTradition}>
  1579. <i class={styles.iconArrow}></i>
  1580. <div class={styles.goodsTitle}></div>
  1581. <div class={styles.steps}>
  1582. <div class={styles.step}>
  1583. <span class={styles.nums}>
  1584. <span class={styles.numInner}>1</span>
  1585. </span>
  1586. <div class={styles.stepContent}>
  1587. <span>AI工具标准:</span>
  1588. 可以学练音乐教材中的乐曲,通过手机应用商店准备。
  1589. </div>
  1590. </div>
  1591. {['Panpipes', 'Ocarina', 'Tenor Recorder', 'Woodwind'].includes(
  1592. forms.instrumentCode
  1593. ) && (
  1594. <div class={styles.step}>
  1595. <span class={styles.nums}>
  1596. <span class={styles.numInner}>2</span>
  1597. </span>
  1598. <div class={styles.stepContent}>
  1599. <span>
  1600. {forms.instrumentCode === 'Panpipes' && '排箫'}
  1601. {forms.instrumentCode === 'Ocarina' && '陶笛'}
  1602. {forms.instrumentCode === 'Tenor Recorder' && '竖笛'}
  1603. {forms.instrumentCode === 'Woodwind' && '葫芦丝'}
  1604. 标准:
  1605. </span>
  1606. {forms.instrumentCode === 'Panpipes' &&
  1607. '管数不限,建议20管以上C调加嘴排箫(不需要重复更换),黑色,选择单一原调(调性多很难掌握);'}
  1608. {forms.instrumentCode === 'Ocarina' &&
  1609. 'C调、蓝色、十二孔高音、树脂或陶土均可;'}
  1610. {forms.instrumentCode === 'Tenor Recorder' &&
  1611. 'C调、木质、高音德式八孔;'}
  1612. {forms.instrumentCode === 'Woodwind' &&
  1613. 'C调、红木色、树脂或木质;'}
  1614. </div>
  1615. </div>
  1616. )}
  1617. </div>
  1618. </div>
  1619. )} */}
  1620. {forms.joinType && (
  1621. <MSticky position="bottom" ref={mstickyRef}>
  1622. <div class={styles.paymentContainer}>
  1623. <div class={styles.payemntPrice}>
  1624. {/* <img src={giftTip} class={styles.giftTip} /> */}
  1625. <div>
  1626. <span class={styles.needPrice}>
  1627. <i style="font-style: normal">¥ </i>
  1628. <span>{moneyFormat(calcPrice.value.amount)}</span>
  1629. <i class={styles.unit} style="font-style: normal">
  1630. /年
  1631. </i>
  1632. </span>
  1633. {calcPrice.value.originAmount > calcPrice.value.amount &&
  1634. forms.joinType === 'digitalize' ? (
  1635. <del class={styles.allPrice}>
  1636. ¥ {moneyFormat(calcPrice.value.originAmount)}
  1637. </del>
  1638. ) : (
  1639. ''
  1640. )}
  1641. </div>
  1642. </div>
  1643. <div
  1644. class={styles.paymentBtn}
  1645. onClick={() => {
  1646. onSubmit();
  1647. }}>
  1648. <Button
  1649. round
  1650. disabled={forms.submitLoading}
  1651. loading={forms.submitLoading}>
  1652. {forms.joinType === 'digitalize'
  1653. ? '报名与支付'
  1654. : '提交报名'}
  1655. </Button>
  1656. </div>
  1657. {/* {forms.joinType === 'tradition' && (
  1658. <div
  1659. class={styles.traditionBtn}
  1660. onClick={() => {
  1661. onSubmit();
  1662. }}>
  1663. <Button
  1664. round
  1665. disabled={forms.submitLoading}
  1666. loading={forms.submitLoading}>
  1667. 提交报名
  1668. </Button>
  1669. </div>
  1670. )} */}
  1671. </div>
  1672. </MSticky>
  1673. )}
  1674. </div>
  1675. {forms.imgCodeStatus ? (
  1676. <MImgCode
  1677. v-model:value={forms.imgCodeStatus}
  1678. phone={studentInfo.username}
  1679. type="REGISTER"
  1680. onClose={() => {
  1681. forms.imgCodeStatus = false;
  1682. }}
  1683. onSendCode={onCodeSend}
  1684. />
  1685. ) : null}
  1686. {/* 年级 */}
  1687. <Popup
  1688. v-model:show={forms.gradeStatus}
  1689. position="bottom"
  1690. round
  1691. safeAreaInsetBottom
  1692. lazyRender={false}
  1693. class={'popupBottomSearch'}
  1694. onOpen={() => {
  1695. forms.gradePopupShow = true;
  1696. }}
  1697. onClosed={() => {
  1698. forms.gradePopupShow = false;
  1699. }}>
  1700. {forms.gradePopupShow && (
  1701. <Picker
  1702. showToolbar
  1703. v-model={forms.gradePopupIndex}
  1704. columns={forms.gradeList}
  1705. onCancel={() => (forms.gradeStatus = false)}
  1706. onConfirm={(val: any) => {
  1707. const selectedOption = val.selectedOptions[0];
  1708. studentInfo.extra.currentGradeNum = selectedOption.value;
  1709. forms.gradeNumText = selectedOption.text;
  1710. forms.gradeStatus = false;
  1711. if (
  1712. ['SCHOOL', 'GRADE'].includes(forms.schoolInstrumentSetType)
  1713. ) {
  1714. forms.instrumentCode = selectedOption.instrumentCode;
  1715. }
  1716. if (forms.schoolInstrumentSetType === 'CLASS') {
  1717. forms.classList = selectedOption.classList;
  1718. }
  1719. if (
  1720. ['CLASS', 'GRADE'].includes(forms.schoolInstrumentSetType)
  1721. ) {
  1722. forms.currentClassText = '';
  1723. studentInfo.extra.currentClass = '';
  1724. }
  1725. }}
  1726. />
  1727. )}
  1728. </Popup>
  1729. {/* 班级 */}
  1730. <Popup
  1731. v-model:show={forms.classStatus}
  1732. position="bottom"
  1733. round
  1734. class={'popupBottomSearch'}
  1735. onOpen={() => {
  1736. forms.classPopupShow = true;
  1737. }}
  1738. onClosed={() => {
  1739. forms.classPopupShow = false;
  1740. }}>
  1741. {forms.classPopupShow && (
  1742. <Picker
  1743. showToolbar
  1744. v-model={forms.classPopupIndex}
  1745. columns={forms.classList}
  1746. onCancel={() => (forms.classStatus = false)}
  1747. onConfirm={(val: any) => {
  1748. const selectedOption = val.selectedOptions[0];
  1749. studentInfo.extra.currentClass = selectedOption.value;
  1750. forms.currentClassText = selectedOption.text;
  1751. forms.classStatus = false;
  1752. if (['CLASS'].includes(forms.schoolInstrumentSetType)) {
  1753. forms.instrumentCode = selectedOption.instrumentCode;
  1754. }
  1755. }}
  1756. />
  1757. )}
  1758. </Popup>
  1759. {/* 已经购买过样品 */}
  1760. {/* <MDialog
  1761. title="提示"
  1762. v-model:show={forms.dialogConfirmStatus}
  1763. message={'已购买会员,是否确认购买?'}
  1764. primaryColor="#FF8057"
  1765. allowHtml={true}
  1766. confirmButtonText="确定"
  1767. showCancelButton
  1768. onConfirm={async () => {
  1769. await paymentContinue();
  1770. }}
  1771. onCancel={() => {
  1772. //取消支付,判断是否有结束时间,是否已经结束
  1773. if (forms.registerExpireTime && forms.activeOverStatus) {
  1774. applyOver();
  1775. }
  1776. }}
  1777. /> */}
  1778. <MDialog
  1779. title="提示"
  1780. v-model:show={forms.dialogStatus}
  1781. message={forms.dialogMessage}
  1782. allowHtml={true}
  1783. primaryColor="#FF8057"
  1784. showCancelButton={true}
  1785. messageAlign={forms.messageAlign}
  1786. confirmButtonText={forms.confirmButtonText}
  1787. cancelButtonText={forms.cancelButtonText}
  1788. onConfirm={async () => {
  1789. if (forms.joinType === 'tradition') {
  1790. //
  1791. await cancelPaymentOrder();
  1792. //取消支付,判断是否有结束时间,是否已经结束
  1793. if (forms.registerExpireTime && forms.activeOverStatus) {
  1794. applyOver();
  1795. }
  1796. }
  1797. if (forms.joinType === 'digitalize') {
  1798. // 继续支付
  1799. const paymentConfig = forms.dialogConfig;
  1800. state.config = paymentConfig?.paymentConfig;
  1801. state.orderNo = paymentConfig?.orderNo;
  1802. const updateStatus = await updateStudentInfo();
  1803. if (!updateStatus) return;
  1804. await lastSubmit();
  1805. }
  1806. }}
  1807. onCancel={(val: any) => {
  1808. // countDown.pause();
  1809. if (forms.joinType === 'tradition') {
  1810. forms.dialogStatus = false;
  1811. //取消支付,判断是否有结束时间,是否已经结束
  1812. if (forms.registerExpireTime && forms.activeOverStatus) {
  1813. applyOver();
  1814. }
  1815. }
  1816. if (forms.joinType === 'digitalize') {
  1817. // 重新下单 - 先关闭订单
  1818. resetOrderPayment();
  1819. }
  1820. }}
  1821. />
  1822. <Popup
  1823. show={state.paymentStatus}
  1824. closeOnClickOverlay={false}
  1825. position="bottom"
  1826. round
  1827. closeOnPopstate
  1828. safeAreaInsetBottom
  1829. style={{ minHeight: '30%' }}>
  1830. <Payment
  1831. paymentConfig={state.orderInfo}
  1832. onClose={() => (state.paymentStatus = false)}
  1833. onBackOut={onBackOut}
  1834. onConfirm={(val: any) => onConfirm(val)}
  1835. />
  1836. </Popup>
  1837. <Popup
  1838. v-model:show={state.showQrcode}
  1839. round
  1840. onClose={() => {
  1841. // 二维码关闭时清除定时器
  1842. clearInterval(state.orderTimer);
  1843. }}>
  1844. <QrcodePayment
  1845. url={state.qrCodeUrl}
  1846. pay_channel={state.pay_channel}
  1847. orderType={orderType.value}
  1848. />
  1849. </Popup>
  1850. <MPopup v-model:modelValue={state.authShow}>
  1851. <UserAuth onSuccess={onAuthSuccess} hideHeader={!browser().isApp} />
  1852. </MPopup>
  1853. {/* 是否在微信中打开 */}
  1854. <OWxTip
  1855. show={forms.showTips}
  1856. message={forms.showMessage}
  1857. showButton={forms.showButton}
  1858. buttonText="刷新"
  1859. onConfirm={() => window.location.reload()}
  1860. />
  1861. <MMessageTip
  1862. show={otherParams.showOtherSchool}
  1863. // showCloseButton={otherParams.showCloseButton}
  1864. messageAlign={otherParams.messageAlign}
  1865. message={otherParams.showOtherMessage}
  1866. showCancelButton={otherParams.showCancelButton}
  1867. cancelButtonColor={otherParams.cancelButtonColor}
  1868. cancelButtonText={otherParams.cancelButtonText}
  1869. confirmButtonColor={otherParams.confirmButtonColor}
  1870. confirmButtonText={otherParams.confirmButtonText}
  1871. onClose={() => (otherParams.showOtherSchool = false)}
  1872. onCancel={async () => {
  1873. otherParams.showOtherSchool = false;
  1874. if (otherParams.otherType === 'nickname') {
  1875. forms.isRegister = 'create'; // 新建
  1876. changeTipStatus(false, false);
  1877. onSubmit();
  1878. } else if (otherParams.otherType === 'member') {
  1879. const updateStatus = await updateStudentInfo();
  1880. if (!updateStatus) return;
  1881. //取消支付,判断是否有结束时间,是否已经结束
  1882. if (forms.registerExpireTime && forms.activeOverStatus) {
  1883. applyOver();
  1884. }
  1885. } else if (otherParams.otherType === 'payment') {
  1886. forms.joinType = 'tradition';
  1887. }
  1888. }}
  1889. onConfirm={async () => {
  1890. otherParams.showOtherSchool = false;
  1891. // 名字
  1892. if (otherParams.otherType === 'nickname') {
  1893. forms.isRegister = 'update'; // 修改
  1894. changeTipStatus(false, false);
  1895. // 直接注册
  1896. onSubmit();
  1897. } else if (otherParams.otherType === 'change') {
  1898. // 学校更换
  1899. forms.isChangeSchool = true;
  1900. // 直接注册
  1901. onSubmit();
  1902. } else if (otherParams.otherType === 'limit') {
  1903. // 人数超限制
  1904. changeTipStatus(
  1905. forms.isRegister === 'create' && !forms.studentItem.userId
  1906. ? false
  1907. : true,
  1908. false
  1909. );
  1910. } else if (otherParams.otherType === 'member') {
  1911. await paymentContinue();
  1912. }
  1913. }}
  1914. />
  1915. <Popup
  1916. v-model:show={forms.showSelectStudent}
  1917. round
  1918. position="bottom"
  1919. safeAreaInsetBottom
  1920. closeable
  1921. class={styles.selectStudentPopup}>
  1922. <SelectStudent
  1923. studentItem={forms.studentItem}
  1924. list={forms.studentList}
  1925. onClose={() => (forms.showSelectStudent = false)}
  1926. onConfirm={(val: any) => {
  1927. if (val.userId) {
  1928. forms.studentItem = val;
  1929. const firstStudent = val;
  1930. studentInfo.extra.nickname = firstStudent.nickname;
  1931. const tempGrade: any = forms.gradeList || [];
  1932. studentInfo.extra.currentGradeNum = null;
  1933. forms.gradeNumText = '';
  1934. forms.instrumentCode = '';
  1935. tempGrade?.forEach((i: any) => {
  1936. if (i.value === firstStudent.currentGradeNum) {
  1937. forms.instrumentCode = i.instrumentCode;
  1938. forms.gradeNumText = i.text;
  1939. studentInfo.extra.currentGradeNum =
  1940. firstStudent.currentGradeNum;
  1941. if (forms.schoolInstrumentSetType === 'CLASS') {
  1942. forms.classList = i.classList;
  1943. }
  1944. }
  1945. });
  1946. studentInfo.extra.currentClass = null;
  1947. forms.currentClassText = '';
  1948. forms.classList.forEach((i: any) => {
  1949. if (i.value === firstStudent.currentClass) {
  1950. forms.currentClassText = i.text;
  1951. studentInfo.extra.currentClass = firstStudent.currentClass;
  1952. }
  1953. });
  1954. studentInfo.extra.gender = firstStudent.gender;
  1955. forms.isRegister = 'update';
  1956. changeTipStatus(true, false);
  1957. forms.showSelectStudent = false;
  1958. } else {
  1959. // 判断新建学员是否上限了
  1960. if (forms.studentList.length >= forms.multi_user_limit) {
  1961. otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
  1962. otherParams.showOtherSchool = true;
  1963. otherParams.showCancelButton = false;
  1964. otherParams.showCloseButton = true;
  1965. otherParams.confirmButtonColor =
  1966. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  1967. otherParams.confirmButtonText = '我知道了';
  1968. otherParams.otherType = 'limit';
  1969. otherParams.messageAlign = 'center';
  1970. return true;
  1971. } else {
  1972. forms.studentItem = val;
  1973. forms.isRegister = 'create';
  1974. changeTipStatus(false, false);
  1975. studentInfo.extra.nickname = '';
  1976. studentInfo.extra.currentGradeNum = '';
  1977. studentInfo.extra.currentClass = '';
  1978. studentInfo.extra.gender = 1;
  1979. forms.currentClassText = '';
  1980. forms.gradeNumText = '';
  1981. forms.showSelectStudent = false;
  1982. }
  1983. }
  1984. }}
  1985. />
  1986. </Popup>
  1987. </div>
  1988. );
  1989. }
  1990. });