<template>
  <scroll-view :class="['scroll-Y' ,'color-scroll-Y', theme]">
    <div class="wrap">
      <div class="parkingFee">
        <!-- 菜单 -->
        <div
          :class="{
            top_menu: true,
            blue_top_menu: custTypeId === 1,
            green_top_menu: custTypeId === 2,
          }"
          v-if="custTypeId >= 0"
        >
          <div class="menu_item" @click="doRouter">
            <img :src="`${require(`./static/images/icon-order.png`)}`" />
            <span>缴费记录</span>
          </div>
          <div class="menu_item" @click="doRouter3" v-if="source === 'CRM'">
            <img :src="`${require(`./static/images/icon-coupon.png`)}`" />
            <span>停车劵兑换</span>
          </div>
          <div class="menu_item" @click="doRouter1">
            <img :src="`${require(`./static/images/icon-ticket.png`)}`" />
            <span>停车开票</span>
          </div>
          <div class="menu_item" @click="doRouter2">
            <img :src="`${require(`./static/images/icon-car.png`)}`" />
            <span>车辆管理</span>
          </div>
        </div>
        <!-- 中控 -->
        <div class="parkingFee-bottom">
          <div style="height: 40px; background-color: #FBFCFF;" v-if="source !== 'CRM'"></div>
          <div :class="['parkingFee-tab', tabbarActive === '无牌缴费' && 'unlicensed-box-bottom']" v-if="supportUnlicensed && source === 'CRM'">
            <div :class="['bar', tabbarActive === '手动缴费' && 'active']" @click="tabbarActiveEvent('手动缴费')">手动缴费</div>
            <div :class="['bar', tabbarActive === '无牌缴费' && 'active']" @click="tabbarActiveEvent('无牌缴费')">无牌缴费</div>
          </div>

          <!-- 手动缴费 -->
          <div class="manual-box" v-if="tabbarActive === '手动缴费'">
            <div class="parkingFee-search">
              <div class="search_tip_1" :style="{paddingTop: supportUnlicensed? '0': '32px'}">
                <div class="title">车辆类型</div>
                <k-tab type="fill" @change="toggleType" :tabs="['普通车牌', '新能源', '特殊车牌']" />
              </div>
              <!-- <div class="search_tip">
                <div class="title">车辆类型</div>
                <div class="search_tip_pt">
                  <div :class="carType == 0 ? 'search_tip_pt_index' : ''" @click="toggleType(0)">普通车牌</div>
                  <div :class="carType == 1 ? 'search_tip_pt_index' : ''" @click="toggleType(1)">新能源</div>
                  <div :class="carType == 2 ? 'search_tip_pt_index' : ''" @click="toggleType(2)">特殊车牌</div>
                </div>
              </div> -->
              <div class="input-box">
                <!-- <div v-for="i in carType === 1 ? 8 : 7" class="li" :key="`numArr${i}`" @click="clickShowKeyboard(i)" :class="[active === i ? 'active' : '']">
                  {{ numArr[i] }}
                </div> -->
                <div class="van-hairline--surround li" @click="clickShowKeyboard(0)" :class="[active === 0 ? 'active' : '']">
                  {{ numArr[0] }}
                </div>
                <div class="van-hairline--surround li" @click="clickShowKeyboard(1)" :class="[active === 1 ? 'active' : '']">
                  {{ numArr[1] }}
                </div>
                <div class="input_box_dian">·</div>
                <div class="van-hairline--surround li" @click="clickShowKeyboard(2)" :class="[active === 2 ? 'active' : '']">
                  {{ numArr[2] }}
                </div>
                <div class="van-hairline--surround li" @click="clickShowKeyboard(3)" :class="[active === 3 ? 'active' : '']">
                  {{ numArr[3] }}
                </div>
                <div class="van-hairline--surround li" @click="clickShowKeyboard(4)" :class="[active === 4 ? 'active' : '']">
                  {{ numArr[4] }}
                </div>
                <div class="van-hairline--surround li" @click="clickShowKeyboard(5)" :class="[active === 5 ? 'active' : '']">
                  {{ numArr[5] }}
                </div>
                <div :class="['van-hairline--surround li', active === 6 ? 'active' : '']" @click="clickShowKeyboard(6)">
                  {{ numArr[6] }}
                </div>
                <div class="li dashed green-active" @click="clickShowKeyboard(7)" :class="[active === 7 ? 'active' : '']" >
                  <span v-if="numArr[7] && carType === 1">{{ numArr[7] }}</span>
                  <img v-else :src="require('./static/images/unlicensed/leaf.svg')">
                </div>
              </div>
              <k-button title="查询缴费" style="margin-top: 46px;margin-bottom: 43px;" :disabled="disabledBtn" disabledColor="#D1D2D9" @click="preHandleSearch" />
              <!-- <div type="primary" class="search-btn" :class="disabledBtn ? 'disabled-btn' : ''" :disabled="disabledBtn" @click="preHandleSearch">查询缴费</div> -->
            </div>
            <div class="vehicleMgt-list">
              <div class="vehicleMgt-title">
                <div>历史查询车辆</div>
                <!-- <image src="./static/images/icon5.png" class="vehicleMgt-title-img"/> -->
              </div>
              <div class="vehicleMgt-content" v-if="carList.length">
                <div class="item" v-for="(item, index) in carList" :key="index" @click="toHandleSearch(item, 1)" :class="vehicleNumber == item ? 'vehicleMgt-content_cls' : ''">
                  {{ item | formatCarno }}
                </div>
              </div>
            </div>
          </div>

          <!-- 无牌缴费 -->
          <div class="unlicensed-box" v-else>
            <!-- 无牌车 -->
            <!-- <k-illustration name="no-parking-fee" description="未查询到无牌车信息" /> -->
            <div class="no-car-unlicensed-box" v-if="!unlicensedCar">
              <img :src="`${require(`./static/images/unlicensed-1.png`)}`" />
              <div class="no-car-unlicensed-info">未查询到无牌车信息</div>
              <div class="search-btn no-car-unlicensed-btn" @click="scanCarCode">
                <!-- <van-icon name="scan" />扫描进场二维码领取无牌车号牌 -->
                <img class="unlicensed-scan" :src="`${require(`./static/images/unlicensed-scan.png`)}`" /><sapn class="text">扫描进场二维码领取无牌车号牌</sapn>
              </div>
            </div>
            <!-- 有无牌车 -->
            <div class="in-car" v-else>
              <div class="car-number-box">
                <img :src="`${require(`./static/images/unlicensed-0.png`)}`" />
                <div class="car-number">
                  <div class="number">{{ unlicensedCar }}</div>
                  <div class="tips">车辆类型：无牌车辆</div>
                </div>
              </div>
              <div class="search-btn" @click="unlicensedToPay">去支付</div>
            </div>
          </div>
        </div>
        <div class="parkingFee-top">
          <div class="top_content">
            <div class="title_box">
              <span class="btn">缴费说明</span>
            </div>
            <div class="sub_title_box">
              <span class="btn">基础计费规则：</span>
            </div>
            
            <div class="info" :class="!init_ch ? 'info_show' : ''">
              <!-- <p></p> -->
              <!-- <p>{{ description }}</p> -->
              <div v-html="description"></div>
            </div>
          </div>
          <div class="top_down" @click="top_display" v-if="!init_ch && description && description.length > 60"><van-icon name="arrow-down" /></div>
          <div class="top_down" @click="top_display" v-else><van-icon name="arrow-up" /></div>
        </div>
      </div>
      <plate-number ref="plateKeyboard" :noDisBtn="[36, 37]" :carType="carType" :active="active" :ind="ind" :numArr="numArr" @carnoArr="updateCarno"></plate-number>
    </div>
  </scroll-view>
