feat: add required kyc blocking modal and fix copper asset units to kilogram
This commit is contained in:
@@ -175,8 +175,10 @@ import {
|
||||
formatPortfolioProfitPercent,
|
||||
formatPortfolioProfitText,
|
||||
resolveAssetsRialValue,
|
||||
resolveBoursecuCopperUnit,
|
||||
resolveMetalAssetsDisplayLabel,
|
||||
} from '@/utils/productAssets'
|
||||
import { formatWeightAmount } from '@/utils/usePrice'
|
||||
import type { WalletMetalTotal } from '@/models/walletAssets'
|
||||
import { useAssetsPortfolioChart } from './composables/useAssetsPortfolioChart'
|
||||
import assetsCopperBanner from '@/assets/img/assets-copper-banner.webp'
|
||||
@@ -265,10 +267,13 @@ const profitClass = computed(() => {
|
||||
})
|
||||
|
||||
const summaryItems = computed(() => {
|
||||
const items = metalTotals.value.map((metal) => ({
|
||||
label: assetsMetalLabel(metal),
|
||||
value: `${metal.total_weight} ${metal.unit}`,
|
||||
}))
|
||||
const items = metalTotals.value.map((metal) => {
|
||||
const unit = metal.metal_id === 3 ? resolveBoursecuCopperUnit(metal.unit) : (metal.unit || 'کیلوگرم')
|
||||
return {
|
||||
label: assetsMetalLabel(metal),
|
||||
value: `${formatWeightAmount(Number(metal.total_weight ?? 0))} ${unit}`,
|
||||
}
|
||||
})
|
||||
items.push(
|
||||
{ label: 'کیف پول ریالی', value: usePrice(cashWallet.value) },
|
||||
{ label: 'ارزش ریالی مس', value: usePrice(metalRialValue.value) },
|
||||
@@ -287,10 +292,11 @@ const assetRows = computed(() => {
|
||||
const profit = portfolioInsight.value?.unrealized_profit_rial
|
||||
const changeClass = profit == null || profit === 0 ? '' : profit > 0 ? 'is-profit' : 'is-loss'
|
||||
const rows = metalTotals.value.flatMap((metal) => {
|
||||
const unit = metal.metal_id === 3 ? resolveBoursecuCopperUnit(metal.unit) : (metal.unit || 'کیلوگرم')
|
||||
const head = {
|
||||
key: `metal-${metal.metal_id}`,
|
||||
name: assetsMetalLabel(metal),
|
||||
balance: `${metal.total_weight} ${metal.unit}`,
|
||||
balance: `${formatWeightAmount(Number(metal.total_weight ?? 0))} ${unit}`,
|
||||
rial: usePrice(metalRialValue.value),
|
||||
change: pct || '—',
|
||||
changeClass,
|
||||
|
||||
@@ -62,6 +62,7 @@ import {
|
||||
formatPortfolioProfitPercent,
|
||||
formatPortfolioProfitText,
|
||||
resolveAssetsRialValue,
|
||||
resolveBoursecuCopperUnit,
|
||||
} from '@/utils/productAssets'
|
||||
import { formatWeightAmount, usePriceWithoutType } from '@/utils/usePrice'
|
||||
import { getTradeBuyPrice, lastPrice } from '@/utils/price'
|
||||
@@ -76,7 +77,7 @@ const props = withDefaults(
|
||||
const { assetsSummary } = useWalletAssets()
|
||||
|
||||
const portfolio = computed(() => assetsSummary.value?.portfolio)
|
||||
const weightUnit = computed(() => assetsSummary.value?.meta?.weight_unit || 'گرم')
|
||||
const weightUnit = computed(() => resolveBoursecuCopperUnit(assetsSummary.value?.meta?.weight_unit))
|
||||
|
||||
const totalRial = computed(() =>
|
||||
Number(portfolio.value?.total_rial_value ?? assetsSummary.value?.total_rial_value ?? 0)
|
||||
|
||||
@@ -43,6 +43,7 @@ import {
|
||||
formatPortfolioProfitLabel,
|
||||
formatPortfolioProfitPercent,
|
||||
formatPortfolioProfitText,
|
||||
resolveBoursecuCopperUnit,
|
||||
} from '@/utils/productAssets'
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -55,7 +56,7 @@ const props = withDefaults(
|
||||
const { assetsSummary } = useWalletAssets()
|
||||
|
||||
const portfolio = computed(() => assetsSummary.value?.portfolio)
|
||||
const weightUnit = computed(() => assetsSummary.value?.meta?.weight_unit || 'گرم')
|
||||
const weightUnit = computed(() => resolveBoursecuCopperUnit(assetsSummary.value?.meta?.weight_unit))
|
||||
|
||||
const hasProfitInsight = computed(() => portfolio.value?.unrealized_profit_rial != null)
|
||||
const profitTone = computed(() => formatPortfolioProfitLabel(portfolio.value?.unrealized_profit_rial))
|
||||
|
||||
@@ -20,6 +20,7 @@ import { getBoursecuActionIconSrc } from '@/utils/config'
|
||||
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||
import { getReferralShareText, getReferralShareTitle, shareReferralText } from '@/utils/referralShare'
|
||||
import { normalizeAuthFormFields } from '@/utils/persianDigits'
|
||||
import { performUserLogout } from '@/utils/authSession'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { useTrackingSystemsFeature } from '@/composables/useTrackingSystemsFeature'
|
||||
import { openGoldDayCalculator } from '@/composables/useGoldDayCalculator'
|
||||
@@ -300,18 +301,8 @@ export function useUserPage() {
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
userStore.userInfo = undefined
|
||||
walletStore.walletInfo = undefined
|
||||
clearWalletAssets()
|
||||
resetHomePageData()
|
||||
resetWalletPageData()
|
||||
resetAddressPageData()
|
||||
resetTransactionsPageData()
|
||||
resetProductsPageData()
|
||||
removeToken()
|
||||
showLogoutConfirm.value = false
|
||||
await router.push({ name: 'login' })
|
||||
window.location.reload()
|
||||
await performUserLogout()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -68,11 +68,11 @@
|
||||
<div class="text-black">مقدار {{ getMetalTypeTradeLabel() }} مبادله شده:</div>
|
||||
<div :class="item.gold >= 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center">
|
||||
<div class="text-base ml-1 number-ltr">{{ formatGoldAmount(item.gold) }}</div>
|
||||
گرم
|
||||
{{ getWeightUnit() }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="item.order" class="flex justify-between mb-3">
|
||||
<div class="text-black">قیمت هر گرم {{ getTradePriceUnitLabel() }} حین معامله:</div>
|
||||
<div class="text-black">قیمت هر {{ getWeightUnit() }} {{ getTradePriceUnitLabel() }} حین معامله:</div>
|
||||
<div class="flex text-xs items-center number-ltr">
|
||||
<div class="text-base ml-1">{{ usePriceWithoutType(item.order?.price?? 0) }}</div>
|
||||
ریال
|
||||
|
||||
Reference in New Issue
Block a user