<template>
  <div class="goods-list-template-con">
    <div class="hot-recommend-item-con">
      <div class="header flex-default">
        <div class="title flex-default">
          推荐数字藏品
        </div>
      </div>
      <div class="item-list-con">
        <div
          class="item-con"
          v-for="(item, index) of list"
          :key="'goods-item-' + index"
          @click="goGoods(item.goodsId, item.type,item.salesType)"
        >
          <div class="top">
            <img
              class="thumb"
              :src="item.thumb"
            />
            <div class="goods-stock" v-if="item.stockCount">
               <m-icon icon="icon-hot-goods" :size="10"/>
               <span>热销中</span>
            </div>
            <div class="goods-stock" v-else>
              <m-icon icon="icon-sell-out" :size="10"/>
               <span>已售罄</span>
            </div>
          </div>
          <div class="footer">
             <div class="title">
              {{ item.name }}
            </div>
            <div class="bottom flex-between">
              <div class="circulationCount flex-default">
                <div class="label">限量</div>
                <div class="num">{{item.circulationCount}}份</div>
              </div>
              <div class="value">
                <span class="yen">￥</span>{{ item.defaultPrice || 0 }}
              </div> 
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "推荐NFT",
    },
    line: {
      type: Number,
      default: 2,
    },
    floorId: String,
  },
  data() {
    return {
      loading: true,
      list: []
    };
  },
  computed: {},
  methods: {
    requestData() {
      this.loading = true;
      let param = this.floorId;
      this.$api({
        apiName: "getFloorGoods",
        postData: {
          param,
          page: 1,
          size: 100
        },
        success: (res) => {
          this.list = res.list;
          setTimeout(() => {
            this.loading = false;
            this.$emit("loadSuccess");
          }, 500);
        },
      });
    },
  },
};
</script>

<style lang="less">
.goods-list-template-con {
  padding: 18px 11px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F7FB 100%);
  .hot-recommend-item-con {
    // height: 328px;
    // background: #ffffff;
    border-radius: 8px;
    padding: 0 9px 20px;
    .header {
      justify-content: space-between;
      align-items: center;
      color: #140603;
      height: 50px;
      line-height: 20px;
      padding: 18px 0;
      .title {
        font-weight: bold;
        font-size: 16px;
        align-items: flex-start;
        line-height: 20px;
        // background: url(~@/assets/img/hot-recommend-nft-title.png) no-repeat;
        background-size: 100%;
        // width: 83px;
        height: 15px;
      }
      .more {
        font-size: 14px;
      }
    }
    .item-list-con {
      flex-wrap: wrap;
      justify-content: space-between;
      &::after {
        content: "";
        display: block;
        width: 107px;
      }
      .item-con {
        margin-bottom: 18px;
        overflow: hidden;
        border-radius: 8px;
        background: #ffffff;
        .top {
          height: 270px;
          width: 100%;
          overflow: hidden;
          position: relative;
          .thumb {
            height: 270px;
            width: 100%;
            background-position: center;
            margin: auto;
            object-fit: cover;
          }
          .goods-stock {
            position: absolute;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 2px;
            width: 54px;
            height: 18px; 
            top:14px;
            left:12px;
            line-height: 18px;
            text-align: center;
            span{
              font-size: 11px;
              color: #ffffff;
              margin-left:1px ;
            }
          }
        }
        .footer {
          flex: 1;
          display: flex;
          flex-direction: column;
          justify-content:space-around;
          padding:0 15px;
          .title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 18px;
            color: #030711;
            margin: 10px 0;
          }
          .bottom {
            width:100%;
            margin-bottom: 20px;
            // .label {
            //   font-size: 12px;
            //   transform: scale(0.8);
            // }
            .value {
              font-size: 22px;
              color: #F78706;
              .yen {
                display: inline-block;
                font-size: 14px;
                transform: scale(0.8);
                font-weight: normal;
                width: 14px;
              }
            }
            .circulationCount{
              width: 86px;
              height: 16px;
              line-height: 16px;
              font-size: 10px;
              overflow: hidden;
              border-radius: 2px;
              .label{
                width: 35px;
                height: 16px;
                text-align: center;
                background:#F3E0BC ;
                color: #030711;
              }
              .num {
                width: 51px;
                height: 16px;
                background: #4B4B4C;
                color:#F3E0BC;
                text-align: center;
              }
            }
          }
          .tips {
            height: 100%;
            width: 26px;
            font-size: 12px;
            color: #ffffff;
            background-color: #1a1d20;
            padding-left: 5px;
            position: relative;
            overflow: hidden;
            text-align: center;
            flex-shrink: 0;
            &::after,
            &::before {
              content: "";
              display: inline-block;
              width: 0;
              height: 0;
              border-left: 5px solid transparent;
              border-right: 5px solid transparent;
              border-top: 15px solid #dd2e41;
              position: absolute;
              left: -5px;
            }
            &::after {
              top: 13px;
            }
          }
        }
      }
    }
  }
}
</style>