<template>
  <div id="app">
    <header class="app-header">
      <h1>🔍 商城回收系统 - 日志测试平台</h1>
      <p class="subtitle">Spring Cloud微服务日志完整链路演示</p>
    </header>
    
    <nav class="tab-nav">
      <button 
        v-for="tab in tabs" 
        :key="tab"
        @click="activeTab = tab"
        :class="['tab-btn', { active: activeTab === tab }]"
      >
        {{ tab === 'order' ? '📦 订单管理' : '💰 支付管理' }}
      </button>
    </nav>

    <div class="content">
      <OrderComponent v-if="activeTab === 'order'" />
      <PaymentComponent v-if="activeTab === 'payment'" />
    </div>

    <footer class="app-footer">
      <p>💡 提示：每个操作都会在后端生成JSON格式的结构化日志，包含:
        <br/>traceId（链路追踪ID）、uri_group（规范化URI）、event_class（事件分类）、duration（耗时）
      </p>
      <p>查看后端控制台输出，观看JSON格式日志的生成 | <code>curl http://localhost:8080/api/health</code> 查看服务健康状态</p>
    </footer>
  </div>
</template>

<script>
import OrderComponent from './components/OrderComponent.vue'
import PaymentComponent from './components/PaymentComponent.vue'

export default {
  name: 'App',
  components: {
    OrderComponent,
    PaymentComponent
  },
  data() {
    return {
      activeTab: 'order',
      tabs: ['order', 'payment']
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.app-header h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 28px;
}

.subtitle {
  color: #666;
  font-size: 14px;
}

.tab-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 0 20px 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 30px;
  font-size: 16px;
  border: 2px solid white;
  background: transparent;
  color: white;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tab-btn.active {
  background: white;
  color: #667eea;
}

.content {
  flex: 1;
  padding-bottom: 20px;
}

.app-footer {
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  text-align: center;
  margin-top: auto;
  border-top: 1px solid #eee;
}

.app-footer p {
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  margin: 10px 0;
}

.app-footer code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: #d63384;
}
</style>
