From f03554893b3c0d6db5c3e87d23a96abc5c4614ed Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev Date: Thu, 15 Jan 2026 00:07:21 +0700 Subject: [PATCH] Update OfferResultCard: add location, mini map, fix price format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove distance from right side (shown in stepper) - Change price format to symbol + formatted number (e.g. $1,200/тонна) - Add locationName prop for displaying offer location - Add LocationMiniMap component for showing point on map - Update hub page and CalcResultContent to pass coordinates --- app/components/CalcResultContent.vue | 4 +- app/components/catalog/LocationMiniMap.vue | 103 +++++++++++++++++++++ app/components/catalog/OfferResultCard.vue | 59 +++++++++--- app/pages/catalog/hubs/[id].vue | 4 +- 4 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 app/components/catalog/LocationMiniMap.vue diff --git a/app/components/CalcResultContent.vue b/app/components/CalcResultContent.vue index 57f9061..bfe6814 100644 --- a/app/components/CalcResultContent.vue +++ b/app/components/CalcResultContent.vue @@ -21,11 +21,13 @@ v-for="option in productRouteOptions" :key="option.sourceUuid" :source-name="option.sourceName || 'Склад'" + :location-name="getOfferData(option.sourceUuid)?.locationName" :product-name="productName" :price-per-unit="getOfferData(option.sourceUuid)?.pricePerUnit" :currency="getOfferData(option.sourceUuid)?.currency" :unit="getOfferData(option.sourceUuid)?.unit" - :total-distance="option.distanceKm || 0" + :latitude="option.sourceLat" + :longitude="option.sourceLon" :stages="getRouteStages(option)" /> diff --git a/app/components/catalog/LocationMiniMap.vue b/app/components/catalog/LocationMiniMap.vue new file mode 100644 index 0000000..59a9706 --- /dev/null +++ b/app/components/catalog/LocationMiniMap.vue @@ -0,0 +1,103 @@ + + + diff --git a/app/components/catalog/OfferResultCard.vue b/app/components/catalog/OfferResultCard.vue index 281af11..69207ef 100644 --- a/app/components/catalog/OfferResultCard.vue +++ b/app/components/catalog/OfferResultCard.vue @@ -1,21 +1,32 @@ @@ -24,11 +35,13 @@ import type { RouteStage } from './RouteStepper.vue' const props = withDefaults(defineProps<{ sourceName: string + locationName?: string productName?: string pricePerUnit?: number | null currency?: string | null unit?: string | null - totalDistance: number + latitude?: number | null + longitude?: number | null stages?: RouteStage[] }>(), { stages: () => [] @@ -40,13 +53,33 @@ defineEmits<{ const priceDisplay = computed(() => { if (!props.pricePerUnit) return null - const curr = props.currency || 'USD' - const u = props.unit || 'т' - return `${props.pricePerUnit} ${curr}/${u}` + const currSymbol = getCurrencySymbol(props.currency) + const unitName = getUnitName(props.unit) + const formattedPrice = props.pricePerUnit.toLocaleString() + return `${currSymbol}${formattedPrice}/${unitName}` }) -const formatDistance = (km?: number | null) => { - if (!km) return '0' - return Math.round(km).toLocaleString() +const getCurrencySymbol = (currency?: string | null) => { + switch (currency?.toUpperCase()) { + case 'USD': return '$' + case 'EUR': return '€' + case 'RUB': return '₽' + case 'CNY': return '¥' + default: return '$' + } +} + +const getUnitName = (unit?: string | null) => { + switch (unit?.toLowerCase()) { + case 'т': + case 'ton': + case 'tonne': + return 'тонна' + case 'кг': + case 'kg': + return 'кг' + default: + return 'тонна' + } } diff --git a/app/pages/catalog/hubs/[id].vue b/app/pages/catalog/hubs/[id].vue index cb8ebba..1f2ccf2 100644 --- a/app/pages/catalog/hubs/[id].vue +++ b/app/pages/catalog/hubs/[id].vue @@ -61,11 +61,13 @@