<template>
  <div class="bond-details-modal">
    <div class="modal-header">
      <h2>债券详情</h2>
      <button
        class="close-btn"
        @click="closeModal"
      >
        <span class="close-icon">×</span>
      </button>
    </div>

    <div class="modal-content">
      <div class="bond-title">
        <div class="bond-icon">
          <span>券</span>
        </div>
        <div class="bond-code">231705.BC</div>
      </div>

      <div class="bond-basic-info">
        <div class="info-row">
          <div class="info-item">
            <div class="info-label">ISIN编码</div>
            <div class="info-value">231705.BC</div>
          </div>
          <div class="info-item">
            <div class="info-label">债券名称</div>
            <div class="info-value">231705.BC</div>
          </div>
        </div>
      </div>

      <div class="tabs">
        <div
          v-for="(tab, index) in tabs"
          :key="index"
          :class="['tab', { active: activeTab === index }]"
          @click="activeTab = index"
        >
          {{ tab }}
        </div>
      </div>

      <div
        v-if="activeTab === 0"
        class="tab-content"
      >
        <div class="section">
          <div class="section-header">
            <div class="section-indicator" />
            <div class="section-title">基本信息</div>
          </div>

          <div class="info-grid">
            <div class="grid-item">
              <div class="grid-label">发行面值</div>
              <div class="grid-value">100,000,000.00</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">货币</div>
              <div class="grid-value">CNY</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">起息日</div>
              <div class="grid-value">2024-08-05</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">利息类型</div>
              <div class="grid-value">FIXED</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">到期日</div>
              <div class="grid-value">2024-08-05</div>
              <div class="tag">标签内容（可选）</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">付息频率</div>
              <div class="grid-value">3M</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">票面利率</div>
              <div class="grid-value">4.2500</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">含权</div>
              <div class="grid-value">否</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">计息基础</div>
              <div class="grid-value">ACT_360(SIMPLE)</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">调整惯例</div>
              <div class="grid-value">None</div>
            </div>
          </div>
        </div>

        <div class="section">
          <div class="section-header">
            <div class="section-indicator" />
            <div class="section-title">发行信息</div>
          </div>

          <div class="info-grid">
            <div class="grid-item">
              <div class="grid-label">发行日期</div>
              <div class="grid-value">2024-08-05</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">发行价</div>
              <div class="grid-value">100.000000</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">发行量(亿)</div>
              <div class="grid-value">100.00</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">退市日期</div>
              <div class="grid-value">银行间</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">区域</div>
              <div class="grid-value">中国</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">发行类型</div>
              <div class="grid-value">一级</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">发行人</div>
              <div class="grid-value">黄阳银行股份有限公司</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">担保级别</div>
              <div class="grid-value">其他</div>
            </div>
          </div>
        </div>

        <div class="section">
          <div class="section-header">
            <div class="section-indicator" />
            <div class="section-title">评级类型</div>
          </div>

          <div class="info-grid">
            <div class="grid-item">
              <div class="grid-label">评级类型</div>
              <div class="grid-value">zy评级</div>
            </div>
            <div class="grid-item">
              <div class="grid-label">评级机构</div>
              <div class="grid-value">zy评级</div>
            </div>
          </div>
        </div>
      </div>

      <div class="modal-footer">
        <button class="btn btn-cancel">取消</button>
        <button class="btn btn-confirm">确定</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BondDetails',
  data() {
    return {
      activeTab: 0,
      tabs: ['债券信息', '现金流', '计息表'],
    };
  },
  methods: {
    closeModal() {
      this.$emit('close');
    },
  },
};
</script>

<style scoped>
.bond-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #222839;
  color: #fff;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #2a2f3e;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: normal;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
  background-size: 100% 200px;
  background-repeat: no-repeat;
  position: relative;
}

.bond-title {
  display: flex;
  align-items: center;
  padding: 16px 20px;
}

.bond-icon {
  width: 40px;
  height: 40px;
  background-color: #3a5ccc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.bond-code {
  font-size: 20px;
  font-weight: bold;
}

.bond-basic-info {
  padding: 0 20px 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
}

.info-item {
  flex: 1;
  display: flex;
  align-items: center;
}

.info-label {
  color: #8c8c8c;
  font-size: 14px;
  margin-right: 8px;
  min-width: 70px;
}

.info-value {
  font-size: 14px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #2a2f3e;
}

.tab {
  padding: 12px 20px;
  cursor: pointer;
  position: relative;
  font-size: 14px;
  color: #8c8c8c;
}

.tab.active {
  color: #fff;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #3a5ccc;
}

.tab-content {
  padding: 16px 20px;
}

.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.section-indicator {
  width: 3px;
  height: 16px;
  background-color: #3a5ccc;
  margin-right: 8px;
}

.section-title {
  font-size: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-item {
  position: relative;
  display: flex;
  align-items: center;
}

.grid-label {
  color: #8c8c8c;
  font-size: 14px;
  min-width: 70px;
}

.grid-value {
  font-size: 14px;
}

.tag {
  position: absolute;
  top: 0;
  right: 0;
  background-color: #2a3a5c;
  color: #8c9cbc;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid #2a2f3e;
  position: sticky;
  bottom: 0;
  background-color: #222839;
}

.btn {
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-left: 12px;
}

.btn-cancel {
  background-color: transparent;
  border: 1px solid #3a3f4e;
  color: #fff;
}

.btn-confirm {
  background-color: #3a5ccc;
  border: none;
  color: #fff;
}
</style>
