diff --git a/pages/memorial/compositons/offeringModal.vue b/pages/memorial/compositons/offeringModal.vue index 14db4cd..d7c03f4 100644 --- a/pages/memorial/compositons/offeringModal.vue +++ b/pages/memorial/compositons/offeringModal.vue @@ -107,17 +107,21 @@ export default { return; } + console.log("this.durationOptions", this.durationOptions); + // 获取选中的时长选项 const selectedOption = this.durationOptions.find( - (option) => option.value === this.selectedDuration, + (option) => option.id === this.selectedDuration, ); + console.log("selectedOption", selectedOption); + // 触发确认事件 this.$emit("confirm", { - duration: this.selectedDuration, - durationLabel: selectedOption.label, - price: selectedOption.price, - offererName: this.offererName.trim(), + thaliId: this.selectedDuration, + // durationLabel: selectedOption.name, + payAmount: selectedOption.amount, + worName: this.offererName.trim(), }); }, }, diff --git a/pages/memorial/memorialHall.vue b/pages/memorial/memorialHall.vue index c2f9ab9..4c8b3c7 100644 --- a/pages/memorial/memorialHall.vue +++ b/pages/memorial/memorialHall.vue @@ -144,6 +144,7 @@ import BottomButton from "../../components/bottom-button/bottom-button.vue"; import OfferingModal from "./compositons/offeringModal.vue"; import { getPackageList } from "../../api/memorial/memorial"; +import { ordersEnshrined } from "../../api/order/order"; export default { components: { @@ -228,6 +229,8 @@ export default { this.PackageList = response.data; + console.log("this.PackageList", this.PackageList); + console.log("获取的套餐数据:", this.PackageList); }, @@ -399,7 +402,8 @@ export default { }, // 确认供奉 - handleOfferingConfirm(offeringData) { + async handleOfferingConfirm(offeringData) { + offeringData = { ...offeringData, memorialId: this.selectedUnitId }; console.log("确认供奉:", offeringData); // 这里可以调用供奉API @@ -407,19 +411,18 @@ export default { title: "正在提交供奉...", }); - // 模拟API调用 - setTimeout(() => { - uni.hideLoading(); + let res = await ordersEnshrined(offeringData); + uni.hideLoading(); + if (res.code === 200) { uni.showToast({ title: "供奉成功!", icon: "success", }); + } + // 关闭弹窗 + this.closeOfferingModal(); - // 关闭弹窗 - this.closeOfferingModal(); - - // 可以在这里刷新数据或跳转到其他页面 - }, 2000); + // 可以在这里刷新数据或跳转到其他页面 }, // 刷新数据