-
-
-
{{ formatSignedPercentChange(percentChange) }}
+
+
+
+
+
-
- ریال
+
فروشگاه بسته است
+
{{ storeClosedHint }}
-
+
+
+
+
+ {{ priceLabel }}
+
+
+
+
+
+ {{ formatSignedPercentChange(percentChange) }}
+
+
+
ریال
+
+
+
@@ -31,29 +49,128 @@
import { computed } from 'vue'
import Icon from '@/components/BasicPacks/BasicIcon.vue'
import { useConfigStore } from '@/store/configStore'
+import { useUserStore } from '@/store/userStore'
+import { isBoursecuProject } from '@/utils/config'
import { getTradeBuyPrice, lastPrice, percentPriceChanged, price } from '@/utils/price'
+import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
import Vue3Odometer from 'vue3-odometer'
import 'odometer/themes/odometer-theme-default.css'
import { formatSignedPercentChange } from '@/utils/usePrice'
const config = useConfigStore()
+const userStore = useUserStore()
+const isBoursecu = isBoursecuProject()
+
+const priceLabel = computed(() =>
+ isBoursecu ? 'قیمت لحظهای کاتد مس' : `قیمت خرید از ${config.config.name_fa}`
+)
+
+const showStoreClosed = computed(() => {
+ if (isBoursecu) {
+ return isStoreClosed()
+ }
+ return lastPrice?.value?.goldir === 0 && getTradeBuyPrice(lastPrice.value) === 0
+})
+
+const storeClosedHint = computed(() => {
+ const custom = userStore.getValueByKey('closed_message')
+ if (typeof custom === 'string' && custom.trim()) {
+ return custom.replace(/<[^>]*>/g, '').trim()
+ }
+ return getStoreClosedMessage()
+})
+
+const containerClass = computed(() => {
+ if (!isBoursecu) {
+ return 'border-gray-200 border-1'
+ }
+ if (showStoreClosed.value) {
+ return 'boursecu-price-box boursecu-price-box--closed'
+ }
+ return 'boursecu-price-box boursecu-price-box--open'
+})
const percentChange = computed(() => {
if (!getTradeBuyPrice(lastPrice.value)) return 0
return percentPriceChanged()
})
-const isMarketClosed = computed(() => {
- return lastPrice?.value?.goldir === 0 && getTradeBuyPrice(lastPrice.value) === 0
-})
-
const displayGoldVal = computed(() => {
- if (isMarketClosed.value) return 0
+ if (showStoreClosed.value) return 0
return getTradeBuyPrice(lastPrice.value)
})
+
+void price
diff --git a/src/views/base/home/desktop/components/DesktopPriceRange.vue b/src/views/base/home/desktop/components/DesktopPriceRange.vue
index 1f80fb1..a2a73cb 100644
--- a/src/views/base/home/desktop/components/DesktopPriceRange.vue
+++ b/src/views/base/home/desktop/components/DesktopPriceRange.vue
@@ -5,7 +5,7 @@ import { usePriceWithoutType } from '@/utils/usePrice'
import { getHomeLayoutId } from '../../layouts/registry'
import { resolveMetalDayRangePrices, usePriceChart } from '../../composables/usePriceChart'
-const { selectedChartMetal, maftolChartRatio } = usePriceChart()
+const { selectedChartMetal, selectedMetalChartRatio } = usePriceChart()
const isBoursecuLayout = computed(() => getHomeLayoutId() === 'boursecu')
const rangePrices = computed(() =>
@@ -13,7 +13,7 @@ const rangePrices = computed(() =>
price: price.value,
metal: selectedChartMetal.value,
isBoursecuLayout: isBoursecuLayout.value,
- maftolRatio: maftolChartRatio.value,
+ metalRatio: selectedMetalChartRatio.value,
})
)
diff --git a/src/views/base/home/layouts/sections/MarketClosedSection.vue b/src/views/base/home/layouts/sections/MarketClosedSection.vue
index 6372e2c..cd485b6 100644
--- a/src/views/base/home/layouts/sections/MarketClosedSection.vue
+++ b/src/views/base/home/layouts/sections/MarketClosedSection.vue
@@ -1,5 +1,6 @@