2025-08-11 16:02:00 +08:00
|
|
|
|
<template>
|
2025-08-27 15:46:27 +08:00
|
|
|
|
<view v-if="visible" class="offering-modal" @click="handleClose">
|
2025-08-11 16:02:00 +08:00
|
|
|
|
<view class="modal-overlay" @click="handleClose"></view>
|
|
|
|
|
|
<view class="modal-content" @click.stop>
|
|
|
|
|
|
<!-- 关闭按钮 -->
|
|
|
|
|
|
<view class="close-btn" @click="handleClose">
|
|
|
|
|
|
<text class="close-icon">×</text>
|
|
|
|
|
|
</view>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-11 16:02:00 +08:00
|
|
|
|
<!-- 标题 -->
|
|
|
|
|
|
<view class="modal-title">牌位供奉</view>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-11 16:02:00 +08:00
|
|
|
|
<!-- 供奉时长选择 -->
|
|
|
|
|
|
<view class="duration-section">
|
|
|
|
|
|
<view class="duration-grid">
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-for="option in durationOptions"
|
2025-08-27 15:46:27 +08:00
|
|
|
|
:key="option.id"
|
|
|
|
|
|
:class="{ selected: selectedDuration === option.id }"
|
2025-08-11 16:02:00 +08:00
|
|
|
|
class="duration-option"
|
2025-08-27 15:46:27 +08:00
|
|
|
|
@click="selectDuration(option.id)"
|
2025-08-11 16:02:00 +08:00
|
|
|
|
>
|
2025-08-27 15:46:27 +08:00
|
|
|
|
<text class="duration-text">{{ option.name }}</text>
|
|
|
|
|
|
<text class="duration-price">¥{{ option.amount }}</text>
|
2025-08-11 16:02:00 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-11 16:02:00 +08:00
|
|
|
|
<!-- 供奉人信息 -->
|
|
|
|
|
|
<view class="offerer-section">
|
|
|
|
|
|
<view class="section-label">供奉人</view>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<input
|
2025-08-11 16:02:00 +08:00
|
|
|
|
v-model="offererName"
|
2025-08-27 15:46:27 +08:00
|
|
|
|
class="offerer-input"
|
2025-08-11 16:02:00 +08:00
|
|
|
|
maxlength="20"
|
2025-08-27 15:46:27 +08:00
|
|
|
|
placeholder="请填写供奉人姓名"
|
2025-08-11 16:02:00 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="input-tip">将在供奉名单上展现供奉人的姓名,此为必填</view>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-11 16:02:00 +08:00
|
|
|
|
<!-- 确认按钮 -->
|
|
|
|
|
|
<view class="confirm-section">
|
|
|
|
|
|
<view class="price-info">
|
|
|
|
|
|
<text class="total-price">¥{{ totalPrice }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="confirm-btn" @click="handleConfirm">
|
|
|
|
|
|
<text class="btn-text">立即供奉</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-08-27 15:46:27 +08:00
|
|
|
|
import { object } from "../../../uni_modules/uv-ui-tools/libs/function/test";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "OfferingModal",
|
|
|
|
|
|
props: {
|
|
|
|
|
|
visible: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false,
|
2025-08-11 16:02:00 +08:00
|
|
|
|
},
|
2025-08-27 15:46:27 +08:00
|
|
|
|
durationOptions: {
|
|
|
|
|
|
type: object(),
|
|
|
|
|
|
default: {},
|
2025-08-11 16:02:00 +08:00
|
|
|
|
},
|
2025-08-27 15:46:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
selectedDuration: null, // 默认选择3天
|
|
|
|
|
|
offererName: "",
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
totalPrice() {
|
|
|
|
|
|
// 未选择或options为空时返回0
|
|
|
|
|
|
if (!this.selectedDuration || !this.durationOptions.length) return 0;
|
|
|
|
|
|
|
|
|
|
|
|
const selectedOption = this.durationOptions.find(
|
|
|
|
|
|
(option) => option.id === this.selectedDuration,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 当未找到选项时返回空值
|
|
|
|
|
|
return selectedOption?.amount ?? null;
|
2025-08-14 11:22:53 +08:00
|
|
|
|
},
|
2025-08-27 15:46:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
|
handleClose() {
|
|
|
|
|
|
this.$emit("close");
|
2025-08-14 11:22:53 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
// 选择供奉时长
|
|
|
|
|
|
selectDuration(value) {
|
|
|
|
|
|
this.selectedDuration = value;
|
|
|
|
|
|
},
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
// 确认供奉
|
|
|
|
|
|
handleConfirm() {
|
|
|
|
|
|
// 验证供奉人姓名
|
|
|
|
|
|
if (!this.offererName.trim()) {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "请填写供奉人姓名",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
2025-08-14 11:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 15:14:08 +08:00
|
|
|
|
console.log("this.durationOptions", this.durationOptions);
|
|
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
// 获取选中的时长选项
|
|
|
|
|
|
const selectedOption = this.durationOptions.find(
|
2025-09-18 15:14:08 +08:00
|
|
|
|
(option) => option.id === this.selectedDuration,
|
2025-08-27 15:46:27 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
2025-09-18 15:14:08 +08:00
|
|
|
|
console.log("selectedOption", selectedOption);
|
|
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
// 触发确认事件
|
|
|
|
|
|
this.$emit("confirm", {
|
2025-09-18 15:14:08 +08:00
|
|
|
|
thaliId: this.selectedDuration,
|
|
|
|
|
|
// durationLabel: selectedOption.name,
|
|
|
|
|
|
payAmount: selectedOption.amount,
|
|
|
|
|
|
worName: this.offererName.trim(),
|
2025-08-27 15:46:27 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.offering-modal {
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.modal-overlay {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.modal-content {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
background: #fffbf5;
|
|
|
|
|
|
border-radius: 24rpx 24rpx 0 0;
|
|
|
|
|
|
padding: 40rpx 32rpx 60rpx 32rpx;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
max-height: 80vh;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.close-btn {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 20rpx;
|
|
|
|
|
|
right: 20rpx;
|
|
|
|
|
|
width: 60rpx;
|
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
z-index: 10;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.close-icon {
|
|
|
|
|
|
font-size: 40rpx;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.modal-title {
|
|
|
|
|
|
color: #695347;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
|
|
padding-top: 20rpx;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
line-height: 44rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.duration-section {
|
|
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.duration-grid {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
|
gap: 20rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.duration-option {
|
|
|
|
|
|
background: #fff1dd;
|
|
|
|
|
|
border-radius: 12rpx;
|
|
|
|
|
|
padding: 24rpx 20rpx;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
border: 2rpx solid transparent;
|
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
&.selected {
|
2025-08-14 11:22:53 +08:00
|
|
|
|
background: #a24242;
|
2025-08-27 15:46:27 +08:00
|
|
|
|
border-color: #a24242;
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-27 15:46:27 +08:00
|
|
|
|
.duration-text,
|
|
|
|
|
|
.duration-price {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
2025-08-14 11:22:53 +08:00
|
|
|
|
}
|
2025-08-27 15:46:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.duration-text {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #c7a26d;
|
|
|
|
|
|
margin-bottom: 8rpx;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.duration-price {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
color: #c7a26d;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.offerer-section {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
width: 686rpx;
|
|
|
|
|
|
height: 112rpx;
|
|
|
|
|
|
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
|
|
|
|
|
border: 2rpx solid #a24242;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-label {
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
color: #522510;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
margin: 34rpx 70rpx 34rpx 54rpx;
|
|
|
|
|
|
width: 196rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.offerer-input {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #acacac;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
margin: 34rpx 0 34rpx 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-tip {
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #695347;
|
|
|
|
|
|
line-height: 38rpx;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.confirm-section {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 24rpx 51rpx;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 90rpx;
|
|
|
|
|
|
background: #a24242;
|
|
|
|
|
|
border-radius: 45rpx 45rpx 45rpx 45rpx;
|
|
|
|
|
|
gap: 20rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.price-info {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
text-align: right;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.total-price {
|
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.confirm-btn {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn-text {
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
2025-08-14 11:22:53 +08:00
|
|
|
|
</style>
|