/*
    一行一个，图片在左
 */
<template>
  <div class="tab_content abroad" :class="notab?'notab':''">
    <template v-for="(item,index) in list">
      <div class="uni_item" :key="index" @click="handleUniDetail(item)">
        <div class="img_box">
          <!-- <img :loading="defaultImg"  v-lazy="item.coverUrl" alt=""> -->
          <img :src="item.coverUrl?item.coverUrl:defaultImg" alt="">
          <div class="bottom">
            <span class="count">
              <van-icon name="eye-o" /> {{item.read_count}}
            </span>
          </div>
          <span class="pintuan_tag" v-if="item.minPeopleCount<=item.applyCount">已成团</span>
        </div>
        <div class="content">
          <div>
            <p class="title">{{item.course_name}}</p>
            <!-- <p class="des">{{item.course_info}}</p> -->
            <p class="active_time" v-if="item.startDate==item.endDate">活动时间：{{item.startDate}} {{item.week}}</p>
            <p class="active_time" v-else>活动时间：{{item.startDate}}-{{item.endDate}}</p>
            <div class="tag_box">
              <template v-for="(tag,index2) in item.course_labels">
                <span class="tag" v-if="tag" :key="index2">{{tag}}</span>
              </template>
            </div>
          </div>
          <div class="flex_box">
            <div>
              <p class="address">{{item.cityAddress}}{{item.cityAddress&&item.areaAddress?'·':''}}{{item.areaAddress}}</p>
              <p class="price" v-if="item.showPrice>0"><span class="icon">¥</span>{{item.showPrice}}<span class="tint">起 </span><span class="limit">/{{item.minPeopleCount}}人成团</span></p>
              <p class="price free" v-else>免费 <span class="limit">/{{item.minPeopleCount}}人成团</span></p>
            </div>
            <div class="pintuan" :class="item.applyCount>=item.stockCount?'disabled':''">
              <p>{{item.applyCount>=item.stockCount?'已满团':'拼团中'}}</p>
              <span class="span1">已报名{{item.applyCount}}</span>
              <span class="span2">/{{item.stockCount}}</span>
            </div>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: []
    },
    notab: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      active: 0,
      defaultImg: require('@/assets/service/defCoure.jpg'),
    }
  },
  methods: {
    handleUniDetail (item) {
      this.$router.push({ name: 'ServiceAbroadDetail', query: { courseId: item.id} })
    },
  }
}
</script>
<style lang="scss" scoped>
.tab_content {
  // height: calc(100vh - 360px - 196px);
  box-sizing: border-box;
  // overflow: auto;
  // &.notab {
  //   height: calc(100vh - 196px);
  // }
}
.tab_btn_box {
  .tab_btn {
    width: 178px;
    height: 52px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.36);
    color: #666666;
    padding: 0;
    margin-right: 16px;
    &.active {
      background: #ffffff;
      color: #4092ff;
    }
  }
}
.abroad {
  padding: 18px 0;
  padding-bottom: 146px;
  .padding_box {
    padding: 0 28px;
    padding-bottom: 16px;
  }
  .line {
    width: 100%;
    height: 16px;
    background: #f5f6fa;
  }
  .uni_item {
    position: relative;
    margin-top: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 694px;
    margin-top: 24px;
    padding: 0 28px;
    .img_box {
      position: relative;
      border-radius: 16px;
      overflow: hidden;
      width: 273px;
      img {
        width: 364px;
        height: 273px;
        margin-left: -45.5px;
      }
      .bottom {
        position: absolute;
        bottom: 0;
        left: 0;
        color: #fff;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
        padding: 0 20px;
        background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
        .count {
          font-size: 24px;
        }
      }
      .pintuan_tag {
        display: block;
        width: 116px;
        // height: 38px;
        background: #f64c37;
        border-top-left-radius: 16px;
        border-bottom-right-radius: 16px;
        font-size: 24px;
        color: #fff;
        line-height: 38px;
        text-align: center;
        position: absolute;
        top: 0;
      }
    }
    .content {
      width: 400px;
      height: 276px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .title {
        font-size: 28px;
        .status {
          font-size: 20px;
          display: inline-block;
          width: 78px;
          line-height: 32px;
          border-radius: 6px;
          text-align: center;
          vertical-align: top;
          margin-top: 4px;
          margin-right: 10px;
        }
        .status1 {
          background: #94d3f4;
          color: #136894;
        }
        .status2 {
          background: #ffe9b1;
          color: #a15b2b;
        }
        .status3 {
          background: #ff3909;
          color: #ffffff;
        }
      }
      .des {
        font-size: 24px;
        color: #999999;
        margin-top: 10px;
      }
      .active_time {
        font-size: 24px;
      }
      .address {
        font-size: 24px;
        margin-top: 10px;
        white-space: nowrap;
      }
      .tag_box {
        .tag {
          display: inline-block;
          margin-top: 10px;
          margin-right: 10px;
          color: #4092ff;
          font-size: 20px;
          border-radius: 4px;
          border: 2px solid #4092ff;
          padding: 0px 6px;
        }
      }
      .price {
        font-size: 32px;
        font-weight: bold;
        margin-top: 12px;
        color: #f64c37;
        .icon {
          font-size: 24px;
          color: #f64c37;
        }
        .tint {
          font-size: 22px;
          font-weight: normal;
          color: #909399;
        }
        .limit {
          font-size: 22px;
          font-weight: normal;
          color: #333333;
        }
      }
      .free {
        font-size: 28px;
      }
      .flex_box {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
      .pintuan {
        width: 158px;
        height: 68px;
        background: #f64c37;
        border-radius: 8px;
        color: #fff;
        font-size: 20px;
        text-align: center;
        font-weight: bold;
        line-height: 30px;
        padding: 6px 0;
        box-sizing: border-box;
        &.disabled {
          background: #dadada;
        }
        .span2 {
          font-weight: initial;
        }
      }
    }
  }
}
</style>
<style lang="scss">
// 长辈版
.elder {
  .abroad {
    .uni_item {
      .content {
        height: auto;
        .title {
          font-size: 40px;
        }
        .active_time {
          font-size: 32px;
        }
        .tag_box {
          .tag {
            font-size: 32px;
          }
        }
        .address {
          font-size: 40px;
        }
        .price {
          font-size: 40px;
          .icon {
            font-size: 40px;
          }
          .tint {
            font-size: 40px;
          }
          .limit {
            font-size: 34px;
          }
        }
        .flex_box {
          display: block;
        }
        .pintuan {
          width: auto;
          height: auto;
          font-size: 34px;
          line-height: 44px;
        }
      }
      .img_box .bottom .count {
        font-size: 34px;
      }
    }
  }
}
</style>