feat(mall): classic B2B2C PC storefront with fixed mock API layer
- Mock adapter implementing @vmall/shared ApiClient (localStorage-persisted cart/orders/invoices), runtime switch via mockApi flag (default on) - Fixed bilingual mock catalog: 3-level categories, 24 products w/ SKUs, stores, brands, banners, floors, seckill/collective/integral, comments, coupons, addresses, seeded orders/shipments/invoices - B2B2C mall shell: top bar, logo/search/cart header, dark nav + category mega-menu, value-prop footer, back-to-top; 1200px grid, #ca151e theme - UI primitives replacing element-plus: carousel, pagination, breadcrumb, qty stepper, rating stars, modal, tabs, step bar, product card - Pages: home floors, search (filters/sort/paging), goods detail (SKU picker, store rail, review tabs), cart -> checkout -> pay -> success, auth pages, user center (dashboard/orders/addresses/favorites/coupons/ invoices), stores, seckill, collective, integral - i18n split into per-domain locale modules (en+zh) - OpenSpec change mall-pc-storefront-replica archived; all specs green
This commit is contained in:
+4
-45
@@ -1,56 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
const session = useSessionStore();
|
||||
const { locale, locales, setLocale } = useI18n();
|
||||
const { currency } = usePrefs();
|
||||
const { $api } = useNuxtApp();
|
||||
|
||||
onMounted(() => session.hydrate());
|
||||
|
||||
const currencies = ref<string[]>(["USD"]);
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const list = await $api.listCurrencies();
|
||||
if (list.length > 0) currencies.value = list.map((c) => c.code);
|
||||
} catch {
|
||||
/* API may be down during SSR-less dev */
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<header class="topnav">
|
||||
<div class="container topnav-inner">
|
||||
<NuxtLink to="/" class="brand">{{ $t("common.appName") }}</NuxtLink>
|
||||
<nav>
|
||||
<NuxtLink to="/">{{ $t("nav.home") }}</NuxtLink>
|
||||
<NuxtLink to="/cart">{{ $t("nav.cart") }}</NuxtLink>
|
||||
<NuxtLink to="/orders">{{ $t("nav.orders") }}</NuxtLink>
|
||||
<NuxtLink to="/invoices">{{ $t("nav.invoices") }}</NuxtLink>
|
||||
</nav>
|
||||
<select
|
||||
:value="currency"
|
||||
:aria-label="$t('common.currency')"
|
||||
@change="currency = ($event.target as HTMLSelectElement).value"
|
||||
>
|
||||
<option v-for="c in currencies" :key="c" :value="c">{{ c }}</option>
|
||||
</select>
|
||||
<select
|
||||
:value="locale"
|
||||
:aria-label="$t('common.language')"
|
||||
@change="setLocale(($event.target as HTMLSelectElement).value as 'en' | 'zh')"
|
||||
>
|
||||
<option v-for="l in locales" :key="l.code" :value="l.code">{{ l.name }}</option>
|
||||
</select>
|
||||
<template v-if="session.isLoggedIn">
|
||||
<span class="muted">{{ session.user?.display_name }}</span>
|
||||
<button class="btn sm" @click="session.logout()">{{ $t("common.logout") }}</button>
|
||||
</template>
|
||||
<NuxtLink v-else to="/login" class="btn sm primary">{{ $t("common.login") }}</NuxtLink>
|
||||
</div>
|
||||
</header>
|
||||
<main class="container page">
|
||||
<ShellTopBar />
|
||||
<ShellSiteHeader />
|
||||
<main class="mall-main">
|
||||
<NuxtPage />
|
||||
</main>
|
||||
<ShellSiteFooter />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user