Add a group-buying page where a shop user lists, creates, edits, and deletes its own activities, configuring the SKU, localized name and description, group price, required paid members, active window, and group lifetime, and seeing each activity's open groups. Expose it as a group-buying navigation entry.
51 lines
1.8 KiB
Vue
51 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
const session = useSessionStore();
|
|
const { locale, locales, setLocale } = useI18n();
|
|
const route = useRoute();
|
|
|
|
onMounted(() => session.hydrate());
|
|
|
|
const isAuthPage = computed(() => route.path === "/login");
|
|
watchEffect(() => {
|
|
if (import.meta.client && session.token === null && !isAuthPage.value && route.path !== "/") {
|
|
// pages opt into auth middleware; nothing global here
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="isAuthPage">
|
|
<NuxtPage />
|
|
</div>
|
|
<div v-else class="auth-layout">
|
|
<aside>
|
|
<div class="brand">{{ $t("common.appName") }} · Shop</div>
|
|
<NuxtLink to="/">{{ $t("nav.dashboard") }}</NuxtLink>
|
|
<NuxtLink to="/products">{{ $t("nav.products") }}</NuxtLink>
|
|
<NuxtLink to="/orders">{{ $t("nav.orders") }}</NuxtLink>
|
|
<NuxtLink to="/shipments">{{ $t("nav.shipments") }}</NuxtLink>
|
|
<NuxtLink to="/invoices">{{ $t("nav.invoices") }}</NuxtLink>
|
|
<NuxtLink to="/coupons">{{ $t("nav.coupons") }}</NuxtLink>
|
|
<NuxtLink to="/flash-sales">{{ $t("nav.flashSales") }}</NuxtLink>
|
|
<NuxtLink to="/group-buying">{{ $t("nav.groupBuying") }}</NuxtLink>
|
|
</aside>
|
|
<main>
|
|
<div class="main-head">
|
|
<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>
|
|
<NuxtPage />
|
|
</main>
|
|
</div>
|
|
</template>
|