|
@@ -62,6 +62,7 @@ import { useInterval, useIntervalFn } from '@vueuse/core';
|
|
|
import MPopup from '@/components/m-popup';
|
|
|
import UserAuth from './component/user-auth';
|
|
|
import MMessageTip from '@/components/m-message-tip';
|
|
|
+import SelectStudent from './modal/select-student';
|
|
|
|
|
|
const classList: any = [];
|
|
|
for (let i = 1; i <= 40; i++) {
|
|
@@ -121,6 +122,7 @@ export default defineComponent({
|
|
|
const forms = reactive({
|
|
|
schoolId: route.query.sId as any,
|
|
|
paymentType: '', // 支付类型
|
|
|
+ multi_user_limit: 1, // 限制注册学生数量
|
|
|
// popupShow: false,
|
|
|
registerDetails: {} as any,
|
|
|
details: [] as any[],
|
|
@@ -128,6 +130,10 @@ export default defineComponent({
|
|
|
gradeYear: '', // 学制
|
|
|
schoolInstrumentSetType: null as any,
|
|
|
// bugGoods: false, // 是否购买AI
|
|
|
+
|
|
|
+ isRegister: '' as 'create' | 'update' | '', // 是否注册学生
|
|
|
+ isChangeSchool: false, // 是否切换学校
|
|
|
+
|
|
|
registerType: '', // 报名类型
|
|
|
detailVip: {} as any,
|
|
|
giftVipDay: 0, // 赠送天数
|
|
@@ -145,8 +151,6 @@ export default defineComponent({
|
|
|
gradeStatus: false,
|
|
|
classStatus: false,
|
|
|
loading: false,
|
|
|
- // dialogStatusVisible: false,
|
|
|
- // dialogStatusMessage: '',
|
|
|
|
|
|
dialogStatus: false,
|
|
|
dialogMessage: '',
|
|
@@ -158,8 +162,9 @@ export default defineComponent({
|
|
|
contract_sign: false, // 是否实名认证
|
|
|
countDownTimePay: 60 * 1000,
|
|
|
dialogConfig: {} as any,
|
|
|
- showOtherSchool: false,
|
|
|
- showOtherMessage: '',
|
|
|
+ showSelectStudent: false, // 选择学生
|
|
|
+ studentList: [], // 手机号关联学生列表
|
|
|
+ studentItem: {} as any, // 选择的学生
|
|
|
joinType: '' as 'digitalize' | 'tradition',
|
|
|
gradeList: [] as any,
|
|
|
classList: [] as any,
|
|
@@ -176,6 +181,20 @@ export default defineComponent({
|
|
|
classPopupIndex: [] as any // 班级下拉索引
|
|
|
});
|
|
|
|
|
|
+ const otherParams = reactive({
|
|
|
+ showOtherSchool: false,
|
|
|
+ showOtherMessage: '',
|
|
|
+ /** limit 超限制,change 更换学生,nickname 名称不一致 */
|
|
|
+ otherType: '' as 'limit' | 'change' | 'nickname',
|
|
|
+ showCancelButton: true,
|
|
|
+ cancelButtonColor: '',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ showConfirmButton: true,
|
|
|
+ confirmButtonColor: '',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ messageAlign: 'left' as 'center' | 'left' | 'right'
|
|
|
+ });
|
|
|
+
|
|
|
const state = reactive({
|
|
|
showQrcode: false,
|
|
|
qrCodeUrl: '',
|
|
@@ -208,19 +227,6 @@ export default defineComponent({
|
|
|
const pageTimer = useInterval(1000, { controls: true });
|
|
|
pageTimer.pause();
|
|
|
|
|
|
- // const countDown = useCountDown({
|
|
|
- // // 倒计时 60 秒
|
|
|
- // time: forms.countDownTimePay,
|
|
|
- // onChange(current: CurrentTime) {
|
|
|
- // forms.dialogStatusMessage = `有待支付订单,请在${Math.ceil(
|
|
|
- // current.total / 1000
|
|
|
- // )}s后重试`;
|
|
|
- // },
|
|
|
- // onFinish() {
|
|
|
- // forms.dialogStatusVisible = false;
|
|
|
- // }
|
|
|
- // });
|
|
|
-
|
|
|
const overCountDown = useCountDown({
|
|
|
time: forms.activeOverTime,
|
|
|
onFinish() {
|
|
@@ -320,10 +326,6 @@ export default defineComponent({
|
|
|
});
|
|
|
});
|
|
|
forms.gradeList.sort((a: any, b: any) => a.value - b.value);
|
|
|
- // console.log(
|
|
|
- // forms.gradeList.sort((a: any, b: any) => a.value - b.value),
|
|
|
- // 'forms.gradeList.sort((a: any, b: any) => a.value - b.value)'
|
|
|
- // );
|
|
|
forms.classList = classList;
|
|
|
} else if (data.schoolInstrumentSetType === 'CLASS') {
|
|
|
// 班级
|
|
@@ -436,8 +438,10 @@ export default defineComponent({
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
- // 登记成功之后购买
|
|
|
- const onSubmit = async (isRegister = false) => {
|
|
|
+ /**
|
|
|
+ * 登记成功之后购买
|
|
|
+ */
|
|
|
+ const onSubmit = async () => {
|
|
|
forms.submitLoading = true;
|
|
|
try {
|
|
|
if (checkForm()) {
|
|
@@ -445,20 +449,75 @@ export default defineComponent({
|
|
|
return;
|
|
|
}
|
|
|
const { extra, ...res } = studentInfo;
|
|
|
- if (!isRegister) {
|
|
|
- const checkSchool = await request.get(
|
|
|
- `/edu-app/open/student/studentSchool?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
|
|
|
- );
|
|
|
- if (checkSchool.data?.schoolId !== forms.schoolId) {
|
|
|
- forms.showOtherSchool = true;
|
|
|
- forms.showOtherMessage = `您已绑定【${
|
|
|
- forms.registerDetails.schoolName || ''
|
|
|
- }】,提交后将更换到【${
|
|
|
- checkSchool.data?.schoolName
|
|
|
- }】,是否确认提交?`;
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (
|
|
|
+ forms.studentItem.nickname !== extra.nickname &&
|
|
|
+ forms.isRegister === ''
|
|
|
+ ) {
|
|
|
+ otherParams.showOtherMessage =
|
|
|
+ '学生姓名与上次提交信息不一致,请确认修改学生信息或创建新的学生账号';
|
|
|
+ otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCancelButton = true;
|
|
|
+ otherParams.cancelButtonColor =
|
|
|
+ 'linear-gradient( 224deg, #3FE1E6 0%, #00CDD4 100%)';
|
|
|
+ otherParams.cancelButtonText = '新建学生';
|
|
|
+ otherParams.confirmButtonColor =
|
|
|
+ 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
|
|
|
+ otherParams.confirmButtonText = '修改信息';
|
|
|
+ otherParams.otherType = 'nickname';
|
|
|
+ otherParams.messageAlign = 'left';
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ // 判断新建学员是否上限了
|
|
|
+ if (
|
|
|
+ !forms.studentItem.userId &&
|
|
|
+ forms.studentList.length >= forms.multi_user_limit
|
|
|
+ ) {
|
|
|
+ otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
|
|
|
+ otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCancelButton = false;
|
|
|
+ otherParams.confirmButtonColor =
|
|
|
+ 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
|
|
|
+ otherParams.confirmButtonText = '我知道了';
|
|
|
+ otherParams.otherType = 'limit';
|
|
|
+ otherParams.messageAlign = 'center';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断是否为同一个学校
|
|
|
+ if (
|
|
|
+ forms.studentItem.schoolId !== forms.registerDetails.schoolId &&
|
|
|
+ !forms.isChangeSchool
|
|
|
+ ) {
|
|
|
+ otherParams.showOtherMessage = `您已绑定【${
|
|
|
+ forms.registerDetails.schoolName || ''
|
|
|
+ }】,提交后将更换到【${
|
|
|
+ forms.studentItem?.schoolName
|
|
|
+ }】,是否确认提交?`;
|
|
|
+ otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCancelButton = true;
|
|
|
+ otherParams.cancelButtonColor = '';
|
|
|
+ otherParams.cancelButtonText = '取消';
|
|
|
+ otherParams.confirmButtonColor = '';
|
|
|
+ otherParams.confirmButtonText = '确定';
|
|
|
+ otherParams.otherType = 'change';
|
|
|
+ otherParams.messageAlign = 'left';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (!isRegister) {
|
|
|
+ // const checkSchool = await request.get(
|
|
|
+ // `/edu-app/open/student/studentSchool?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
|
|
|
+ // );
|
|
|
+ // if (checkSchool.data?.schoolId !== forms.schoolId) {
|
|
|
+ // forms.showOtherSchool = true;
|
|
|
+ // forms.showOtherMessage = `您已绑定【${
|
|
|
+ // forms.registerDetails.schoolName || ''
|
|
|
+ // }】,提交后将更换到【${
|
|
|
+ // checkSchool.data?.schoolName
|
|
|
+ // }】,是否确认提交?`;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
const result = await request.post('/edu-app/userlogin', {
|
|
|
requestType: 'form',
|
|
|
data: {
|
|
@@ -521,6 +580,9 @@ export default defineComponent({
|
|
|
} catch {
|
|
|
} finally {
|
|
|
forms.submitLoading = false;
|
|
|
+ // 重置信息
|
|
|
+ forms.isRegister = '';
|
|
|
+ forms.isChangeSchool = false;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -574,38 +636,31 @@ export default defineComponent({
|
|
|
const { data } = await request.get(
|
|
|
`/edu-app/open/student/studentInfo?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
|
|
|
);
|
|
|
- if (data) {
|
|
|
- if (!studentInfo.extra.nickname) {
|
|
|
- studentInfo.extra.nickname = data.nickname;
|
|
|
- }
|
|
|
-
|
|
|
- if (!studentInfo.extra.currentGradeNum) {
|
|
|
- const tempGrade: any = forms.gradeList || [];
|
|
|
- // console.log(tempGrade, 'tempGrade');
|
|
|
- tempGrade?.forEach((i: any) => {
|
|
|
- if (i.value === data.currentGradeNum) {
|
|
|
- forms.instrumentCode = i.instrumentCode;
|
|
|
- forms.gradeNumText = i.text;
|
|
|
- studentInfo.extra.currentGradeNum = data.currentGradeNum;
|
|
|
- if (forms.schoolInstrumentSetType === 'CLASS') {
|
|
|
- forms.classList = i.classList;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (!studentInfo.extra.currentClass) {
|
|
|
- forms.classList.forEach((i: any) => {
|
|
|
- if (i.value === data.currentClass) {
|
|
|
- forms.currentClassText = i.text;
|
|
|
- studentInfo.extra.currentClass = data.currentClass;
|
|
|
+ console.log(data, 'studentInfo');
|
|
|
+ forms.studentList = data || [];
|
|
|
+
|
|
|
+ if (forms.studentList.length > 0) {
|
|
|
+ const firstStudent: any = forms.studentList[0];
|
|
|
+ forms.studentItem = firstStudent;
|
|
|
+ studentInfo.extra.nickname = firstStudent.nickname;
|
|
|
+ const tempGrade: any = forms.gradeList || [];
|
|
|
+ tempGrade?.forEach((i: any) => {
|
|
|
+ if (i.value === firstStudent.currentGradeNum) {
|
|
|
+ forms.instrumentCode = i.instrumentCode;
|
|
|
+ forms.gradeNumText = i.text;
|
|
|
+ studentInfo.extra.currentGradeNum = firstStudent.currentGradeNum;
|
|
|
+ if (forms.schoolInstrumentSetType === 'CLASS') {
|
|
|
+ forms.classList = i.classList;
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
- studentInfo.extra.gender =
|
|
|
- studentInfo.extra.gender !== data.gender
|
|
|
- ? data.gender
|
|
|
- : studentInfo.extra.gender;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ forms.classList.forEach((i: any) => {
|
|
|
+ if (i.value === firstStudent.currentClass) {
|
|
|
+ forms.currentClassText = i.text;
|
|
|
+ studentInfo.extra.currentClass = firstStudent.currentClass;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ studentInfo.extra.gender = firstStudent.gender;
|
|
|
}
|
|
|
} catch {
|
|
|
//
|
|
@@ -681,29 +736,6 @@ export default defineComponent({
|
|
|
state.orderNo = paddingConfig?.orderNo;
|
|
|
await lastSubmit();
|
|
|
return true;
|
|
|
- // 判断是否可以取消订单
|
|
|
- // if (paddingData.cancelPayment) {
|
|
|
- // await request.post(
|
|
|
- // '/edu-app/userPaymentOrder/cancelPayment/' +
|
|
|
- // paddingConfig.orderNo
|
|
|
- // );
|
|
|
- // return false;
|
|
|
- // } else {
|
|
|
- // // forms.countDownTime = paddingData.cancelTimes;
|
|
|
- // // countDown.reset(Number(paddingData.cancelTimes));
|
|
|
- // // countDown.start();
|
|
|
- // // forms.dialogStatusMessage = `有待支付订单,请在${Math.ceil(
|
|
|
- // // countDown.current.value.total / 1000
|
|
|
- // // )}s后重试`;
|
|
|
- // // forms.dialogStatusVisible = true;
|
|
|
- // // forms.dialogConfig = paddingData;
|
|
|
- // // 继续支付
|
|
|
- // // const paymentConfig = forms.dialogConfig;
|
|
|
- // state.config = paddingConfig?.paymentConfig;
|
|
|
- // state.orderNo = paddingConfig?.orderNo;
|
|
|
- // await lastSubmit();
|
|
|
- // return true;
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
return false;
|
|
@@ -1070,7 +1102,34 @@ export default defineComponent({
|
|
|
};
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- await getRegisterGoods();
|
|
|
+ try {
|
|
|
+ // 获取支付类型
|
|
|
+ const { data } = await request.get(
|
|
|
+ '/edu-app/open/paramConfig/queryByParamNameList',
|
|
|
+ {
|
|
|
+ requestType: 'form',
|
|
|
+ params: {
|
|
|
+ paramNames:
|
|
|
+ 'payment_service_provider,contract_sign,multi_user_limit'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ if (data && Array.isArray(data)) {
|
|
|
+ data.forEach((item: any) => {
|
|
|
+ if (item.paramName === 'contract_sign') {
|
|
|
+ forms.contract_sign = item.paramValue === '1' ? true : false;
|
|
|
+ } else if (item.paramName === 'payment_service_provider') {
|
|
|
+ forms.paymentType = item.paramValue || '';
|
|
|
+ } else if (item.paramName === 'multi_user_limit') {
|
|
|
+ forms.multi_user_limit = item.paramValue
|
|
|
+ ? Number(item.paramValue)
|
|
|
+ : 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ await getRegisterGoods();
|
|
|
+ } catch {}
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
@@ -1193,10 +1252,22 @@ export default defineComponent({
|
|
|
<div class={styles.title1}></div>
|
|
|
|
|
|
<Form labelAlign="left" class={styles.registerForm}>
|
|
|
- <div class={styles.selectStudentGroup}>
|
|
|
- <i class={styles.studentIcon}></i>
|
|
|
- <span>新增学生</span>
|
|
|
- </div>
|
|
|
+ {/* 大于等于2,则可以切换学生 */}
|
|
|
+ {forms.studentList.length > 1 && (
|
|
|
+ <div
|
|
|
+ class={[
|
|
|
+ styles.selectStudentGroup,
|
|
|
+ forms.showSelectStudent && styles.selectStudentGroupChecked
|
|
|
+ ]}
|
|
|
+ onClick={() => (forms.showSelectStudent = true)}>
|
|
|
+ <i
|
|
|
+ class={[
|
|
|
+ styles.studentIcon,
|
|
|
+ !forms.studentItem.userId && styles.studentIconAdd
|
|
|
+ ]}></i>
|
|
|
+ <span>新增学生</span>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
|
|
|
<Field
|
|
|
clearable={false}
|
|
@@ -1605,29 +1676,6 @@ export default defineComponent({
|
|
|
}}
|
|
|
/>
|
|
|
|
|
|
- {/* <MDialog
|
|
|
- title="提示"
|
|
|
- v-model:show={forms.dialogStatusVisible}
|
|
|
- message={forms.dialogStatusMessage}
|
|
|
- allowHtml={true}
|
|
|
- primaryColor="#FF8057"
|
|
|
- confirmButtonText="继续支付"
|
|
|
- onConfirm={async () => {
|
|
|
- countDown.pause();
|
|
|
- const paymentConfig = forms.dialogConfig.paymentConfig;
|
|
|
- state.config = paymentConfig?.paymentConfig;
|
|
|
- state.orderNo = paymentConfig?.orderNo;
|
|
|
- await lastSubmit();
|
|
|
- }}
|
|
|
- onCancel={(val: any) => {
|
|
|
- countDown.pause();
|
|
|
- //取消支付,判断是否有结束时间,是否已经结束
|
|
|
- if (forms.registerExpireTime && forms.activeOverStatus) {
|
|
|
- applyOver();
|
|
|
- }
|
|
|
- }}
|
|
|
- /> */}
|
|
|
-
|
|
|
<MDialog
|
|
|
title="提示"
|
|
|
v-model:show={forms.dialogStatus}
|
|
@@ -1718,17 +1766,47 @@ export default defineComponent({
|
|
|
/>
|
|
|
|
|
|
<MMessageTip
|
|
|
- show={forms.showOtherSchool}
|
|
|
- messageAlign="left"
|
|
|
- message={forms.showOtherMessage}
|
|
|
- showCancelButton
|
|
|
- onCancel={() => (forms.showOtherSchool = false)}
|
|
|
+ show={otherParams.showOtherSchool}
|
|
|
+ messageAlign={otherParams.messageAlign}
|
|
|
+ message={otherParams.showOtherMessage}
|
|
|
+ showCancelButton={otherParams.showCancelButton}
|
|
|
+ cancelButtonColor={otherParams.cancelButtonColor}
|
|
|
+ cancelButtonText={otherParams.cancelButtonText}
|
|
|
+ confirmButtonColor={otherParams.confirmButtonColor}
|
|
|
+ confirmButtonText={otherParams.confirmButtonText}
|
|
|
+ onCancel={() => {
|
|
|
+ otherParams.showOtherSchool = false;
|
|
|
+ if (otherParams.otherType === 'nickname') {
|
|
|
+ forms.isRegister = 'create'; // 新建
|
|
|
+ onSubmit();
|
|
|
+ } else if (otherParams.otherType === 'limit') {
|
|
|
+ }
|
|
|
+ }}
|
|
|
onConfirm={() => {
|
|
|
- forms.showOtherSchool = false;
|
|
|
- // 直接注册
|
|
|
- onSubmit(true);
|
|
|
+ otherParams.showOtherSchool = false;
|
|
|
+ if (otherParams.otherType === 'nickname') {
|
|
|
+ forms.isRegister = 'update'; // 新建
|
|
|
+ // 直接注册
|
|
|
+ onSubmit();
|
|
|
+ } else if (otherParams.otherType === 'change') {
|
|
|
+ forms.isChangeSchool = true;
|
|
|
+ // 直接注册
|
|
|
+ onSubmit();
|
|
|
+ }
|
|
|
}}
|
|
|
/>
|
|
|
+
|
|
|
+ <Popup
|
|
|
+ v-model:show={forms.showSelectStudent}
|
|
|
+ round
|
|
|
+ position="bottom"
|
|
|
+ safeAreaInsetBottom
|
|
|
+ closeable>
|
|
|
+ <SelectStudent
|
|
|
+ studentItem={forms.studentItem}
|
|
|
+ list={forms.studentList}
|
|
|
+ />
|
|
|
+ </Popup>
|
|
|
</div>
|
|
|
);
|
|
|
}
|