支付祈福订单-待完善

This commit is contained in:
WindowBird 2025-09-18 13:52:06 +08:00
parent 4ddb9bfd5c
commit cc471533cf
6 changed files with 257 additions and 170 deletions

32
api/order/order.js Normal file
View File

@ -0,0 +1,32 @@
import request from "../../utils/request";
// 祈愿订单接口
export function ordersPray(data = {}) {
return request({
url: "/app/orders/pray",
method: "POST",
data: {
channelId: 1,
templeId: 12,
...data,
}, // POST请求应该使用data而不是params
});
}
// 法会订单接口
export function ordersFormed(data = {}) {
return request({
url: "/app/orders/formed",
method: "POST",
data,
});
}
// 供奉订单接口
export function ordersEnshrined(data = {}) {
return request({
url: "/app/orders/enshrined",
method: "POST",
data,
});
}

View File

@ -0,0 +1,19 @@
<template>
<view class="pages">
<web-view :src="https"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
https: "",
};
},
onLoad(option) {
this.https = decodeURIComponent(decodeURIComponent(option.https));
console.log("https:" + option.https);
},
};
</script>

View File

@ -19,5 +19,3 @@ export default {
methods: {}, methods: {},
}; };
</script> </script>
<style lang="scss" scoped></style>

View File

@ -251,6 +251,13 @@
"style": { "style": {
"navigationBarTitleText": "VR" "navigationBarTitleText": "VR"
} }
},
{
"path" : "webView/webView",
"style" :
{
"navigationBarTitleText" : ""
}
} }
] ]
} }

View File

@ -211,10 +211,11 @@ export default {
uni.showToast({ title: "祈福成功!", icon: "success" }); uni.showToast({ title: "祈福成功!", icon: "success" });
this.resetForm(); this.resetForm();
let prayId = response.data.prayId;
// //
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/pray/praySuccess", url: "/pages/pray/praySuccess?prayId=" + prayId,
}); });
}, 1500); }, 1500);
} else { } else {

View File

@ -1,10 +1,14 @@
<template> <template>
<view class="page"> <view class="page">
<custom-navbar title="祈福成功" /> <custom-navbar title="祈福成功" />
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }"> <view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 孔明灯图标 --> <!-- 孔明灯图标 -->
<view class="lantern-container"> <view class="lantern-container">
<image class="lantern-image" :src="CommonEnum.KongmingLantern" mode="aspectFit" /> <image
:src="CommonEnum.KongmingLantern"
class="lantern-image"
mode="aspectFit"
/>
</view> </view>
<!-- 确认信息 --> <!-- 确认信息 -->
@ -25,16 +29,21 @@
</view> </view>
<!-- 捐赠弹窗 --> <!-- 捐赠弹窗 -->
<donate-modal :visible="showDonate" @close="closeDonateModal" @confirm="handleConfirmDonate" /> <donate-modal
:visible="showDonate"
@close="closeDonateModal"
@confirm="handleConfirmDonate"
/>
</view> </view>
</template> </template>
<script> <script>
import CommonEnum from '../../enum/common' import CommonEnum from "../../enum/common";
import CustomNavbar from '../../components/custom-navbar/custom-navbar.vue' import CustomNavbar from "../../components/custom-navbar/custom-navbar.vue";
import DonateModal from '../../components/donate-modal/donate-modal.vue' import DonateModal from "../../components/donate-modal/donate-modal.vue";
import { ordersPray } from "../../api/order/order";
export default { export default {
components: { components: {
CustomNavbar, CustomNavbar,
DonateModal, DonateModal,
@ -44,87 +53,108 @@
CommonEnum, CommonEnum,
loading: false, loading: false,
showDonate: true, showDonate: true,
} PostData: {},
};
}, },
onLoad() { onLoad(options) {
this.PostData.prayId = options.prayId;
// //
this.loadPageData() this.loadPageData();
}, },
methods: { methods: {
// //
async loadPageData() { async loadPageData() {
this.loading = true this.loading = true;
try { try {
// TODO: API // TODO: API
// const response = await getPageData() // const response = await getPageData()
// //
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false;
}, 1000) }, 1000);
} catch (error) { } catch (error) {
console.error('获取页面数据失败:', error) console.error("获取页面数据失败:", error);
this.loading = false this.loading = false;
} }
}, },
// //
handleDonate() { handleDonate() {
uni.showToast({ uni.showToast({
title: '捐赠功能开发中', title: "捐赠功能开发中",
icon: 'none', icon: "none",
}) });
}, },
// //
handleReturnHome() { handleReturnHome() {
uni.reLaunch({ uni.reLaunch({
url: '/pages/nearbystores/index', url: "/pages/nearbystores/index",
}) });
}, },
// //
showDonateModal() { showDonateModal() {
this.showDonate = true this.showDonate = true;
}, },
// //
closeDonateModal() { closeDonateModal() {
this.showDonate = false this.showDonate = false;
}, },
// //
handleConfirmDonate(data) { handleConfirmDonate(data) {
const amount = data.isRandom ? '随缘' : data.amount const amount = data.isRandom ? "随缘" : data.amount;
uni.showModal({ uni.showModal({
title: '提示', title: "提示",
content: `您确定要捐赠 ${amount} 元吗?`, content: `您确定要捐赠 ${amount} 元吗?`,
success: res => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
this.PostData.payAmount = amount;
this.backCallPay();
uni.showToast({ uni.showToast({
title: '捐赠成功!', title: "捐赠成功!",
icon: 'success', icon: "success",
}) });
this.closeDonateModal() this.closeDonateModal();
} }
}, },
}) });
},
async backCallPay() {
const res = await ordersPray(this.PostData);
console.log("@@@@@@@@@", res);
console.log("@@@@@@@@@", res.data);
console.log("@@@@@@@@@", res.data.payParams);
console.log("@@@@@@@@@", res.data.payParams.payUrl);
const encodedUrl = encodeURIComponent(
encodeURIComponent(res.data.payParams.payUrl),
);
uni.navigateTo({
url: "/page_user/webView/webView?https=" + encodedUrl,
});
}, },
}, },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
page { page {
background: #f5f0e7; background: #f5f0e7;
} }
.page { .page {
position: relative; position: relative;
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
} }
.header { .header {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
display: flex; display: flex;
@ -133,9 +163,9 @@
padding: 0 15rpx; padding: 0 15rpx;
padding-top: 120rpx; padding-top: 120rpx;
padding-bottom: 200rpx; padding-bottom: 200rpx;
} }
.lantern-container { .lantern-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -148,9 +178,9 @@
border-radius: 20rpx; border-radius: 20rpx;
padding: 20rpx; padding: 20rpx;
} }
} }
.confirmation-message { .confirmation-message {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -170,9 +200,9 @@
text-align: center; text-align: center;
line-height: 1.5; line-height: 1.5;
} }
} }
.action-buttons { .action-buttons {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -225,5 +255,5 @@
font-weight: bold; font-weight: bold;
} }
} }
} }
</style> </style>