<template>
  <div class="medical-container">
    <!-- 顶部说明卡片 -->
    <div class="top-info-card">
      <div class="desc-text">
        中国建设科技有限公司是国务院国资委直属的大型骨干科技型中央企业。为贯彻落实中央扶贫精神完成全国脱贫攻坚战的最后战役，经中共中央批准为广大民众拨款发放建设科技分红，参与以下建科基金可享受分红资金打款到账银行卡（享受周期5年）参与基金的本金将在30天后自动返回银行卡上，国家承诺不会落下一个贫困民众国家不会忘记人民，百分百真实到账！
      </div>
    </div>

    <!-- 团队奖励卡片 -->
    <div class="commission-card">
      <div class="commission-content">
        <div class="reward-left">
          <div class="reward-icon">🎯</div>
          <span class="reward-label">团队奖励</span>
        </div>
        <div class="reward-right">
          <div class="reward-item">
            <span class="reward-level">一级</span>
            <span class="reward-percent">5%</span>
          </div>
          <div class="reward-item">
            <span class="reward-level">二级</span>
            <span class="reward-percent">2%</span>
          </div>
          <div class="reward-item">
            <span class="reward-level">三级</span>
            <span class="reward-percent">1%</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 项目列表 -->
    <div class="project-list">
      <div v-for="item in rewards" :key="item.id" class="project-item">
        <!-- 项目头部 -->
        <div class="project-header">
          <span class="project-name">{{ item.title }}</span>
          <span class="project-shares">获得养老金{{ Math.floor(item.computing_power) }}元</span>
        </div>
        
        <!-- 项目内容 -->
        <div class="project-content">
          <div class="project-image">
            <img :src="item.images" :alt="item.title" class="project-img" />
          </div>
          <div class="project-info">
            <div class="income-info">
              <div class="income-rate">{{ item.power }}%</div>
              <div class="income-label">每日收益</div>
            </div>
            <div class="amount-info">
              <div class="amount-value">{{ Math.floor(item.money) }}元</div>
              <div class="amount-label">参与金额</div>
            </div>
          </div>
          <button class="join-btn" @click="toPayment(item)">立即参与</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {getMiner} from '@/api/home.js'

export default {
  name: 'Medical',
  data() {
    return {
     rewards: [{},{},{},{}]
    }
  },
  methods: {
     getPlans(){
      let data = {
        page:'',
        size:'',
        type:1
      }
      getMiner(data).then(res=>{
        if(res.code === 1){
          this.rewards = res.data
        }
      })
    },
    toPayment(item){
            this.$router.push({path:'/Payment',query:{item:item}});
    }
  },
  mounted(){
    this.getPlans()
  }
}
</script>

<style scoped>
.medical-container {
  min-height: 100vh;
  background: #b43a39;
  padding: 20px;
  box-sizing: border-box;
  padding-bottom: 80px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 顶部信息卡片 */
.top-info-card {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.desc-text {
  color: #1a1a1a;
  font-size: 15px;
  line-height: 1.8;
  text-align: justify;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* 团队奖励卡片 */
.commission-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(180, 58, 57, 0.15);
}

.commission-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.reward-left {
  display: flex;
  align-items: center;
}

.reward-icon {
  font-size: 24px;
  margin-right: 8px;
}

.reward-label {
  color: #b53b38;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.5px;
}

.reward-right {
  display: flex;
  align-items: center;
}

.reward-item {
  margin: 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.reward-level {
  color: #4a4a4a;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.reward-percent {
  background: #b43a39;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  min-width: 32px;
}

.reward-percent:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(180, 58, 57, 0.4);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 项目列表 */
.project-list {
  /* 项目容器 */
}

.project-item {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.project-header {
  background: #d91d42;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.project-shares {
  font-size: 15px;
  color: #fff;
  font-weight: 500;
}

.project-content {
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.project-image {
  flex-shrink: 0;
}

.project-img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid #f0f0f0;
}

.project-img:hover {
  border-color: #d91d42;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(217, 29, 66, 0.3);
}

.project-info {
  display: flex;
  flex: 1;
  justify-content: space-around;
  align-items: center;
}

.income-info, .amount-info {
  text-align: center;
}

.income-rate, .amount-value {
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.income-label, .amount-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.join-btn {
  background: #d91d42;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.join-btn:hover {
  background: #c01a3a;
  transform: scale(1.05);
}

.join-btn:active {
  transform: scale(0.95);
}

.commission-card::before {
  display: none;
}
</style> 