<template>
  <view class="selectCar-box">
    <view class="details">
      <view class="title"> 基础信息 </view>
      <view class="details-item">
        <view> 订单编号： </view>
        <text>123234350000001</text>
      </view>
      <view class="details-item">
        <view> 用户名称： </view>
        <text>xxxxx</text>
      </view>
      <view class="details-item">
        <view> 用户证件类型： </view>
        <text>居民身份证</text>
      </view>
      <view class="details-item">
        <view> 用户证件号： </view>
        <text>44504049343434001</text>
      </view>
      <view class="details-item">
        <view> 订单车牌号： </view>
        <text style="color: #00b38b ;">贵A12345</text>
      </view>
      <view class="details-item">
        <view> 收费车型： </view>
        <text>客车</text>
      </view>
    </view>
    <view class="title"> 卡信号 </view>
    <view class="card">
      <view class="card-left">
        <image :src="`${$imgUrl}/card2.png`" mode=""></image>
        <view class="card-center">
          <view class="card-center-head"> 2023022700012 </view>
          <view class="tips">
            <text>储蓄卡</text>
            <text class="tips-card">正常</text>
          </view>
        </view>
      </view>
      <view class="choose-item" @click="choose(1)">
        <view class="active" v-if="flag.includes(1)"> </view>
      </view>
    </view>
    <view class="title"> OBU设备信息 </view>
    <view class="card">
      <view class="card-left">
        <image :src="`${$imgUrl}/card1.png`" mode=""></image>
        <view class="card-center">
          <view class="card-center-head"> 2023022700012 </view>
          <view class="tips">
            <!-- <text>储蓄卡</text> -->
            <text class="tips-card">正常</text>
          </view>
        </view>
      </view>
      <view class="choose-item" @click="choose(2)">
        <view class="active" v-if="flag.includes(2)"> </view>
      </view>
    </view>
    <view class="title"> OBU设备信息 </view>
    <view class="remark">
      <view> 1.xxxxxxxx </view>
      <view> 2.xxxxxxxx </view>
      <view> 3.xxxxxxxx </view>
      <view> 4.xxxxxxxx </view>
    </view>
    <button class="submit" @click="toPage">下一步</button>
  </view>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import { navTo } from "@/utils/utils";
const toPage = () => {
  if (flag.length == 0) {
    uni.showToast({
      title: "请至少勾选一项",
    });
  } else {
    wx.showModal({
      title: "提示",
      content: "请确保你的ETC设备可以使用，若ETC丢失请前往挂失",
      confirmText: "确认停用",
      cancelText: "前往挂失",
      success: function (res) {
        if (res.confirm) {
          console.log("用户点击确定");
          navTo("/pages/bluetooth/bluetooth");
        } else if (res.cancel) {
          console.log("用户点击取消");
          navTo("/after-sale/card-loss-reporting/cardloss-confirm");
        }
      },
    });
  }
};

const flag = reactive([]);
const choose = (data) => {
  if (!flag.includes(data)) {
    flag.push(data);
    console.log(flag);
  } else {
    flag.splice(flag.indexOf(data), 1);
    console.log(flag);
  }
};
</script>

<style>
page {
  width: 100%;
  height: 100%;
  background-color: #fff;
}
</style>
<style lang="scss" scoped>
.selectCar-box {
  // width: 100%;
  // height: 100%;
  padding: 30rpx;

  .title {
    font-size: 30rpx;
    font-family: Microsoft YaHei UI;
    font-weight: 400;
    color: #333333;
    margin-bottom: 30rpx;
  }

  .details {
    .title {
      font-size: 30rpx;
      font-family: Microsoft YaHei UI;
      font-weight: 400;
      color: #333333;
      margin-bottom: 30rpx;
    }

    .details-item {
      display: flex;
      font-size: 26rpx;
      font-family: Noto Sans S Chinese;
      font-weight: 400;
      color: #999999;
      margin-bottom: 30rpx;

      text {
        font-size: 26rpx;
        font-family: Noto Sans S Chinese;
        font-weight: 400;
        color: #333333;
      }
    }
  }

  .card {
    height: 150rpx;
    background: #ffffff;
    box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
    border-radius: 20rpx;
    padding: 30rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 60rpx;

    .card-left {
      display: flex;
      align-items: center;

      image {
        width: 100rpx;
        height: 90rpx;
      }

      .card-center {
        margin-left: 30rpx;

        .card-center-head {
          font-size: 32rpx;
          font-family: Noto Sans S Chinese;
          font-weight: 400;
          color: #333333;
        }

        .tips {
          font-size: 26rpx;
          font-family: Noto Sans S Chinese;
          font-weight: 400;
          color: #666666;

          .tips-card {
            width: 70rpx;
            height: 40rpx;
            background: #d3f2ef;
            border-radius: 6rpx;
            font-size: 20rpx;
            font-family: Noto Sans S Chinese;
            font-weight: 400;
            color: #0a8f8a;
            padding: 5rpx 10rpx;
            margin-left: 20rpx;
          }
        }
      }
    }

    .choose-item {
      margin-right: 20rpx;
      width: 50rpx;
      height: 50rpx;
      border: 1rpx solid #00b38b;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;

      .active {
        width: 38rpx;
        height: 38rpx;
        background: #00b38b;
        border-radius: 50%;
      }
    }
  }

  .remark {
    font-size: 26rpx;
    font-family: Microsoft YaHei UI;
    font-weight: 400;
    color: #666666;
    text-indent: 30rpx;
    margin-bottom: 30rpx;
  }

  .submit {
    margin-top: 100rpx;
    width: 670rpx;
    height: 80rpx;
    background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
    border-radius: 40rpx;
    font-size: 32rpx;
    font-family: Noto Sans S Chinese;
    font-weight: 400;
    color: #ffffff;
    line-height: 80rpx;
  }
}
</style>
