Files
wb-java-nc-shop/target/classes/templates/user/payment-success.html
2026-01-11 18:14:42 +08:00

215 lines
6.0 KiB
HTML

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>支付成功</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<style>
:root {
--bg-body: #f8fafc;
--primary-color: #3b82f6;
--text-primary: #0f172a;
}
body {
background: var(--bg-body);
font-family: -apple-system, sans-serif;
color: #334155;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.success-container {
background: #fff;
border-radius: 24px;
padding: 40px 24px;
text-align: center;
max-width: 400px;
width: 100%;
box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.success-icon {
width: 80px;
height: 80px;
background: #10b981;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 24px;
animation: scaleIn 0.5s ease;
}
.success-icon i {
font-size: 40px;
color: #fff;
}
@keyframes scaleIn {
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
.success-title {
font-size: 24px;
font-weight: 800;
color: var(--text-primary);
margin-bottom: 8px;
}
.success-desc {
font-size: 14px;
color: #64748b;
margin-bottom: 32px;
}
.order-info {
background: #f8fafc;
border-radius: 12px;
padding: 16px;
margin-bottom: 24px;
text-align: left;
}
.info-row {
display: flex;
justify-content: space-between;
font-size: 13px;
margin-bottom: 8px;
}
.info-row:last-child {
margin-bottom: 0;
}
.info-label {
color: #94a3b8;
}
.info-value {
color: var(--text-primary);
font-weight: 600;
}
.btn-group {
display: flex;
flex-direction: column;
gap: 12px;
}
.btn-action {
padding: 14px 24px;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
border: none;
cursor: pointer;
transition: all 0.2s;
}
.btn-primary-action {
background: var(--text-primary);
color: #fff;
}
.btn-primary-action:hover {
background: #1e293b;
transform: translateY(-1px);
}
.btn-outline-action {
background: #fff;
color: var(--text-primary);
border: 2px solid #e2e8f0;
}
.btn-outline-action:hover {
border-color: var(--text-primary);
background: #f8fafc;
}
</style>
</head>
<body>
<div class="success-container">
<div class="success-icon">
<i class="bi bi-check-lg"></i>
</div>
<div class="success-title">支付成功</div>
<div class="success-desc">感谢您的购买,订单已提交成功</div>
<div class="order-info" id="orderInfo">
<div class="info-row">
<span class="info-label">订单编号</span>
<span class="info-value" id="orderNo">--</span>
</div>
<div class="info-row">
<span class="info-label">支付金额</span>
<span class="info-value" id="orderAmount">--</span>
</div>
</div>
<div class="btn-group">
<button class="btn-action btn-primary-action" onclick="viewOrderDetail()">
查看订单详情
</button>
<button class="btn-action btn-outline-action" onclick="goHome()">
返回首页
</button>
</div>
</div>
<script>
// 从URL参数获取订单ID
const urlParams = new URLSearchParams(window.location.search);
const orderId = urlParams.get('orderId');
const orderNo = urlParams.get('orderNo') || '';
const orderAmount = urlParams.get('amount') || '';
// 显示订单信息
if (orderNo) {
document.getElementById('orderNo').textContent = orderNo;
}
if (orderAmount) {
document.getElementById('orderAmount').textContent = '¥' + orderAmount;
}
// 如果没有订单信息,尝试从服务器获取
if (orderId && (!orderNo || !orderAmount)) {
fetch(`/order/orders/${orderId}`, { credentials: 'include' })
.then(res => res.json())
.then(data => {
if (data.code === 200 && data.data) {
const order = data.data.order;
document.getElementById('orderNo').textContent = order.orderNo || '--';
document.getElementById('orderAmount').textContent = '¥' + (order.totalAmount || '--');
}
})
.catch(e => console.error(e));
}
function viewOrderDetail() {
if (orderId) {
window.location.href = `/order-detail.html?id=${orderId}`;
} else {
window.location.href = '/orders.html';
}
}
function goHome() {
window.location.href = '/index.html';
}
</script>
</body>
</html>