commit
This commit is contained in:
+60
-29
@@ -21,6 +21,7 @@ import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.constant.TheRapyRecuperationState;
|
||||
import io.v.nutz.zhgh.therapyRecuperation.mode.TheRapyRecuperationEnrollExcelMode;
|
||||
@@ -337,10 +338,6 @@ public class TheRapyRecuperationUserQueryController {
|
||||
@Param(value = "satisfyPeople", required = false) Boolean satisfyPeople,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8));
|
||||
|
||||
Cnd commonCnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
commonCnd.and(Cnd.likeEX(searchName, searchKeyword));
|
||||
@@ -359,8 +356,10 @@ public class TheRapyRecuperationUserQueryController {
|
||||
line.lineName,
|
||||
enroll.*,
|
||||
date_format( enroll.signingUptime, '%Y-%m-%d %H:%i:%s' ) signingUptimeFormat,
|
||||
date_format( lineu.playStartTime, '%Y-%m-%d' ) playStartTime,
|
||||
date_format( lineu.playStartTime, '%m-%d' ) playStartTime,
|
||||
date_format( lineu.playEndTime, '%m-%d' ) playEndTime,
|
||||
lineu.lineId,
|
||||
TIMESTAMPDIFF(YEAR, u.birthday, CURDATE()) as age,
|
||||
( SELECT COUNT( 1 ) FROM the_rapy_recuperation_enroll_companion WHERE trreId = enroll.id) familyCount,
|
||||
(
|
||||
SELECT
|
||||
@@ -399,7 +398,39 @@ public class TheRapyRecuperationUserQueryController {
|
||||
lineSql.setCondition(lineCnd);
|
||||
List<NutMap> lineEnroll = baseService.listMap(lineSql);
|
||||
|
||||
if (satisfyPeople) {
|
||||
List<NutMap> lineResult = new ArrayList<>();
|
||||
//查家属
|
||||
List<String> list = lineEnroll.stream().map(o -> o.getString("id")).toList();
|
||||
List<TheRapyRecuperationEnrollCompanion> companions = baseService.dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list));
|
||||
int index = 0;
|
||||
for (int i = 0; i < lineEnroll.size(); i++) {
|
||||
NutMap nutMap = lineEnroll.get(i);
|
||||
if(i == 0) {
|
||||
index = 1;
|
||||
}
|
||||
nutMap.put("index", index);
|
||||
nutMap.put("playTime", nutMap.getString("playStartTime") + "至" + nutMap.getString("playEndTime"));
|
||||
lineResult.add(nutMap);
|
||||
//找这个人的家属
|
||||
List<TheRapyRecuperationEnrollCompanion> companionList = companions.stream().filter(o -> o.getTrreId().equals(nutMap.getString("id"))).toList();
|
||||
if(Lang.isNotEmpty(companionList)) {
|
||||
for (int c = 1; c <= companionList.size(); c++) {
|
||||
NutMap map = Lang.obj2nutmap(companionList.get(c - 1));
|
||||
map.put("index", c + index);
|
||||
map.put("unionName", "家属");
|
||||
map.put("familyUserName", map.getString("userName"));
|
||||
map.put("lineName", nutMap.getString("lineName"));
|
||||
map.put("playTime", nutMap.getString("playTime"));
|
||||
map.put("userName", "");
|
||||
lineResult.add(map);
|
||||
}
|
||||
index += companionList.size() + 1;
|
||||
} else {
|
||||
index ++;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (satisfyPeople) {
|
||||
//按照选择线路id分组,便于判断是否成团
|
||||
Map<String, List<NutMap>> enrollGroup = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("takePartInLineId")));
|
||||
|
||||
@@ -416,7 +447,7 @@ public class TheRapyRecuperationUserQueryController {
|
||||
Map<String, List<NutMap>> lineGroupMap = lineEnroll.stream().collect(Collectors.groupingBy(o -> o.getString("lineId")));
|
||||
//查询所有的线路
|
||||
List<TheRapyRecuperationLine> lineList = baseService.dao().query(TheRapyRecuperationLine.class, Cnd.NEW());
|
||||
Map<String, String> lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName));
|
||||
Map<String, String> lineMap = lineList.stream().collect(Collectors.toMap(TheRapyRecuperationLine::getId, TheRapyRecuperationLine::getLineName));*/
|
||||
|
||||
//定点的查询
|
||||
Sql travelSql = Sqls.create("""
|
||||
@@ -459,14 +490,21 @@ public class TheRapyRecuperationUserQueryController {
|
||||
commonEntities.add(entity);
|
||||
|
||||
//线路表头
|
||||
ArrayList<ExcelExportEntity> lineEntities = new ArrayList<>(commonEntities);
|
||||
lineEntities.add(new ExcelExportEntity("出行时间", "playStartTime", 20));
|
||||
ArrayList<ExcelExportEntity> lineEntities = new ArrayList<>();
|
||||
lineEntities.add(new ExcelExportEntity("序号", "index", 10));
|
||||
lineEntities.add(new ExcelExportEntity("二级分工会", "unionName", 30));
|
||||
lineEntities.add(new ExcelExportEntity("姓名", "userName", 10));
|
||||
lineEntities.add(new ExcelExportEntity("家属姓名", "familyUserName", 10));
|
||||
lineEntities.add(new ExcelExportEntity("手机号", "mobile", 15));
|
||||
lineEntities.add(new ExcelExportEntity("性别", "sex", 10));
|
||||
lineEntities.add(new ExcelExportEntity("身份证号码", "idCard", 30));
|
||||
lineEntities.add(new ExcelExportEntity("年龄", "age", 10));
|
||||
lineEntities.add(new ExcelExportEntity("身高(cm)", "height", 10));
|
||||
lineEntities.add(new ExcelExportEntity("线路名称", "lineName", 20));
|
||||
lineEntities.add(new ExcelExportEntity("旅行社", "travelAgencyName", 20));
|
||||
lineEntities.add(new ExcelExportEntity("随行人数", "familyCount", 20));
|
||||
ExcelExportEntity lineEntity = new ExcelExportEntity("随行人信息", "companionInfo", 50);
|
||||
lineEntity.setWrap(true);
|
||||
lineEntities.add(lineEntity);
|
||||
lineEntities.add(new ExcelExportEntity("行程", "playTime", 20));
|
||||
lineEntities.add(new ExcelExportEntity("房间需求数", "roomCount", 20));
|
||||
lineEntities.add(new ExcelExportEntity("用房备注", "roomRemarkName", 30));
|
||||
lineEntities.add(new ExcelExportEntity("其他", "other", 20));
|
||||
|
||||
//自由组团表头
|
||||
ArrayList<ExcelExportEntity> travelEntities = new ArrayList<>(commonEntities);
|
||||
@@ -478,23 +516,16 @@ public class TheRapyRecuperationUserQueryController {
|
||||
|
||||
try {
|
||||
if(Arrays.asList(types).contains("line")) {
|
||||
for (String key : lineGroupMap.keySet()) {
|
||||
List<NutMap> enrollList = lineGroupMap.get(key);
|
||||
enrollList.forEach(item -> {
|
||||
// String remark = TherapyRecuperationCommon.getRemarkBySchoolTime(item.getString("schoolTime"));
|
||||
// item.put("remark", remark);
|
||||
});
|
||||
String fileName = "线路报名人员/" + lineMap.get(key) + ".xlsx";
|
||||
zipOutputStream.putNextEntry(new ZipEntry(fileName));
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, enrollList);
|
||||
workbook.write(zipOutputStream);
|
||||
zipOutputStream.closeEntry();
|
||||
response.flushBuffer();
|
||||
}
|
||||
ViTool.excelResponse(response, "线路报名人员.xls");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.HSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, lineEntities, lineResult);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
if(Arrays.asList(types).contains("base")) {
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("content-disposition", "attachment;filename="
|
||||
+ URLEncoder.encode("疗休养报名人员名单.zip", StandardCharsets.UTF_8));
|
||||
for (String key : travelGroupMap.keySet()) {
|
||||
List<NutMap> enrollList = travelGroupMap.get(key);
|
||||
enrollList.forEach(item -> {
|
||||
|
||||
@@ -212,5 +212,30 @@ public class TheRapyRecuperationEnroll extends BaseModel {
|
||||
@Comment("出行时间")
|
||||
private String specificTime;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DOUBLE)
|
||||
@Comment("房间数量")
|
||||
private Double roomCount;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("房间数量显示")
|
||||
private String roomCountName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("用房备注")
|
||||
private Integer roomRemark;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("用房备注")
|
||||
private String roomRemarkName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("拼房人")
|
||||
private String roommate;
|
||||
|
||||
private String firstLetter;
|
||||
}
|
||||
|
||||
+5
@@ -70,6 +70,11 @@ public class TheRapyRecuperationEnrollCompanion extends BaseModel {
|
||||
@Comment("床位信息id")
|
||||
private String bedInfoId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("身高")
|
||||
private String height;
|
||||
|
||||
/**
|
||||
* 床位信息
|
||||
*/
|
||||
|
||||
+15
-2
@@ -841,6 +841,14 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
|
||||
return Map.of(false, "报名时间已过,抱歉不能报名");
|
||||
}
|
||||
|
||||
//报的线路,不管新增还是编辑都要判断
|
||||
if(StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
|
||||
Map<Boolean, String> roomValid = validRoom(enrollInfo);
|
||||
if(roomValid != null && roomValid.containsKey(false)) {
|
||||
return roomValid;
|
||||
}
|
||||
}
|
||||
|
||||
TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature());
|
||||
|
||||
if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
|
||||
@@ -1051,7 +1059,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
|
||||
|
||||
// 去判断当前报名的记录,名额有没有超出限制,包含家属
|
||||
List<TheRapyRecuperationEnrollCompanion> companionList = enrollInfo.getCompanionList();
|
||||
int applyNum = 1;
|
||||
int applyNum = StrUtil.isNotBlank(enrollInfo.getId()) ? 0 : 1;
|
||||
if (Lang.isNotEmpty(companionList)) {
|
||||
applyNum = applyNum + companionList.size();
|
||||
}
|
||||
@@ -1061,7 +1069,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
|
||||
if (canApplyNum == 0) {
|
||||
return Map.of(false, "此线路报名人数已满,请选择其他线路报名");
|
||||
} else {
|
||||
return Map.of(false, "此线路剩余可报名人数为:【" + canApplyNum + "人】,您当前报名人数为:【" + applyNum + "人】,请减少随行人或选择其他线路报名");
|
||||
return Map.of(false, "此线路剩余可报名人数为:【" + canApplyNum + "人】,您当前报名人数为:【" + (StrUtil.isNotBlank(enrollInfo.getId()) ? applyNum + 1 : applyNum) + "人】,请减少随行人或选择其他线路报名");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1217,6 +1225,11 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
|
||||
return Map.of(true, "验证成功");
|
||||
}
|
||||
|
||||
public Map<Boolean, String> validRoom(TheRapyRecuperationEnroll enrollInfo) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<Boolean, String> validSignCount(TheRapyRecuperationEnroll enrollInfo, TheRapyRecuperationConfig config, int estimatedFamilyNumbers, String type) {
|
||||
int hasSignNumber = 0;//已经报名的人数
|
||||
int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数
|
||||
|
||||
@@ -96,11 +96,15 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
|
||||
.join_content {
|
||||
padding: 20px;
|
||||
padding: 10px 20px;
|
||||
height: calc(100% - 26px - 60px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.join_content .van-cell {
|
||||
padding: 6px 16px;
|
||||
}
|
||||
|
||||
.join_submit {
|
||||
width: 90% !important;
|
||||
}
|
||||
@@ -114,7 +118,7 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
|
||||
.van-card-header {
|
||||
padding: 14px 20px;
|
||||
padding: 10px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
box-sizing: border-box;
|
||||
color: #0e78c5;
|
||||
@@ -218,6 +222,17 @@ layout("/mobile/platform.html"){
|
||||
table {
|
||||
width: 100%
|
||||
}
|
||||
.van-notice-bar {
|
||||
height: 26px;
|
||||
padding: 0 20px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.van-notice-bar__wrap {
|
||||
font-size: 13px;
|
||||
}
|
||||
.van-field__label {
|
||||
width: 5.2em;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -369,13 +384,15 @@ layout("/mobile/platform.html"){
|
||||
<div>
|
||||
<van-tag @click="delCompanion" size="large" type="primary" color="lightgrey">删除随行人</van-tag>
|
||||
<van-tag @click="addCompanion" size="large" type="primary"
|
||||
color="#1867b0" v-if="formData.companionList.length < 3">添加随行人</van-tag>
|
||||
color="#1867b0">添加随行人</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="configData.familyInfo === 2">
|
||||
<div>
|
||||
<span style="color: red;margin-left: 20px;font-size: 14px">限填写3岁以上70岁以下随行人</span>
|
||||
<van-notice-bar color="#1989fa" background="#ecf9ff" left-icon="info-o">
|
||||
温馨提醒:限填写3岁以上70岁以下随行人。
|
||||
</van-notice-bar>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length > 0" class="van-card-body">
|
||||
<van-tabs v-model="active" type="card" color="#0e78c5" animated>
|
||||
@@ -383,8 +400,11 @@ layout("/mobile/platform.html"){
|
||||
<van-field label="姓名" name="userName" placeholder="请填写姓名" v-model="item.userName"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
<!--<van-field label="工号" name="loginName" placeholder="若没有工号,请忽略此项" v-model="item.loginName"></van-field>-->
|
||||
<van-field label="身份证件" name="idCard" placeholder="输入身份证自动填充年龄与性别"
|
||||
:rules="[{ required: true }]" maxlength="18"
|
||||
@input="getAgeAndSex(item)" v-model="item.idCard"></van-field>
|
||||
<van-field label="年龄" name="age" placeholder="请填写年龄" v-model="item.age"
|
||||
type="digit" :rules="[{ required: true }]"></van-field>
|
||||
type="digit" :rules="[{ required: true }]" @input="(val) => {clearContent()}"></van-field>
|
||||
<van-field :rules="[{ required: true, message: '请选择性别' }]" label="性别" name="validator">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.sex">
|
||||
@@ -393,45 +413,35 @@ layout("/mobile/platform.html"){
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field label="身份证件" name="idCard" placeholder="输入身份证自动填充年龄与性别"
|
||||
:rules="[{ required: true }]" maxlength="18"
|
||||
@input="getAgeAndSex(item)" v-model="item.idCard"></van-field>
|
||||
<van-field label="手机号" name="mobile" placeholder="请填写手机号"
|
||||
:rules="[{ required: true }]" type="digit"
|
||||
v-model="item.mobile"></van-field>
|
||||
<van-field @click="companionVisible = true" readonly is-link label="与本人关系"
|
||||
name="relation"
|
||||
placeholder="随行人与本人关系" v-model="item.relation"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
|
||||
<!--<van-field @click="self = false; roomVisible = true" readonly is-link label="房间"
|
||||
name="bedType" placeholder="请选择房间"
|
||||
v-model="item.bedInfo.bedType"></van-field>
|
||||
<div style="font-size: 8px; color:orangered; padding-left: 16px; padding-bottom: 4px">
|
||||
提醒:如果跟报名人员同一房间,无须选择!
|
||||
</div>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间'" @click="self = false; bedVisible = true"
|
||||
readonly is-link label="床位"
|
||||
name="bedNum" placeholder="请选择床位" v-model="item.bedInfo.bedNum"></van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间'"
|
||||
:rules="[{ validator, message: '请选择是否拼房' }]" label="是否拼房">
|
||||
<van-field v-if="item.age !== '' && item.age <= 12" :rules="[{ required: true, message: '请填写身高' }]"
|
||||
type="digit" label="身高信息" name="height" placeholder="请填写身高信息"
|
||||
v-model="item.height">
|
||||
<template #button>
|
||||
<span>厘米</span>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field v-if="item.age !== '' && item.age <= 12" :rules="[{ required: true, message: '请选择床位信息' }]" label="床位信息" name="needBed">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.bedInfo.isSleepTogether">
|
||||
<van-radio :name="true" shape="square">是</van-radio>
|
||||
<van-radio :name="false" shape="square">否</van-radio>
|
||||
<van-radio-group @change="(val) => {needBedChange(item)}" direction="horizontal" v-model="item.needBed">
|
||||
<van-radio :name="true" shape="square">需要床位</van-radio>
|
||||
<van-radio :name="false" shape="square">无需床位</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间' && item.bedInfo.isSleepTogether == true"
|
||||
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
|
||||
v-model="item.bedInfo.otherSleepUser"></van-field>-->
|
||||
<!--<van-field @click="companionVisible = true" readonly is-link label="与本人关系"
|
||||
name="relation"
|
||||
placeholder="随行人与本人关系" v-model="item.relation"
|
||||
:rules="[{ required: true }]"></van-field>-->
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length == 0" class="companionList_empty_text">
|
||||
<span>
|
||||
如有随行人出行,请添加随行人
|
||||
</span>
|
||||
<span>
|
||||
如有随行人出行,请添加随行人
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -441,20 +451,30 @@ layout("/mobile/platform.html"){
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!--床位信息-->
|
||||
<div v-if="configData.bedInfo === true" class="van-doc-card" style="margin-bottom: 16px">
|
||||
<div></div>
|
||||
<div class="van-card-header">
|
||||
房间信息
|
||||
房间数量
|
||||
</div>
|
||||
<div class="van-card-body">
|
||||
<van-field @click="self = true; roomVisible = true" readonly is-link label="房间" name="bedType"
|
||||
placeholder="请选择房间" v-model="formData.bedInfo.bedType"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
<van-field v-if="formData.bedInfo.bedType == '标准间' && formData.bedInfo.isSleepTogether == true"
|
||||
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
|
||||
v-model="formData.bedInfo.otherSleepUser"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
<van-field @click="self = true; roomVisible = true" readonly is-link label="房间数量" name="roomCountName"
|
||||
placeholder="请选择房间数量" v-model="formData.roomCountName"
|
||||
required :rules="[{ required: true }]"></van-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="configData.bedInfo === true" class="van-doc-card" style="margin-bottom: 16px">
|
||||
<div></div>
|
||||
<div class="van-card-header">
|
||||
用房备注
|
||||
</div>
|
||||
<div class="van-card-body">
|
||||
<van-field @click="roomRemarkClick" readonly is-link label="用房备注" name="roomRemarkName"
|
||||
placeholder="请选择用房备注" v-model="formData.roomRemarkName"
|
||||
required :rules="[{ required: true }]"></van-field>
|
||||
<van-field label="拼房人" name="roommate" :rules="[{ required: true }]"
|
||||
required v-if="formData.roomRemark === 2"
|
||||
placeholder="请填写拼房人" v-model="formData.roommate"></van-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -473,8 +493,18 @@ layout("/mobile/platform.html"){
|
||||
<van-picker
|
||||
title="房间需求数" show-toolbar
|
||||
:columns="roomColumns"
|
||||
@confirm="roomConfirm"
|
||||
@cancel="roomCancel">
|
||||
value-key="label"
|
||||
@confirm="(val) => {formData.roomCountName = val.label;formData.roomCount = val.value;roomVisible=false}"
|
||||
@cancel="() => {formData.roomCountName = '';formData.roomCount = '';roomVisible=false}">
|
||||
</van-picker>
|
||||
</van-popup>
|
||||
<van-popup position="bottom" round v-model="roomRemarkVisible">
|
||||
<van-picker
|
||||
title="用房备注" show-toolbar
|
||||
:columns="roomRemarkColumns"
|
||||
value-key="label"
|
||||
@confirm="(val) => {formData.roomRemarkName = val.label;formData.roomRemark = val.value;roomRemarkVisible=false}"
|
||||
@cancel="() => {formData.roomRemarkName = '';formData.roomRemark = '';roomRemarkVisible=false}">
|
||||
</van-picker>
|
||||
</van-popup>
|
||||
|
||||
@@ -514,10 +544,25 @@ layout("/mobile/platform.html"){
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
roomRemarkVisible: false,
|
||||
isPdf: false,
|
||||
isLoad: false,
|
||||
active: 0,
|
||||
roomColumns: ['0.5间(一张床)', "1间(两张床)}", '1.5间(三张床)', '2间(四张床)'],
|
||||
basicRoomColumns: [
|
||||
{label: '0.5间(一张床)', value: 0.5},
|
||||
{label: '1间(两张床)', value: 1},
|
||||
{label: '1.5间(三张床)', value: 1.5},
|
||||
{label: '2间(四张床)', value: 2},
|
||||
],
|
||||
roomColumns: [],
|
||||
basicRoomRemarkColumns: [
|
||||
{label: '携带家属,包1间房', value: 1},
|
||||
{label: '已与其他老师自由组合共住1间房', value: 2},
|
||||
{label: '1人包房1间,额外支付单房差', value: 3},
|
||||
{label: '正常报名', value: 4},
|
||||
{label: '随机拼房', value: 5},
|
||||
],
|
||||
roomRemarkColumns: [],
|
||||
bedColumns: ['1', '2'],
|
||||
companionColumns: ['配偶', '子女', '亲属', '其他'],
|
||||
bedVisible: false,
|
||||
@@ -538,6 +583,7 @@ layout("/mobile/platform.html"){
|
||||
takePartInUnionId: '',
|
||||
companionList: [],
|
||||
bedInfo: {},
|
||||
roomCount: null,
|
||||
},
|
||||
self: true,
|
||||
btnFlag: false,
|
||||
@@ -552,6 +598,23 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
roomRemarkClick() {
|
||||
if(!this.formData.roomCount) {
|
||||
this.$toast('请先选择房间数量')
|
||||
return
|
||||
}
|
||||
this.self = true
|
||||
this.roomRemarkVisible = true
|
||||
},
|
||||
needBedChange() {
|
||||
this.clearContent()
|
||||
},
|
||||
clearContent() {
|
||||
this.$set(this.formData, 'roomCount', '')
|
||||
this.$set(this.formData, 'roomCountName', '')
|
||||
this.$set(this.formData, 'roomRemark', '')
|
||||
this.$set(this.formData, 'roomRemarkName', '')
|
||||
},
|
||||
getAgeAndSex(item){
|
||||
try {
|
||||
const value = item.idCard
|
||||
@@ -601,7 +664,7 @@ layout("/mobile/platform.html"){
|
||||
for (let i = 0; i < cloneData.companionList.length; i++) {
|
||||
const companion = cloneData.companionList[i];
|
||||
// 检查每个字段是否为空
|
||||
if (!companion.userName || !companion.idCard || !companion.mobile || !companion.relation) {
|
||||
if (!companion.userName || !companion.idCard || !companion.mobile) {
|
||||
this.$toast('请填写完整随行人信息')
|
||||
return
|
||||
}
|
||||
@@ -614,7 +677,7 @@ layout("/mobile/platform.html"){
|
||||
} else {
|
||||
// 判断companion.age,是不是在3到70岁之间,不是就提示
|
||||
if (companion.age < 3 || companion.age > 70) {
|
||||
this.$toast('随行人'+ (i+1) +'的年龄超出限制,请天添加其他联系人')
|
||||
this.$toast('随行人'+ (i+1) +'的年龄超出限制,请添加其他联系人')
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -672,10 +735,16 @@ layout("/mobile/platform.html"){
|
||||
// }, 1000)
|
||||
},
|
||||
addCompanion() {
|
||||
if(this.formData.companionList.length === 3) {
|
||||
this.$toast("随行人最多3人")
|
||||
return
|
||||
}
|
||||
this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}})
|
||||
this.clearContent()
|
||||
},
|
||||
delCompanion() {
|
||||
this.formData.companionList.splice(this.active, 1)
|
||||
this.clearContent()
|
||||
},
|
||||
async join() {
|
||||
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
|
||||
@@ -717,6 +786,7 @@ layout("/mobile/platform.html"){
|
||||
takePartInUnionId: this.takePartInUnionId,
|
||||
companionList: [],
|
||||
bedInfo: {},
|
||||
roomCount: null,
|
||||
}
|
||||
this.$set(this.formData.bedInfo, 'bedType', '大床房')
|
||||
}
|
||||
@@ -873,6 +943,38 @@ layout("/mobile/platform.html"){
|
||||
return false
|
||||
}
|
||||
},
|
||||
updateRoomRemarkColumns() {
|
||||
const roomCount = this.formData.roomCount;
|
||||
const companions = this.formData.companionList || [];
|
||||
const needBedCount = companions.filter(o => o.age > 12 || o.needBed).length;
|
||||
const strategies = {
|
||||
0.5: () => {
|
||||
if (companions.length === 0) return 5;
|
||||
if (needBedCount === 0) return 2;
|
||||
return 2;
|
||||
},
|
||||
1: () => {
|
||||
if (needBedCount + 1 === 2) return 4;
|
||||
if (companions.length > 0 && needBedCount === 0) return 1;
|
||||
if (companions.length === 0) return 3;
|
||||
return 1;
|
||||
},
|
||||
1.5: () => 2,
|
||||
2: () => {
|
||||
if (needBedCount + 1 === 4) return 4;
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
const matchedValue = strategies[roomCount]?.();
|
||||
if (matchedValue !== undefined) {
|
||||
this.roomRemarkColumns = this.basicRoomRemarkColumns.filter(
|
||||
o => o.value === matchedValue
|
||||
);
|
||||
} else {
|
||||
// 默认处理:恢复基础列
|
||||
this.roomRemarkColumns = [...this.basicRoomRemarkColumns];
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
const loading = this.$toast({
|
||||
@@ -954,6 +1056,25 @@ layout("/mobile/platform.html"){
|
||||
})
|
||||
loading.close()
|
||||
},
|
||||
watch: {
|
||||
'formData.companionList': {
|
||||
handler(newVal) {
|
||||
//过滤需要床位的,找大人或者小孩需要床位的
|
||||
const needBed = newVal.filter(o => o.age > 12 || o.needBed === true)
|
||||
const bedCount = 0.5 + (needBed.length - needBed.length * 0.5)
|
||||
console.log(bedCount)
|
||||
if(bedCount === 0.5) {
|
||||
this.roomColumns = this.basicRoomColumns.filter(o => o.value <= 1)
|
||||
} else {
|
||||
this.roomColumns = this.basicRoomColumns.filter(o => Number.isInteger(bedCount) ? o.value === bedCount : o.value >= bedCount)
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
'formData.roomCount'(newVal) {
|
||||
this.updateRoomRemarkColumns()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('scroll', this.scrollToTop)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user