<template>
  <div class="footer-container">
    <div class="footer-content">
      <div class="footer-section">
        <div class="footer-logo">
          <img
            src="D:\code\Restaurant-management-system\uni-frontend\vue-beta\src\assets\image\logo.png"
            alt="Logo"
            class="logo"
          />
          <span class="company-name">商户线上经营平台</span>
        </div>
        <p class="footer-description">为商户提供全方位的线上经营解决方案，助力商业成功</p>
      </div>

      <div class="footer-section">
        <h4 class="footer-title">产品服务</h4>
        <ul class="footer-links">
          <li><a href="#">订单管理</a></li>
          <li><a href="#">商品管理</a></li>
          <li><a href="#">门店管理</a></li>
          <li><a href="#">财务管理</a></li>
        </ul>
      </div>

      <div class="footer-section">
        <h4 class="footer-title">联系我们</h4>
        <ul class="footer-contact">
          <li>
            <el-icon><Phone /></el-icon>
            <span>400-123-4567</span>
          </li>
          <li>
            <el-icon><Message /></el-icon>
            <span>service@platform.com</span>
          </li>
          <li>
            <el-icon><Location /></el-icon>
            <span>北京市朝阳区xxx大厦</span>
          </li>
        </ul>
      </div>
    </div>

    <div class="footer-bottom">
      <div class="footer-bottom-content">
        <div class="copyright">
          <span>&copy; 2025 商户线上经营平台. 保留所有权利</span>
        </div>
        <div class="footer-meta">
          <span class="divider">|</span>
          <span>当前用户: {{ currentUser }}</span>
          <span class="divider">|</span>
          <span>最后更新: {{ currentTime }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Phone, Message, Location } from '@element-plus/icons-vue'

export default {
  name: 'AppFooter',
  components: {
    Phone,
    Message,
    Location,
  },
  data() {
    return {
      currentUser: 'qq1244154570',
      currentTime: '',
    }
  },
  mounted() {
    this.updateTime()
    // 每分钟更新一次时间
    setInterval(this.updateTime, 60000)
  },
  methods: {
    updateTime() {
      const now = new Date()
      this.currentTime = now.toLocaleString('zh-CN', {
        year: 'numeric',
        month: '2-digit',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
      })
    },
  },
}
</script>

<style scoped>
.footer-container {
  background-color: #f8f9fa;
  border-top: 1px solid #e6e6e6;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
}

.footer-section {
  display: flex;
  flex-direction: column;
}

/* Logo 区域 */
.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.company-name {
  font-size: 16px;
  font-weight: bold;
  color: #303133;
  letter-spacing: 1px;
}

.footer-description {
  color: #606266;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* 标题样式 */
.footer-title {
  font-size: 16px;
  font-weight: bold;
  color: #303133;
  margin: 0 0 16px 0;
}

/* 链接列表和联系方式列表基础样式 */
.footer-links,
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* 链接列表 */
.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: #606266;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #409eff;
}

/* 联系方式 */
.footer-contact li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #606266;
  font-size: 14px;
}

.footer-contact .el-icon {
  color: #909399;
  font-size: 16px;
}

/* 底部区域 */
.footer-bottom {
  background-color: #fff;
  border-top: 1px solid #e6e6e6;
  padding: 16px 0;
}

.footer-bottom-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright {
  color: #909399;
  font-size: 14px;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #909399;
  font-size: 12px;
}

.divider {
  color: #d3d4d6;
  font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 15px;
  }

  .footer-bottom-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 0 15px;
  }

  .footer-meta {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .footer-logo {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .company-name {
    font-size: 14px;
  }
}
</style>
