<template>
  <div class="device-detail">
    <template v-if="productInfo">
      <div class="detail-title">设备认证</div>
    <div class="page-top">
      <div class="swiper-body">
        <img :src="productInfo.pcImage" class="device-image" />
        <div class="auth-seal"></div>
        <img class="auth-card" :src="authCardImage" @click="onShowAuthCard" v-if="!showAuthCard" />
        <img class="auth-logo" :src="brandLogoImage" />
      </div>
      <div class="device-info">
        <div class="logo">
          <div class="logo-swiper" v-if="clubLogo.length > 1">
            <SimpleSwiper :imageList="clubLogo" :pagination="false"></SimpleSwiper>
          </div>
          <img :src="clubLogo[0]" alt="logo" v-else />
        </div>
        <div class="section">
          <div class="name" v-text="productInfo.productName"></div>
          <div class="sncode mobile">
            SN码：<span>{{ productInfo.snCode | snCodeRender }}</span>
          </div>
          <div class="row">
            <!-- <span>产地：{{ productInfo.producePlace }}</span> -->
            <span>品牌：{{ productInfo.brandName }}</span
            ><i></i>
            <span v-if="productInfo.producePlaceType === 1">产地：{{ productInfo.producePlace }}</span>
            <span v-if="productInfo.producePlaceType === 2">技术授权方：{{ productInfo.producePlace }}</span>
            <!-- <span>品牌：RÖS'S</span><i></i><span>产地：西班牙巴塞罗那</span> -->
          </div>
          <div class="sncode pc">
            SN码：<span>{{ productInfo.snCode | snCodeRender }}</span>
          </div>
          <div class="maker" v-if="productInfo.manufacturerType === 1">制造商：{{ productInfo.manufacturer }}</div>
          <div class="maker" v-if="productInfo.manufacturerType === 2">制造委托方：{{ productInfo.manufacturer }}</div>
          <div class="supplier">供应商：{{ productInfo.shopName }}</div>
          <!-- <div class="supplier">供应商：ACEBELLE生物科技（深圳）有限公司</div> -->
        </div>
        <div class="auth" v-if="productInfo">
          <div class="auth-icon"></div>
          <template v-for="item in productInfo.clubList">
            <div class="auth-info" :key="item.authId">
              <span>该设备由</span>
              <span class="font-bold">{{ productInfo.shopName }}</span>
              <span>官方授权</span>
              <span>{{ item.authParty }}</span>
            </div>
          </template>
        </div>
      </div>
    </div>
    <div class="page-content">
      <div class="device-params">
        <div class="title">相关参数</div>
        <div class="line"></div>
        <SimpleParamList :paramList="paramListRender" />
      </div>
    </div>
    </template>
    <!-- 设备为空 -->
    <SimpleEmpty
        v-else
        name="icon-empty-device.png"
        description="暂无关联设备信息~"
    />
    <!-- 授权牌弹窗 -->
    <div class="mask" v-if="showAuthCard" @click="onHideAuthCard"></div>
    <transition enter-active-class="animate__zoomIn" leave-active-class="animate__zoomOut">
      <div class="auth-card-content animate__animated" v-if="showAuthCard">
        <div class="auth-card-popup">
          <span class="el-icon-circle-close" @click="onHideAuthCard"></span>
          <img :src="authCardImage" />
        </div>
      </div>
    </transition>
  </div>
</template>

<script>
import deviceDetailMixin from '@/mixins/deviceDetail'
export default {
  layout: 'app-asbl',
  mixins: [deviceDetailMixin],
}
</script>

<style lang="scss" scoped>
::v-deep {
  .swiper-pagination-bullet {
    background: #36bbce !important;
  }

  .simple-swiper {
    .swiper-pagination-bullet-active {
      background: #36bbce;
    }
  }
}

.mask {
  width: 100vw;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.5);
}

