<template>
  <div class="page">
    <van-list
      v-model="loadingMore"
      :finished="finished"
      :immediate-check="false"
      :finished-text="total ? '没有更多了' : ''"
      @load="onLoadMore"
    >
      <div class="page-top flex flex-col justify-center items-center">
        <!-- <img class="logo" :src="supplierInfo.logo" /> -->
        <div class="mt-2 name">
          <!-- <span v-text="supplierInfo.shopName"></span> -->
          <span>官方体疗师认证</span>
        </div>
      </div>
      <div class="page-content">
        <!-- 搜索区域 -->
        <div class="search">
          <SimpleSearch
            v-model="listQuery.doctorName"
            @search="onSearch"
            placeholder="搜索体疗师"
          />
        </div>
        <!-- 标题 -->
        <div class="title px-4 pt-12 pb-6">
          共<span v-text="total"></span>位体疗师
        </div>
        <!-- 列表 -->
        <div class="list">
          <div
            class="section flex justify-between mb-4"
            v-for="item in list"
            :key="item.doctorId"
            @click="toDetail(item)"
          >
            <img class="cover" :src="item.doctorImage" />
            <div class="info">
              <div class="name" v-text="item.doctorName"></div>
              <!-- <div class="tag">{{ item.tagList.join(' | ') }}</div> -->
              <div class="en" v-if="item.englishName">
                英文名：{{ item.englishName }}
              </div>
              <div class="code">
                资格证编号：<span>{{ item.certificateNo }}</span>
              </div>
              <div class="club-name">
                所在机构：<span>{{ item.clubName }}</span>
              </div>
            </div>
          </div>
        </div>

        <!-- 列表为空 -->
        <SimpleEmpty
          v-if="!total && !isRequest"
          name="icon-empty-doctor.png"
          description="敬请期待~"
        ></SimpleEmpty>
      </div>
    </van-list>
  </div>
</template>

<script>
import operatDoctorListMixin from '@/mixins/operatDoctorList'
export default {
  layout: 'app-ross',
  mixins: [operatDoctorListMixin],
}
</script>

<style scoped lang="scss">
.page {
  position: relative;
  min-height: calc(100vh - 80px - 80px);
  background-color: #fff;
}
// pc 端
@media screen and (min-width: 768px) {
  .page {
    @include useTheme() {
      .page-top {
        height: 420px;
        background: fetch('pc-banner-doctor') no-repeat center;
        background-size: auto 420px;

        .logo {
          display: block;
          width: 120px;
          height: 120px;
          border-radius: 50%;
          background: #fff;
        }
        .name {
          font-size: 30px;
          color: #fff;
        }

        .logo,
        .name {
          transform: translateY(-30px);
        }
      }
      .page-content {
        width: 1000px;
        margin: 0 auto;

        .search {
          position: absolute;
          left: 50%;
          top: 300px;
          transform: translateX(-50%);
        }

        .title {
          font-size: 16px;
          color: #404040;

          span {
            color: fetch('color');
          }
        }

        .list {
          display: flex;
          align-items: center;
          flex-wrap: wrap;
          justify-content: space-between;

          .empty {
            width: 390px;
          }

          .section {
            width: 490px;
            height: 136px;
            background-color: #f3f5f6;
            border-radius: 4px;
            box-sizing: border-box;
            padding: 16px;

            cursor: pointer;
            transition: all 0.4s;
            &:hover {
              box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
            }

            .cover {
              display: block;
              width: 78px;
              height: 104px;
            }
            .info {
              flex: 1;
              flex-shrink: 0;
              position: relative;
              margin-left: 16px;
              .name {
                font-size: 18px;
                color: #101010;
                font-weight: bold;
                text-overflow: ellipsis;
                white-space: nowrap;
                overflow: hidden;
                font-weight: bold;
                margin-bottom: 8px;
              }
              .tag,
              .en,
              .code,
              .club-name {
                height: 20px;
                position: relative;
                font-size: 14px;
                color: #999;
                line-height: 20px;
                text-overflow: ellipsis;
                white-space: nowrap;
                overflow: hidden;
                margin-top: 4px;

                span {
                  color: #333333;
                }
              }

              .tag,
              .en {
                color: #909399;
              }
            }
          }
        }
      }
    }
  }
}

// 移动 端
@media screen and (max-width: 768px) {
  .page {
    @include useTheme() {
      .page-top {
        height: 46vw;
        background: fetch('h5-banner-doctor') no-repeat center;
        background-size: auto 46vw;

        .logo {
          display: block;
          width: 14.8vw;
          height: 14.8vw;
          border-radius: 50%;
          background: #fff;
        }
        .name {
          font-size: 4vw;
          color: #fff;
        }
      }
      .page-content {
        position: relative;
        .search {
          position: absolute;
          left: 50%;
          top: 0;
          transform: translate(-50%, -50%);
        }

        .city {
          padding-top: 12vw;
        }

        .title {
          font-size: 3.4vw;
          color: #404040;

          span {
            color: fetch('color');
          }
        }

        .list {
          display: flex;
          align-items: center;
          flex-direction: column;

          .section {
            width: 93.6vw;
            background-color: #f3f5f6;
            border-radius: 4px;
            box-sizing: border-box;
            padding: 3.2vw;

            .cover {
              display: block;
              width: 16.2vw;
              height: 21.6vw;
            }
            .info {
              position: relative;
              margin-left: 3.6vw;
              flex: 1;
              flex-shrink: 0;
              .name {
                font-size: 4vw;
                color: #101010;
                font-weight: bold;
                margin-bottom: 0.8vw;
                text-overflow: ellipsis;
                white-space: nowrap;
                overflow: hidden;
              }
              .tag,
              .code,
              .en,
              .club-name {
                width: 62vw;
                height: 5vw;
                position: relative;
                font-size: 3vw;
                color: #999;
                line-height: 5vw;
                text-overflow: ellipsis;
                white-space: nowrap;
                overflow: hidden;

                span {
                  color: #333;
                }
              }
              .tag,
              .en {
                color: #909399;
              }
            }
          }
        }
      }
    }
  }
}
</style>
