预约成功的界面跳转

This commit is contained in:
WindowBird 2025-08-15 12:03:09 +08:00
parent bda8e4e9fe
commit 460ed0643e
3 changed files with 115 additions and 64 deletions

View File

@ -1,29 +1,29 @@
import request from '@/utils/request'
import request from "@/utils/request";
// 获取牌位详情
export function getMemorialDetail(id) {
return request({
url: `/app/memorial/${id}`,
method: 'get',
})
method: "get",
});
}
// 获取供奉记录列表
export function getEnshrinedList(params) {
return request({
url: '/app/enshrined/list',
method: 'get',
url: "/app/enshrined/list",
method: "get",
params,
})
});
}
// 搜索往生者
export function searchDeceased(params) {
return request({
url: '/app/deceased/search',
method: 'get',
url: "/app/deceased/search",
method: "get",
params,
})
});
}
// 收藏牌位 (使用 x-www-form-urlencoded 格式)
@ -31,35 +31,22 @@ export function collectMemorial(data) {
// 将数据转换为 x-www-form-urlencoded 格式
return request({
url: '/app/collect',
method: 'post',
url: "/app/collect",
method: "post",
data,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
"Content-Type": "application/x-www-form-urlencoded",
},
})
});
}
// 检查是否已收藏
export function checkIsCollected(memorialId) {
return request({
url: '/app/collect/isCollect',
method: 'get',
url: "/app/collect/isCollect",
method: "get",
params: {
memorialId: memorialId,
},
})
});
}
// // 收藏牌位 (使用 form-data 格式,可选)
// export function collectMemorialFormData(data) {
// return request({
// url: '/app/collect',
// method: 'post',
// data,
// header: {
// 'Content-Type': 'multipart/form-data'
// }
// })
// }

View File

@ -96,6 +96,8 @@ export default {
// ID
activityId: "",
//
activityName: "",
//
loading: false,
@ -130,6 +132,10 @@ export default {
if (options.actId) {
this.activityId = parseInt(options.actId);
}
// 使
if (options.activityName) {
this.activityName = decodeURIComponent(options.activityName);
}
this.fetchActivitySlots();
},
methods: {
@ -263,9 +269,20 @@ export default {
icon: "success",
});
//
//
setTimeout(() => {
uni.navigateBack();
const params = {
date: this.getSelectedDateLabel(),
time: this.getSelectedTimeLabel(),
number: this.getSelectedNumberLabel(),
activityName: this.activityName || '活动'
};
const queryString = Object.keys(params)
.map(key => `${key}=${encodeURIComponent(params[key])}`)
.join('&');
uni.navigateTo({
url: `/pages/activity/appointmentSuccess?${queryString}`,
});
}, 1500);
} else {
uni.showToast({
@ -287,6 +304,7 @@ export default {
const selectedDate = this.dateOptions.find(
(date) => date.value === this.selectedDate,
);
return selectedDate ? selectedDate.label : "";
},

View File

@ -1,45 +1,48 @@
<template>
<view class="page">
<custom-navbar ref="customNavbar" title="基础页面" />
<tile-grid />
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 状态展示 -->
<status-display v-if="loading" loading-text="加载中..." type="loading" />
<!-- 页面内容将在这里添加 -->
<custom-navbar ref="customNavbar" title="预约成功" />
<image :src="CommonEnum.SUCCESS_APPOINTMENT"></image>
<view class="container">
<view class="info">
<text class="success">您提交的预约已成功</text>
<text class="date">预约日期{{ date }}</text>
<text class="time">预约时段{{ time }}</text>
</view>
</view>
<view class="back" @click="back">返回首页</view>
</view>
</template>
<script>
import CommonEnum from "../../enum/common";
import BottomButton from "../../components/bottom-button/bottom-button.vue";
export default {
components: {},
components: { BottomButton },
data() {
return {
CommonEnum,
loading: false,
time: "",
date: "",
number: "",
activityName: "",
};
},
onLoad() {
//
this.loadPageData();
onLoad(options) {
//
this.time = decodeURIComponent(options.time || "");
this.date = decodeURIComponent(options.date || "");
this.number = decodeURIComponent(options.number || "");
},
methods: {
//
async loadPageData() {
this.loading = true;
try {
// TODO: API
// const response = await getPageData()
//
setTimeout(() => {
this.loading = false;
}, 1000);
} catch (error) {
console.error("获取页面数据失败:", error);
this.loading = false;
}
//
back() {
uni.switchTab({
url: '/pages/index/index'
});
},
},
};
@ -47,16 +50,59 @@ export default {
<style lang="scss" scoped>
.page {
background: #f5f0e7;
}
.header {
width: 100%;
//min-height: 100vh;//
background: #faf8f3;
display: flex;
align-items: flex-start;
flex-direction: column;
padding: 0 15rpx;
padding-bottom: 40rpx;
align-items: center;
//border: 1rpx solid #250404;
image {
margin-top: 24rpx;
width: 564rpx;
height: 564rpx;
//border: 1rpx solid #250404;
}
.container {
position: relative;
top: -46rpx;
margin-bottom: 150rpx;
.info {
display: flex;
flex-direction: column;
align-items: center;
//border: 1rpx solid #250404;
text {
color: #695347;
text-align: center;
//border: 1rpx solid #250404;
font-size: 32rpx;
font-weight: 500;
line-height: 216.5%;
}
.success {
}
.time {
}
}
}
.back {
width: 552rpx;
height: 100rpx;
border-radius: 50rpx;
box-sizing: border-box;
border: 2rpx solid #c7a26d;
text-align: center;
font-size: 36rpx;
font-weight: 500;
line-height: 100rpx;
color: #c7a26d;
}
}
</style>