<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="header-left">
          <img src="@/assets/hongqi.png" alt="红旗" class="logo-img" />
        </div>
        <div class="header-right">
          <div class="slogan">红旗资本·民生为本·保障一生</div>
        </div>
      </div>

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

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

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

        <!-- 三级退休补贴金 -->
        <div class="subsidy-card">
          <div class="subsidy-title">三级退休补贴金</div>
          <div class="subsidy-content">
            <div class="subsidy-row">
              <span>收益率</span>
              <span>每日获得</span>
              <span>已参与份数</span>
            </div>
            <div class="subsidy-row">
              <span>10%</span>
              <span>{{ 20000 * (userInfo.sanji || 0) }}元</span>
              <span>{{ userInfo.sanji || 0 }}份</span>
            </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-image: url('../assets/dabag.png');
  background-size: cover;
  background-position: center;
  padding-bottom: 20px;
}

.nav-bar {
  height: 44px;
  background-color: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 15px;
}

.back-btn {
  width: 24px;
  height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.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: bold;
}

.content {
  padding: 20px;
  margin-top: -20px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 30px;
  color: #fff;
  padding: 0 15px;
}

.header-left {
  margin-right: 15px;
  width: 60px;
  height: 60px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.header-right {
  flex: 1;
}

.slogan {
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
}

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

.subsidy-card {
  background-color: #ffffff;
  /* border-radius: 10px; */
  overflow: hidden;
}

.subsidy-title {
  background-color: #fdf3d0;
  color: #333;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  text-align: start;
  border-bottom: 1px solid #eee;
}

.subsidy-content {
  padding: 8px 10px;
}

.subsidy-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  color: #000;
}

.subsidy-row span {
  flex: 1;
  text-align: center;
  width: 33.33%;
}

.subsidy-row:last-child {
  margin-bottom: 0;
  font-weight: bold;
  color: #000;
}

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

  .subsidy-card {
    margin-bottom: 10px;
  }

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

  .subsidy-content {
    padding: 12px;
  }

  .subsidy-row {
    font-size: 14px;
  }
}
</style> 