wallet handling

This commit is contained in:
2026-06-15 12:05:00 +03:30
parent 38e0cffe86
commit 23311cee01
5 changed files with 65 additions and 21 deletions
+8 -5
View File
@@ -61,8 +61,8 @@
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(cashWallet) }}ریال</div>
</div>
<div class="flex justify-center mt-2 w-full z-20">
معادل ریالی مجموع دارایی ها:
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(totalRialValue) }}ریال</div>
مجموع دارایی ریالی:
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(cashWallet + metalRialValue) }}ریال</div>
</div>
</div>
</div>
@@ -108,8 +108,9 @@ import { usePriceWithoutType } from '@/utils/usePrice'
import { useConfigStore } from '@/store/configStore'
import { useWalletAssets } from '@/composables/useWalletAssets'
import type { WalletMetalTotal } from '@/models/walletAssets'
import { resolveSummaryMetalWeight, fundPageInventoryCards } from '@/utils/productAssets'
import { resolveSummaryMetalWeight, fundPageInventoryCards, resolveAssetsRialValue } from '@/utils/productAssets'
import { useWalletStore } from '@/store/walletStore'
import { getTradeBuyPrice, lastPrice } from '@/utils/price'
import {
getProjectFundEmptyImage,
getProjectFundEmptyText,
@@ -129,7 +130,9 @@ const inventoryCards = computed(() => fundPageInventoryCards(assetsSummary.value
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
const primaryMetalTotal = computed(() => metalTotals.value[0])
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
const metalRialValue = computed(() =>
resolveAssetsRialValue(assetsSummary.value, getTradeBuyPrice(lastPrice.value))
)
const countBasedInventory = computed(() =>
(assetsSummary.value?.count_products ?? []).reduce((sum, item) => sum + Number(item.quantity ?? 0), 0)
)
@@ -137,7 +140,7 @@ const countBasedInventory = computed(() =>
onMounted(async () => {
try {
loading.value = true
const tasks = [loadWalletAssets(true)]
const tasks = [loadWalletAssets(true), getLastPrices()]
if (isBazretalaProject()) {
tasks.push(walletStore.getMyWallet())
}