<template>
  <view class="home-container">
    <!-- 顶部蓝色渐变背景及数据 -->
    <view class="header-gradient">
      <view class="header-title">胥口枢纽闸站状态</view>
      <view class="header-info">
        <view class="info-item">
          <text class="info-label">今日水位：</text>
          <text class="info-value">4.2m</text>
        </view>
        <view class="info-item">
          <text class="info-label">水深：</text>
          <text class="info-value">3.8m</text>
        </view>
        <view class="info-item">
          <text class="info-label">限高：</text>
          <text class="info-value">7.5m</text>
        </view>
      </view>
      <view class="batch-row-strict">
        <view class="batch-col">
          <text class="batch-num-strict">2025040101</text>
          <view class="batch-tag-strict orange">
            <text class="tag-orange">南向北</text>当前批次
          </view>
        </view>
        <view class="batch-divider-strict"></view>
        <view class="batch-col">
          <text class="batch-num-strict">2025040101</text>
          <view class="batch-tag-strict orange">
            <text class="tag-green">南向北</text>当前批次
          </view>
        </view>
      </view>
    </view>

    <!-- 闸站流程 -->
    <view class="process-card">
      <view class="process-title-bar">
        <text>闸站流程</text>
      </view>
      <view class="process-flow">
        <view class="process-step">
          <image class="icon" src="/static/icon_step_index1.png" mode="aspectFit" />
          <text class="process-label">先预约</text>
        </view>
        <view class="arrow">&gt;</view>
        <view class="process-step">
          <image class="icon" src="/static/icon_step_index2.png" mode="aspectFit" />
          <text class="process-label">在购票</text>
        </view>
        <view class="arrow">&gt;</view>
        <view class="process-step">
          <image class="icon" src="/static/icon_step_index3.png" mode="aspectFit" />
          <text class="process-label">排队过闸</text>
        </view>
      </view>
    </view>

    <!-- 四个功能卡片 -->
    <view class="card-grid">
      <view class="func-card bg-green" @click="goReservation">
        <view class="func-card-content">
          <text class="func-title">过闸预约</text>
          <text class="func-num">2</text>
        </view>
        <view class="func-bg-icon clock"></view>
      </view>
      <view class="func-card bg-blue" @click="goOrder">
        <view class="func-card-content">
          <text class="func-title">在线购票</text>
          <text class="func-num">30</text>
        </view>
        <view class="func-bg-icon ticket"></view>
      </view>
      <view class="func-card bg-orange" @click="goShipManager">
        <view class="func-card-content">
          <text class="func-title">船只管理</text>
          <text class="func-num">6</text>
        </view>
        <view class="func-bg-icon ship"></view>
      </view>
      <view class="func-card bg-purple" @click="goInvoiceManage">
        <view class="func-card-content">
          <text class="func-title">发票管理</text>
          <text class="func-num">20</text>
        </view>
        <view class="func-bg-icon invoice"></view>
      </view>
    </view>

    <!-- 实时/公告信息 -->
    <view class="info-list">
      <view class="info-item-row">
        <view class="info-tag realtime">
          <text class="info-tag-text">实时</text>
        </view>
        <text class="info-text">北向南2025040102准备过闸</text>
      </view>
      <view class="info-item-row">
        <view class="info-tag notice">
          <text class="info-tag-text">公告</text>
        </view>
        <text class="info-text">北向南2025040102准备过闸</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'IndexPage',
  methods: {
    goReservation() {
      uni.navigateTo({ url: '/pages/reservation/index' });
    },
    goShipManager() {
      uni.navigateTo({ url: '/pages/index/ship_manage' });
    },
    goOrder() {
      uni.navigateTo({ url: '/pages/order/pay_order' });
    },
    goInvoiceManage() {
      uni.navigateTo({ url: '/pages/index/invoice_manage' });
    }
  }
}
</script>

<style scoped>
.home-container {
  background: #f6f8fc;
  min-height: 100vh;
  padding-bottom: 24rpx;
  position: relative;
}

