<template>
  <section>
    <div class="footer__container footer-friendlink">
      <div class="footer__box footer-wrap width-1200">
        <div class="footer-friendlink__box">
          <img src="@/public/images/logo.png" class="footer-friendlink__logo" />
          <div class="footer-friendlink__baseinfo">
            <div
              class="footer-friendlink__baseinfo-item"
              style="font-size: 18px; font-size: 1.125rem; margin-bottom: 10px"
            >
              <span class="footer-friendlink__baseinfo-label">{{ $t('system.companyName') }} </span>
            </div>
            <div class="footer-friendlink__baseinfo-item">
              <span class="footer-friendlink__baseinfo-label">{{ $t('system.emailLabel') }}: </span>
              <span class="footer-friendlink__baseinfo-content">vavabuy@163.com</span>
            </div>
            <div class="footer-friendlink__baseinfo-item">
              <span class="footer-friendlink__baseinfo-label"
                >{{ $t('system.hongkongEmailLabel') }}:
              </span>
              <span class="footer-friendlink__baseinfo-content">296635202@qq.com </span>
            </div>
            <div class="footer-friendlink__baseinfo-item">
              <span class="footer-friendlink__baseinfo-label"
                >{{ $t('system.addressLabel') }}:
              </span>
              <span class="footer-friendlink__baseinfo-content"
                >{{ $t('system.companyAddress') }}
              </span>
            </div>
            <div class="footer-friendlink__baseinfo-item">
              <span class="footer-friendlink__baseinfo-label"
                >{{ $t('system.hongkongAddressLabel') }}:
              </span>
              <span class="footer-friendlink__baseinfo-content"
                >{{ $t('system.hongkongCompanyAddress') }}
              </span>
            </div>
          </div>
        </div>
        <div class="footer-friendlink__box" v-for="(itemInfo, i) in [...linkList]" :key="i">
          <div class="footer-friendlink__box-head">{{ itemInfo.name }}</div>
          <div
            v-for="(info, index) in itemInfo.lists"
            :key="index"
            class="footer-friendlink__item"
            @click="updateActiveInfo(itemInfo, info, goArticleDetailPage)"
          >
            <span
              class="text_hover_underline"
              :class="[
                activeLinkId && activeLinkId == info.id ? 'text_hover_underline--active' : '',
              ]"
              >{{ info.title }}</span
            >
          </div>
        </div>
      </div>
    </div>

    <div class="footer__container footer-right">
      <div class="footer__box width-1200">
        <span>©1997-2025 VAVA BUY.com All Rights Reserved</span>
      </div>
    </div>

    <!-- <div class="footer__container footer-footnote">
    <div class="footer__box width-1200">
      <span>{{
        $t(
          'paragraph["我们使用 cookie 来提供更好的在线体验。 访问和使用 VAVA BUY.com，即表示您同意我们使用 Cookie。 通过阅读我们的条款和条件、使用条款、 和隐私政策。"]'
        )
      }}</span>
    </div>
  </div> -->
  </section>
</template>


<script setup lang="ts">
import { watch, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import useSystemStore from '@/stores/useSystemStore'
import useFooterStore from '@/stores/useFooterStore'

// system store
const systemStore = useSystemStore()
const { locale, screenWidth } = storeToRefs(systemStore)
// footer store
const footerStore = useFooterStore()
const { linkList, activeLinkId, activeLinkInfo, activeLinkCateInfo } = storeToRefs(footerStore)
const { fetchHelpDatas, updateActiveInfo } = footerStore
// 路由对象
const route = useRoute()
const router = useRouter()

const linkListCount = computed<number>(() => {
  let count = 4
  if (screenWidth.value >= 1200) {
    count = 4
  } else if (screenWidth.value > 824) {
    count = 3
  } else if (screenWidth.value > 524) {
    count = 2
  } else {
    count = 1
  }
  return count
})

// 获取数据列表
fetchHelpDatas(locale.value)

// 跳转文章详情页
const goArticleDetailPage = function () {
  if (!activeLinkInfo.value && !activeLinkId.value) return
  router.push({
    path: '/article/article_details',
    query: {
      id: activeLinkId.value
        ? activeLinkId.value
        : activeLinkInfo.value
        ? activeLinkInfo.value.id
        : '',
      cateId: activeLinkCateInfo.value ? activeLinkCateInfo.value.id : '',
    },
  })
}
</script>


<style lang="less" scoped>
.footer__container {
  display: flex;
  justify-content: center;
  background-color: #f5f5f5;
}

.footer-friendlink {
  .footer__box {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 30px 15px;
    padding: 1.875rem 0.9375rem;
  }

  .footer-friendlink__box {
    // width: 25%;
    max-width: 360px;
    max-width: 22.5rem;
    padding: 6px 10px 10px;
    padding: 0.375rem 0.625rem 0.625rem;
  }

  .footer-friendlink__box:first-child {
    padding-top: 0;
  }

  .footer-friendlink__box .footer-friendlink__logo {
    width: 150px;
    width: 9.375rem;
    margin-bottom: 20px;
    margin-bottom: 1.25rem;
  }

  .footer-friendlink__box .footer-friendlink__box-head {
    margin-bottom: 24px;
    margin-bottom: 1.5rem;
    font-size: 18px;
    font-size: 1.125rem;
    font-weight: 500;
    color: #222;
  }

  .footer-friendlink__baseinfo {
    max-width: 360px;
    max-width: 22.5rem;
  }

  .footer-friendlink__baseinfo-item {
    margin-bottom: 6px;
    margin-bottom: 0.375rem;
    font-family: Poppins;
    font-size: 14px;
    font-size: 0.875rem;
    font-weight: normal;
    color: #3d3d3d;
  }

  .footer-friendlink__baseinfo-label {
    color: #000;
  }

  .footer-friendlink__baseinfo-content {
    color: #555;
  }

  .footer-friendlink__item {
    margin-bottom: 6px;
    margin-bottom: 0.375rem;
    font-family: Poppins;
    font-weight: normal;
    letter-spacing: 1px;
    color: #3d3d3d;
  }
}

.footer-right {
  background-color: #000;

  .footer__box {
    padding: 15px;
    padding: 0.9375rem;
    font-family: Poppins;
    font-weight: 400;
    color: rgba(255, 255, 2555, 0.8);
  }
}

.footer-footnote {
  .footer__box {
    padding: 15px;
    padding: 0.9375rem;
    font-family: Source Han Sans;
    font-weight: 400;
    color: #5a6670;
  }
}
</style>

<style lang="less" scoped>
@import url(./css/footer@1200.less);
@import url(./css/footer@1024.less);
@import url(./css/footer@768.less);
@import url(./css/footer@512.less);
</style>./hooks/useData