</template>

<script>
import parkingFeeJs from './mixins/parkingFee';
import baseMixins from './mixins/base'
export default {
  mixins: [baseMixins, parkingFeeJs],
  name: 'parkingFeeCom',
};
</script>

<style lang="less" scoped>
.scroll-Y {
  width: 100%;
  height: 100vh;
}

.color-scroll-Y {
  background: #f4f7ff;
  // background: red;
}

.wrap {
  display: flex;
  flex-direction: column;
  width: 100%;

  .parkingFee {
    display: flex;
    flex-direction: column;

    .top_menu {
      background: #FBFCFF;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      padding-top: 34px;
      margin-bottom: 20px;
      padding-bottom: 30px;

      .menu_item {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 33.3%;

        img {
          width: 100px;
          height: 100px;
          margin-bottom: 3px;
        }

        span {
          // font-size: 30px;
          margin-top: 10px;
          // color: #333333;
          // font-size: 28px;


          font-family: 'Inter';
          font-style: normal;
          font-weight: 400;
          font-size: 28px;
          line-height: 34px;
          color: #333333;
        }
      }
    }

    .parkingFee-bottom {
      width: 100%;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
      // tabber 切换
      .parkingFee-tab {
        padding-top: 46px;
        padding-left: 27px;
        padding-bottom: 50px;
        background-color: #FBFCFF;
        display: flex;
        align-items: flex-end;
        &.unlicensed-box-bottom {
          padding-bottom: 120px;
        }

        .bar {
          color: #666666;
          // font-size: 32px;
          // font-weight: 500;


          font-family: 'PingFang SC';
          font-style: normal;
          font-weight: 500;
          font-size: 32px;
          line-height: 30px;
          /* identical to box height, or 94% */


          color: #666666;


          &:nth-child(1) {
            margin-right: 24px;
          }

          &.active {
            font-size: 38px;
            color: #333333;

            font-family: 'PingFang SC';
            font-style: normal;
            font-weight: 500;
            font-size: 38px;
            line-height: 38px;
            color: #333333;
          }
        }
      }

      // 车牌号查询
      .parkingFee-search {
        width: 100%;
        display: flex;
        flex-direction: column;
        background: #FBFCFF;
        box-sizing: border-box;

        .search_tip {
          width: 100%;
          margin-left: -1px;
          display: flex;
          justify-content: flex-start;
          align-items: center;
          padding-right: 30px;
          margin-bottom: 40px;

          .title {
            font-size: 30px;
            color: #333333;
            padding-left: 27px;
            margin-right: 33px;
          }

          .search_tip_pt {
            font-size: 28px;
            margin-right: 30px;
            flex: 1;
            display: flex;
            justify-content: space-around;
            align-items: center;
            border: 1px solid #999999;
            height: 60px;
            color: #999999;
            overflow: hidden;
            border-radius: 90px;

            div {
              height: 100%;
              width: 100%;
              border-radius: 90px;
              line-height: 62px;
              text-align: center;
            }

            .search_tip_pt_index {
              color: #fff;
              //background-image: linear-gradient(to right, #7e4fa1, #433c7f);
              background-color: #644a79;
            }
          }
        }
        .search_tip_1 {
          padding: 0 27px 40px;
          display: flex;
          align-items: center;
          .title {
            // font-size: 30px;
            margin-right: 33px;
            font-family: 'PingFang SC';
            font-style: normal;
            font-weight: 500;
            font-size: 30px;
            line-height: 36px;
            color: #333333;
          }
          .k-tab-group-fill {
            flex: 1;
          }
        }
        // 车牌号 & 虚拟键盘
        .input-box {
          width: 100%;
          flex: 1;
          display: flex;
          padding-bottom: 46px;
          padding: 0 17px;
          justify-content: center;
          box-sizing: border-box;

          .li {
            width: 100%;
            //border: 1px solid #d9dbe0;
            box-sizing: border-box;
            height: 90px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #333333;
            background-color: #f4f7ff;
            border-radius: 4px;
            font-size: 40px;
            margin: 0 3px;
            &.dashed {
              background-color: #fafbff;
              border: 1px dashed #fafbff;
            }
            &.van-hairline--surround {
              &::after{
                border-radius: 7px;
                border-color: #D9DBE0;
              }
            }
            &.active {
              border-color: var(--k-color-primary-01, #064c8a);
            }
            &.green-active {
              background: #F8FFED;
              border-color: #7DB124;
              color: #7DB124;
              img{

                width: 41px;
                height: 39px;
              }
            }
          }

          .input_box_dian {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 120px;
            height: 70px;
            color: var(--k-color-primary);
          }
        }

        .search-btn {
          color: #fff;
          margin: 0 auto;
          height: 90px;
          width: calc(100% - 60px);
          line-height: 90px;
          border-radius: 80px;
          font-size: 36px;
          text-align: center;
          //background-image: linear-gradient(to right, #7e4fa1, #433c7f);
          // background-color: #644a79;
          background-color: var(--k-color-primary);

          margin-bottom: 43px;
        }

        .disabled-btn {
          background-color: #c1c1c1 !important;
          //background-image: none !important;
        }
      }

      /* 历史车牌 */
      .vehicleMgt-list {
        // margin-top: 43px;
        // padding-top: 43px;
        display: flex;
        flex-direction: column;
        // margin-bottom: 34px;
        padding-bottom: 34px;
        //margin-top: 20px;
        //padding-top: 20px;
        background-color: #FBFCFF;

        .vehicleMgt-title {
          //width: 91%;
          padding-left: 27px;
          display: flex;
          text-align: left;
          font-weight: 500;
          justify-content: space-between;
          //margin-left: 4%;
          // padding-left: 30px;
          //padding-top: 30px;
          height: 40px;
          line-height: 40px;
          box-sizing: border-box;
          margin-bottom: 24px;
          // border-top: 1px solid #f2f2f2;
          font-size: 30px;

          .vehicleMgt-title-img {
            width: 30px;
            height: 30px;
          }
        }

        .vehicleMgt-content {
          width: 94%;
          margin-left: 29px;
          display: flex;
          flex-wrap: wrap;
          // justify-content: space-around;
          border-radius: 15px;

          .item {
            width: 30%;
            height: 60px;
            // margin-top: 30px;
            // margin-left: 16px;
            margin-right: 15px;
            margin-bottom: 16px;
            text-align: center;
            box-sizing: border-box;
            border: 1px solid #d9dbe0;
            background-color: #f4f7ff;
            line-height: 60px;
            font-size: 28px;
            border-radius: 30px;
            color: #666666;
          }

          .vehicleMgt-content_cls {
            color: var(--k-color-primary-active);
            border: 2px solid var(--k-color-primary-active);
          }
        }
      }
    }
    /* 无牌车UI */
    .unlicensed-box {
      background-color: #FBFCFF;

      .no-car-unlicensed-box {
        box-sizing: border-box;
        img {
          width: 391px;
          display: block;
          margin: 0 auto;
        }
        .no-car-unlicensed-info {
          color: #919baa;
          font-size: 36px;
          line-height: 36px;
          text-align: center;
          margin-bottom: 70px;
          font-family: 'PingFang SC';
          font-style: normal;
          font-weight: 400;
        }
        .search-btn {
          font-size: 32px;
          height: 90px;
          color: #ffffff;
          line-height: 90px;
          background: var(--k-color-primary);
          text-align: center;
          margin: 0 30px;
          border-radius: 45px;
          margin-bottom: 58px;
          .unlicensed-scan {
            display: inline-block;
            width: 60px;
            height: 60px;
            position: relative;
            top: 17px;
            margin-right: 15px;
          }
          &.no-car-unlicensed-btn {
            .text{
              position: relative;
              top: -2px;
            }
          }
        }
      }

      .in-car {
        box-sizing: border-box;
        .car-number-box {
          height: 230px;
          //padding-top: 53px;
          padding-left: 18px;
          //padding-bottom: 34px;
          background: #fbfcff;
          border: 1px solid #d9dbe0;
          border-radius: 4px;
          margin: 0 24px;
          display: flex;
          margin-bottom: 40px;
          display: flex;
          align-items: center;

          img {
            width: 288px;
            height: 142px;
          }
          .car-number {
            .number {
              font-size: 50px;
              line-height: 56px;
              font-weight: 600;
              color: #333333;
              margin-bottom: 23px;
            }
            .tips {
              color: #999999;
            }
          }
        }
        .search-btn {
          background: var(--k-color-primary);
          border-radius: 45px;
          color: #ffffff;
          line-height: 90px;
          height: 90px;
          font-size: 36px;
          text-align: center;
          margin: 0 30px 40px;
        }
      }
    }

    /* 缴费说明 */
    .parkingFee-top {
      display: flex;
      flex-direction: column;
      background-size: 100% 30%;
      padding-left: 27px;
      padding-right: 27px;
      background-color: #FBFCFF;

      .top_content {
        box-sizing: border-box;

        span {
          font-size: 24px;
          color: #898989;
          text-align: left;
        }

        .title_box {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-bottom: 20px;

          .btn {
            box-sizing: border-box;
            border-radius: 20px;
            font-size: 30px;
            font-weight: 500;
            color: #333;
            text-align: left;
          }
        }
        .sub_title_box {
          margin-bottom: 5px;
          .btn{
            font-family: 'PingFang SC';
            font-style: normal;
            font-weight: 400;
            font-size: 26px;
            line-height: 40px;
            
            color: #333333;  
          }
        }

        .info {
          padding-left: 2px;
          font-size: 27px;
          width: 95%;
          color: #666;
          line-height: 45px;
          p {
            margin: 0;
          }
        }

        .info_show {
          word-break: break-all;
          text-overflow: ellipsis;
          overflow: hidden;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
        }
      }

      .top_down {
        width: 100%;
        text-align: center;
        color: #999999;
        margin-top: 25px;
        margin-bottom: 20px;
      }
    }
  }
}

// 缴费说明
.payInstruct_wrap {
  width: 300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;

  .scroll {
    height: 600px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;

    .payInstruct_title {
      font-size: 30px;
      text-align: center;
      padding: 20px 0;
      box-sizing: border-box;
      border-bottom: 1px solid #f2f2f2;
    }

    .payInstruct_con {
      display: flex;
      width: 100%;
      padding: 20px 10px;
      box-sizing: border-box;

      span {
        font-size: 28px;
        color: #999;
      }
    }
  }
}

.class-plate-box {
  width: 100%;
  padding: 24px 0;
  box-sizing: border-box;
  position: relative;
}

.delBtn {
  color: #fff;
  height: 38px;
  line-height: 38px;
  font-size: 20px;
  width: 124px;
  border-radius: 7px;
  text-align: center;
  padding: 4px;
  background-color: #c69c6d;
}

.payThe {
  background-color: #fff;
  width: 100%;

  .pay_index {
    text-align: center;
    width: 200px;
    padding-top: 10px;
    margin: 0px auto;
  }

  .pay_title {
    width: 500px;
    display: flex;
    align-items: center;
    margin-top: 30px;
  }

  .pay_title1 {
    width: 100%;
    margin-top: 20px;
    display: flex;
    align-items: center;
  }

  .pay_title_yhj {
    margin-left: 60px;
    font-size: 20px;
  }

  .pay_title_yhj1 {
    margin-left: 35px;
    font-size: 20px;
  }

  .payjf {
    font-size: 20px;
    margin-left: 30px;
  }

  .paySelect {
    color: rgba(16, 16, 16, 100);
    font-size: 20px;
    font-family: Arial;
    border: 1px solid rgba(187, 187, 187, 100);
    border-radius: 10px;
    margin-left: 80px;
    width: 260px;
    height: 80px;
  }

  .paySelect1 {
    color: rgba(16, 16, 16, 100);
    font-size: 20px;
    font-family: Arial;
    border: 1px solid rgba(187, 187, 187, 100);
    border-radius: 10px;
    margin-left: 80px;
    width: 260px;
    height: 80px;
    display: flex;
    align-items: center;
  }

  .pay-se {
    width: 120px;
    height: 100%;
    background-color: #d8dce6;

    .pay-se-l {
      height: 48%;
      text-align: center;
      font-size: 50px;
      line-height: 68px;
    }

    .pay-se-l1 {
      border-left: 1px solid rgba(187, 187, 187, 100);
      border-bottom: 1px solid rgba(187, 187, 187, 100);
    }

    .pay-se-l2 {
      border-left: 1px solid rgba(187, 187, 187, 100);
    }
  }

  .payjfzk {
    font-size: 20px;
    color: #8b8c8b;
    margin-top: 10px;
    margin-left: 210px;
  }

  .pay_time {
    font-size: 28px;
    margin-left: 180px;
    padding-bottom: 40px;
  }

  .pay_time1 {
    margin-top: 26px;
  }
}

.pay_jiaof {
  width: 97%;
  height: 60px;
  line-height: 60px;
  margin-left: 10px;
  background-color: #c69c6d;
  text-align: center;
  color: rgba(255, 255, 255, 100);
  font-size: 28px;
  font-family: Microsoft Yahei;
  border-radius: 10px;
  margin-top: 20px;
}

.sq_content {
  width: 700px;
  background-color: #fff;
  position: fixed;
  bottom: 25px;
  left: 25px;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 15px;
  font-size: 16px;
  color: #c69c6d;
  padding: 0px 30px;
  box-sizing: border-box;
}

.sq_content .btn {
  width: 180px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  color: #fff;
  background-color: #c69c6d;
  margin-top: -3px;
  border-radius: 25px;
}

// 停车券弹窗
.ticketPopup {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 999;

  .popup-title {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 42px;
    box-sizing: border-box;
    border-bottom: 1px solid #f2f2f2;
    position: relative;

    span {
      color: #999;
      font-size: 28px;
    }

    .useRule-text {
      position: absolute;
      right: 42px;
      color: rgb(58, 130, 248);
    }
  }

  .popup_scroll {
    height: 70vh;
    background: #f2f2f2;
  }

  .popup_content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
    box-sizing: border-box;

    .item {
      display: flex;
      background: #fff;
      margin-bottom: 20px;
      border-radius: 10px;

      .item-left {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 20px 0;
        box-sizing: border-box;
        position: relative;

        .item-type {
          position: absolute;
          top: 0;
          left: 0;
          background: #fff5f1;
          border-radius: 10px 0 10px 0;
          width: 205px;
          display: flex;
          justify-content: center;

          span {
            color: #999;
            font-size: 20px;
            text-align: center;
            line-height: 28px;
          }
        }

        .item-value {
          color: #c69c6d;
          font-size: 40px;
          padding: 10px 30px;
          box-sizing: border-box;
          width: 205px;
          display: flex;
          justify-content: center;

          .b {
            color: #c69c6d;
            font-weight: 600;
            font-size: 60px;
          }
        }

        .color_disabled {
          color: #999 !important;
        }
      }

      .item-right {
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0 8px 8px 0;
        position: relative;

        span {
          color: #c69c6d;
          font-size: 24px;
          padding: 0 20px;
          box-sizing: border-box;
        }

        .color_disabled {
          color: #999;
        }

        // 对勾
        .dot {
          position: absolute;
          top: 0;
          right: 0;
          width: 2.25rem;
          height: 2.375rem;
        }
      }
    }
  }
}

// 弹窗按钮
.popup_button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  box-sizing: border-box;

  span {
    height: 110px;
    line-height: 110px;
    text-align: center;
  }

  .cancel_btn {
    background: #fff;
    color: #ed1c24 !important;
  }

  .ok_btn {
    background: #c69c6d;
    color: #fff !important;
    width: 120px;
    height: 40px;
    line-height: 40px;
    border-radius: 40px;
  }
}
</style>
