支付祈福订单-待完善

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: {},
};
</script>
<style lang="scss" scoped></style>

View File

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

View File

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

View File

@ -1,10 +1,14 @@
<template>
<view class="page">
<custom-navbar title="祈福成功" />
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }">
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
<!-- 孔明灯图标 -->
<view class="lantern-container">
<image class="lantern-image" :src="CommonEnum.KongmingLantern" mode="aspectFit" />
<image
:src="CommonEnum.KongmingLantern"
class="lantern-image"
mode="aspectFit"
/>
</view>
<!-- 确认信息 -->
@ -25,205 +29,231 @@
</view>
<!-- 捐赠弹窗 -->
<donate-modal :visible="showDonate" @close="closeDonateModal" @confirm="handleConfirmDonate" />
<donate-modal
:visible="showDonate"
@close="closeDonateModal"
@confirm="handleConfirmDonate"
/>
</view>
</template>
<script>
import CommonEnum from '../../enum/common'
import CustomNavbar from '../../components/custom-navbar/custom-navbar.vue'
import DonateModal from '../../components/donate-modal/donate-modal.vue'
import CommonEnum from "../../enum/common";
import CustomNavbar from "../../components/custom-navbar/custom-navbar.vue";
import DonateModal from "../../components/donate-modal/donate-modal.vue";
import { ordersPray } from "../../api/order/order";
export default {
components: {
CustomNavbar,
DonateModal,
},
data() {
return {
CommonEnum,
loading: false,
showDonate: true,
export default {
components: {
CustomNavbar,
DonateModal,
},
data() {
return {
CommonEnum,
loading: false,
showDonate: true,
PostData: {},
};
},
onLoad(options) {
this.PostData.prayId = options.prayId;
//
this.loadPageData();
},
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;
}
},
onLoad() {
//
this.loadPageData()
//
handleDonate() {
uni.showToast({
title: "捐赠功能开发中",
icon: "none",
});
},
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
}
},
//
handleDonate() {
uni.showToast({
title: '捐赠功能开发中',
icon: 'none',
})
},
//
handleReturnHome() {
uni.reLaunch({
url: '/pages/nearbystores/index',
})
},
//
showDonateModal() {
this.showDonate = true
},
//
closeDonateModal() {
this.showDonate = false
},
//
handleConfirmDonate(data) {
const amount = data.isRandom ? '随缘' : data.amount
uni.showModal({
title: '提示',
content: `您确定要捐赠 ${amount} 元吗?`,
success: res => {
if (res.confirm) {
uni.showToast({
title: '捐赠成功!',
icon: 'success',
})
this.closeDonateModal()
}
},
})
},
//
handleReturnHome() {
uni.reLaunch({
url: "/pages/nearbystores/index",
});
},
}
//
showDonateModal() {
this.showDonate = true;
},
//
closeDonateModal() {
this.showDonate = false;
},
//
handleConfirmDonate(data) {
const amount = data.isRandom ? "随缘" : data.amount;
uni.showModal({
title: "提示",
content: `您确定要捐赠 ${amount} 元吗?`,
success: async (res) => {
if (res.confirm) {
this.PostData.payAmount = amount;
this.backCallPay();
uni.showToast({
title: "捐赠成功!",
icon: "success",
});
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>
<style lang="scss" scoped>
page {
background: #f5f0e7;
page {
background: #f5f0e7;
}
.page {
position: relative;
width: 100%;
min-height: 100vh;
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
padding: 0 15rpx;
padding-top: 120rpx;
padding-bottom: 200rpx;
}
.lantern-container {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
margin-bottom: 60rpx;
.lantern-image {
width: 400rpx;
height: 400rpx;
border-radius: 20rpx;
padding: 20rpx;
}
}
.confirmation-message {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
.message-title {
font-size: 36rpx;
font-weight: bold;
color: #695347;
margin-bottom: 20rpx;
text-align: center;
}
.page {
position: relative;
width: 100%;
min-height: 100vh;
.message-subtitle {
font-size: 28rpx;
color: #695347;
text-align: center;
line-height: 1.5;
}
}
.header {
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
padding: 0 15rpx;
padding-top: 120rpx;
padding-bottom: 200rpx;
}
.action-buttons {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
gap: 30rpx;
.lantern-container {
.donate-button {
width: 600rpx;
height: 100rpx;
background-color: #8b2e2e;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
margin-bottom: 60rpx;
box-shadow: 0 8rpx 20rpx rgba(139, 46, 46, 0.3);
transition: all 0.3s ease;
.lantern-image {
width: 400rpx;
height: 400rpx;
border-radius: 20rpx;
padding: 20rpx;
&:active {
background-color: #7a2a2a;
transform: scale(0.98);
}
}
.confirmation-message {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
.message-title {
.button-text {
color: #ffffff;
font-size: 36rpx;
font-weight: bold;
color: #695347;
margin-bottom: 20rpx;
text-align: center;
}
.message-subtitle {
font-size: 28rpx;
color: #695347;
text-align: center;
line-height: 1.5;
}
}
.action-buttons {
.return-button {
width: 600rpx;
height: 100rpx;
background-color: #f5f0e7;
border: 2rpx solid #8b2e2e;
border-radius: 50rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
gap: 30rpx;
box-shadow: 0 4rpx 12rpx rgba(139, 46, 46, 0.1);
transition: all 0.3s ease;
.donate-button {
width: 600rpx;
height: 100rpx;
background-color: #8b2e2e;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 8rpx 20rpx rgba(139, 46, 46, 0.3);
transition: all 0.3s ease;
&:active {
background-color: #7a2a2a;
transform: scale(0.98);
}
.button-text {
color: #ffffff;
font-size: 36rpx;
font-weight: bold;
}
&:active {
background-color: #f0ebe0;
transform: scale(0.98);
}
.return-button {
width: 600rpx;
height: 100rpx;
background-color: #f5f0e7;
border: 2rpx solid #8b2e2e;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 4rpx 12rpx rgba(139, 46, 46, 0.1);
transition: all 0.3s ease;
&:active {
background-color: #f0ebe0;
transform: scale(0.98);
}
.button-text {
color: #8b2e2e;
font-size: 36rpx;
font-weight: bold;
}
.button-text {
color: #8b2e2e;
font-size: 36rpx;
font-weight: bold;
}
}
}
</style>