<template>
  <view class="page-container">
    <!-- 导航栏 start -->
    <view class="custom-bav-bar">
      <view class="left">
        <u-icon name="arrow-left" color="#666" size="36rpx" @click="handleBack" />
      </view>
      <view class="center"> 添加自选风口概念 </view>
    </view>
    <!-- 导航栏 end -->

    <!-- 搜搜 start -->
    <view class="page-search">
      <u-input
        v-model="input"
        type="text"
        placeholder="输入概念名称查找"
        prefixIcon="search"
        fontSize="28rpx"
        prefixIconStyle="font-size: 40rpx;color: #BDC1C7;"
        :customStyle="{
          borderRadius: '36rpx',
          background: '#F3F5F8',
        }"
      />
    </view>
    <!-- 搜搜 end -->

    <view class="page-main">
      <view class="my-industry">
        <view class="my-industry-top">
          <view class="label">我的风口</view>
          <view class="label-count">
            <text>已选</text>
            <text class="color">4</text>
            <text>/10</text>
          </view>
        </view>
        <view class="my-industry-list">
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
            <view class="industry-btn"></view>
          </view>
          <view class="industry-item">
            <view class="industry-name">电子-半导体</view>
            <view class="industry-btn"></view>
          </view>
          <view class="industry-item">
            <view class="industry-name">计算机-软件开发</view>
            <view class="industry-btn"></view>
          </view>
          <view class="industry-item">
            <view class="industry-name">汽车-乘用车</view>
            <view class="industry-btn"></view>
          </view>
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
            <view class="industry-btn"></view>
          </view>
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
            <view class="industry-btn"></view>
          </view>
        </view>
        <view class="my-industry-empty"> 暂无自选，请从下方添加 </view>
      </view>
      <view class="recommend-industry">
        <view class="recommend-industry-top">
          <view class="label">预期风口</view>
          <view class="right">
            <view class="icon"></view>
            <view class="text">换一换</view>
          </view>
        </view>
        <view class="recommend-industry-list">
          <view class="industry-item active">
            <view class="industry-name">非银金融-证券</view>
          </view>
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
          </view>
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
          </view>
          <view class="industry-item">
            <view class="industry-name">非银金融-证券</view>
          </view>
        </view>
      </view>
    </view>

    <view class="page-footer">
      <view class="btn-clear">清空</view>
      <view class="btn-done">完成配置</view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from "vue";

const input = ref("");

// 导航栏路由返回
const handleBack = () => {
  uni.navigateBack({
    delta: 1,
  });
};
</script>

<style scoped lang="scss">
.page-container {
  width: 100%;
  background-color: #fff;
}

.custom-bav-bar {
  width: 100%;
  height: 88rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;

  .back_icon {
    width: 36rpx;
    height: 36rpx;
  }

  .logo_icon {
    width: 168rpx;
    height: 36rpx;
    margin-right: 6rpx;
  }

  .left {
    position: absolute;
    top: 24rpx;
    left: 32rpx;
  }

  .center {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "PingFangSC, PingFang SC";
    font-weight: 500;
    font-size: 34rpx;
    color: #222222;
    line-height: 36rpx;
  }
}

.page-search {
  position: relative;
  margin-top: 16rpx;
  margin-bottom: 20rpx;
  padding: 0 30rpx;
  z-index: 2;
}

.page-main {
  width: 100%;
  padding: 33rpx 30rpx 0;
  box-sizing: border-box;

  .my-industry {
    margin-bottom: 80rpx;
    .my-industry-top {
      display: flex;
      align-items: center;
      margin-bottom: 32rpx;

      .label {
        margin-right: 13rpx;
        font-family: "PingFangSC, PingFang SC";
        font-weight: 500;
        font-size: 30rpx;
        color: #111111;
      }

      .label-count {
        font-family: "PingFangSC, PingFang SC";
        font-weight: 400;
        font-size: 26rpx;
        color: #666666;
        .color {
          color: #ffa800;
        }
      }
    }

    .my-industry-list {
      display: flex;
      gap: 20rpx;
      flex-wrap: wrap;

      .industry-item {
        display: flex;
        align-items: center;
        padding: 18rpx 30rpx;
        background: #FFF9EC;
        border-radius: 8rpx;

        .industry-name {
          margin-right: 20rpx;
          font-family: "PingFangSC, PingFang SC";
          font-weight: 400;
          font-size: 26rpx;
          color: #ffa800;
        }
        .industry-btn {
          width: 20rpx;
          height: 20rpx;
          background: url("@/assets/images/page/icon_close@2x.png") no-repeat;
          background-size: 20rpx 20rpx;
        }
      }
    }

    .my-industry-empty {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100rpx;
      background: #f7f8fa;
      border-radius: 8rpx;
      border: 2rpx solid #e4e9f0;
      font-family: "PingFangSC, PingFang SC";
      font-weight: 400;
      font-size: 26rpx;
      color: #cccccc;
    }
  }

  .recommend-industry {
    .recommend-industry-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 30rpx;

      .label {
        font-family: "PingFangSC, PingFang SC";
        font-weight: 500;
        font-size: 30rpx;
        color: #111111;
      }
      .right {
        display: flex;
        align-items: center;
        .icon {
          width: 32rpx;
          height: 32rpx;
          background: url("@/assets/images/page/icon_change@2x.png") no-repeat 0 3rpx;
          background-size: 32rpx 32rpx;
          margin-right: 10rpx;
        }
        .text {
          font-family: "PingFangSC, PingFang SC";
          font-weight: 400;
          font-size: 26rpx;
          color: #999999;
        }
      }
    }

    .recommend-industry-list {
      display: grid;
      gap: 20rpx;
      grid-template-columns: repeat(2, 1fr);

      .industry-item {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 18rpx 0;
        background-color: #f3f5f8;
        border-radius: 8px;

        &.active {
          background-color: #fff9ec;
          .industry-name {
            color: #ffa800;
          }
        }

        .industry-name {
          font-family: "PingFangSC, PingFang SC";
          font-weight: 400;
          font-size: 28rpx;
          color: #333333;
          line-height: 40rpx;
          text-align: center;
        }
      }
    }
  }
}

.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16rpx 24rpx;
  background: #ffffff;
  box-shadow: 0px -4px 12px 0px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;

  .btn-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 239rpx;
    height: 100rpx;
    border-radius: 50rpx;
    background: #fff;
    border: 2rpx solid #979797;
    font-family: "PingFangSC, PingFang SC";
    font-weight: 500;
    font-size: 32rpx;
    color: #656565;
    line-height: 45rpx;
    cursor: pointer;
  }

  .btn-done {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 437rpx;
    height: 100rpx;
    border-radius: 50rpx;
    background: #ffa800;
    font-family: "PingFangSC, PingFang SC";
    font-weight: 500;
    font-size: 32rpx;
    color: #ffffff;
    line-height: 45rpx;
    cursor: pointer;
  }
}
</style>
