fix: cart
This commit is contained in:
@@ -34,10 +34,33 @@
|
||||
|
||||
<div class="flex-1 flex flex-col">
|
||||
<div class="flex h-(--ui-header-height) shrink-0 items-center justify-between px-4 border-b border-default">
|
||||
<div class="flex items-center gap-2">
|
||||
<UButton icon="i-lucide-panel-left" color="neutral" variant="ghost" aria-label="Toggle sidebar"
|
||||
@click="open = !open" />
|
||||
<span class="text-[20px] font-medium">{{ pageTitle }}</span>
|
||||
<div class="flex items-center gap-5">
|
||||
<div class="flex items-center gap-2">
|
||||
<UButton icon="i-lucide-panel-left" color="neutral" variant="ghost" aria-label="Toggle sidebar"
|
||||
@click="open = !open" />
|
||||
<span class="text-[20px] font-medium">{{ pageTitle }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="cartStore.activeCart"
|
||||
class="flex items-center gap-2 p-1 rounded-md bg-gray-100 dark:bg-gray-800">
|
||||
<UIcon name="i-lucide-shopping-cart" />
|
||||
|
||||
<div class="flex gap-2">
|
||||
<p class="text-sm font-medium">
|
||||
{{ cartStore.activeCart.name }}-
|
||||
<span class="text-xs text-gray-400">
|
||||
ID: {{ cartStore.activeCart.cart_id }}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span v-else class="text-sm text-red-400 flex gap-1 items-center">
|
||||
<UIcon name="i-lucide-shopping-cart" />
|
||||
No cart selected
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden md:flex items-center gap-12">
|
||||
@@ -50,7 +73,7 @@
|
||||
<button v-if="authStore.isAuthenticated" @click="authStore.logout()"
|
||||
class="flex gap-2 items-center px-3 py-1.5 text-sm font-medium text-black dark:text-white hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-600 rounded-lg transition-colors border border-(--border-light) dark:border-(--border-dark) whitespace-nowrap">
|
||||
{{ $t('general.logout') }}
|
||||
<UIcon name="ic:baseline-logout" class="text-red-700 dark:text-red-500"/>
|
||||
<UIcon name="ic:baseline-logout" class="text-red-700 dark:text-red-500" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,6 +195,7 @@ import LangSwitch from '@/components/inner/LangSwitch.vue'
|
||||
import ThemeSwitch from '@/components/inner/ThemeSwitch.vue'
|
||||
import type { LabelTrans, TopMenuItem } from '@/types'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useCartStore } from '@/stores/customer/cart'
|
||||
|
||||
|
||||
const router = useRouter()
|
||||
@@ -297,5 +321,11 @@ const userItems = computed<DropdownMenuItem[][]>(() => [
|
||||
]
|
||||
])
|
||||
|
||||
const cartStore = useCartStore()
|
||||
|
||||
onMounted(() => {
|
||||
cartStore.initCart()
|
||||
})
|
||||
|
||||
defineShortcuts(extractShortcuts(teamsItems.value))
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user