Route shop browse through categories and catalogs, and align product detail with the mockup.

Customers can add items without a company-first path, and the detail page matches the card, badge, share, and footer layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 21:05:05 +03:30
co-authored by Cursor
parent c1acbebeb9
commit c81db8e620
21 changed files with 540 additions and 218 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ onMounted(load)
watch(companyId, load)
function openCatalog(catalogId: string) {
router.push(`/companies/${companyId.value}/catalogs/${catalogId}/products`)
router.push({
path: '/products',
query: { catalogId, companyId: companyId.value },
})
}
function getProductCount(catalogId: string) {
+19 -5
View File
@@ -38,9 +38,12 @@ onMounted(async () => {
error.value = null
try {
const list = await crm.loadBrowseProducts()
products.value = list
if (preselectId.value) {
quantities.value = { ...quantities.value, [preselectId.value]: 1 }
const selected = preselectId.value
products.value = selected
? [...list].sort((a, b) => Number(b.id === selected) - Number(a.id === selected))
: list
if (selected) {
quantities.value = { ...quantities.value, [selected]: 1 }
}
} catch (e) {
error.value = e instanceof Error ? e.message : 'بارگذاری محصولات ناموفق بود.'
@@ -79,11 +82,18 @@ async function submit() {
<div class="page">
<PageHeader title="درخواست کالیته" show-back centered @back="router.back()" />
<div class="page__scroll page__scroll--with-nav body">
<p class="hint">محصولات و تعداد اقلام موردنظر را مشخص کنید.</p>
<p class="hint">
{{ preselectId ? 'این محصول برای درخواست کالیته انتخاب شده است. در صورت نیاز اقلام دیگر را هم اضافه کنید.' : 'محصولات و تعداد اقلام موردنظر را مشخص کنید.' }}
</p>
<PageSkeleton v-if="loading" variant="form" />
<p v-else-if="error" class="error">{{ error }}</p>
<template v-else>
<article v-for="item in products" :key="item.id" class="row">
<article
v-for="item in products"
:key="item.id"
class="row"
:class="{ 'row--selected': preselectId === item.id }"
>
<div>
<strong>{{ item.name }}</strong>
<span>کد {{ item.code }}</span>
@@ -141,6 +151,10 @@ async function submit() {
box-shadow: var(--shadow-sm);
}
.row--selected {
outline: 2px solid var(--color-primary);
}
.row strong {
display: block;
font-size: 0.9rem;
+5 -4
View File
@@ -36,7 +36,8 @@ onMounted(async () => {
function openCatalog(item: Catalog) {
router.push({
path: `/companies/${item.companyId}/catalogs/${item.id}/products`,
path: '/products',
query: { catalogId: item.id, companyId: item.companyId },
})
}
@@ -61,9 +62,9 @@ function companyName(companyId: string) {
<strong>مشاهده دسته‌بندی‌ها</strong>
<span>انتخاب بر اساس کاربرد و فصل</span>
</button>
<button type="button" class="hub-card" @click="router.push('/companies')">
<strong>کالیته‌های برندها</strong>
<span>مسیر انتخاب شرکت و کالیته</span>
<button type="button" class="hub-card" @click="router.push('/products')">
<strong>همه محصولات</strong>
<span>مشاهده کاتالوگ و ثبت سفارش</span>
</button>
<PageSkeleton v-if="loading" variant="grid" />