// pc 端
@media screen and (min-width: 768px) {
  .device-detail {
    margin-bottom: 48px;

    .auth-card-content {
      width: 100vw;
      height: 100vh;
      position: fixed;
      left: 0;
      top: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 9;
      .auth-card-popup {
        position: relative;
        width: 622px;

        img {
          display: block;
          width: 100%;
          height: auto;
        }

        .el-icon-circle-close {
          position: absolute;
          top: -50px;
          right: 0;
          font-size: 32px;
          color: #fff;
          cursor: pointer;
        }
      }
    }

    .detail-title {
      font-size: 24px;
      color: #282828;
      margin: 32px auto 24px;
      width: 1200px;
    }

    .page-top,
    .page-content {
      width: 1200px;
      margin: 0 auto;
      background: #fff;
    }
    .page-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      padding: 24px;
      padding-right: 40px;
      .swiper-body {
        position: relative;
        width: 540px;
        height: 540px;
        background: #f7f7f7;
        .device-image {
          width: 100%;
          height: 100%;
        }

        .auth-seal {
          position: absolute;
          width: 70px;
          height: 70px;
          background: url(~assets/theme-images/asbl/pc-icon-auth-seal-t.png) no-repeat center;
          background-size: 70px;
          right: 24px;
          bottom: 24px;
          z-index: 2;
        }

        .auth-card {
          position: absolute;
          width: auto;
          height: 110px;
          display: block;
          bottom: 24px;
          left: 24px;
          z-index: 2;
          cursor: pointer;
        }

        .auth-logo {
          position: absolute;
          max-width: 120px;
          max-height: 120px;
          top: 24px;
          left: 24px;
          z-index: 2;
        }
      }
      .device-info {
        width: 572px;
        position: relative;

        .section {
          width: 440px;
          word-break: break-all;
        }

        .logo {
          width: 114px;
          height: 114px;
          border-radius: 50%;
          // background: #d8d8d8;
          border: 1px solid #d8d8d8;
          // box-sizing: border-box;
          position: absolute;
          right: 0;
          top: 0;

          .logo-swiper {
            width: 112px;
            height: 112px;
            overflow: hidden;
            border-radius: 50%;
          }

          ::v-deep {
            img {
              width: 112px;
              height: 112px;
              border-radius: 50%;
            }
          }

          &::after {
            content: '';
            position: absolute;
            z-index: 1;
            right: 6px;
            bottom: 0;
            display: block;
            width: 24px;
            height: 24px;
            background: url(~assets/theme-images/asbl/pc-icon-auth-ren.png) no-repeat center;
            background-size: 23px;
          }

          img {
            display: block;
            width: 100%;
            height: 100%;
            // background: pink;
            border-radius: 50%;
          }
        }

        .name {
          font-size: 24px;
          color: #282828;
          line-height: 1.6;
          margin-bottom: 24px;
          font-weight: bold;
        }

        .row,
        .sncode,
        .maker {
          margin-bottom: 16px;
        }
        .row {
          line-height: 24px;
          i {
            position: relative;
            margin: 0 16px;
            &::after {
              content: '';
              display: block;
              width: 1px;
              height: 16px;
              background: #999999;
              position: absolute;
              top: 0;
              left: 0;
            }
          }

          span {
            font-size: 18px;
            color: #999999;
          }
        }

        .sncode.mobile {
          display: none;
        }

        .sncode.pc {
          font-size: 18px;
          color: #282828;
        }
        .supplier,
        .maker {
          font-size: 20px;
          color: #282828;
        }

        .auth {
          width: 100%;
          min-height: 114px;
          background: #36bbce;
          margin-top: 56px;
          box-sizing: border-box;
          padding: 24px;

          .auth-icon {
            height: 28px;
            background: url(~assets/theme-images/asbl/pc-icon-auth2.png) no-repeat left center;
            background-size: auto 28px;
            margin-bottom: 10px;
          }

          .auth-info {
            font-size: 0;
            span {
              font-size: 20px;
              color: #fff;
            }
          }
        }
      }
    }
    .page-content {
      margin-top: 16px;
      box-sizing: border-box;
      padding: 24px;
      .device-params {
        .title {
          font-size: 28px;
          color: #282828;
          font-weight: bold;
        }
        .line {
          height: 1px;
          background: #ececec;
          position: relative;
          margin-top: 10px;
          margin-bottom: 20px;
          &::after {
            content: '';
            position: absolute;
            width: 73px;
            height: 2px;
            background: #36bbce;
            left: 0;
            bottom: 0;
          }
        }
      }
    }
  }
}

