<template>
  <div class="goods-shop-con">
    <div class="header flex-default" @click="goShop(data.merchantId)">
      <div class="thumb">
        <img :src="data.shopImage" mode="" style="width: 100%; height: 100%" />
      </div>
      <div class="desc">
        <div class="name">{{ data.merchantName }}</div>
        <!-- <div class="score">评分 {{ data.comment | commontFilter }}</div> -->
      </div>
      <m-icon icon="icon-more" :size="10" className="more" />
    </div>
    <div class="title">精选数字藏品</div>
    <div class="goods-list flex-default">
      <div
        class="item"
        v-for="(item, index) in RecommendList"
        :key="index"
        @click="goGoods(item.goodsId, item.type,item.salesType)"
      >
        <img :src="item.thumb" />
      </div>
    </div>
    <div class="bottom flex-default">
      <van-button class="all-btn" @click="goShop(data.merchantId)" plain>查看全部</van-button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default: () => {
        return {
          id: "",
          name: "",
        };
      },
    },
  },
  data() {
    return {
      RecommendList: [],
    };
  },
  filters: {
    commontFilter(val) {
      if (typeof val === "number") {
        return val.toFixed(1);
      } else {
        return "";
      }
    },
  },
  methods: {
    requestData() {
      this.$api({
        apiName: "getShopRecommend",
        postData: { merchantId: this.data.merchantId },
        success: (res) => {
          this.RecommendList = res;
        },
      });
    },
  },
};
</script>

<style lang="less">
.goods-shop-con {
  padding: 15px 17px;
  background: #ffffff;
  border-radius: 10px;
  margin-bottom: 10px;
  > .header {
    align-items: center;
    margin-bottom: 20px;
    .thumb {
      height: 50px;
      width: 50px;
      background-color: #ffffff;
      box-shadow: 0px 2px 6px 0px #f1f1f1;
      border-radius: 4px;
      margin-right: 10px;
      img{
        object-fit: cover;
        border-radius: 4px;
      }
    }
    .desc {
      flex: 1;
    }
    .desc .name {
      color: #140603;
      font-size: 14px;
      font-weight: bold;
      line-height: 20px;
      margin-bottom: 8px;
    }
    .desc .score {
      color: #aeaeae;
      font-size: 12px;
      line-height: 17px;
    }
    .more {
    }
  }
  > .title {
    color: #140603;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  > .goods-list {
    justify-content: space-between;
    flex-wrap: wrap;
    &::after{
      content: '';
      display: block;
      width: 108px;
    }
    .item {
      width: 108px;
      height: 108px;
      border-radius: 4px;
      img {
        width: 100%;
        height: 100%;
        border-radius: 4px;
        object-fit: cover;
      }
    }
  }
  > .bottom {
    margin-top: 18px;
    justify-content: center;
  }
  > .bottom .all-btn {
    font-size: 12px;
    color: #140603;
    height: 30px;
    line-height: 28px;
    border: 1px solid #aeaeae;
    border-radius: 15px;
    background: #ffffff;
    padding: 0 19px;
    &::after {
      border: none;
    }
  }
}
</style>