|
@@ -132,7 +132,7 @@ export default defineComponent({
|
|
|
// bugGoods: false, // 是否购买AI
|
|
|
|
|
|
isRegister: 'create' as 'create' | 'update' | '', // 是否注册学生
|
|
|
- isTipRegister: true, // 是否显示名字不一致 - 默认显示
|
|
|
+ isTipRegister: false, // 是否显示名字不一致 - 默认显示
|
|
|
isChangeSchool: false, // 是否切换学校
|
|
|
|
|
|
registerType: '', // 报名类型
|
|
@@ -186,9 +186,10 @@ export default defineComponent({
|
|
|
|
|
|
const otherParams = reactive({
|
|
|
showOtherSchool: false,
|
|
|
+ showCloseButton: true, // 是否显示关闭按钮
|
|
|
showOtherMessage: '',
|
|
|
/** limit 超限制,change 更换学生,nickname 名称不一致 */
|
|
|
- otherType: '' as 'limit' | 'change' | 'nickname',
|
|
|
+ otherType: '' as 'limit' | 'change' | 'nickname' | 'member',
|
|
|
showCancelButton: true,
|
|
|
cancelButtonColor: '',
|
|
|
cancelButtonText: '取消',
|
|
@@ -449,6 +450,9 @@ export default defineComponent({
|
|
|
} else if (!studentInfo.extra.nickname) {
|
|
|
status && showToast('请输入学生姓名');
|
|
|
return true;
|
|
|
+ } else if (![0, 1].includes(studentInfo.extra.gender)) {
|
|
|
+ status && showToast('请选择性别');
|
|
|
+ return true;
|
|
|
} else if (!studentInfo.extra.currentGradeNum) {
|
|
|
status && showToast('请选择所在年级');
|
|
|
return true;
|
|
@@ -477,6 +481,7 @@ export default defineComponent({
|
|
|
'学生姓名与上次提交信息不一致,请确认修改学生信息或创建新的学生账号';
|
|
|
otherParams.showOtherSchool = true;
|
|
|
otherParams.showCancelButton = true;
|
|
|
+ otherParams.showCloseButton = true;
|
|
|
otherParams.cancelButtonColor =
|
|
|
'linear-gradient( 224deg, #3FE1E6 0%, #00CDD4 100%)';
|
|
|
otherParams.cancelButtonText = '新建学生';
|
|
@@ -496,6 +501,7 @@ export default defineComponent({
|
|
|
otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
|
|
|
otherParams.showOtherSchool = true;
|
|
|
otherParams.showCancelButton = false;
|
|
|
+ otherParams.showCloseButton = true;
|
|
|
otherParams.confirmButtonColor =
|
|
|
'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
|
|
|
otherParams.confirmButtonText = '我知道了';
|
|
@@ -506,16 +512,20 @@ export default defineComponent({
|
|
|
|
|
|
// 判断是否为同一个学校
|
|
|
if (
|
|
|
+ forms.studentItem.schoolId &&
|
|
|
forms.studentItem.schoolId !== forms.registerDetails.schoolId &&
|
|
|
!forms.isChangeSchool &&
|
|
|
forms.isRegister === 'update'
|
|
|
) {
|
|
|
otherParams.showOtherMessage = `您已绑定【${
|
|
|
+ forms.studentItem?.schoolName || ''
|
|
|
+ }】,提交后将更换到
|
|
|
+ <span style="color: #2B85FF">【${
|
|
|
forms.registerDetails.schoolName || ''
|
|
|
- }】,提交后将更换到【${
|
|
|
- forms.studentItem?.schoolName
|
|
|
- }】,是否确认提交?`;
|
|
|
+ }】</span>
|
|
|
+ ,是否确认提交?`;
|
|
|
otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCloseButton = false;
|
|
|
otherParams.showCancelButton = true;
|
|
|
otherParams.cancelButtonColor = '';
|
|
|
otherParams.cancelButtonText = '取消';
|
|
@@ -631,6 +641,45 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const updateStudentInfo = async () => {
|
|
|
+ try {
|
|
|
+ const { extra, username } = studentInfo;
|
|
|
+ const registerResult = await request.post('/edu-app/student/register', {
|
|
|
+ data: {
|
|
|
+ schoolId: forms.schoolId,
|
|
|
+ clientType: 'STUDENT',
|
|
|
+ schoolVerify: true,
|
|
|
+ ...extra,
|
|
|
+ giftVipDay:
|
|
|
+ forms.detailVip.membershipDays || 0 + forms.giftVipDay || 0,
|
|
|
+ mobile: username,
|
|
|
+ newRegUser: forms.isRegister === 'create' ? true : false
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (registerResult.code !== 200) {
|
|
|
+ if (registerResult.code === 5436) {
|
|
|
+ forms.showTips = true;
|
|
|
+ forms.showMessage = '二维码已经失效,详情请咨询学校老师';
|
|
|
+ forms.showButton = false;
|
|
|
+ } else if (registerResult.code === 5435) {
|
|
|
+ forms.showTips = true;
|
|
|
+ forms.showMessage = registerResult.message;
|
|
|
+ forms.showButton = true;
|
|
|
+ } else if (registerResult.code === 5437) {
|
|
|
+ forms.showTips = true;
|
|
|
+ forms.showMessage = '团购时间已截止,感谢您的参与'; //result.message;
|
|
|
+ forms.showButton = false;
|
|
|
+ }
|
|
|
+ console.log('-----');
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ console.log('=====');
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ };
|
|
|
+
|
|
|
// 登记成功之后购买
|
|
|
const onRegisterSubmit = async () => {
|
|
|
try {
|
|
@@ -644,6 +693,9 @@ export default defineComponent({
|
|
|
|
|
|
// 传统方式
|
|
|
if (forms.joinType === 'tradition') {
|
|
|
+ const updateStatus = await updateStudentInfo();
|
|
|
+ if (!updateStatus) return;
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
showToast('报名成功');
|
|
|
// router.push('/download');
|
|
@@ -659,7 +711,17 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
if (schoolInfo.data.hasBuyCourse && vipList.length > 0) {
|
|
|
- forms.dialogConfirmStatus = true;
|
|
|
+ // forms.dialogConfirmStatus = true;
|
|
|
+ otherParams.showOtherMessage = `该学员已购买会员,是否再次购买?`;
|
|
|
+ otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCloseButton = false;
|
|
|
+ otherParams.showCancelButton = true;
|
|
|
+ otherParams.cancelButtonColor = '';
|
|
|
+ otherParams.cancelButtonText = '取消';
|
|
|
+ otherParams.confirmButtonColor = '';
|
|
|
+ otherParams.confirmButtonText = '确定';
|
|
|
+ otherParams.otherType = 'member';
|
|
|
+ otherParams.messageAlign = 'center';
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -755,6 +817,8 @@ export default defineComponent({
|
|
|
|
|
|
// 判断是否有完成订单 并且选择 自备
|
|
|
if (isFinal && forms.joinType === 'tradition') {
|
|
|
+ const studentResult = await updateStudentInfo();
|
|
|
+ if (!studentResult) return;
|
|
|
setTimeout(() => {
|
|
|
showToast('您已通过数字化方式报名成功');
|
|
|
}, 100);
|
|
@@ -773,20 +837,19 @@ export default defineComponent({
|
|
|
return true;
|
|
|
}
|
|
|
if (isPadding && forms.joinType === 'digitalize') {
|
|
|
- // 会选判断逻辑 -
|
|
|
- await request.get(
|
|
|
- '/edu-app/userPaymentOrder/registerStatus/' + forms.schoolId
|
|
|
- );
|
|
|
- // const vipList = studentRegisterStore.getVip;
|
|
|
-
|
|
|
- // if (schoolInfo.data.hasBuyCourse && vipList.length > 0) {
|
|
|
- // forms.dialogConfirmStatus = true;
|
|
|
- // return true;
|
|
|
- // }
|
|
|
// 最终确认,有待支付订单直接去支付,没有则才会创建订单
|
|
|
- state.config = paddingConfig?.paymentConfig;
|
|
|
- state.orderNo = paddingConfig?.orderNo;
|
|
|
- await lastSubmit();
|
|
|
+ // state.config = paddingConfig?.paymentConfig;
|
|
|
+ // state.orderNo = paddingConfig?.orderNo;
|
|
|
+ // const updateStatus = await updateStudentInfo();
|
|
|
+ // if (!updateStatus) return;
|
|
|
+ // await lastSubmit();
|
|
|
+
|
|
|
+ // 为了处理,有待支付订单,然后后台改了金额,会导致金额不一致
|
|
|
+ forms.dialogConfig = paddingConfig;
|
|
|
+ const cancelStatus = await cancelPaymentOrder();
|
|
|
+ if (cancelStatus) {
|
|
|
+ await paymentContinue();
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -823,7 +886,10 @@ export default defineComponent({
|
|
|
await request.post(
|
|
|
'/edu-app/userPaymentOrder/cancelPayment/' + orderNo
|
|
|
);
|
|
|
- } catch {}
|
|
|
+ return true;
|
|
|
+ } catch {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const paymentContinue = async () => {
|
|
@@ -853,6 +919,10 @@ export default defineComponent({
|
|
|
});
|
|
|
});
|
|
|
// 创建订单
|
|
|
+ const updateStatus = await updateStudentInfo();
|
|
|
+ console.log(updateStatus, 'updateStatus');
|
|
|
+ if (!updateStatus) return;
|
|
|
+
|
|
|
const result = await request.post(
|
|
|
'/edu-app/userPaymentOrder/executeOrder',
|
|
|
{
|
|
@@ -1157,6 +1227,22 @@ export default defineComponent({
|
|
|
} catch {}
|
|
|
};
|
|
|
|
|
|
+ /** 手机号变更时清空验证码信息,用户信息 */
|
|
|
+ const phoneChangeEmptyInfo = () => {
|
|
|
+ studentInfo.password = '';
|
|
|
+ studentInfo.extra.nickname = '';
|
|
|
+ studentInfo.extra.currentGradeNum = '';
|
|
|
+ studentInfo.extra.currentClass = '';
|
|
|
+ studentInfo.extra.gender = 1;
|
|
|
+ forms.currentClassText = '';
|
|
|
+ forms.gradeNumText = '';
|
|
|
+ forms.studentList = []; // 手机号关联学生列表
|
|
|
+ forms.studentItem = {}; // 选择的学生
|
|
|
+ forms.isRegister = 'create'; // 是否注册学生
|
|
|
+ forms.isTipRegister = false; // 是否显示名字不一致 - 默认显示
|
|
|
+ forms.isChangeSchool = false; // 是否切换学校
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
try {
|
|
|
// 获取支付类型
|
|
@@ -1244,7 +1330,10 @@ export default defineComponent({
|
|
|
class={styles.username}
|
|
|
v-model={studentInfo.username}
|
|
|
border={false}
|
|
|
- maxlength={11}>
|
|
|
+ maxlength={11}
|
|
|
+ onUpdate:modelValue={() => {
|
|
|
+ phoneChangeEmptyInfo();
|
|
|
+ }}>
|
|
|
{{
|
|
|
label: () => (
|
|
|
<div>
|
|
@@ -1741,7 +1830,7 @@ export default defineComponent({
|
|
|
</Popup>
|
|
|
|
|
|
{/* 已经购买过样品 */}
|
|
|
- <MDialog
|
|
|
+ {/* <MDialog
|
|
|
title="提示"
|
|
|
v-model:show={forms.dialogConfirmStatus}
|
|
|
message={'已购买会员,是否确认购买?'}
|
|
@@ -1758,7 +1847,7 @@ export default defineComponent({
|
|
|
applyOver();
|
|
|
}
|
|
|
}}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
|
|
|
<MDialog
|
|
|
title="提示"
|
|
@@ -1785,6 +1874,9 @@ export default defineComponent({
|
|
|
const paymentConfig = forms.dialogConfig;
|
|
|
state.config = paymentConfig?.paymentConfig;
|
|
|
state.orderNo = paymentConfig?.orderNo;
|
|
|
+
|
|
|
+ const updateStatus = await updateStudentInfo();
|
|
|
+ if (!updateStatus) return;
|
|
|
await lastSubmit();
|
|
|
}
|
|
|
}}
|
|
@@ -1851,6 +1943,7 @@ export default defineComponent({
|
|
|
|
|
|
<MMessageTip
|
|
|
show={otherParams.showOtherSchool}
|
|
|
+ // showCloseButton={otherParams.showCloseButton}
|
|
|
messageAlign={otherParams.messageAlign}
|
|
|
message={otherParams.showOtherMessage}
|
|
|
showCancelButton={otherParams.showCancelButton}
|
|
@@ -1858,16 +1951,32 @@ export default defineComponent({
|
|
|
cancelButtonText={otherParams.cancelButtonText}
|
|
|
confirmButtonColor={otherParams.confirmButtonColor}
|
|
|
confirmButtonText={otherParams.confirmButtonText}
|
|
|
- onCancel={() => {
|
|
|
+ onClose={() => (otherParams.showOtherSchool = false)}
|
|
|
+ onCancel={async () => {
|
|
|
otherParams.showOtherSchool = false;
|
|
|
if (otherParams.otherType === 'nickname') {
|
|
|
forms.isRegister = 'create'; // 新建
|
|
|
changeTipStatus(false, false);
|
|
|
onSubmit();
|
|
|
- } else if (otherParams.otherType === 'limit') {
|
|
|
+ } else if (otherParams.otherType === 'member') {
|
|
|
+ const updateStatus = await updateStudentInfo();
|
|
|
+ if (!updateStatus) return;
|
|
|
+ //取消支付,判断是否有结束时间,是否已经结束
|
|
|
+ if (forms.registerExpireTime && forms.activeOverStatus) {
|
|
|
+ applyOver();
|
|
|
+ }
|
|
|
+ // onConfirm={async () => {
|
|
|
+ // await paymentContinue();
|
|
|
+ // }}
|
|
|
+ // onCancel={() => {
|
|
|
+ // //取消支付,判断是否有结束时间,是否已经结束
|
|
|
+ // if (forms.registerExpireTime && forms.activeOverStatus) {
|
|
|
+ // applyOver();
|
|
|
+ // }
|
|
|
+ // }}
|
|
|
}
|
|
|
}}
|
|
|
- onConfirm={() => {
|
|
|
+ onConfirm={async () => {
|
|
|
otherParams.showOtherSchool = false;
|
|
|
// 名字
|
|
|
if (otherParams.otherType === 'nickname') {
|
|
@@ -1888,6 +1997,8 @@ export default defineComponent({
|
|
|
: true,
|
|
|
false
|
|
|
);
|
|
|
+ } else if (otherParams.otherType === 'member') {
|
|
|
+ await paymentContinue();
|
|
|
}
|
|
|
}}
|
|
|
/>
|
|
@@ -1903,11 +2014,16 @@ export default defineComponent({
|
|
|
list={forms.studentList}
|
|
|
onClose={() => (forms.showSelectStudent = false)}
|
|
|
onConfirm={(val: any) => {
|
|
|
- forms.studentItem = val;
|
|
|
if (val.userId) {
|
|
|
+ forms.studentItem = val;
|
|
|
const firstStudent = val;
|
|
|
studentInfo.extra.nickname = firstStudent.nickname;
|
|
|
const tempGrade: any = forms.gradeList || [];
|
|
|
+
|
|
|
+ studentInfo.extra.currentGradeNum = null;
|
|
|
+ forms.gradeNumText = '';
|
|
|
+ forms.instrumentCode = '';
|
|
|
+
|
|
|
tempGrade?.forEach((i: any) => {
|
|
|
if (i.value === firstStudent.currentGradeNum) {
|
|
|
forms.instrumentCode = i.instrumentCode;
|
|
@@ -1919,6 +2035,10 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ studentInfo.extra.currentClass = null;
|
|
|
+ forms.currentClassText = '';
|
|
|
+
|
|
|
forms.classList.forEach((i: any) => {
|
|
|
if (i.value === firstStudent.currentClass) {
|
|
|
forms.currentClassText = i.text;
|
|
@@ -1928,15 +2048,33 @@ export default defineComponent({
|
|
|
studentInfo.extra.gender = firstStudent.gender;
|
|
|
forms.isRegister = 'update';
|
|
|
changeTipStatus(true, false);
|
|
|
+
|
|
|
+ forms.showSelectStudent = false;
|
|
|
} else {
|
|
|
- forms.isRegister = 'create';
|
|
|
- changeTipStatus(false, false);
|
|
|
- studentInfo.extra.nickname = '';
|
|
|
- studentInfo.extra.currentGradeNum = '';
|
|
|
- studentInfo.extra.currentClass = '';
|
|
|
- studentInfo.extra.gender = 1;
|
|
|
- forms.currentClassText = '';
|
|
|
- forms.gradeNumText = '';
|
|
|
+ // 判断新建学员是否上限了
|
|
|
+ if (forms.studentList.length >= forms.multi_user_limit) {
|
|
|
+ otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
|
|
|
+ otherParams.showOtherSchool = true;
|
|
|
+ otherParams.showCancelButton = false;
|
|
|
+ otherParams.showCloseButton = true;
|
|
|
+ otherParams.confirmButtonColor =
|
|
|
+ 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
|
|
|
+ otherParams.confirmButtonText = '我知道了';
|
|
|
+ otherParams.otherType = 'limit';
|
|
|
+ otherParams.messageAlign = 'center';
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ forms.studentItem = val;
|
|
|
+ forms.isRegister = 'create';
|
|
|
+ changeTipStatus(false, false);
|
|
|
+ studentInfo.extra.nickname = '';
|
|
|
+ studentInfo.extra.currentGradeNum = '';
|
|
|
+ studentInfo.extra.currentClass = '';
|
|
|
+ studentInfo.extra.gender = 1;
|
|
|
+ forms.currentClassText = '';
|
|
|
+ forms.gradeNumText = '';
|
|
|
+ forms.showSelectStudent = false;
|
|
|
+ }
|
|
|
}
|
|
|
}}
|
|
|
/>
|