update
This commit is contained in:
parent
61cefd9380
commit
bc56eb02ad
@ -16,46 +16,30 @@
|
|||||||
<p>感谢您的购买,我们已收到您的USDT支付</p>
|
<p>感谢您的购买,我们已收到您的USDT支付</p>
|
||||||
|
|
||||||
<div class="order-details" id="orderDetails">
|
<div class="order-details" id="orderDetails">
|
||||||
<h3>订单详情</h3>
|
<h3>订单状态</h3>
|
||||||
<div class="detail-item">
|
|
||||||
<span>订单号:</span>
|
|
||||||
<span id="orderId">-</span>
|
|
||||||
</div>
|
|
||||||
<div class="detail-item">
|
<div class="detail-item">
|
||||||
<span>支付状态:</span>
|
<span>支付状态:</span>
|
||||||
<span class="status-success">已完成</span>
|
<span class="status-success">支付已完成</span>
|
||||||
|
</div>
|
||||||
|
<div class="detail-item">
|
||||||
|
<span>处理状态:</span>
|
||||||
|
<span class="status-pending">等待发货</span>
|
||||||
|
</div>
|
||||||
|
<div class="success-message">
|
||||||
|
<p>✅ 支付已成功完成!</p>
|
||||||
|
<p>📦 我们将尽快为您安排发货</p>
|
||||||
|
<p>🔔 发货后会第一时间通知您</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button onclick="window.location.href='/'" class="btn-primary">继续购物</button>
|
<button onclick="window.location.href='/'" class="btn-primary">继续购物</button>
|
||||||
<button onclick="checkOrderStatus()" class="btn-secondary">查看订单状态</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 获取URL参数
|
// 成功页面无需JavaScript逻辑,直接显示支付成功信息
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
const orderId = urlParams.get('order_id');
|
|
||||||
|
|
||||||
if (orderId) {
|
|
||||||
document.getElementById('orderId').textContent = orderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkOrderStatus() {
|
|
||||||
if (orderId) {
|
|
||||||
fetch(`/api/orders/${orderId}`)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
alert(`订单状态:${data.payment_status}`);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Error:', error);
|
|
||||||
alert('查询失败');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -122,6 +106,26 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-pending {
|
||||||
|
color: #f39c12;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-message {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding: 15px;
|
||||||
|
background: #d5edda;
|
||||||
|
border: 1px solid #c3e6cb;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-message p {
|
||||||
|
margin: 8px 0;
|
||||||
|
color: #155724;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 15px;
|
gap: 15px;
|
||||||
|
|||||||
@ -165,7 +165,6 @@ app.post('/api/payment/create', async (req, res) => {
|
|||||||
|
|
||||||
// 创建 UPay 支付订单
|
// 创建 UPay 支付订单
|
||||||
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
||||||
const redirectUrl = `${baseUrl}/success.html?order_id=${order_id}`;
|
|
||||||
|
|
||||||
const paymentData = {
|
const paymentData = {
|
||||||
appId: UPAY_APP_ID,
|
appId: UPAY_APP_ID,
|
||||||
@ -174,12 +173,10 @@ app.post('/api/payment/create', async (req, res) => {
|
|||||||
fiatAmount: order.total_amount.toFixed(2),
|
fiatAmount: order.total_amount.toFixed(2),
|
||||||
fiatCurrency: 'USD',
|
fiatCurrency: 'USD',
|
||||||
notifyUrl: `${baseUrl}/api/payment/callback`,
|
notifyUrl: `${baseUrl}/api/payment/callback`,
|
||||||
redirectUrl: encodeURIComponent(redirectUrl)
|
redirectUrl: `${baseUrl}/success.html`
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Payment data before signature:', paymentData);
|
console.log('Payment data with redirectUrl:', paymentData);
|
||||||
console.log('Original redirectUrl:', redirectUrl);
|
|
||||||
console.log('Encoded redirectUrl:', paymentData.redirectUrl);
|
|
||||||
|
|
||||||
// 生成签名
|
// 生成签名
|
||||||
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user