// 移动端
@media screen and (max-width: 768px) {
  .device-detail {
    .detail-title {
      display: none;
    }

    .auth-card-content {
      width: 100vw;
      height: 100vh;
      position: fixed;
      left: 0;
      top: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 9;
      .auth-card-popup {
        position: relative;
        width: 86vw;

        img {
          display: block;
          width: 100%;
          height: auto;
        }

        .el-icon-circle-close {
          position: absolute;
          top: -8vw;
          right: 0;
          font-size: 7vw;
          color: #fff;
          cursor: pointer;
        }
      }
    }

    .page-top,
    .page-content {
      margin: 0 auto;
      background: #fff;
    }
    .page-top {
      .swiper-body {
        position: relative;
        width: 100vw;
        height: 100vw;
        background: #f7f7f7;

        .device-image {
          width: 100%;
          height: 100%;
        }

        ::v-deep {
          img {
            width: 100vw;
            height: 100vw;
          }
        }

        .auth-seal {
          position: absolute;
          width: 13.8vw;
          height: 13.8vw;
          background: url(~assets/theme-images/asbl/h5-icon-auth-seal-t.png) no-repeat center;
          background-size: 13.8vw;
          right: 4vw;
          bottom: 4vw;
          z-index: 2;
        }

        .auth-card {
          position: absolute;
          width: auto;
          height: 20.6vw;
          display: block;
          bottom: 4vw;
          left: 4vw;
          z-index: 2;
        }

        .auth-logo {
          position: absolute;
          max-width: 18vw;
          max-height: 18vw;
          top: 4vw;
          left: 4vw;
          z-index: 2;
        }
      }
      .device-info {
        position: relative;

        .section {
          word-break: break-all;
          padding: 4vw 4vw 0;
        }

        .logo {
          width: 18vw;
          height: 18vw;
          border-radius: 50%;
          // background: #d8d8d8;
          border: 0.1vw solid #d8d8d8;
          box-sizing: border-box;
          position: absolute;
          right: 4vw;
          top: 5.8vw;

          .logo-swiper {
            width: 18vw;
            height: 18vw;
            overflow: hidden;
            border-radius: 50%;
          }

          ::v-deep {
            img {
              width: 18vw;
              height: 18vw;
              border-radius: 50%;
            }
          }

          &::after {
            content: '';
            position: absolute;
            z-index: 1;
            right: 0.7vw;
            bottom: 0;
            display: block;
            width: 3.6vw;
            height: 3.6vw;
            background: url(~assets/theme-images/asbl/h5-icon-auth-ren.png) no-repeat center;
            background-size: 3.6vw;
          }

          img {
            display: block;
            width: 100%;
            height: 100%;
            // background: pink;
            border-radius: 50%;
          }
        }

        .name {
          font-size: 5.4vw;
          color: #282828;
          line-height: 7.4vw;
          margin-bottom: 2.4vw;
          font-weight: bold;
        }

        .sncode.pc {
          display: none;
        }
        .sncode.mobile {
          margin: 2.4vw 0 5.6vw;
          color: #282828;
          font-size: 4vw;
        }

        .row {
          line-height: 4.7vw;
          i {
            position: relative;
            margin: 0 4vw;
            &::after {
              content: '';
              display: block;
              width: 0.2vw;
              height: 3vw;
              background: #282828;
              position: absolute;
              top: 1vw;
              left: 0;
            }
          }

          span {
            font-size: 3.6vw;
            color: #282828;
          }
        }

        .row,
        .maker {
          margin-bottom: 1.2vw;
        }

        .supplier,
        .maker {
          font-size: 3.6vw;
          color: #282828;
        }

        .auth {
          // width: 100%;
          margin: 0 4vw;
          min-height: 20vw;
          background: #36bbce;
          margin-top: 4vw;
          box-sizing: border-box;
          padding: 5.2vw 4vw;
          border-radius: 1.2vw;

          .auth-icon {
            height: 4.9vw;
            background: url(~assets/theme-images/asbl/h5-icon-auth2.png) no-repeat left center;
            background-size: auto 4.9vw;
            margin-bottom: 1vw;
          }

          .auth-info {
            font-size: 0;
            span {
              font-size: 3.6vw;
              line-height: 6.4vw;
              color: #fff;
              font-weight: bold;
            }
          }
        }
      }
    }
    .page-content {
      .device-params {
        padding: 8vw 4vw;
        box-sizing: border-box;
        .title {
          font-size: 4.6vw;
          color: #282828;
          font-weight: bold;
        }
        .line {
          // height: 0.2vw;
          // background: #ececec;
          position: relative;
          margin-top: 4.7vw;
          margin-bottom: 1.2vw;
        }
      }
    }
  }
}
</style>