.header-gradient {
  background: linear-gradient(180deg, #2f50ff 0%, #28a8fa 100%);
  border-bottom-left-radius: 20rpx;
  border-bottom-right-radius: 20rpx;
  padding: 0 0 36rpx 0;
  color: #fff;
  position: relative;
  height: 630rpx;
  min-height: 400rpx;
  max-height: 650rpx;
}

.header-title {
  text-align: center;
  font-size: 36rpx;
  font-weight: bold;
  padding-top: 7vh;
  letter-spacing: 2rpx;
}

.header-info {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: fit-content;
  margin: 5vh auto 0 auto; /* 水平居中 */
  gap: 170rpx; /* 控制每组间距 */
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.info-label {
  font-size: 24rpx;
  opacity: 0.95;
  color: #e6eaff;
}

.info-value {
  font-size: 32rpx;
  font-weight: normal;
  margin-top: 8rpx;
  display: block;
  color: #fff;
  font-family: sans-serif;
}

.batch-row-strict {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 4vh 48rpx 0 48rpx;
  position: relative;
}

.batch-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.batch-divider-strict {
  width: 2rpx;
  height: 82rpx;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 48rpx;
}

.batch-num-strict {
  font-size: 32rpx;
  font-weight: normal;
  margin-bottom: 8rpx;
  font-family: 'PangMenZhengDao', 'SourceHanSansCN', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  letter-spacing: 3rpx;
}

.batch-tag-strict {
  font-size: 22rpx;
  padding: 4rpx 12rpx;
  border-radius: 20rpx;
  background: #2b70ee;
  display: flex;
  align-items: center;
  gap: 4rpx;
}

.tag-orange {
  color: #FF9F43;
}

.tag-green {
  color: #28C76F;
}

.tag-blue {
  color: #4FC3FF;
}

.process-card {
  background: #fff;
  border-radius: 22rpx;
  margin: 24rpx;
  padding: 48rpx 32rpx 32rpx 32rpx;
  box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.08);
  position: relative;
  margin-top: -140rpx;
  height: 138px;
}

.process-title-bar {
  width: 60%;
  margin: 0 auto;
  margin-top: -47rpx;
  background: linear-gradient(180deg, #2f4dff 0%, #4b65ff 100%);
  color: #fff;
  font-size: 28rpx;
  font-weight: bold;
  border-radius: 0 0 20rpx 20rpx;
  padding: 12rpx 0;
  text-align: center;
  box-shadow: 0 4rpx 16rpx rgba(59,124,255,0.12);
  z-index: 2;
  position: relative;
}

.process-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12rpx;
  margin-top: 38rpx;
}

.process-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.icon {
  width: 88rpx;
  height: 88rpx;
  border-radius: 50%;
  background: linear-gradient(135deg, #2c51ff 0%, #2991fd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12rpx;
  /* 这里放svg或字体icon，颜色为白色 */
}

.process-label {
  color: #445fff;
  font-size: 26rpx;
  margin-top: 4rpx;
}

.arrow {
  color: #B0B8C6;
  font-size: 40rpx;
  font-weight: bold;
  margin: 0 12rpx;
  margin-top: -30rpx;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32rpx;
  margin: 32rpx 24rpx 24rpx 24rpx;
}

.func-card {
  position: relative;
  border-radius: 32rpx;
  height: 200rpx;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32rpx 0 32rpx 32rpx;
}

.func-card-content {
  z-index: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.func-title {
  font-size: 28rpx;
  color: #fff;
  font-weight: 500;
  margin-bottom: 25rpx;
  margin-top: 15rpx;
}

.func-num {
  font-size: 58rpx;
  font-weight: normal;
  color: #fff;
  font-family: 'PangMenZhengDao', 'SourceHanSansCN', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  letter-spacing: 5rpx;
}

.func-bg-icon {
  position: absolute;
  right: 12rpx;
  bottom: 12rpx;
  width: 100rpx;
  height: 100rpx;
  opacity: 0.18;
  z-index: 1;
  /* 这里放svg或字体icon */
}

.card-bg-img {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 120rpx;
  height: 120rpx;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}

.func-card-content, .func-bg-icon {
  position: relative;
  z-index: 1;
}

.func-card.bg-green {
  background: url('/static/index_radius_green.png') no-repeat center center;
  background-size: cover;
}
.func-card.bg-blue {
  background: url('/static/index_radius_blue.png') no-repeat center center;
  background-size: cover;
}
.func-card.bg-orange {
  background: url('/static/index_radius_orange.png') no-repeat center center;
  background-size: cover;
}
.func-card.bg-purple {
  background: url('/static/index_radius_purple.png') no-repeat center center;
  background-size: cover;
}

.info-list {
  background: #fff;
  border-radius: 24rpx;
  margin: 24rpx;
  padding: 24rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
}

.info-item-row {
  display: flex;
  align-items: center;
  margin-bottom: 16rpx;
  padding: 12rpx 0;
}

.info-item-row:last-child {
  margin-bottom: 0;
}

.info-tag {
  font-size: 22rpx;
  padding: 4rpx 18rpx;
  border-radius: 8rpx;
  margin-right: 12rpx;
  white-space: nowrap;
  color: #fff;
  display: inline-block;
  background: #e68c6e;
  transform: skewX(-20deg);
  font-weight: 500;
  border: none;
  margin-right: 32rpx;
}

.info-tag-text {
  display: inline-block;
  transform: skewX(20deg);
}

.notice {
  background: linear-gradient(90deg, #2b70ee 0%, #4FC3FF 100%);
  color: white;
}

.realtime {
  background: linear-gradient(90deg, #e68d6e 0%, #ffb86c 100%);
  color: white;
}

.info-text {
  font-size: 26rpx;
  color: #333;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>