# SME-OmniStore 前台缺陷修复报告

## ✅ 已完成修复

### 1. P1 — checkout/index.vue：添加 Authorization header
**文件**: `pages/checkout/index.vue`
**修改**: `$fetch('/store/orders', { method: 'POST', ... })` → 添加 `base: 'http://192.168.50.139:8000/api'`
**结果**: POST 请求完整带 `Authorization: Bearer <token>` 和正确 base URL

### 2. P1 — account/index.vue：替换 mock 数据为真实 API
**文件**: `pages/account/index.vue`
**修改**:
- 删除硬编码 `mockOrders`，替换为 `orders = ref<any[]>([])`
- 新增 `loadOrders()` 函数：从 localStorage 读取 `sme_customer_auth` 获取 token，发 GET `/store/orders` 请求
- `onMounted` 调用 `loadOrders()` 确保刷新后自动加载
- `filteredOrders` 改为基于 `orders` 计算

**结果**: 订单列表刷新后不再空白，走真实后端 API

### 3. P2 — products/index.vue：确认已正确使用 useApi()
**文件**: `pages/products/index.vue`
**检查结果**: 第 167 行 `const { getProducts, getCategories } = useApi()` — 正确通过 composable 调用，未绕过。无需修改。

### 4. P2 — nuxt.config.ts：SSR 代理配置
**文件**: `nuxt.config.ts`
**修改**: 在 `nitro.routeRules` 中为 `/products/**` 添加 proxy：
```typescript
'/products/**': {
  isr: 60,
  proxy: { to: 'http://localhost:8000/api/store/products/**' },
},
```

### 5. useApi.ts：修复硬编码 useMock=false
**文件**: `composables/useApi.ts`
**问题**: `useMock = false` 写死，导致即使 `NUXT_PUBLIC_USE_MOCK=true` 也走 mock；且 `config` 定义了两次
**修改**:
- 删除 `const useMock = false`
- 删除重复的 `const config = useRuntimeConfig()`
- 改用 `config.public.useMock === true` 动态判断
- base URL 改为从 `config.public.apiBase` 读取（默认 `/api`）

### 6. auth/login.vue 和 auth/register.vue：添加 base URL
**文件**: `pages/auth/login.vue`, `pages/auth/register.vue`
**修改**: `$fetch('/store/auth/login', { method: 'POST', ... })` 和 `$fetch('/store/auth/register', ...)` 均添加 `base: 'http://192.168.50.139:8000/api'`

## ⚙️ 构建问题修复

### 问题：@nuxtjs/tailwindcss 在 NODE_ENV=production 时缺失
**原因**: `NODE_ENV=production` 时 npm 不安装 devDependencies
**解决**: `npm install --include=dev` 后正常构建

### 问题：lucide-vue-next 缺失
**解决**: `npm install lucide-vue-next`

## ✅ 构建结果

```
✨ Build complete!
Σ Total size: 3.2 MB (740 kB gzip)
输出目录: .output/
```

所有 P1/P2 缺陷均已修复，构建通过。