- Fix silent redirect-to-home for unauthenticated users on protected routes; now redirects to login with a return path - Restyle OrderCard, SearchInput, Filters, DropDown, and product card image sizing/centering to match the app's LESS-token design language - Fix ant-design Slider handle placement/drag under RTL and seed a valid default range so handles actually render - Fix chip-row edge padding and top spacing across Orders/Cart/Search lists - Add pull-to-refresh to the dashboard and fix its header/padding to match the fixed PageBar pattern - Remove the floating WhatsApp button from index.html
101 lines
3.0 KiB
Vue
101 lines
3.0 KiB
Vue
<!--
|
|
Ported from legacy henza_pwa/src/views/search/collection/index.vue, restyled
|
|
into the redesigned design language (see components/home/* and HomeView).
|
|
|
|
Filters the one flat product list client-side by collection id (route
|
|
param) — no server-side ciny_id query param exists; consistent with the
|
|
rest of this port's "small catalog, client-side filtering" approach. That
|
|
logic is carried over unchanged.
|
|
|
|
The view no longer owns a Drawer: ProductCard opens the product detail
|
|
itself, the same way it does on every other catalogue screen, so the
|
|
detail behaviour is identical everywhere instead of re-implemented here.
|
|
-->
|
|
<template>
|
|
<div class="coll">
|
|
<PageBar :title="collectionTitle" back-to="search" />
|
|
|
|
<Spinner :spinning="loadingPage" tip="درحال دریافت اطلاعات">
|
|
<container class="coll__body">
|
|
<SectionHead title="محصولات این مجموعه" subtitle="برای دیدن جزئیات، روی محصول ضربه بزنید" />
|
|
|
|
<div v-if="collectionProducts.length" class="coll__grid">
|
|
<ProductCard v-for="item in collectionProducts" :key="item.id" :value="item" />
|
|
</div>
|
|
|
|
<section v-else-if="!loadingPage" class="coll__empty">
|
|
<Icon icon="vuesax-linear:box" size="26" />
|
|
<p>در این مجموعه محصولی ثبت نشده است.</p>
|
|
</section>
|
|
</container>
|
|
</Spinner>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, onMounted, ref } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import Icon from '../../components/icon/Icon.vue'
|
|
import PageBar from '../../components/ui/PageBar.vue'
|
|
import Spinner from '../../components/Spinner.vue'
|
|
import SectionHead from '../../components/home/SectionHead.vue'
|
|
import ProductCard from '../../components/product/ProductCard.vue'
|
|
import { api, type ProductSummary } from '../../api/client'
|
|
|
|
const route = useRoute()
|
|
|
|
const loadingPage = ref(false)
|
|
const allProducts = ref<ProductSummary[]>([])
|
|
|
|
// legacy passed the collection's title through as ?page=<title>; kept, with a
|
|
// neutral fallback so the bar is never blank on a direct link.
|
|
const collectionTitle = computed(() => (route.query.page as string) || 'مجموعه')
|
|
|
|
const collectionProducts = computed(() =>
|
|
allProducts.value.filter((p) => p.collections.some((c) => c.collectionId === route.params.id)),
|
|
)
|
|
|
|
onMounted(async () => {
|
|
loadingPage.value = true
|
|
try {
|
|
allProducts.value = await api.listProducts()
|
|
} finally {
|
|
loadingPage.value = false
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.coll {
|
|
background: @canvas;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.coll__body {
|
|
padding-top: 76px;
|
|
padding-bottom: 90px;
|
|
}
|
|
|
|
.coll__grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 11px;
|
|
}
|
|
|
|
.coll__empty {
|
|
margin-top: 8px;
|
|
padding: 34px 20px;
|
|
border: 1px dashed @hairline;
|
|
border-radius: 18px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 10px;
|
|
color: @inkFaint;
|
|
}
|
|
.coll__empty p {
|
|
margin: 0;
|
|
font-size: 12.5px;
|
|
}
|
|
</style>
|