widthdraw and deposit

This commit is contained in:
2026-06-09 21:04:22 +03:30
parent 95516ee2d8
commit 689c51c27d
26 changed files with 1228 additions and 522 deletions
+44 -50
View File
@@ -5,50 +5,27 @@
<div class="w-full text-center font-bold">موجودی ها</div>
<div class="h-30vh overflow-y-auto">
<div class="mt-5">
<BasicInfoItem
<template v-for="metal in metalTotals" :key="metal.metal_id">
<BasicInfoItem
class="flex justify-between"
:title="`مجموعه کل دارایی ${settingsStore.metalTypeLabel}`"
:title="metal.label"
is-line
:info="`در این قسمت مجموع کل وزن ${settingsStore.metalTypeLabel} آبشده (${(walletInfo?.gold ?? 0)?.toFixed(3)}) + ارزش دارایی ها (${(walletInfo?.treasure_sum ?? 0)?.toFixed(3)} ) را مشاهده میفرمایید.`"
:infoHead="`مجموع کل دارایی ${settingsStore.metalTypeLabel}`"
:value="parseFloat((walletInfo?.gold_sum ?? 0).toFixed(2)) + ' ' + weightUnit"
:value="formatMetalTotal(metal)"
/>
<a-divider class="!my-1" />
</template>
<BasicInfoItem
class="flex justify-between"
title="دارایی کیف پول ریالی"
is-line
:value="usePrice(cashWallet)"
/>
<a-divider class="!my-1" />
<BasicInfoItem
class="flex justify-between"
title="دارایی کیف پول ریالی"
is-line
:value="usePrice(walletInfo?.cash ?? 0)"
/>
<a-divider class="!my-1" />
<BasicInfoItem
class="flex justify-between"
:title="`دارایی کیف پول ${settingsStore.metalTypeLabel}`"
is-line
:value="(walletInfo?.count_gold_wallet ?? 0) + ' ' + weightUnit"
/>
<a-divider v-if="nameProject === 'goldsun'" class="!my-1" />
<BasicInfoItem
v-if="nameProject === 'goldsun'"
class="flex justify-between"
title="دارایی کیف پول نقره"
is-line
:value="(walletInfo?.count_silver ?? 0) + ' گرم'"
/>
<a-divider v-if="nameProject === 'goldsun'" class="!my-1" />
<BasicInfoItem
v-if="nameProject === 'goldsun'"
class="flex justify-between"
title="دارایی کیف پول مس"
is-line
:value="(walletInfo?.count_copper ?? 0) + ' گرم'"
/>
<a-divider class="!my-1" />
<BasicInfoItem
class="flex justify-between"
title="معادل ریالی مجموع دارایی ها"
is-line
:value="usePrice(walletInfo?.count_cash_total ?? 0)"
class="flex justify-between"
title="معادل ریالی مجموع دارایی ها"
is-line
:value="usePrice(totalRialValue)"
/>
</div>
</div>
@@ -58,13 +35,12 @@
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { computed, onMounted, watch } from 'vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import BasicInfoItem from '@/components/BasicPacks/BasicInfoItem.vue'
import { useConfigStore } from '@/store/configStore'
import { useSettingsStore } from '@/store/settingsStore'
import { getWeightUnit } from '@/utils/productDealMethod'
import {usePrice} from "@/utils/usePrice";
import { usePrice } from '@/utils/usePrice'
import { useWalletAssets } from '@/composables/useWalletAssets'
import type { WalletMetalTotal } from '@/models/walletAssets'
const props = defineProps<{
show: boolean
@@ -76,13 +52,31 @@ const emit = defineEmits<{
'update:show': [value: boolean]
}>()
const config = useConfigStore()
const nameProject = config.config.name
const settingsStore = useSettingsStore()
const weightUnit = computed(() => getWeightUnit())
const { assetsSummary, loadWalletAssets } = useWalletAssets()
const visible = computed({
get: () => props.show,
set: (val) => emit('update:show', val)
set: (val) => emit('update:show', val),
})
</script>
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
onMounted(() => {
void loadWalletAssets()
})
watch(
() => props.show,
(open) => {
if (open) {
void loadWalletAssets(true)
}
}
)
function formatMetalTotal(metal: WalletMetalTotal) {
return `${metal.total_weight} ${metal.unit}`
}
</script>