feat: show selected rolls and color meterage
The preorder summary lists each chosen color with its roll count and meterage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import CheckoutStepper from '@/components/layout/CheckoutStepper.vue'
|
||||
import IconCart from '@/components/icons/IconCart.vue'
|
||||
@@ -10,10 +11,11 @@ import IconLightbulb from '@/components/icons/IconLightbulb.vue'
|
||||
import IconLayoutGrid from '@/components/icons/IconLayoutGrid.vue'
|
||||
import IconDiamond from '@/components/icons/IconDiamond.vue'
|
||||
import { formatMeterage, formatNumber } from '@/utils/format'
|
||||
import { cartColorLines } from '@/utils/cartSelections'
|
||||
import type { CartItem, PaymentLimits, SettlementType } from '@/types'
|
||||
import PreorderPaymentFields from '@/components/orders/PreorderPaymentFields.vue'
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
items: CartItem[]
|
||||
companyName: string
|
||||
companySummaries?: {
|
||||
@@ -33,6 +35,9 @@ defineProps<{
|
||||
paymentLimits?: PaymentLimits
|
||||
}>()
|
||||
|
||||
const colorLines = computed(() => cartColorLines(props.items))
|
||||
const totalRolls = computed(() => colorLines.value.reduce((sum, line) => sum + line.rolls, 0))
|
||||
|
||||
const emit = defineEmits<{
|
||||
remove: [id: string]
|
||||
checkout: []
|
||||
@@ -165,6 +170,17 @@ const quickLinks = [
|
||||
</span>
|
||||
<strong>{{ formatMeterage(totalMeterage) }}</strong>
|
||||
</div>
|
||||
<div v-if="totalRolls > 0" class="cart-summary-card__row">
|
||||
<span class="cart-summary-card__row-label">تعداد طاقه</span>
|
||||
<strong>{{ formatNumber(totalRolls) }} طاقه</strong>
|
||||
</div>
|
||||
<div v-for="line in colorLines" :key="line.key" class="cart-summary-card__row">
|
||||
<span class="cart-summary-card__row-label">{{ line.label }}</span>
|
||||
<strong>
|
||||
<template v-if="line.rolls">{{ formatNumber(line.rolls) }} طاقه · </template>
|
||||
{{ formatMeterage(line.meterage) }}
|
||||
</strong>
|
||||
</div>
|
||||
<div class="cart-summary-card__row cart-summary-card__row--hint">
|
||||
<span class="cart-summary-card__row-label">
|
||||
<IconOrders :size="16" />
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import BaseButton from '@/components/ui/BaseButton.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
import IconTrash from '@/components/icons/IconTrash.vue'
|
||||
import IconChevronBack from '@/components/icons/IconChevronBack.vue'
|
||||
import { formatMeterage, formatNumber } from '@/utils/format'
|
||||
import { cartColorLines } from '@/utils/cartSelections'
|
||||
import type { CartItem, PaymentLimits, SettlementType } from '@/types'
|
||||
import PreorderPaymentFields from '@/components/orders/PreorderPaymentFields.vue'
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
items: CartItem[]
|
||||
companyName: string
|
||||
companySummaries?: {
|
||||
@@ -27,6 +29,9 @@ defineProps<{
|
||||
paymentLimits?: PaymentLimits
|
||||
}>()
|
||||
|
||||
const colorLines = computed(() => cartColorLines(props.items))
|
||||
const totalRolls = computed(() => colorLines.value.reduce((sum, line) => sum + line.rolls, 0))
|
||||
|
||||
const emit = defineEmits<{
|
||||
back: []
|
||||
remove: [id: string]
|
||||
@@ -82,6 +87,21 @@ const emit = defineEmits<{
|
||||
<span>جمع متراژ کل</span>
|
||||
<strong>{{ formatMeterage(totalMeterage) }}</strong>
|
||||
</div>
|
||||
<div v-if="totalRolls > 0" class="cart-mobile-summary__row">
|
||||
<span>تعداد طاقه</span>
|
||||
<strong>{{ formatNumber(totalRolls) }} طاقه</strong>
|
||||
</div>
|
||||
<div
|
||||
v-for="line in colorLines"
|
||||
:key="line.key"
|
||||
class="cart-mobile-summary__row cart-mobile-summary__row--color"
|
||||
>
|
||||
<span>{{ line.label }}</span>
|
||||
<strong>
|
||||
<template v-if="line.rolls">{{ formatNumber(line.rolls) }} طاقه · </template>
|
||||
{{ formatMeterage(line.meterage) }}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
<PreorderPaymentFields
|
||||
:settlement-type="settlementType"
|
||||
@@ -275,6 +295,11 @@ const emit = defineEmits<{
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.cart-mobile-summary__row--color {
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.cart-mobile-summary__row:not(:last-child) {
|
||||
border-bottom: 1px solid #e8edf3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user