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

import type { ClaimKuaishouCloudFlowInfo, ClaimOrderInfo, ClaimOrderItemInfo } from '@/types/claim'

defineProps<{
  resultTitle: string
  resultDescription: string
  flow: ClaimKuaishouCloudFlowInfo
  order: ClaimOrderInfo | null
  orderItem: ClaimOrderItemInfo | null
  roleName: string
  roleId: string
  formatDateTime: (value: string | null) => string
}>()
</script>

<template>
  <section class="content-card">
    <div class="result-header">
      <el-icon class="large-icon success"><CircleCheck /></el-icon>
      <div>
        <h2>{{ resultTitle }}</h2>
        <p class="muted">{{ resultDescription }}</p>
      </div>
    </div>

    <div class="info-grid">
      <div class="info-item">
        <span>结果时间</span>
        <strong>{{ formatDateTime(flow.dispatch.dispatchAt) }}</strong>
      </div>
      <div class="info-item">
        <span>商品名称</span>
        <strong>{{ orderItem?.skuName || '-' }}</strong>
      </div>
      <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>{{ order?.platformOrderId || '-' }}</strong>
      </div>
      <div class="info-item">
        <span>购买数量</span>
        <strong>{{ orderItem?.quantity || 0 }}</strong>
      </div>
    </div>

    <div class="status-banner success">
      <el-icon><CircleCheck /></el-icon>
      <span>客户侧操作已经完成，后续履约结果请以后台任务界面为准。</span>
    </div>
  </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;
}

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.large-icon {
  font-size: 44px;
}

.large-icon.success {
  color: #16a34a;
}

.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.success {
  background: #f0fdf4;
  color: #166534;
}

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

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