Allow multi-company carts to submit as one checkout creating one order per company.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-15 08:30:57 +02:00
co-authored by Cursor
parent 800b950a46
commit 1b4a149e76
8 changed files with 255 additions and 83 deletions
+35 -4
View File
@@ -9,6 +9,13 @@ import type { CartItem } from '@/types'
defineProps<{
items: CartItem[]
companyName: string
companySummaries?: {
companyId: string
companyName: string
meterage: number
maxMeterage: number
remaining: number
}[]
totalMeterage: number
maxMeterage: number
remainingCapacity: number
@@ -67,10 +74,23 @@ const emit = defineEmits<{
<div class="cart-mobile-page__footer">
<div class="cart-mobile-summary">
<div class="cart-mobile-summary__row">
<span>جمع متراژ</span>
<span>جمع متراژ کل</span>
<strong>{{ formatMeterage(totalMeterage) }}</strong>
</div>
<div class="cart-mobile-summary__row">
<template v-if="companySummaries?.length">
<div
v-for="row in companySummaries"
:key="row.companyId"
class="cart-mobile-summary__row cart-mobile-summary__row--sub"
>
<span>{{ row.companyName }}</span>
<strong>
{{ formatMeterage(row.meterage) }}
<span class="cart-mobile-summary__cap">/ {{ formatMeterage(row.maxMeterage) }}</span>
</strong>
</div>
</template>
<div v-else class="cart-mobile-summary__row">
<span>حداکثر مجاز</span>
<strong>{{ formatMeterage(maxMeterage) }}</strong>
</div>
@@ -80,8 +100,7 @@ const emit = defineEmits<{
</div>
</div>
<p class="cart-mobile-page__hint">
پس از ثبت، مدیریت سفارش را قیمت‌گذاری می‌کند و فاکتور برای انتخاب روش تسویه به شما اعلام
می‌شود.
پس از ثبت، برای هر شرکت یک پیش‌سفارش جداگانه ساخته می‌شود و مدیریت قیمت‌گذاری می‌کند.
</p>
<BaseButton block :loading="submitting" @click="emit('checkout')">ثبت پیش‌سفارش</BaseButton>
</div>
@@ -250,10 +269,22 @@ const emit = defineEmits<{
.cart-mobile-summary__row {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 8px 0;
font-size: 0.875rem;
}
.cart-mobile-summary__row--sub {
color: var(--color-text-muted);
font-size: 0.8125rem;
}
.cart-mobile-summary__cap {
font-weight: 500;
color: var(--color-text-muted);
}
.cart-mobile-summary__row:not(:last-child) {
border-bottom: 1px solid var(--color-border);
}