Files
zhgh_cpu/src/main/resources/views/mobile/site/apply/index.html
T

121 lines
4.3 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<style>
</style>
<div id="app">
<van-nav-bar title="场地预约" left-text="返回" left-arrow @click-left="pjaxReplace('/mobile/index')" fixed placeholder></van-nav-bar>
<van-sticky offset-top="46px">
<!-- <van-search-->
<!-- v-model="pageForm.searchKeyword"-->
<!-- :show-action="false"-->
<!-- :reverse-color="false"-->
<!-- input-align="left"-->
<!-- placeholder="请输入场地名称或场地地址搜索"-->
<!-- @search="doSearch"-->
<!-- ></van-search>-->
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<!-- <year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>-->
<van-dropdown-item v-model="pageForm.type" :options="typeOptions" :multiple="false"
@change="doSearch"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/site/apply/pageData" :page_form.sync="pageForm" ref="tableListRef" title="name" @ready="onReady">
<template v-slot="{index,row}">
<table-column label="联系人">{{row.contactName}}</table-column>
<table-column label="联系方式">{{row.contactPhone}}</table-column>
<table-column label="场地地址">{{row.address}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onApply(row)">
<i class="fa fa-edit"></i>
<span>预约</span>
</div>
</template>
</table-list>
<info ref="infoRef"></info>
<site-apply ref="applyRef"></site-apply>
</div>
<script>
<!--#include('/mobile/site/common/siteInfo.js'){}#-->
<!--#include('apply.js'){}#-->
new Vue({
el: "#app",
components: {
"info": siteInfo,
"site-apply": apply,
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: '',
type: null
},
typeOptions: [],
}
},
methods: {
onView(row) {
this.$refs.infoRef.onOpen(row)
},
onApply(row) {
if(row.reserveTarget === 1 && "${@shiro.hasAnyRoles('gh01', 'H04')}" === 'false' && "${@shiro.hasRole('sysadmin')}" === 'false') {
this.$message.warning('该场地只能分工会预约')
return
}
if (row.sexLimit === 1 || row.sexLimit === 2) {
const sex = row.sexLimit === 1 ? '男' : '女'
if(!"${@shiro.getPrincipalProperty('sex')}".includes(sex)) {
this.$message.warning('抱歉,该场地仅限' + sex + '性会员预约')
return
}
}
this.$refs.applyRef.onOpen(row)
this.$refs.applyRef.introduce = row.introduce
},
async onReady() {
const typeList = await this.querySiteType()
this.typeOptions = [
{
text: "全部类型",
value: null
}
].concat(typeList.map((v) => ({ text: v.name, value: v.id })))
if (this.typeOptions.length > 0) {
this.pageForm.type = this.typeOptions[0].value
this.doSearch()
}
},
async querySiteType() {
const res = await $.post("/platform/site/type/querySiteType")
return res.data
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
}
},
})
</script>
<!--#
}
#-->