<template>
  <div class="brand-recommend">
    <p class="title">热门推荐</p>
    <ScrollView :list="list" scroll-x class="content">
      <div class="recommend-content">
        <div class="group-item" @click="handleShop(item)" v-for="item of list" :key="item.shopId">
          <div class="logo-wrapper">
            <img loading="lazy" :src="config.sourceUrl + item.materialList?.[0]" alt="" class="shop-logo" />
          </div>
          <p class="name">
            <span class="shop-name">{{ switchLanguage(item, 'shopName') }}</span>
            <span class="name-right"><img :src="config.sourceUrl + item.industryUrl" class="format-icon" alt="" />{{ item.floor }}</span>
          </p>
        </div>
      </div>
    </ScrollView>
  </div>
</template>

<script setup>
import ScrollView from '@/base/ScrollView/ScrollView.vue'

defineProps({
  list: Array,
  config: Object
})
const emits = defineEmits(['click'])

function handleShop(item) {
  emits('click', item)
}
</script>

<style lang="scss" scoped>
.brand-recommend {
  margin-left: 170px;

  .title {
    font-weight: 700;
    font-size: 24px;
    font-family: 'font_bold';
    color: rgba(0, 0, 0, 0.8);
    padding-bottom: 12px;
  }
  .content {
    width: 910px;
    overflow: hidden;
    margin-bottom: 40px;
  }
  .recommend-content {
    display: inline-block;
    white-space: nowrap;
    padding-top: 32px;
    height: 255px;
  }
  .group-item {
    display: inline-block;
    width: 320px;
    height: 220px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    overflow: hidden;
    margin-right: 16px;
  }
  .logo-wrapper {
    width: 320px;
    height: 180px;
    background-color: #fff;
  }
  .shop-logo {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
  }
  .name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 12px;
  }
  .shop-name {
    font-weight: 700;
    font-size: 12px;
    line-height: 14px;
    font-family: 'font_bold';
    color: rgba(0, 0, 0, 0.6);
  }
  .name-right {
    font-weight: 700;
    display: flex;
    align-items: center;
    font-size: 12px;
    line-height: 14px;
    font-family: 'font_bold';
    color: rgba(0, 0, 0, 0.4);
  }
  .format-icon {
    width: 14px;
    height: 14px;
    margin-right: 8px;
  }
}
</style>
