<route lang="json5">
{
  layout: 'default',
  style: {
    navigationStyle: 'custom'
  }
}
</route>

<template>
  <TopNavigation title="访客邀约">
    <text class="nav-right-text">生成记录</text>
  </TopNavigation>
  <view class="container">
    <!-- 功能区域 -->
    <view class="function-area">
      <view class="function-item">
        <text class="title">访客码</text>
        <text class="desc">一键生成，分享权限，扫码通行</text>
      </view>
      <view class="function-item">
        <text class="title">新建邀约</text>
        <text class="desc">填写表单，短信邀约，灵活通行</text>
      </view>
    </view>

    <!-- 访客通行凭证 -->
    <view class="visitor-pass">
      <view class="pass-header">
        <image class="pass-icon" src="/static/images/visitor/icon_pass.png" mode="aspectFit" />
        <text class="title">访客通行凭证</text>
        <text class="help" @click="showHelp">如何生成访客密码？</text>
      </view>

      <!-- 表单内容 -->
      <view class="form-content">
        <view class="form-item">
          <text class="label">到访地址</text>
          <view class="value">
            <text>19104656的互联</text>
            <image class="arrow" src="/static/images/icon_black_right.png" mode="aspectFit" />
          </view>
        </view>

        <view class="form-item">
          <text class="label">通行方式</text>
          <view class="value">
            <text>二维码</text>
          </view>
        </view>

        <view class="form-item required">
          <text class="label">通行有效时段</text>
          <view class="value">
            <text>24小时内</text>
            <image class="arrow" src="/static/images/icon_black_right.png" mode="aspectFit" />
          </view>
        </view>

        <view class="form-item required">
          <text class="label">通行次数</text>
          <view class="value">
            <text>不限制</text>
            <image class="arrow" src="/static/images/icon_black_right.png" mode="aspectFit" />
          </view>
        </view>

        <text class="tip-text">限制访客在每个门禁点的通行次数</text>

        <view class="form-item">
          <text class="label">访客姓名</text>
          <input class="input" type="text" placeholder="请输入" />
        </view>

        <view class="form-item">
          <text class="label">访客手机号</text>
          <input class="input" type="number" placeholder="请输入" />
        </view>
      </view>
    </view>

    <!-- 底部按钮 -->
    <view class="bottom-bar">
      <button class="submit-btn" @click="handleSubmit">新建邀约</button>
      <button class="submit-btn" @click="handleSubmit">立即生成</button>
    </view>
  </view>
</template>

<script setup>
  import TopNavigation from '@/components/TopNavigation/TopNavigation.vue'
  import { ref } from 'vue'

  const showHelp = () => {
    // 显示帮助信息
  }

  const handleSubmit = () => {
    // 处理提交
  }
</script>

<style scoped lang="scss">
  .container {
    min-height: 100vh;
    padding: 12px 16px;
    background-color: #f5f6fa;
  }

  .function-area {
    display: flex;
    gap: 12px;
    margin: 0 32px 12px 0;

    .function-item {
      flex: 1;
      padding: 16px;
      background: #fff;
      border-radius: 12px;

      .title {
        display: block;
        margin-bottom: 4px;
        font-size: 16px;
        font-weight: 500;
        color: #333;
      }

      .desc {
        font-size: 12px;
        color: #999;
      }
    }
  }

  .visitor-pass {
    margin: 0 32px 0 0;
    background: #fff;
    border-radius: 10px;

    .pass-header {
      display: flex;
      align-items: center;
      padding: 10px;
      border-bottom: 1px solid #f5f5f5;

      .pass-icon {
        width: 24px;
        height: 24px;
        margin-right: 5px;
      }

      .title {
        flex: 1;
        font-size: 16px;
        font-weight: 500;
        color: #333;
      }

      .help {
        font-size: 14px;
        color: #2b5cff;
      }
    }

    .form-content {
      padding: 0 16px;

      .form-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 0;
        border-bottom: 1px solid #f5f5f5;

        &.required .label::before {
          margin-right: 4px;
          color: #ff4d4f;
          content: '*';
        }

        .label {
          font-size: 16px;
          color: #333;
        }

        .value {
          display: flex;
          gap: 8px;
          align-items: center;

          text {
            font-size: 14px;
            color: #999;
          }

          .arrow {
            flex-shrink: 0;
            width: 16px;
            height: 16px;
          }
        }

        .input {
          flex: 1;
          padding: 0 12px;
          margin-right: 4px;
          font-size: 14px;
          color: #333;
          text-align: right;

          &::placeholder {
            color: #999;
          }
        }
      }

      .tip-text {
        display: block;
        padding: 8px 0;
        font-size: 12px;
        color: #999;
      }
    }
  }

  .bottom-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 8px 16px;
    padding-bottom: calc(8px + constant(safe-area-inset-bottom));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #f5f5f5;

    .submit-btn {
      flex: 1;
      height: 44px;
      font-size: 16px;
      line-height: 44px;
      color: #fff;
      text-align: center;
      background: #2b5cff;
      border-radius: 22px;
    }
  }

  .nav-right-text {
    padding: 4px 16px 4px 0;
    margin-right: 16px;
    font-size: 14px;
    color: #333;
  }
</style>
