<template>
  <div class="user-home-page">
	  <section class="welcome-banner">
	  	<h1>欢迎使用旭日快递用户系统</h1>
	  	<p>在这里您可以查看快递状况、下单快递。</p>
	  </section>
    <!-- 用户信息部分 -->
    <section class="user-info">
      <el-row :gutter="20">
        <el-col :span="8">
          <el-card class="user-card">
            <div class="user-title">用户名</div>
            <div class="user-value">{{ username }}</div>
          </el-card>
        </el-col>
        <el-col :span="8">
          <el-card class="user-card">
            <div class="user-title">账户余额</div>
            <div class="user-value">{{ balance }} 元</div>
          </el-card>
        </el-col>
        <el-col :span="8">
          <el-card class="user-card">
            <div class="user-title">最近登录</div>
            <div class="user-value">{{ lastLogin }}</div>
          </el-card>
        </el-col>
      </el-row>
    </section>

    <!-- 快递状态部分 -->
    <section class="express-status">
      <el-row :gutter="20">
        <el-col :span="8">
          <el-card class="status-card">
            <div class="status-title">最新快递</div>
            <div class="status-value">{{ latestExpress }}</div>
            <el-button type="text" @click="goToPage('/express/detail')">查看详情</el-button>
          </el-card>
        </el-col>
        <el-col :span="8">
          <el-card class="status-card">
            <div class="status-title">当前订单</div>
            <div class="status-value">{{ currentOrderStatus }}</div>
            <el-button type="text" @click="goToPage('/express/ongoing')">查看详情</el-button>
          </el-card>
        </el-col>
        <el-col :span="8">
          <el-card class="status-card">
            <div class="status-title">已完成订单</div>
            <div class="status-value">{{ completedOrders }}</div>
            <el-button type="text" @click="goToPage('/express/completed')">查看详情</el-button>
          </el-card>
        </el-col>
      </el-row>
    </section>

    <!-- 常用功能区 -->
    
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

// 用户信息
const username = ref('张三');
const balance = ref(100.5); // 账户余额
const lastLogin = ref('2024年11月19日 10:00');

// 快递状态
const latestExpress = ref('快递001：正在运输中');
const currentOrderStatus = ref('快递002：待取件');
const completedOrders = ref(25);

// 跳转到指定页面
const router = useRouter();
const goToPage = (path) => {
  router.push(path);
};
</script>

<style scoped>
.user-home-page {
  padding: 20px;
  background-color: #f9f9f9;
}

.user-info,
.express-status {
  margin-bottom: 30px;
}

.user-card,
.status-card {
  text-align: center;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.user-title,
.status-title {
  font-size: 18px;
  color: #606266;
  margin-bottom: 10px;
}

.user-value,
.status-value {
  font-size: 24px;
  font-weight: bold;
  color: #409EFF;
}

.quick-actions {
  margin-top: 30px;
  text-align: center;
}

.el-button {
  width: 100%;
  padding: 15px 0;
}

.el-row {
  margin-top: 10px;
}

.el-card {
  cursor: pointer;
}

.el-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.welcome-banner h1 {
	font-size: 24px;
	margin: 0;
}
</style>
