疗休养

This commit is contained in:
Paidax
2025-06-19 03:27:05 +08:00
parent f3542654d5
commit ed46c3e9a4
4 changed files with 126 additions and 244 deletions
@@ -223,9 +223,6 @@ layout("/mobile/platform.html"){
<div class="container">
<div class="header">
<div class="title">
<!--<van-tag size="large" color="#1867b0" style="color: white;position: relative; top: -2px">
{{baseData.lotName}}
</van-tag>-->
{{baseData.baseName}}
</div>
<div style="margin-top: 10px">
@@ -250,16 +247,9 @@ layout("/mobile/platform.html"){
</div>
</div>
<van-divider></van-divider>
<!-- <div v-if="baseData.content" v-html="baseData.content" class="content"></div>-->
<!-- <div v-else v-html="configData.notice" class="content"></div>-->
<van-divider :style="{ color: 'orange', fontSize: '12px' }">上下滑动翻页,单击查看图片,再单击返回</van-divider>
<div v-if="isPdf" v-html="baseData.content" class="content"></div>
<div v-else id="demo" class="pdf_div"></div>
<!--<van-empty
v-else class="custom-image"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
description="暂无详细信息"
></van-empty>-->
</div>
</van-skeleton>
@@ -354,36 +344,6 @@ layout("/mobile/platform.html"){
</div>
</van-popup>
<!--房间类型弹出框-->
<van-popup position="bottom" round v-model="roomVisible">
<van-picker
title="房间信息" show-toolbar
:columns="roomColumns"
@confirm="roomConfirm"
@cancel="roomCancel">
</van-picker>
</van-popup>
<!--床位弹出框-->
<van-popup position="bottom" round v-model="bedVisible">
<van-picker
title="床位" show-toolbar
:columns="bedColumns"
@confirm="bedConfirm"
@cancel="bedVisible = false">
</van-picker>
</van-popup>
<!--随行人关系弹出框-->
<van-popup position="bottom" round v-model="companionVisible">
<van-picker
title="与本人关系" show-toolbar
:columns="companionColumns"
@confirm="(value, index) => {formData.companionList[active].relation = value; companionVisible = false}"
@cancel="companionVisible = false">
</van-picker>
</van-popup>
<van-calendar title="出行日期选择" v-model="timeVisible" :show-confirm="false"
:min-date="minDate" :max-date="maxDate"
ref="cal" @confirm="calConfirm" :style="{ height: '660px' }"></van-calendar>
@@ -499,7 +459,7 @@ layout("/mobile/platform.html"){
async openRead(){
const url = '/platform/theRapyRecuperation/baseManagement/showBaseApplyPdf?baseName='
+ (this.formData.baseName ? this.formData.baseName : '') + '&specificTime=' + (this.formData.specificTime ? this.formData.specificTime : '')
+ '&sign=' + (this.formData.sign ? this.configData.sign : '') + '&idCard=' + (this.formData.idCard ? this.formData.idCard : '')
+ '&sign=' + (this.formData.sign ? this.formData.sign : '') + '&idCard=' + (this.formData.idCard ? this.formData.idCard : '')
this.readVisible = true
this.$nextTick(() => {
@@ -525,43 +485,6 @@ layout("/mobile/platform.html"){
this.$set(this.formData, "specificTime", moment(date).format('YYYY年MM月DD日'))
this.timeVisible = false
},
getAgeAndSex(item){
try {
const value = item.idCard
const age = this.calculateAgeFromIdCard(value)
this.$set(item, "age", age)
const sex = this.getGenderFromIdCard(value)
this.$set(item, "sex", sex)
} catch (error) {
console.log(error)
}
},
roomCancel() {
if (!this.self) {
this.formData.companionList[this.active].bedInfo.bedType = ''
}
this.roomVisible = false
},
roomConfirm(value, index) {
if (this.self) {
this.formData.bedInfo.bedType = value
} else {
this.formData.companionList[this.active].bedInfo.bedType = value
}
this.roomVisible = false
},
bedConfirm(value, index) {
if (this.self) {
this.formData.bedInfo.bedNum = value
} else {
this.formData.companionList[this.active].bedInfo.bedNum = value
}
this.bedVisible = false
},
validator(value) {
return value != null
},
async joinSubmit() {
if (this.hasReadSafe === false) {
this.$toast('请先阅读安全告知书')
@@ -572,7 +495,7 @@ layout("/mobile/platform.html"){
return
}
if (!this.formData.sign) {
this.$toast.fail('请签字')
this.$toast('请签字')
return
}
this.formData.editOther = this.editOther ? this.editOther : ''
@@ -613,12 +536,6 @@ layout("/mobile/platform.html"){
// on cancel
})
},
addCompanion() {
this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}})
},
delCompanion() {
this.formData.companionList.splice(this.active, 1)
},
async join() {
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
@@ -710,106 +627,7 @@ layout("/mobile/platform.html"){
})
this.minDate = new Date(res.data.minDate)
this.maxDate = new Date(res.data.maxDate)
},
calculateAgeFromIdCard(idCard) {
// 检查身份证号码是否合法
if (!idCard) {
throw new Error("Invalid ID card format")
}
let birthDateStr
let birthYear, birthMonth, birthDay
// 处理18位身份证号码
if (idCard.length === 18) {
birthDateStr = idCard.substring(6, 14)
birthYear = parseInt(birthDateStr.substring(0, 4), 10)
birthMonth = parseInt(birthDateStr.substring(4, 6), 10) - 1 // 月份从0开始
birthDay = parseInt(birthDateStr.substring(6, 8), 10)
}
// 处理15位身份证号码
else if (idCard.length === 15) {
birthDateStr = idCard.substring(6, 12)
birthYear = parseInt("19" + birthDateStr.substring(0, 2), 10) // 使用字符串拼接
birthMonth = parseInt(birthDateStr.substring(2, 4), 10) - 1 // 月份从0开始
birthDay = parseInt(birthDateStr.substring(4, 6), 10)
} else {
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
}
// 获取当前日期
const currentDate = new Date()
// 计算年龄
let age = currentDate.getFullYear() - birthYear
// 如果当前日期还没过生日,则年龄减1
if (currentDate.getMonth() < birthMonth || (currentDate.getMonth() === birthMonth && currentDate.getDate() < birthDay)) {
age -= 1
}
return age
},
getGenderFromIdCard(idCard) {
// 检查身份证号码是否合法
if (!idCard) {
throw new Error("Invalid ID card format")
}
let genderDigit
// 处理18位身份证号码
if (idCard.length === 18) {
genderDigit = parseInt(idCard.charAt(16), 10) // 第17位
}
// 处理15位身份证号码
else if (idCard.length === 15) {
genderDigit = parseInt(idCard.charAt(14), 10) // 第15位
} else {
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
}
// 判断性别
if (genderDigit % 2 === 0) {
return "女"
} else {
return "男"
}
},
validateIdCard(idCard) {
if (!idCard) {
return false
}
// 18位身份证号码校验
if (idCard.length === 18) {
const idCardRegex = /^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/
if (!idCardRegex.test(idCard)) {
return false
}
// 校验码计算
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]
let sum = 0
for (let i = 0; i < 17; i++) {
sum += idCard[i] * weights[i]
}
const checksum = checksums[sum % 11]
return checksum === idCard[17].toUpperCase()
}
// 15位身份证号码校验
else if (idCard.length === 15) {
const idCardRegex = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/
return idCardRegex.test(idCard)
}
// 外国人或其他情况
else {
return false
}
},
}
},
async created() {
// 修改其他线路标识
@@ -806,11 +806,11 @@ layout("/mobile/platform.html"){
url = '/platform/theRapyRecuperation/line/enroll/doSignUpForLine'
}
const msg = this.editOther ? ('此操作会取消之前报名线路,并修改为【'+ this.formData.lineName +'】是否确认?') : '请确保信息填写无误,是否确认?'
const msg = this.editOther ? ('此操作会取消之前报名线路,并修改为【'+ this.formData.lineName +'】是否确认提交') : '请确保信息填写无误,是否确认提交'
vant.Dialog.confirm({
title: '温馨提示',
message: msg,
confirmButtonText: '确认',
confirmButtonText: '提交',
cancelButtonText: '取消',
}).then(async () => {
this.showButton = false
@@ -63,7 +63,7 @@ const BASE = {
<span @click="openReadSafe" style="color: #0e5996; text-decoration: underline">
《安全告知书》
</span>
<el-tag @click="openReadSafe" size="medium" effect="dark">查看</el-tag>
<el-tag @click="openReadSafe" size="mini" effect="dark">查看</el-tag>
</el-checkbox>
</div>
<div style="display: flex;" v-if="formData.specificTime && formData.sign">
@@ -73,7 +73,7 @@ const BASE = {
<span @click="openRead" style="color: #0e5996; text-decoration: underline">
《定点自由行申请表》
</span>
<el-tag @click="openRead" size="medium" effect="dark">查看</el-tag>
<el-tag @click="openRead" size="mini" effect="dark">查看</el-tag>
</el-checkbox>
</div>
</div>
@@ -123,9 +123,7 @@ const BASE = {
data(){
return{
id: '',
index: '',
enrollId: '',
fromUrlByMy: '',
baseData: {},
formData: {
userName: "",
@@ -139,9 +137,49 @@ const BASE = {
companionList: [],
},
formRules: {
userName: [{required: false, message: "必填", trigger: ["change", "blur"]}],
loginName: [{required: false, message: "必填", trigger: ["change", "blur"]}],
specificTime: [{required: false, message: "必填", trigger: ["change", "blur"]}],
idCard: [
{
required: true,
validator: (rule, value, callback) => {
if (/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/.test(value)) {
// 18位身份证号码格式正确
callback();
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 15位身份证号码格式正确
callback();
} else if (/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 外国人身份证号码格式正确(18位)
callback();
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
// 外国人身份证号码格式正确(15位)
callback();
} else {
// 格式错误,返回错误信息
callback(new Error("身份证号码格式错误"));
}
},
trigger: ["change", "blur"]
}
],
mobile: [
{
required: true,
validator: (rule, value, callback) => {
if (/^[1][345789][0-9]{9}$/.test(value)) {
// 手机号格式正确
callback();
} else if (/^\d+-\d+$/.test(value) && value.length <= 16) {
// 座机号格式正确
callback();
} else {
// 格式错误,返回错误信息
callback(new Error(value.includes('-') ? '座机号码格式错误' : '手机号码格式错误'));
}
},
trigger: ["change", "blur"]
}
],
specificTime: [{required: true, message: "必填", trigger: ["change", "blur"]}],
},
// 出行日期相关
timeVisible: false,
@@ -271,7 +309,7 @@ const BASE = {
}
},
async join(){
if (this.fromUrlByMy !== 'editDo') {
if (!this.enrollId) {
if (this.editOther) {
this.$set(this.formData, 'baseName', this.baseData.baseName)
this.$set(this.formData, 'takePartInLineId', null)
@@ -291,9 +329,7 @@ const BASE = {
}
}
}
if(this.index == 3) {
await this.getTimeArray()
}
await this.getTimeArray()
},
joinSubmit(){
if (this.hasReadSafe === false) {
@@ -311,43 +347,38 @@ const BASE = {
this.formData.editOther = this.editOther ? this.editOther : ''
const cloneData = clone(this.formData)
this.$confirm('请确保信息填写无误,是否确认提交?', '提示', {
confirmButtonText: '提交',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.showButton = false
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
enroll: JSON.stringify(cloneData),
})
loading.close()
if (resp.code === 0) {
this.$message.success('报名成功')
this.$emit('success')
// vant.Dialog.alert({
// title: '提示',
// message: '报名成功',
// }).then(() => {
// location.replace('/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index)
// })
} else {
this.$message.warning(resp.msg)
this.showButton = true
this.$refs.formRef.validate(valid => {
if (valid) {
this.$confirm('请确保信息填写无误,是否确认提交?', '提示', {
confirmButtonText: '提交',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.showButton = false
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
enroll: JSON.stringify(cloneData),
})
loading.close()
if (resp.code === 0) {
this.$message.success('操作成功')
this.$emit('success')
} else {
this.$message.warning(resp.msg)
this.showButton = true
}
})
}
})
},
async initData(data){
this.id = data.id
this.index = data.index
this.enrollId = data.enrollId
this.fromUrlByMy = data.fromUrlByMy
this.editOther = data.editOther
await this.getData()
@@ -351,16 +351,21 @@ layout("/layouts/platform.html"){
<line-sign-up ref="lineSignUpRef"></line-sign-up>
<el-dialog :title="baseName + '报名'" width="60%" :visible.sync="baseVisible" :close-on-click-modal="false" :close-on-press-escape="false">
<base-sign-up ref="baseRef" :config_data="config" @success="baseSuccess"></base-sign-up>
</el-dialog>
</div>
<script>
<!--#include('lineSignUp.js'){}#-->
<!--#include('base.js'){}#-->
new Vue({
el: '#app',
mixins: [initTableMixins],
components: {
'line-sign-up': LineSignUp
'line-sign-up': LineSignUp,
'base-sign-up': BASE
},
data() {
return {
@@ -376,6 +381,10 @@ layout("/layouts/platform.html"){
pageSize: 20,
totalCount: 0
},
// 定点报名相关
baseName: '',
baseVisible: false
}
},
methods: {
@@ -436,24 +445,48 @@ layout("/layouts/platform.html"){
},
// 处理报名
async handleSignUp(row) {
const {code,data,msg} = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo',{
enroll: JSON.stringify({
isNormal: true,
takePartInLineId: row.usId,
takePartInUnionId: row.takePartInUnionId,
}),
})
if (code !== 0) {
this.$message.error(msg);
return;
}
if (["0", "1"].includes(this.pageForm.theRapyRecuperationType)) {
const {code,data,msg} = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo',{
enroll: JSON.stringify({
isNormal: true,
takePartInLineId: row.usId,
takePartInUnionId: row.takePartInUnionId,
}),
})
if (code !== 0) {
this.$message.error(msg);
return;
}
// 线路
this.$refs.lineSignUpRef.onOpen(row, this.pageForm, this.config);
} else if (this.pageForm.theRapyRecuperationType === 3) {
} else if (this.pageForm.theRapyRecuperationType === "3") {
// 定点疗休养
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: row.id,
isNormal: true,
}),
})
if (resp.code !== 0) {
this.$message.error(resp.msg);
return;
}
const data = {
id: row.id,
enrollId: '',
}
this.baseName = row.baseName
this.baseVisible = true
this.$nextTick(() => {
this.$refs.baseRef.initData(data)
})
}
},
// 定点相关
baseSuccess() {
this.baseVisible = false
this.pageData();
}
},
created() {
@@ -466,4 +499,4 @@ layout("/layouts/platform.html"){
<!--#
}
#-->
#-->