<script setup>
import Head_menu from "@/module/head_menu.vue";
import Footer from "@/module/footer.vue";
// 过滤产品
import {computed, ref} from 'vue'

// 产品分类
const categories = [
  {id: 'all', name: '全部'},
  {id: 'ArtCustomization', name: '子类 1'},
  {id: 'ModelMaking', name: '子类 2'},
  {id: 'MoreServices', name: '子类 3'}
]

const activeCategory = ref('all')

// 产品列表
const products = [
  {
    id: 1,
    category: 'ArtCustomization',
    icon: '🖼️︎',
    name: '美术定制',
    description: '美术定制 简介',
    features: ['美术定制'],
    price: '¥ 999/张 起'
  },
  {
    id: 2,
    category: 'ModelMaking',
    icon: '🛩️',
    name: '模型制作',
    description: '模型制作 简介',
    features: ['模型制作'],
    price: '¥ 1999/个 起'
  },
  {
    id: 3,
    category: 'MoreServices',
    icon: '🗐',
    name: '更多服务...',
    description: '更多服务敬请期待...',
    features: ['更多服务'],
    price: '¥ xxx/月 起'
  }
]

const filteredProducts = computed(() => {
  if (activeCategory.value === 'all') {
    return products
  }
  return products.filter(p => p.category === activeCategory.value)
})

// 服务特色
const serviceFeatures = [
  {
    icon: '⚡',
    title: '快速',
    description: '客服极速响应，不再等待！'
  },
  {
    icon: '🔄',
    title: '持续',
    description: '定期推出我们的更新'
  },
  {
    icon: '🎯',
    title: '定制',
    description: '根据需求提供个性化解决方案'
  },
  {
    icon: '💬',
    title: '专属',
    description: '一对一技术支持和咨询服务'
  }
]
</script>

<template>
  <div class="products-page">
    <!--顶部导航栏-->
    <head_menu></head_menu>

    <!--页面标题区域-->
    <section class="hero-section">
      <div class="container">
        <h1 class="page-title">我们的服务</h1>
        <p class="page-subtitle">为您提供前所未有的服务体验！</p>
      </div>
    </section>

    <!--产品分类筛选-->
    <section class="filter-section container">
      <div class="filter-tabs">
        <button
            v-for="category in categories"
            :key="category.id"
            :class="['filter-tab', { active: activeCategory === category.id }]"
            @click="activeCategory = category.id"
        >
          {{ category.name }}
        </button>
      </div>
    </section>

    <!--产品列表区域-->
    <section class="products-section container">
      <div class="products-grid">
        <div v-for="product in filteredProducts" :key="product.id" class="product-card card">
          <div class="product-header">
            <div class="product-icon">{{ product.icon }}</div>
            <h3 class="product-name">{{ product.name }}</h3>
          </div>
          <p class="product-desc">{{ product.description }}</p>
          <div class="product-features">
            <span v-for="(feature, index) in product.features" :key="index" class="feature-tag">
              {{ feature }}
            </span>
          </div>
          <div class="product-footer">
            <div class="product-price">{{ product.price }}</div>
            <el-button size="default" type="primary">了解详情</el-button>
          </div>
        </div>
      </div>
    </section>

    <!--服务特色区域-->
    <section class="features-section">
      <div class="container">
        <h2 class="section-title">服务特色</h2>
        <p class="section-subtitle">为什么选择我们的产品和服务</p>
        <div class="features-grid">
          <div v-for="(feature, index) in serviceFeatures" :key="index" class="feature-item card">
            <div class="feature-icon">{{ feature.icon }}</div>
            <h3 class="feature-title">{{ feature.title }}</h3>
            <p class="feature-desc">{{ feature.description }}</p>
          </div>
        </div>
      </div>
    </section>

    <!--行动号召区域-->
    <section class="cta-section container">
      <div class="cta-content card">
        <h2 class="cta-title">需要定制化解决方案？</h2>
        <p class="cta-desc">我们的专家团队将为您量身打造最适合的产品组合</p>
        <router-link class="btn-primary" to="/contact">联系我们</router-link>
      </div>
    </section>

    <!--页脚-->
    <Footer/>
  </div>
</template>

<style scoped>
.products-page {
  min-height: 100vh;
}

/* 顶部区域 */
.hero-section {
  background: var(--gradient-primary);
  padding: 80px 20px;
  text-align: center;
  color: white;
}

.page-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
}

.page-subtitle {
  font-size: 18px;
  opacity: 0.95;
}

/* 筛选区域 */
.filter-section {
  padding: 40px 20px;
}

.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 10px 24px;
  border: 2px solid var(--border-color);
  background: white;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-tab:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 产品列表区域 */
.products-section {
  padding: 40px 20px 80px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.product-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-header {
  margin-bottom: 20px;
}

.product-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.product-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.product-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.product-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.feature-tag {
  padding: 6px 12px;
  background: var(--bg-light);
  color: var(--primary-color);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.product-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

/* 服务特色区域 */
.features-section {
  background: var(--bg-light);
  padding: 80px 20px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.feature-item {
  text-align: center;
  padding: 40px 30px;
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.feature-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 行动号召区域 */
.cta-section {
  padding: 80px 20px;
}

.cta-content {
  text-align: center;
  padding: 60px 40px;
  background: var(--gradient-dark);
  color: white;
}

.cta-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
}

.cta-desc {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .page-title {
    font-size: 36px;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    gap: 12px;
  }

  .filter-tab {
    padding: 8px 16px;
    font-size: 14px;
  }

  .product-footer {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
}
</style>
