<template>
  <div class="goods-list-template-con">
    <div class="hot-goods-item-con">
      <div class="header flex-default">
        <div class="title flex-default">
          <m-icon icon="icon-hot" className="hot" :size="18" />
          <span>{{ title }}</span>
        </div>
        <!-- <text class="more">更多</text> -->
      </div>
      <div class="list-con flex-default">
        <div
          class="item-con flex-default"
          v-for="(item, index) of list"
          :key="'goods-item-' + index"
          @click="goGoods(item.goodsId, item.type,item.salesType)"
        >
          <div class="goods-item flex-default">
            <img class="thumb" :src="item.thumb" />
            <div class="price">￥{{ item.defaultPrice || 0 }}</div>
            <!-- <div class="old-price">￥{{ item.defaultPrice || 0 }}</div> -->
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "爆款抢购",
    },
    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: 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;
  .hot-goods-item-con {
    > .header {
      justify-content: space-between;
      align-items: center;
      color: #140603;
      margin-bottom: 10px;

      .title {
        font-weight: bold;
        font-size: 16px;
        align-items: flex-start;
      }

      .hot {
        margin-right: 5px;
      }
      .more {
        font-size: 14px;
      }
    }

    > .list-con {
      flex-wrap: wrap;
      justify-content: space-between;
      &::after {
        content: "";
        display: block;
        width: 114px;
      }
      .item-con {
        width: 114px;
        margin-bottom: 6px;
        justify-content: center;
      }
      .goods-item {
        overflow: hidden;
        background: #ffffff;
        border-radius: 8px;
        width: 114px;
        // height: 150px;
        padding-bottom: 8px;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        .thumb {
          width: 114px;
          height: 106px;
          margin-bottom: 4px;
          object-fit: cover;
        }
        .price {
          font-size: 15px;
          line-height: 17px;
          color: #F78706;
          font-weight: bold;
        }
        .old-price {
          font-size: 12px;
          color: #aeaeae;
          line-height: 14px;
          text-decoration: line-through;
          transform: scale(0.8);
          transform-origin: 50% 50%;
        }
      }
    }
  }
}
</style>
