diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java index fc8b3a4..137865c 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/model/TheRapyRecuperationLineUnionSelect.java @@ -99,6 +99,10 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel { @Comment("最少参与教工") private Integer minimumGroupSize; + @Column + @ColDefine(type = ColType.INT) + @Comment("最多报名人数") + private Integer maxApplyNum; @Column @ColDefine(type = ColType.VARCHAR, width = 50) diff --git a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java index ceb96be..b1608b5 100644 --- a/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java +++ b/src/main/java/io/v/nutz/zhgh/therapyRecuperation/service/impl/TheRapyRecuperationEnrollServiceImpl.java @@ -1,6 +1,7 @@ package io.v.nutz.zhgh.therapyRecuperation.service.impl; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; import cn.hutool.json.JSONUtil; @@ -194,6 +195,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl list = numSql.getList(String.class); + int enrollNum = list.size(); + if (Lang.isNotEmpty(list)) { + int i = dao().count(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list)); + enrollNum = enrollNum + i; + } + + // 去判断当前报名的记录,名额有没有超出限制,包含家属 + List companionList = enrollInfo.getCompanionList(); + int applyNum = 1; + if (Lang.isNotEmpty(companionList)) { + applyNum = applyNum + companionList.size(); + } + + if ((applyNum + enrollNum) > maxApplyNum) { + int canApplyNum = maxApplyNum - enrollNum; + if (canApplyNum == 0) { + return Map.of(false, "此线路报名人数已满,请选择其他线路报名"); + } else { + return Map.of(false, "此线路剩余可报名人数为:【" + canApplyNum + "人】,您当前报名人数为:【" + applyNum + "人】,请减少随行人或选择其他线路报名"); + } + } + TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature()); if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) { @@ -1484,6 +1516,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl{{lineData.estimatedCost}}元
- - 当前报名: - {{lineData.signUpUserNum + lineData.signUpUserFamilyNum + '人'}} + '人)'}}
当前报名: - - {{lineData.signUpUserNum + lineData.familyNumber + '人'}} + '人)'}}
- {{lineData.signUpUserNum + '人'}} + '人)'}}
当前报名: - - {{lineData.signUpUserNum + '人'}} + '人)'}}
@@ -365,47 +360,6 @@ layout("/mobile/platform.html"){ - -
-
-
- 房间信息 -
-
- - - -
- 包房需自费;不包房两位老师一间且随机分配 -
- - -
-
-
@@ -414,7 +368,8 @@ layout("/mobile/platform.html"){ 随行人信息
删除随行人 - 添加随行人 + 添加随行人
@@ -486,6 +441,23 @@ layout("/mobile/platform.html"){ + +
+
+
+ 房间信息 +
+
+ + +
+
+
提交报名
@@ -499,7 +471,7 @@ layout("/mobile/platform.html"){ @@ -545,7 +517,7 @@ layout("/mobile/platform.html"){ isPdf: false, isLoad: false, active: 0, - roomColumns: ['包房', '默认房间'], + roomColumns: ['0.5间(一张床)', "1间(两张床)}", '1.5间(三张床)', '2间(四张床)'], bedColumns: ['1', '2'], companionColumns: ['配偶', '子女', '亲属', '其他'], bedVisible: false, @@ -658,7 +630,7 @@ layout("/mobile/platform.html"){ url = '/platform/theRapyRecuperation/line/enroll/doSignUpForLine' } - const toast = vant.Toast.loading({ + const loading = vant.Toast.loading({ duration: 0, forbidClick: true, overlay: true, @@ -667,21 +639,37 @@ layout("/mobile/platform.html"){ const resp = await $.post(url, { enroll: JSON.stringify(cloneData), }) - setTimeout(() => { - if (resp.code === 0) { - toast.message = '提交成功' - toast.type = 'success' - } else { - toast.message = resp.msg - toast.type = 'fail' - } - setTimeout(() => { - toast.clear() - }, 500) - if (resp.code === 0) { + loading.clear() + if (resp.code === 0) { + vant.Dialog.alert({ + title: '提示', + message: '报名成功', + }).then(() => { location.replace('/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index) - } - }, 1000) + }) + } else { + vant.Dialog.alert({ + title: '提示', + message: resp.msg, + }).then(() => { + }) + } + + // setTimeout(() => { + // if (resp.code === 0) { + // toast.message = '提交成功' + // toast.type = 'success' + // } else { + // toast.message = resp.msg + // toast.type = 'fail' + // } + // setTimeout(() => { + // toast.clear() + // }, 500) + // if (resp.code === 0) { + // location.replace('/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index) + // } + // }, 1000) }, addCompanion() { this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}}) diff --git a/src/main/resources/views/mobile/therapyRecuperation/lineList.html b/src/main/resources/views/mobile/therapyRecuperation/lineList.html index 2e51bb1..bec6437 100644 --- a/src/main/resources/views/mobile/therapyRecuperation/lineList.html +++ b/src/main/resources/views/mobile/therapyRecuperation/lineList.html @@ -353,6 +353,7 @@ layout("/mobile/platform.html"){
{{item.name}}
{{item.playTime}}
+
{{'报名人数限制:' + item.maxApplyNum + '人'}}
{{item.subname}}
@@ -447,25 +448,20 @@ layout("/mobile/platform.html"){ if(this.modifyConfig.familyInfo == 2) { item.subname = '已报人数:' + (item.signUpUserNum + item.signUpUserFamilyNum) - + '人' + + '(家属' + item.signUpUserFamilyNum + '人)' } else { item.subname = '已报人数:' + (item.signUpUserNum + item.signUpUserFamilyNum) - + '人' + + '(家属' + item.familyNumber + '人)' } - // if(this.modifyConfig.familyInfo == 2) { - // item.subname = '已报人数:' - // + (item.signUpUserNum + item.signUpUserFamilyNum) - // + '(家属' + item.signUpUserFamilyNum + '人)' - // } else { - // item.subname = '已报人数:' - // + (item.signUpUserNum + item.signUpUserFamilyNum) - // + '(家属' + item.familyNumber + '人)' - // } }) this.selectLinePopup = true }, onSelect(item) { + if ((item.signUpUserNum + item.signUpUserFamilyNum) >= item.maxApplyNum) { + vant.Toast('报名人数已满') + return + } this.findOne(item) }, otherUnionClick() { diff --git a/src/main/resources/views/platform/theRapyRecuperation/process/lineUnionSelect.html b/src/main/resources/views/platform/theRapyRecuperation/process/lineUnionSelect.html index 87351ff..b4e52db 100644 --- a/src/main/resources/views/platform/theRapyRecuperation/process/lineUnionSelect.html +++ b/src/main/resources/views/platform/theRapyRecuperation/process/lineUnionSelect.html @@ -403,11 +403,11 @@ layout("/layouts/platform.html"){ - - + - + @@ -509,8 +509,8 @@ layout("/layouts/platform.html"){ {{row.minimumGroupSize}} - - {{row.trafficTools}} + + {{row.maxApplyNum}}