Files
zhgh_hmc/src/main/resources/views/mobile/therapyRecuperation/baseManagement.html
T
2025-06-19 03:27:05 +08:00

695 lines
25 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<style>
.container img {
background-size: contain;
width: 100%;
height: auto;
margin: 5px auto;
display: block;
}
.header {
padding: 20px;
}
.content {
line-height: 26px;
padding: 0 20px 56px 20px;
max-height: calc(100vh - 46px - 210px - 60px - 24px);
overflow-y: auto;
}
.title {
font-weight: bold;
font-size: 19px;
color: #505050;
margin-bottom: 10px;
}
.van-divider {
border-color: grey;
margin: 0;
}
.van-skeleton {
padding: 20px;
}
.van-skeleton__content {
height: 600px;
padding-top: 60px;
}
.van-skeleton__row, .van-skeleton__title {
height: 30px;
}
.footer {
background-color: white;
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
display: flex;
justify-content: space-evenly;
align-items: center;
left: 0;
}
.footer .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
}
.family_join {
background-color: #ff976a;
color: white;
}
.join {
background-color: #0e78c5;
color: white;
}
.joinPopup {
width: 100%;
height: 100%;
background-color: #f6f7f9;
}
.join_content {
padding: 20px;
height: calc(100% - 40px - 46px - 60px);
overflow-y: auto;
}
.join_submit {
width: 90% !important;
}
.van-doc-card {
background-color: #fff;
border-radius: 6px;
box-shadow: 0 8px 12px #ebedf0;
line-height: 20px;
position: relative;
}
.van-card-header {
padding: 14px 20px;
border-bottom: 1px solid #ebeef5;
box-sizing: border-box;
color: #0e78c5;
font-weight: bold;
}
.van-card-body {
padding: 0px 10px 0px 10px
}
.van-doc-card > div:first-child {
border: 2px #0e78c5 solid;
width: 26px;
border-radius: 6px;
position: absolute;
top: 0;
left: 20px;
}
.van-cell {
padding: 8px 16px;
}
.van-tabs__wrap {
margin: 6px;
}
.van-tabs__nav--card {
border: none;
}
.van-tabs__nav--card .van-tab.van-tab--active {
border-radius: 6px;
}
.van-tabs__nav--card .van-tab {
border-right: 0 !important;
}
.top_icon {
position: fixed;
bottom: 80px;
right: 20px;
}
.van-field__control {
text-overflow: ellipsis;
}
.list-card {
width: auto;
}
.companionList_empty_text {
text-align: center;
padding: 10px 0px;
font-size: 14px;
color: grey;
}
/*.header div span {*/
/* color: grey;*/
/*}*/
.header :last-child {
font-size: 14px;
}
.van-empty {
position: relative;
transform: none;
top: 0;
left: 0;
background-color: transparent;
height: calc(100vh - 46px - 153px - 60px);
}
.submitButton {
background-color: white !important;
width: 100%;
height: 60px;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.submitButton .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
}
.van-image-preview img {
background-color: white;
}
.sign_div {
background-color: white;
margin-bottom: 16px;
padding: 18px;
border-radius: 6px;
box-shadow: 0 8px 12px #ebedf0;
}
.pdf_div {
padding-bottom: 70px;
height: calc(100vh - 46px - 170px - 60px - 24px);
}
</style>
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar @click-left="history.back()" fixed left-arrow placeholder title="职工疗休养-酒店介绍"></van-nav-bar>
</van-sticky>
<!--线路详情-->
<van-skeleton title :loading="skeLoading" :row="12">
<div class="container">
<div class="header">
<div class="title">
{{baseData.baseName}}
</div>
<div style="margin-top: 10px">
<div>
<span class="line_label">&emsp;&emsp;域:</span>
{{baseData.regionalNature}}
</div>
<div>
<span>创建模式:</span>
{{baseData.createMode === 1 ? '校工会' : '分工会'}}
</div>
<div>
<span>报名时间:</span>
{{moment(baseData.signUpStartTime).format('YYYY-MM-DD HH:mm') + ' ~ ' +
moment(baseData.signUpEndTime).format('YYYY-MM-DD HH:mm')}}
</div>
<div>
<span>活动时间:</span>
{{moment(baseData.activityStartTime).format('YYYY-MM-DD HH:mm') + ' ~ ' +
moment(baseData.activityEndTime).format('YYYY-MM-DD HH:mm')}}
</div>
</div>
</div>
<van-divider></van-divider>
<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>
</div>
</van-skeleton>
<!--置顶图标-->
<image v-if="btnFlag" @click="backTop" src="/assets/mobile/svg/therapyRecuperation/top.svg"
class="top_icon"></image>
<!--底部报名按钮-->
<div class="footer" v-if="fromUrlByMy != 'edit'">
<template v-if="baseData.isNormal==0&&baseData.isNormalFalse>0">
<van-button @click="join"
class="join">
{{ (fromUrlByMy == 'editDo' || editOther) ? '修改报名' : '我要报名' }}
</van-button>
</template>
<template v-else>
<van-button v-if="moment().unix() <= moment(baseData.signUpEndTime).unix()" @click="join" class="join">
{{ (fromUrlByMy == 'editDo' || editOther) ? '修改报名' : '我要报名' }}
</van-button>
<van-button v-if="moment().unix() > moment(baseData.signUpEndTime).unix()" class="join">报名结束</van-button>
</template>
</div>
<!--报名弹出框-->
<van-popup v-model:show="joinPopup" position="right" class="joinPopup">
<van-nav-bar @click-left="joinPopup = false" fixed left-arrow placeholder title="疗休养报名"></van-nav-bar>
<van-notice-bar color="#1989fa" background="#ecf9ff" left-icon="info-o">
温馨提示:报名定点疗休养需签署【定点自由行申请表】,填写基础信息和签字后会同步在申请表中,点击查看按钮可展示申请表
</van-notice-bar>
<div class="join_content">
<van-form @submit="joinSubmit">
<!--基础信息-->
<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header">
基础信息
</div>
<div class="van-card-body">
<van-field label="姓名" readonly v-model="formData.userName"></van-field>
<van-field label="工号" readonly v-model="formData.loginName"></van-field>
<van-field label="身份证件" name="idCard" required :rules="[{ required: true }]"
placeholder="请填写身份证号、护照、台胞证等" v-model="formData.idCard"></van-field>
<van-field label="手机号" name="mobile" required :rules="[{ required: true }]"
placeholder="请填写手机号" v-model="formData.mobile"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="报名酒店" readonly v-model="formData.baseName"></van-field>
<van-field label="出行时间" readonly @click="timeVisible = true"
:rules="[{ required: true }]" placeholder="请选择出行时间" required
is-link v-model="formData.specificTime" name="specificTime"></van-field>
</div>
</div>
<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header">
签字
</div>
<div class="van-card-body">
<mobile-sign :is_value_base64="false" v-model="formData.sign" prefix="RAPY"
ref="signature"></mobile-sign>
</div>
</div>
<div class="sign_div">
<div style="display: flex">
<van-checkbox v-model="hasReadSafe" shape="square" @change="readChangeSafe" class="mr10"></van-checkbox>
我已查看
<span @click="openReadSafe" style="color: #0e5996; text-decoration: underline">
《安全告知书》
</span>
<van-tag @click="openReadSafe" size="large" type="primary" color="#1867b0">查看</van-tag>
</div>
<div style="display: flex; margin-top: 10px" v-if="formData.specificTime && formData.sign">
<van-checkbox v-model="hasRead" shape="square" @change="readChange" class="mr10"></van-checkbox>
我已查看
<span @click="openRead" style="color: #0e5996; text-decoration: underline">
《定点自由行申请表》
</span>
<van-tag @click="openRead" size="large" type="primary" color="#1867b0">查看</van-tag>
</div>
</div>
<div class="submitButton" v-if="showButton">
<van-button class="join join_submit">提交报名</van-button>
</div>
</van-form>
</div>
</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>
<van-action-sheet v-model="readVisibleSafe" title="安全告知书">
<van-divider :style="{ color: 'orange', fontSize: '12px' }">上下滑动翻页,单击查看,再单击返回</van-divider>
<div id="readFile" style="height: 530px; overflow-y: auto"></div>
<div class="submitButton">
<van-button @click="onReadSafe" class="join join_submit" style="margin: 10px 0">我已阅读确认</van-button>
</div>
</van-action-sheet>
<van-action-sheet v-model="readVisible" title="定点自由行申请表">
<van-divider :style="{ color: 'orange', fontSize: '12px' }">上下滑动翻页,单击查看,再单击返回</van-divider>
<div id="basePdf" style="height: 530px; overflow-y: auto"></div>
<div class="submitButton" style="margin-bottom: 7vh">
<van-button @click="onRead" class="join join_submit" style="margin: 10px 0">我已阅读确认</van-button>
</div>
</van-action-sheet>
</div>
<script>
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return null;
}
let pdfh5 = null
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
showButton: true,
isPdf: false,
active: 0,
minDate: new Date(2010, 0, 1),
maxDate: new Date(2010, 0, 31),
roomColumns: ['包房', '默认房间'],
bedColumns: ['1', '2'],
companionColumns: ['配偶', '子女', '亲属', '其他'],
bedVisible: false,
roomVisible: false,
companionVisible: false,
joinPopup: false,
skeLoading: true,
id: '',
baseData: {},
formData: {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
lineName: '',
takePartInLineId: '',
takePartInUnionId: '',
companionList: [],
bedInfo: {},
specificTime: '',
sign: ''
},
self: true,
btnFlag: false,
index: 0,
scrollTop: 0,
fromUrlByMy: '',
enrollId: '',
configData: {},
// 出行日期相关
timeVisible: false,
// 定点疗休养申请表相关
readVisible: false,
hasRead: false,
clickRead: false,
// 修改其他线路相关
editOther: '',
// 安全告知书相关
readVisibleSafe: false,
clickReadSafe: false,
hasReadSafe: '',
}
},
methods: {
// 展示安全告知书
async openReadSafe(){
this.readVisibleSafe = true
this.$nextTick(() => {
if (this.configData.files && this.configData.files.length > 0) {
pdfh5 = new Pdfh5('#readFile', {
pdfurl: CREATE_PREVIEW_URL(this.configData.files[0].id),
})
}
})
},
onReadSafe() {
this.clickReadSafe = true
this.hasReadSafe = true
this.readVisibleSafe = false
},
readChangeSafe() {
if (this.clickReadSafe === false) {
this.$toast('请先阅读安全告知书')
this.hasReadSafe = false
}
},
// 展示申请表
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.formData.sign : '') + '&idCard=' + (this.formData.idCard ? this.formData.idCard : '')
this.readVisible = true
this.$nextTick(() => {
pdfh5 = new Pdfh5('#basePdf', {
pdfurl: url,
});
})
},
onRead() {
this.clickRead = true
this.hasRead = true
this.readVisible = false
},
readChange() {
if (this.clickRead === false) {
this.$toast('请先阅读定点自由行申请表')
this.hasRead = false
}
},
// 出行日期相关
calConfirm(date) {
console.log(date)
this.$set(this.formData, "specificTime", moment(date).format('YYYY年MM月DD日'))
this.timeVisible = false
},
async joinSubmit() {
if (this.hasReadSafe === false) {
this.$toast('请先阅读安全告知书')
return
}
if (this.hasRead === false) {
this.$toast('请先阅读定点自由行申请表')
return
}
if (!this.formData.sign) {
this.$toast('请签字')
return
}
this.formData.editOther = this.editOther ? this.editOther : ''
const cloneData = clone(this.formData)
vant.Dialog.confirm({
title: '温馨提示',
message: '请确保信息填写无误,是否确认提交?',
confirmButtonText: '提交',
cancelButtonText: '取消',
}).then(async () => {
this.showButton = false
const loading = vant.Toast.loading({
duration: 0,
forbidClick: true,
overlay: true,
message: '努力提交中',
})
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
enroll: JSON.stringify(cloneData),
})
loading.clear()
if (resp.code === 0) {
vant.Dialog.alert({
title: '提示',
message: '报名成功',
}).then(() => {
location.replace('/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index)
})
} else {
vant.Dialog.alert({
title: '提示',
message: resp.msg,
})
this.showButton = true
}
}).catch(() => {
// on cancel
})
},
async join() {
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: this.baseData.isNormal,
id: this.enrollId,
editOther: this.editOther
}),
})
if (re.code !== 0) {
vant.Dialog.alert({
title: '温馨提示',
message: re.msg,
})
return
}
if (this.fromUrlByMy !== 'editDo') {
if (this.editOther) {
this.$set(this.formData, 'baseName', this.baseData.baseName)
this.$set(this.formData, 'takePartInLineId', null)
this.$set(this.formData, 'takePartInUnionId', null)
this.$set(this.formData, 'takePartInTravelAgencyId', null)
this.$set(this.formData, 'takePartInBaseManagementId', this.baseData.id)
} else {
this.formData = {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "${@shiro.getPrincipalProperty('idcard')}",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
}
}
}
if(this.index == 3) {
await this.getTimeArray()
}
this.joinPopup = true
},
async getData() {
const res = await $.get('/platform/theRapyRecuperation/baseManagement/selectBaseAllInfo', {
id: this.id
})
if (res.code === 0) {
this.baseData = res.data
this.formData.baseName = this.baseData.baseName
this.skeLoading = false
}
},
// 点击图片回到顶部方法,加计时器是为了过渡顺滑
backTop() {
const that = this
let timer = setInterval(() => {
let speed = Math.floor(-that.scrollTop / 5)
document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + speed
if (that.scrollTop === 0) {
clearInterval(timer)
}
}, 16)
},
// 为了计算距离顶部的高度,当高度大于100显示回顶部图标,小于100则隐藏
scrollToTop() {
const that = this
that.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
that.btnFlag = that.scrollTop > 100;
},
//修改时查询报名信息,进行回显
async findSignUpInfoById() {
const res = await $.post('/platform/theRapyRecuperation/line/enroll/findSignUpInfoById', {
id: this.enrollId,
editOther: this.editOther
})
if (res.code === 0) {
this.formData = res.data
this.formData.bedInfo = {}
this.formData.companionList = []
this.$forceUpdate()
}
},
async getConfigData() {
const resp = await $.get('/platform/theRapyRecuperation/TheRapyConfig/findOne')
this.configData = resp.data
},
async getTimeArray(){
const res = await $.post('/platform/theRapyRecuperation/baseManagement/getTimeArray', {
id: this.id
})
this.minDate = new Date(res.data.minDate)
this.maxDate = new Date(res.data.maxDate)
}
},
async created() {
// 修改其他线路标识
this.editOther = getQueryString('editOther') ? getQueryString('editOther') : ''
this.id = getQueryString('id') ? getQueryString('id') : ''
this.enrollId = getQueryString('enrollId') ? getQueryString('enrollId') : ''
this.index = getQueryString('index') ? getQueryString('index') : ''
await this.getConfigData()
//编辑传出来的参数
this.fromUrlByMy = getQueryString('fromUrlByMy') ? getQueryString('fromUrlByMy') : ''
if (this.enrollId || this.editOther) {
await this.findSignUpInfoById()
}
await this.getData()
try {
const parser = new DOMParser();
const doc = parser.parseFromString(this.baseData.content, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
this.$nextTick(() => {
pdfh5 = new Pdfh5('#demo', {
pdfurl: href,
});
})
}catch (e) {
this.isPdf = true
}
},
mounted() {
window.addEventListener('scroll', this.scrollToTop)
document.addEventListener('click', function (event) {
const imgDoc = document.querySelectorAll('img')
let array = []
let classArray = []
imgDoc.forEach(o => {
if(o.getAttribute('class') !== 'top_icon') {
classArray.push(o.getAttribute('class'))
array.push(o.getAttribute('src'))
}
})
// 打印被点击的元素标签名和 class
if (event.target.tagName === 'IMG' && event.target.className !== 'top_icon') {
const index = array.indexOf(event.target.currentSrc)
if(index !== -1) {
vant.ImagePreview({
images: array,
startPosition: index,
closeable: true,
})
}
}
})
},
destroyed() {
window.removeEventListener('scroll', this.scrollToTop)
},
})
</script>
<!--#
}
#-->