<!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>
        .detail-card {
            max-width: 600px;
            margin: 0 auto;
        }
        .info-row {
            border-bottom: 1px solid #dee2e6;
            padding: 0.75rem 0;
        }
        .info-row:last-child {
            border-bottom: none;
        }
        .status-badge {
            font-size: 1rem;
            padding: 0.5rem 1rem;
        }
    </style>
</head>
<body>
    <div class="container mt-4">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card detail-card shadow">
                    <div class="card-header bg-primary text-white">
                        <h4 class="mb-0"><i class="fas fa-receipt me-2"></i>支付详情</h4>
                    </div>
                    <div class="card-body">
                        <div th:if="${error}" class="alert alert-danger" role="alert">
                            <i class="fas fa-exclamation-triangle me-2"></i>
                            <span th:text="${error}"></span>
                        </div>
                        
                        <div th:if="${payment}">
                            <div class="row mb-4">
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>订单号：</strong>
                                        <span th:text="${payment.orderId}"></span>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>支付状态：</strong>
                                        <span th:if="${payment.status.name() == 'SUCCESS'}" 
                                              class="badge bg-success status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                        <span th:if="${payment.status.name() == 'FAILED'}" 
                                              class="badge bg-danger status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                        <span th:if="${payment.status.name() == 'PENDING'}" 
                                              class="badge bg-warning status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                        <span th:if="${payment.status.name() == 'PROCESSING'}" 
                                              class="badge bg-info status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                        <span th:if="${payment.status.name() == 'CANCELLED'}" 
                                              class="badge bg-secondary status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                        <span th:if="${payment.status.name() == 'REFUNDED'}" 
                                              class="badge bg-dark status-badge" 
                                              th:text="${payment.status.displayName}"></span>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="row mb-4">
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>支付金额：</strong>
                                        <span class="h5 text-primary">
                                            <span th:text="${payment.currency}"></span>
                                            <span th:text="${payment.amount}"></span>
                                        </span>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>支付方式：</strong>
                                        <span th:text="${payment.paymentMethod.displayName}"></span>
                                    </div>
                                </div>
                            </div>
                            
                            <div th:if="${payment.description}" class="row mb-4">
                                <div class="col-12">
                                    <div class="info-row">
                                        <strong>支付描述：</strong>
                                        <span th:text="${payment.description}"></span>
                                    </div>
                                </div>
                            </div>
                            
                            <div th:if="${payment.externalTransactionId}" class="row mb-4">
                                <div class="col-12">
                                    <div class="info-row">
                                        <strong>外部交易ID：</strong>
                                        <span th:text="${payment.externalTransactionId}"></span>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="row mb-4">
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>创建时间：</strong>
                                        <span th:text="${#temporals.format(payment.createdAt, 'yyyy-MM-dd HH:mm:ss')}"></span>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="info-row">
                                        <strong>更新时间：</strong>
                                        <span th:text="${#temporals.format(payment.updatedAt, 'yyyy-MM-dd HH:mm:ss')}"></span>
                                    </div>
                                </div>
                            </div>
                            
                            <div th:if="${payment.paidAt}" class="row mb-4">
                                <div class="col-12">
                                    <div class="info-row">
                                        <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 d-md-flex justify-content-md-end">
                                <a th:href="@{/payment/history}" class="btn btn-outline-secondary">
                                    <i class="fas fa-arrow-left me-2"></i>返回列表
                                </a>
                                <a th:href="@{/payment/create}" class="btn btn-primary">
                                    <i class="fas fa-plus me-2"></i>新建支付
                                </a>
                            </div>
                        </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>

