<script setup lang="ts">
import { Warning } from '@element-plus/icons-vue'

import type { ClaimOrderItemInfo } from '@/types/claim'

defineProps<{
  roleName: string
  roleId: string
  orderItem: ClaimOrderItemInfo | null
  redeeming: boolean
}>()

defineEmits<{
  confirmRedeem: []
}>()
</script>

<template>
  <section class="content-card">
    <h2>第 3 步：确认兑换信息</h2>
    <p class="muted">请再次确认角色和商品信息，确认无误后再继续兑换。</p>

    <div class="info-grid">
      <div class="info-item">
        <span>角色名称</span>
        <strong>{{ roleName || '-' }}</strong>
      </div>
      <div class="info-item">
        <span>角色 ID</span>
        <strong>{{ roleId || '-' }}</strong>
      </div>
      <div class="info-item">
        <span>商品名称</span>
        <strong>{{ orderItem?.skuName || '-' }}</strong>
      </div>
      <div class="info-item">
        <span>商品数量</span>
        <strong>{{ orderItem?.quantity || 0 }}</strong>
      </div>
    </div>

    <div class="status-banner warning">
      <el-icon><Warning /></el-icon>
      <span>兑换后不可取消，也不可退货。</span>
    </div>

    <el-button type="primary" size="large" :loading="redeeming" @click="$emit('confirmRedeem')">
      确认兑换
    </el-button>
  </section>
</template>

<style scoped>
.content-card {
  width: 100%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content-card h2 {
  margin: 0;
  color: #0f172a;
}

.muted {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-item {
  padding: 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-item span {
  color: #64748b;
  font-size: 13px;
}

.info-item strong {
  color: #0f172a;
  font-size: 17px;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
}

.status-banner.warning {
  background: #fff7ed;
  color: #c2410c;
}

@media (max-width: 720px) {
  .content-card {
    max-width: 100%;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
</style>
