Files
UNION_NSI/target/classes/views/mobile/activity/unionActivity/unionReg.html
T
2026-09-08 19:49:21 +08:00

367 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.activity_img_back {
background-repeat: no-repeat;
background-size: cover;
height: 200px;
width: 100%;
}
.regCell .van-cell__label .van-tag {
margin-right: 10px;
margin-bottom: 10px;
}
.userActionPopup {
height: 80%;
}
.userActionPopup .van-cell__value {
text-align: center;
}
.userActionPopup .addBtn {
width: 24px;
}
.userActionPopup .van-action-sheet__item {
position: relative;
}
.userActionPopup .userSelSuccess {
position: absolute;
right: 20px;
}
.van-search__action {
background-color: #edf0ff
}
.activity_name .van-cell__title{
width: 100px;
flex: unset;
}
.activity_name .van-cell__value{
width: calc(100% - 100px);
flex: unset;
}
</style>
<div id="app" v-cloak>
<van-nav-bar :title="title" left-arrow placeholder fixed
@click-left="history.back()"></van-nav-bar>
<!--#include("/mobile/activity/unionActivity/common/activityInfo.html"){}#-->
<van-cell-group inset class="mt5">
<van-cell title="报名人员" class="regCell">
<template #title>
报名人员({{registerList.length}}人)
</template>
<template #label>
<div>
<span v-if="o.userNumberLimit===1">
本活动限制总报名人数:({{o.totalUserNumberLimit}})人
</span>
<span v-else-if="o.userNumberLimit===2">
当前分工会报名限额 <span style="color: orange">{{o.limitUnion.limitNum}})人</span>
</span>
</div>
<div class="mt5" v-loading="tagCloseable">
<div v-if="registerList && registerList.length>0" style="max-height: 300px;overflow-y: scroll">
<template v-for="item in registerList">
<div style="display: flex;align-items: center">
<!-- <van-tag type="primary" :closeable="tagCloseable" size="medium"-->
<!-- :color="themeColor"-->
<!-- @close="removeRegUser(item)">-->
<!-- {{item.userName}}-->
<!-- </van-tag>-->
<div style="min-width: 100px;max-width: 100px;font-size: 14px;color: #000000">
{{item.userName}}
</div>
<van-field v-model="item.notes" label="" maxlength="20"
:readonly="!tagCloseable"
placeholder="如未能到现场请填写备注原因"></van-field>
<van-button icon="delete" type="danger" size="small" @click="removeRegUser(item)"
v-if="tagCloseable"
></van-button>
</div>
</template>
</div>
<div v-else>
<div style="text-align: center;margin-top: 20px;">
无报名人员
</div>
</div>
</div>
<div class="mt5" style="text-align: right" v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="tagCloseable" size="mini" type="info"
@click="openUserActionSheet" :color="themeColor">选择报名人员
</van-button>
</div>
</template>
</van-cell>
</van-cell-group>
<van-action-sheet v-model="userActionSheet" title="选择报名人员" class="userActionPopup">
<van-search v-model="searchKey" @search="onSearchUser" show-action
placeholder="请输入姓名搜索">
<template #action>
<div @click="onSearchUser(searchKey)">搜索</div>
</template>
</van-search>
<!-- <div class="van-hairline&#45;&#45;bottom">-->
<!-- 点击列表中的人员添加到活动人员中-->
<!-- </div>-->
<template v-if="searchLoading">
<van-loading size="24px" vertical>搜索中...</van-loading>
</template>
<div class="van-action-sheet__content mt5"
style="height: calc(100% - 107px);overflow-y: scroll"
v-else-if="searchUserList && searchUserList.length>0">
<template>
<template v-for="item in searchUserList"
v-if="!registerList.map(v=>v.id).includes(item.id)">
<button @click="searchUserAdd(item)"
class="van-action-sheet__item van-hairline--bottom">
<span class="van-action-sheet__name">{{item.userName}}{{item.loginName}}</span>
</button>
</template>
<!--<van-empty description="没有更多了" style="position:absolute;height: 70%"
v-else></van-empty>-->
</template>
</div>
<van-empty description="暂无数据" style="position:absolute;height: 70%"
v-else-if="searchUserList.length===0"></van-empty>
</van-action-sheet>
<div style="margin: 20px 20px 10px 20px"
v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="tagCloseable" @click="doSave()" style="border-radius: 10px" block
type="info"
:color="themeColor">
提 交
</van-button>
<van-button v-else="!tagCloseable" @click="tagCloseable = true" style="border-radius: 10px"
block type="info"
:color="themeColor">
修 改
</van-button>
</div>
<!-- <div style="margin: 20px 20px 10px 20px" v-if="tagCloseable">-->
<!-- <van-button-->
<!-- :disabled="moment().valueOf() > moment(o.endTime).valueOf() || moment().valueOf() < moment(o.startTime).valueOf()"-->
<!-- @click="doSign()" style="border-radius: 10px" block type="info"-->
<!-- :color="themeColor">-->
<!-- 立即签到-->
<!-- </van-button>-->
<!-- </div>-->
</div>
<script>
<!--#include("/mobile/activity/unionActivity/common/initMap.js"){}#-->
var vue = new Vue({
el: '#app',
mixins: [mobileMixins, self_mixin],
data() {
return {
title: "",
userId: "${@shiro.getPrincipalProperty('id')}",
userName: "${@shiro.getPrincipalProperty('username')}",
activityId: '',
o: {},
registerList: [],
addRegisterList: [],
userActionSheet: false,
searchKey: '',
searchUserList: [],
tagCloseable: true,
searchLoading: false
}
},
methods: {
async getRegisterUser() {
const resp = await $.get('/mobile/activity/myActivity/selectRegisterList', {activityId: this.activityId})
if (resp.code === 0) {
if (this.o.signUpMethod === 3) {
this.registerList = resp.data.filter(v => v.applyUserId === this.userId)
} else {
this.registerList = resp.data
}
this.addRegisterList = resp.data
if (this.registerList.length > 0) {
this.tagCloseable = false
}
}
},
openUserActionSheet() {
this.searchKey = ''
this.searchUserList = []
this.userActionSheet = true
this.onSearchUser(null)
},
async onSearchUser(val) {
// if (!val) {
// this.$toast.fail("请输入搜索条件")
// return
// }
this.searchLoading = true
const resp = await $.get('/mobile/activity/unionActivity/searchNoRegisterUser', {
activityId: this.activityId,
searchKey: val
})
if (resp.code === 0) {
this.searchLoading = false
this.searchUserList = resp.data.list
} else {
this.$toast.fail(resp.msg)
}
},
searchUserAdd(item) {
const {id, userName} = item
this.registerList.push({id, userName})
this.$toast('添加成功')
},
async removeRegUser(item) {
if (this.userId === item.id) {
this.$toast.fail("自己不能删除")
return
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要移除吗?',
})
if (confirm === 'confirm') {
const index = this.registerList.findIndex(v => v.id === item.id)
this.registerList.splice(index, 1)
}
},
//保存
async doSave() {
if (this.registerList.length === 0) {
this.$toast('请添加报名人员后再提交!')
return
}
if (this.o.signUpMethod === 3) {
if (this.registerList.length !== this.o.teamNum) {
vant.Dialog.alert({
title: '温馨提示',
message: '此活动是双人报名模式您需要报名' + this.o.teamNum + '人!',
}).then(() => {
});
return
}
if (!this.registerList.map(v => v.id).includes(this.userId)) {
vant.Dialog.alert({
title: '温馨提示',
message: '此活动是组队模式请您找' + this.o.teamNum + '朋友一起报名!',
}).then(() => {
});
return
}
// await this.getRegisterUser()
const resp = await $.get('/mobile/activity/myActivity/selectRegisterList', {activityId: this.activityId})
this.addRegisterList = resp.data
let arr = []
if (this.addRegisterList && this.addRegisterList.length > 0) {
this.addRegisterList.forEach(v => {
this.registerList.forEach(r => {
if (v.id === r.id && v.applyUserId !== this.userId) {
arr.push(r.userName)
}
})
})
}
if (arr && arr.length > 0) {
vant.Dialog.alert({
title: '温馨提示',
message: '【' + arr.toString() + '】已成功报名您无需再报名!',
}).then(() => {
});
return
}
/* if (this.addRegisterList.map(v => v.id).includes(this.userId)) {
vant.Dialog.alert({
title: '温馨提示',
message: '您已报名无需再报名!',
}).then(() => {
});
return
}*/
}
let message = ''
if (this.o.needSign) {
message = '此活动开启了签到,需要您活动当天前往签到点位核实活动报名人员后进行签到!'
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: message + '您确认要报名吗?',
})
if (confirm === 'confirm') {
const loading = this.$toast.loading({
message: '报名中...',
forbidClick: true,
overlay: true,
duration: 0
})
const params = {
activityId: this.activityId,
personIds: JSON.stringify(this.registerList.map(v => v.id)),
persons: JSON.stringify(this.registerList)
}
const resp = await $.post('/mobile/activity/unionActivity/doSaveUnionRegister', params)
loading.close()
if (resp.code === 0) {
await this.getRegisterUser()
await this.getHasRegUserNum()
this.$toast.success(resp.msg)
} else {
this.$toast.fail(resp.msg)
}
}
}
},
async created() {
const id = GetQueryString("id")
if (id) {
this.activityId = id
await this.getActivityInfo()
await this.getRegisterUser()
if (this.o.signUpMethod === 3 && this.registerList.length === 0) {
this.registerList.push({id: this.userId, userName: this.userName})
}
this.title = (this.o.signUpMethod === 2 ? '分工会报名' : '组队报名')
if (moment(this.o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() > moment(this.o.applyEndTime).valueOf()) {
this.$toast.fail("不在活动范围内")
}
}
}
})
</script>
<!--#
}
#-->