<!DOCTYPE html>
<html lang="zh-CN" 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 href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        .result-card {
            max-width: 500px;
            margin: 0 auto;
        }
        .success-icon {
            color: #28a745;
            font-size: 4rem;
        }
        .error-icon {
            color: #dc3545;
            font-size: 4rem;
        }
        .payment-info {
            background-color: #f8f9fa;
            border-radius: 0.375rem;
            padding: 1rem;
        }
    </style>
</head>
<body>
    <div class="container mt-5">
        <div class="row justify-content-center">
            <div class="col-md-6">
                <div class="card result-card shadow">
                    <div class="card-body text-center">
                        <div th:if="${success}">
                            <i class="fas fa-check-circle success-icon mb-3"></i>
                            <h3 class="text-success mb-3">支付成功！</h3>
                            <p class="text-muted mb-4">您的支付已完成，感谢您的使用。</p>
                        </div>
                        
                        <div th:if="${error}">
                            <i class="fas fa-times-circle error-icon mb-3"></i>
                            <h3 class="text-danger mb-3">支付失败</h3>
                            <p class="text-muted mb-4" th:text="${error}"></p>
                        </div>
                        
                        <div th:if="${payment}" class="payment-info mb-4">
                            <h5 class="mb-3">支付详情</h5>
                            <div class="row text-start">
                                <div class="col-6">
                                    <strong>订单号：</strong>
                                </div>
                                <div class="col-6" th:text="${payment.orderId}"></div>
                                
                                <div class="col-6">
                                    <strong>支付金额：</strong>
                                </div>
                                <div class="col-6">
                                    <span th:text="${payment.currency}"></span>
                                    <span th:text="${payment.amount}"></span>
                                </div>
                                
                                <div class="col-6">
                                    <strong>支付方式：</strong>
                                </div>
                                <div class="col-6" th:text="${payment.paymentMethod.displayName}"></div>
                                
                                <div class="col-6">
                                    <strong>支付状态：</strong>
                                </div>
                                <div class="col-6">
                                    <span th:if="${payment.status.name() == 'SUCCESS'}" class="badge bg-success" th:text="${payment.status.displayName}"></span>
                                    <span th:if="${payment.status.name() == 'FAILED'}" class="badge bg-danger" th:text="${payment.status.displayName}"></span>
                                    <span th:if="${payment.status.name() == 'PENDING'}" class="badge bg-warning" th:text="${payment.status.displayName}"></span>
                                    <span th:if="${payment.status.name() == 'PROCESSING'}" class="badge bg-info" th:text="${payment.status.displayName}"></span>
                                </div>
                                
                                <div th:if="${payment.description}" class="col-12 mt-2">
                                    <strong>支付描述：</strong>
                                    <span th:text="${payment.description}"></span>
                                </div>
                                
                                <div th:if="${payment.paidAt}" class="col-12 mt-2">
                                    <strong>支付时间：</strong>
                                    <span th:text="${#temporals.format(payment.paidAt, 'yyyy-MM-dd HH:mm:ss')}"></span>
                                </div>
                            </div>
                        </div>
                        
                        <div class="d-grid gap-2">
                            <a th:href="@{/payment/history}" class="btn btn-outline-primary">
                                <i class="fas fa-history me-2"></i>查看支付记录
                            </a>
                            <a th:href="@{/}" class="btn btn-primary">
                                <i class="fas fa-home me-2"></i>返回首页
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

