<template>
  <div class="goods-list-template-con">
    <div class="blind-goods-item-con">
      <div class="header">
        <div class="title">盲盒</div>
      </div>
      <div
        class="item-list-con flex-default"
        v-for="(item, index) of list"
        :key="'goods-item-' + index"
        @click="goGoods(item.goodsId, item.type,item.salesType)"
      >
        <div class="left-img">
          <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="right-con flex-default">
          <div class="title">
            {{ item.name }}
          </div>
          <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>
</template>

<script>
import GoodsItem from "./goods-item.vue";
export default {
  components: {
    GoodsItem,
  },
  props: {
    title: {
      type: String,
      default: "电影专区",
    },
    line: {
      type: Number,
      default: 1,
    },
    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: this.line * 3,
        },
        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%);
  .blind-goods-item-con {
    .header {
      justify-content: space-between;
      align-items: center;
      color: #140603;
      height: 50px;
      line-height: 20px;
      padding: 0 16px;
    //   margin-bottom: 20px;
      .title {
        font-weight: bold;
        font-size: 16px;
        align-items: flex-start;
        line-height: 20px;
        height: 15px;
      }
    }
    .item-list-con {
      background: url(~@/assets/img/blind-card.png) no-repeat;
      background-size: 100% 100%;
      margin-bottom: 45px;
      padding: 28px;
      height: 160px;
      .left-img {
        position: relative;
        width: 120px;
        height: 146px;
        border-radius: 10px;
        // overflow: hidden;
        .thumb {
          width: 120px;
          height: 146px;
          border-radius: 10px;
          object-fit: cover;
          margin-top: -25px;
        }
        .goods-stock {
          position: absolute;
          background: rgba(0, 0, 0, 0.2);
          border-radius: 0 0 10px 10px;
          width: 120px;
          height: 18px;
          bottom: 25px;
          left: 0;
          line-height: 18px;
          text-align: center;
          span {
            font-size: 11px;
            color: #ffffff;
            margin-left: 1px;
          }
        }
      }
      .right-con {
        flex-direction: column;
        align-items: flex-start;
        justify-content: space-around;
        height: 130px;
        padding:5px 10px 10px;
        .title {
          width: 170px;
          font-size: 15px;
          font-weight: 500;
          color: #030711;
          line-height: 21px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .circulationCount {
          width: 86px;
          height: 16px;
          line-height: 16px;
          font-size: 10px;
          overflow: hidden;
          border-radius: 2px;
          margin-bottom: 22px;
          .label {
            width: 35px;
            height: 16px;
            text-align: center;
            background: #f3e0bc;
            color: #030711;
          }
          .num {
            width: 51px;
            height: 16px;
            background: #4b4b4c;
            color: #f3e0bc;
            text-align: center;
          }
        }
        .value {
          font-size: 22px;
          color: #f78706;
          .yen {
            display: inline-block;
            font-size: 14px;
            transform: scale(0.8);
            font-weight: normal;
            width: 14px;
          }
        }
      }
    }
  }
}
</style>