buddhism/pages/memorial/memorialHall.vue

474 lines
12 KiB
Vue
Raw Normal View History

2025-08-11 10:14:33 +08:00
<template>
<view class="page">
<base-background />
<!-- 使用自定义导航栏组件 -->
<custom-navbar
ref="customNavbar"
title="往生大殿"/>
<view class="header">
<!-- 搜索框 -->
<search-box
v-model="searchName"
:width="'682rpx'"
:search-icon="CommonEnum.SEARCH"
placeholder="请输入姓名或分区进行查找"
btn-text="搜索"
@search="handleSearch"
/>
<view class="container">
<!-- 顶部信息 -->
<view class="memorial-header">
2025-08-11 11:01:25 +08:00
<view class="location">{{ memorialDetail ? memorialDetail.name : '加载中...' }}</view>
2025-08-11 10:14:33 +08:00
<view class="collection-btn">收藏牌位</view>
</view>
<!-- 刻铭标题 -->
<view class="title">刻铭</view>
2025-08-11 11:01:25 +08:00
<!-- 加载状态 -->
<view v-if="loading" class="loading-container">
<view class="loading-text">加载中...</view>
</view>
2025-08-11 10:53:44 +08:00
<!-- 动态渲染往生者信息 -->
<view
2025-08-11 11:01:25 +08:00
v-else-if="deceasedList.length > 0"
2025-08-11 10:53:44 +08:00
v-for="(deceased, index) in deceasedList"
:key="deceased.id"
class="memorial-text"
>
2025-08-11 10:14:33 +08:00
<view class="name">
2025-08-11 10:53:44 +08:00
<view class="honorific">{{ deceased.honorific }}</view>
<view class="fullName">{{ deceased.fullName }}</view>
2025-08-11 10:14:33 +08:00
</view>
<view class="date">
2025-08-11 10:29:25 +08:00
<view class="bornDate">
<view></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.bornYear }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.bornMonths }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.bornDay }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
</view>
<view class="diedDate">
<view></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.diedYear || '吉' }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.diedMonths || '吉利' }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
2025-08-11 10:53:44 +08:00
<view>{{ deceased.diedDay || '吉' }}</view>
2025-08-11 10:29:25 +08:00
<view class="time"></view>
</view>
2025-08-11 10:14:33 +08:00
</view>
</view>
2025-08-11 11:01:25 +08:00
<!-- 空数据提示 -->
<view v-else-if="!loading && deceasedList.length === 0" class="empty-container">
<view class="empty-text">暂无往生者信息</view>
</view>
2025-08-11 10:14:33 +08:00
<!-- 联系人信息 -->
<view class="contact-info">
2025-08-11 11:01:25 +08:00
<view v-if="memorialDetail">
联系人{{ memorialDetail.contactName || '暂无' }}{{ memorialDetail.contactPhone || '暂无' }}
</view>
<view v-if="memorialDetail && memorialDetail.address">
地址{{ memorialDetail.address }}
</view>
<view v-else>
联系人暂无联系信息
</view>
2025-08-11 10:14:33 +08:00
</view>
</view>
<!-- 状态栏 -->
<StatusBar
v-if="selectedUnitId"
:unit-id="selectedUnitId"
@view-details="handleViewDetails"
/>
</view>
<view class="bottom">
<bottom-button
title="立即供奉"
type="primary"
@click="submitPrayer"
/>
</view>
</view>
</template>
<script>
import {CommonEnum} from '@/enum/common.js'
2025-08-11 11:01:25 +08:00
import { getDeceasedList, getMemorialDetail } from '@/api/memorial/index.js'
2025-08-11 10:14:33 +08:00
import SearchBox from "../../components/search-box/search-box.vue"
import StatusDisplay from "../../components/status-display/status-display.vue"
import EnshrinedList from "./compositons/enshrinedList.vue"
import FloorSelector from "./compositons/floorSelector.vue"
import StatusBar from "./compositons/statusBar.vue"
import BottomButton from "../../components/bottom-button/bottom-button.vue";
export default {
components: {
BottomButton,
SearchBox,
StatusDisplay,
EnshrinedList,
FloorSelector,
StatusBar
},
data() {
return {
CommonEnum,
searchName: '',
loading: false,
// 楼层选择器默认值
defaultFloorId: '',
defaultAreaId: '',
defaultUnitId: '',
// 当前选中的楼层信息
currentSelection: {
floor: null,
area: null,
unit: null
},
// 当前选中的单元ID用于状态栏查询
2025-08-11 10:53:44 +08:00
selectedUnitId: '16',
// 往生者列表数据
deceasedList: [],
// 分页参数
pageParams: {
pageNum: 1,
pageSize: 10
2025-08-11 11:01:25 +08:00
},
// 往生殿详情数据
memorialDetail: null
2025-08-11 10:14:33 +08:00
}
},
onLoad(options) {
2025-08-11 11:18:55 +08:00
console.log('memorialHall页面接收到的参数:', options)
2025-08-11 10:14:33 +08:00
// 从路由参数获取往生殿ID
if (options.id) {
2025-08-11 11:18:55 +08:00
this.selectedUnitId = options.id
console.log('区域ID:', this.selectedUnitId)
} else {
console.warn('未接收到区域ID使用默认ID:', this.selectedUnitId)
2025-08-11 10:14:33 +08:00
}
this.initPage()
},
2025-08-11 11:01:25 +08:00
// 下拉刷新
onPullDownRefresh() {
this.refreshData()
},
2025-08-11 10:14:33 +08:00
methods: {
// 初始化页面
async initPage() {
this.loading = true
try {
// 页面初始化逻辑
2025-08-11 11:18:55 +08:00
console.log('往生大殿页面初始化ID:', this.selectedUnitId)
2025-08-11 11:01:25 +08:00
// 获取往生殿详情
await this.getMemorialDetail()
2025-08-11 10:53:44 +08:00
// 获取往生者列表
await this.getDeceasedList()
2025-08-11 10:14:33 +08:00
} catch (error) {
console.error('页面初始化失败:', error)
uni.showToast({
title: '页面加载失败',
icon: 'none'
})
} finally {
this.loading = false
}
},
2025-08-11 11:01:25 +08:00
// 获取往生殿详情
async getMemorialDetail() {
try {
2025-08-11 11:18:55 +08:00
const response = await getMemorialDetail(this.selectedUnitId)
2025-08-11 11:01:25 +08:00
console.log('往生殿详情响应:', response)
if (response.code === 200) {
this.memorialDetail = response.data
console.log('往生殿详情数据:', this.memorialDetail)
} else {
console.error('获取往生殿详情失败:', response.msg)
uni.showToast({
title: response.msg || '获取往生殿信息失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取往生殿详情异常:', error)
uni.showToast({
title: '获取往生殿信息失败',
icon: 'none'
})
}
},
2025-08-11 10:53:44 +08:00
// 获取往生者列表
async getDeceasedList() {
try {
const params = {
2025-08-11 11:18:55 +08:00
memorialId: this.selectedUnitId,
2025-08-11 10:53:44 +08:00
pageNum: this.pageParams.pageNum,
pageSize: this.pageParams.pageSize
}
// 如果有搜索关键词,添加到参数中
if (this.searchName) {
params.keyword = this.searchName
}
const response = await getDeceasedList(params)//api
if (response.code === 200) {
this.deceasedList = response.rows || []
console.log('往生者列表数据:', this.deceasedList)
} else {
console.error('获取往生者列表失败:', response.msg)
uni.showToast({
title: response.msg || '获取数据失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取往生者列表异常:', error)
uni.showToast({
title: '网络请求失败',
icon: 'none'
})
}
},
2025-08-11 10:14:33 +08:00
// 处理搜索
2025-08-11 10:53:44 +08:00
async handleSearch(value) {
2025-08-11 10:14:33 +08:00
console.log('搜索内容:', value)
this.searchName = value
2025-08-11 10:53:44 +08:00
// 重置页码
this.pageParams.pageNum = 1
// 重新获取数据
await this.getDeceasedList()
2025-08-11 10:14:33 +08:00
},
2025-08-11 10:53:44 +08:00
2025-08-11 10:14:33 +08:00
// 处理查看详情
handleViewDetails(unitData) {
console.log('查看单元详情:', unitData)
},
2025-08-11 10:53:44 +08:00
// 提交供奉
submitPrayer() {
console.log('提交供奉')
// 这里可以添加供奉逻辑
2025-08-11 11:01:25 +08:00
},
// 刷新数据
async refreshData() {
try {
// 重置页码
this.pageParams.pageNum = 1
// 重新获取数据
await this.getMemorialDetail()
await this.getDeceasedList()
// 停止下拉刷新
uni.stopPullDownRefresh()
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 1500
})
} catch (error) {
console.error('刷新数据失败:', error)
uni.stopPullDownRefresh()
uni.showToast({
title: '刷新失败',
icon: 'none'
})
}
2025-08-11 10:53:44 +08:00
}
2025-08-11 10:14:33 +08:00
}
}
</script>
<style lang="scss" scoped>
.page {
width: 100%;
min-height: 100vh;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
padding-bottom: 180rpx;
box-sizing: border-box;
}
.container {
width: 100%;
2025-08-11 10:29:25 +08:00
//border: 1px red solid;
2025-08-11 10:14:33 +08:00
height: 862rpx;
padding:34rpx 32rpx 0 32rpx;
.memorial-header {
display: flex;
justify-content: space-between;
align-items: center;
2025-08-11 10:29:25 +08:00
//border: 1px red solid;
2025-08-11 10:14:33 +08:00
padding-left: 2rpx;
height: 54rpx;
margin-bottom: 26rpx;
.location {
font-weight: 500;
font-size: 40rpx;
color: #522510;
line-height: 54rpx;
text-align: left;
}
.collection-btn {
color: white;
padding: 5px 10px;
font-size: 14px;
text-align: center;
align-items: center;
width: 180rpx;
height: 56rpx;
background: #A24242;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
}
.title {
margin-bottom: 22rpx;
font-weight: 500;
font-size: 40rpx;
color: #522510;
line-height: 54rpx;
text-align: left;
2025-08-11 10:29:25 +08:00
//border: 1px red solid;
2025-08-11 10:14:33 +08:00
}
2025-08-11 11:01:25 +08:00
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 100rpx; /* Adjust height as needed */
margin-bottom: 22rpx;
}
.loading-text {
font-size: 28rpx;
color: #522510;
}
.empty-container {
display: flex;
justify-content: center;
align-items: center;
height: 100rpx;
margin-bottom: 22rpx;
}
.empty-text {
font-size: 28rpx;
color: #999;
}
2025-08-11 10:14:33 +08:00
.memorial-text {
display: flex;
margin-bottom: 38rpx;
font-weight: 400;
font-size: 24rpx;
color: #4C382E;
line-height: 32rpx;
letter-spacing: 1px;
text-align: left;
font-style: normal;
text-transform: none;
.name{
margin-top: 4rpx;
display: flex;
margin-right: 34rpx;
.honorific{
font-weight: 400;
font-size: 24rpx;
color: #4C382E;
line-height: 32rpx;
letter-spacing: 1px;
text-align: left;
margin-right: 16rpx;
}
.fullName{
font-weight: 400;
font-size: 28rpx;
color: #4C382E;
line-height: 32rpx;
letter-spacing: 1px;
text-align: left;
}
}
.date{
color: #522510;
.bornDate {
2025-08-11 10:29:25 +08:00
gap:16rpx;
display: flex;
2025-08-11 10:14:33 +08:00
font-weight: 400;
font-size: 28rpx;
line-height: 38rpx;
letter-spacing: 1px;
text-align: left;
}
.diedDate {
2025-08-11 10:29:25 +08:00
gap:16rpx;
display: flex;
2025-08-11 10:14:33 +08:00
font-weight: 400;
font-size: 28rpx;
line-height: 38rpx;
letter-spacing: 1px;
text-align: left;
}
}
}
2025-08-11 10:29:25 +08:00
.time{
font-weight: 500;
font-size: 32rpx;
};
2025-08-11 10:14:33 +08:00
.contact-info {
font-weight: 400;
font-size: 28rpx;
color: #4C382E;
line-height: 38rpx;
letter-spacing: 1px;
text-align: left;
}
}
// 状态栏容器样式
:deep(.status-bar) {
width: 100%;
max-width: 750rpx;
}
.bottom{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background: #FFFBF5;
height: 180rpx;
}
</style>