+
+
{{ sourceName }}
- {{ productName }}
+ {{ locationName }}
{{ priceDisplay }}
- {{ formatDistance(totalDistance) }} км
-
-
+
+
+ {{ productName }}
+
+
+
+
+
+
@@ -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 @@