<template>
  <div class="container">
    <!-- 导航栏 -->
    <div class="nav-bar">
      <div class="back-btn" @click="$router.back()">
        <i class="arrow-left"></i>
      </div>
      <div class="title">退休补贴</div>
    </div>

    <div class="content">
      <!-- Logo和标题 -->
      <div class="header">
        <div class="logo-container">
          <img src="@/assets/hongqi.png" alt="红旗" class="logo-img" />
        </div>
        <div class="header-content">
          <div class="slogan">红旗资本·民生为本·保障一生</div>
        </div>
      </div>

      <!-- 补贴等级列表 -->
      <div class="subsidy-list">
        <!-- 初级退休补贴金 -->
        <div class="subsidy-card">
          <div class="card-header">
            <div class="subsidy-title">初级退休补贴金</div>
          </div>
          <div class="card-body">
            <div class="table-container">
              <div class="table-header">
                <span class="header-item">收益率</span>
                <span class="header-item">每日获得</span>
                <span class="header-item">已参与份数</span>
              </div>
              <div class="table-row">
                <span class="row-item rate">10%</span>
                <span class="row-item amount">{{ 3000 * (userInfo.chuji || 0) }}元</span>
                <span class="row-item count">{{ userInfo.chuji || 0 }}份</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 一级退休补贴金 -->
        <div class="subsidy-card">
          <div class="card-header">
            <div class="subsidy-title">一级退休补贴金</div>
          </div>
          <div class="card-body">
            <div class="table-container">
              <div class="table-header">
                <span class="header-item">收益率</span>
                <span class="header-item">每日获得</span>
                <span class="header-item">已参与份数</span>
              </div>
              <div class="table-row">
                <span class="row-item rate">10%</span>
                <span class="row-item amount">{{ 6000 * (userInfo.yiji || 0) }}元</span>
                <span class="row-item count">{{ userInfo.yiji || 0 }}份</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 二级退休补贴金 -->
        <div class="subsidy-card">
          <div class="card-header">
            <div class="subsidy-title">二级退休补贴金</div>
          </div>
          <div class="card-body">
            <div class="table-container">
              <div class="table-header">
                <span class="header-item">收益率</span>
                <span class="header-item">每日获得</span>
                <span class="header-item">已参与份数</span>
              </div>
              <div class="table-row">
                <span class="row-item rate">10%</span>
                <span class="row-item amount">{{ 10000 * (userInfo.erji || 0) }}元</span>
                <span class="row-item count">{{ userInfo.erji || 0 }}份</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 三级退休补贴金 -->
        <div class="subsidy-card">
          <div class="card-header">
            <div class="subsidy-title">三级退休补贴金</div>
          </div>
          <div class="card-body">
            <div class="table-container">
              <div class="table-header">
                <span class="header-item">收益率</span>
                <span class="header-item">每日获得</span>
                <span class="header-item">已参与份数</span>
              </div>
              <div class="table-row">
                <span class="row-item rate">10%</span>
                <span class="row-item amount">{{ 20000 * (userInfo.sanji || 0) }}元</span>
                <span class="row-item count">{{ userInfo.sanji || 0 }}份</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getUserInfo } from '@/api/home.js';
export default {
  name: 'RetirementSubsidy',
  data() {
    return {
      userInfo: {
        chuji: 0,
        yiji: 0,
        erji: 0,
        sanji: 0
      }
    }
  },
  async created() {
    try {
      const res = await getUserInfo();
      this.userInfo = res.data || {};
    } catch (e) {
      // 处理异常
    }
  }
}
</script>

<style scoped>
.container {
  min-height: 100vh;
  background: linear-gradient(to bottom, #2f9580 0%, #4fb3a1 100%);
}

.nav-bar {
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #fff;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 15px;
}

.back-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.arrow-left {
  width: 12px;
  height: 12px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 600;
}

.content {
  padding: 20px;
  min-height: calc(100vh - 56px);
}

.header {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-container {
  width: 80px;
  height: 80px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.logo-img {
  width: 60px;
  height: 40px;
  object-fit: contain;
}

.header-content {
  flex: 1;
}

.slogan {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.subsidy-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.subsidy-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.subsidy-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: linear-gradient(135deg, #2f9580 0%, #4fb3a1 100%);
  padding: 16px 20px;
}

.subsidy-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.table-container {
  width: 100%;
}

.table-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 2px solid #e5e7eb;
  background: #f8f9fa;
  margin: 0 -20px 16px -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.header-item {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-align: center;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 8px 0;
}

.row-item {
  font-size: 15px;
  color: #374151;
  font-weight: 500;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: #f8f9fa;
}

.rate {
  color: #2f9580;
  font-weight: 600;
  background: rgba(47, 149, 128, 0.1);
}

.amount {
  color: #dc2626;
  font-weight: 600;
  background: rgba(220, 38, 38, 0.1);
}

.count {
  color: #6b7280;
  background: #f3f4f6;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .nav-bar {
    height: 50px;
    padding: 0 12px;
  }
  
  .back-btn {
    width: 36px;
    height: 36px;
  }
  
  .title {
    font-size: 16px;
  }
  
  .content {
    padding: 16px;
  }
  
  .header {
    margin-bottom: 24px;
    padding: 16px;
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .logo-container {
    width: 70px;
    height: 70px;
    margin-right: 0;
  }
  
  .logo-img {
    width: 50px;
    height: 35px;
  }
  
  .slogan {
    font-size: 16px;
  }
  
  .subsidy-list {
    gap: 16px;
  }
  
  .card-header {
    padding: 12px 16px;
  }
  
  .subsidy-title {
    font-size: 15px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .table-header {
    margin: 0 -16px 12px -16px;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 12px;
  }
  
  .header-item {
    font-size: 13px;
  }
  
  .table-row {
    gap: 12px;
  }
  
  .row-item {
    font-size: 14px;
    padding: 6px;
  }
}

@media screen and (max-width: 375px) {
  .content {
    padding: 12px;
  }

  .header {
    padding: 12px;
    gap: 12px;
  }
  
  .logo-container {
    width: 60px;
    height: 60px;
  }
  
  .logo-img {
    width: 40px;
    height: 28px;
  }

  .slogan {
    font-size: 14px;
  }

  .subsidy-list {
    gap: 12px;
  }

  .card-header {
    padding: 10px 12px;
  }

  .subsidy-title {
    font-size: 14px;
  }

  .card-body {
    padding: 12px;
  }
  
  .table-header {
    margin: 0 -12px 10px -12px;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px;
  }
  
  .header-item {
    font-size: 12px;
  }
  
  .table-row {
    gap: 8px;
  }
  
  .row-item {
    font-size: 13px;
    padding: 4px;
  }
}
</style> 