<template>
  <div class="charges-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">
      <div class="recharge-card">
        <div class="header">
          <div class="title">{{ title }}</div>
        </div>
        <div class="headers">
          <div class="titles">{{ amountText }}</div>
        </div>
        <div class="payment-method">
          <div class="label">请选择支付方式</div>
        </div>
        <div class="amount-input">
          <div class="label">{{ descriptionText }}</div>
          <div class="input-wrapper">
            <div class="input">{{ money }}</div>
          </div>
        </div>
        <div class="submit-section">
          <button class="submit-btn" :disabled="true">{{ submitButtonText }}</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getNotification } from '@/api/profile';

export default {
  name: 'Charges',
  data() {
    return {
      selectedPayment: '',
      type: '',
      money: 310,
      title: '个人所得税'
    }
  },
  computed: {
    amountText() {
      return this.type === '4' ? `额度费¥${this.money}缴纳成功立即打款到账` : `税费¥${this.money}缴纳成功立即打款到账`;
    },
    descriptionText() {
      if (this.type === '4') {
        switch (Number(this.money)) {
          case 310:
            return '提升完成可享受到账100万元内额度';
          case 620:
            return '提升完成可享受到账300万元内额度';
          case 930:
            return '提升完成可享受到账500万元内额度';
          case 1240:
            return '提升完成可享受到账1000万元内额度';
          case 1550:
            return '提升完成可享受到账2000万元内额度';
          case 1860:
            return '提升完成可享受到账2000万以上';
          default:
            return '提升完成可享受更高额度';
        }
      }
      return '缴纳个人所得税款是每位公民的义务，缴纳成功立即打款到账';
    },
    submitButtonText() {
      return this.type === '4' ? '立即提升' : '立即缴纳';
    }
  },
  async created() {
    // 从路由参数获取数据
    const { type, money, title } = this.$route.query;
    if (type) this.type = type;
    if (money) this.money = money;
    if (title) this.title = title;

    try {
      const res = await getNotification();
      console.log('通知数据:', res);
    } catch (error) {
      console.error('获取通知失败:', error);
    }
  }
}
</script>

<style scoped>
.charges-container {
  min-height: 100vh;
  background: url('../assets/xiaobh.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.nav-bar {
  height: 44px;
  background-color: #ed4b39;
  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: 16px;
  font-weight: 500;
}

.content {
  padding: 15px;
  padding-top: 100px;
  min-height: calc(100vh - 44px);
}

.recharge-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header {
  margin-bottom: 20px;
}

.header .title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.headers {
  margin-bottom: 20px;
}

.titles {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  font-weight: bold;
  margin-top: 30px;
  text-align: center; 
}

.payment-method {
  margin-bottom: 20px;
}

.payment-method .label {
  font-size: 16px;
  color: #333;
  margin-bottom: 10px;
}

.payment-selector {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 15px;
}

.amount-input {
  margin-bottom: 30px;
}

.amount-input .label {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 15px;
}

.input-wrapper {
  background: #f8f8f8;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
}

.input {
  font-size: 24px;
  color: #333;
  text-align: left;
}

.submit-section {
  margin-top: 30px;
}

.submit-btn {
  width: 100%;
  height: 44px;
  background-color: #ed4b39;
  color: #acacac;
  border: none;
  border-radius: 22px;
  font-size: 16px;
  cursor: pointer;
}

.submit-btn:disabled {
  background-color: #f7f7f7;
  cursor: not-allowed;
}
</style>
