2026-05-14 13:44:43 +03:30
|
|
|
<template>
|
|
|
|
|
<BasicActionSheet v-model:show="visible">
|
|
|
|
|
<div class="pb-20">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="w-full text-center font-bold">موجودی ها</div>
|
|
|
|
|
<div class="h-30vh overflow-y-auto">
|
|
|
|
|
<div class="mt-5">
|
2026-06-09 21:04:22 +03:30
|
|
|
<template v-for="metal in metalTotals" :key="metal.metal_id">
|
|
|
|
|
<BasicInfoItem
|
2026-05-14 13:44:43 +03:30
|
|
|
class="flex justify-between"
|
2026-06-09 21:04:22 +03:30
|
|
|
:title="metal.label"
|
2026-05-14 13:44:43 +03:30
|
|
|
is-line
|
2026-06-09 21:04:22 +03:30
|
|
|
:value="formatMetalTotal(metal)"
|
|
|
|
|
/>
|
2026-06-10 11:36:45 +03:30
|
|
|
<template v-for="card in cardsByMetal(metal.metal_id)" :key="`card-${card.product_id}`">
|
|
|
|
|
<BasicInfoItem
|
|
|
|
|
class="flex justify-between mr-4 text-sm"
|
|
|
|
|
:title="card.title"
|
|
|
|
|
is-line
|
|
|
|
|
:value="formatInventoryCardValue(card)"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2026-06-09 21:04:22 +03:30
|
|
|
<a-divider class="!my-1" />
|
|
|
|
|
</template>
|
|
|
|
|
<BasicInfoItem
|
|
|
|
|
class="flex justify-between"
|
|
|
|
|
title="دارایی کیف پول ریالی"
|
|
|
|
|
is-line
|
|
|
|
|
:value="usePrice(cashWallet)"
|
2026-05-14 13:44:43 +03:30
|
|
|
/>
|
|
|
|
|
<a-divider class="!my-1" />
|
|
|
|
|
<BasicInfoItem
|
2026-06-09 21:04:22 +03:30
|
|
|
class="flex justify-between"
|
2026-06-10 18:40:29 +03:30
|
|
|
title="معادل ریالی محصولات"
|
|
|
|
|
is-line
|
|
|
|
|
:value="usePrice(assetsRialValue)"
|
|
|
|
|
/>
|
|
|
|
|
<a-divider class="!my-1" />
|
|
|
|
|
<BasicInfoItem
|
|
|
|
|
class="flex justify-between"
|
|
|
|
|
title="مجموع دارایی ریالی"
|
2026-06-09 21:04:22 +03:30
|
|
|
is-line
|
|
|
|
|
:value="usePrice(totalRialValue)"
|
2026-05-14 13:44:43 +03:30
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</BasicActionSheet>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-06-09 21:04:22 +03:30
|
|
|
import { computed, onMounted, watch } from 'vue'
|
2026-05-14 13:44:43 +03:30
|
|
|
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
|
|
|
|
import BasicInfoItem from '@/components/BasicPacks/BasicInfoItem.vue'
|
2026-06-09 21:04:22 +03:30
|
|
|
import { usePrice } from '@/utils/usePrice'
|
|
|
|
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
|
|
|
|
import type { WalletMetalTotal } from '@/models/walletAssets'
|
2026-06-10 18:40:29 +03:30
|
|
|
import { formatInventoryCardValue, assetSheetInventoryCards } from '@/utils/productAssets'
|
2026-05-14 13:44:43 +03:30
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
show: boolean
|
|
|
|
|
walletInfo: any
|
|
|
|
|
goldVal: number
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
'update:show': [value: boolean]
|
|
|
|
|
}>()
|
|
|
|
|
|
2026-06-09 21:04:22 +03:30
|
|
|
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
2026-05-14 13:44:43 +03:30
|
|
|
|
|
|
|
|
const visible = computed({
|
|
|
|
|
get: () => props.show,
|
2026-06-09 21:04:22 +03:30
|
|
|
set: (val) => emit('update:show', val),
|
2026-05-14 13:44:43 +03:30
|
|
|
})
|
2026-06-09 21:04:22 +03:30
|
|
|
|
2026-06-10 11:36:45 +03:30
|
|
|
const inventoryCards = computed(() => assetsSummary.value?.inventory_cards ?? [])
|
2026-06-09 21:04:22 +03:30
|
|
|
const metalTotals = computed(() => assetsSummary.value?.metal_totals ?? [])
|
|
|
|
|
const cashWallet = computed(() => assetsSummary.value?.cash_wallet ?? 0)
|
2026-06-10 18:40:29 +03:30
|
|
|
const assetsRialValue = computed(() => assetsSummary.value?.assets_rial_value ?? 0)
|
2026-06-09 21:04:22 +03:30
|
|
|
const totalRialValue = computed(() => assetsSummary.value?.total_rial_value ?? 0)
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
void loadWalletAssets()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.show,
|
|
|
|
|
(open) => {
|
|
|
|
|
if (open) {
|
|
|
|
|
void loadWalletAssets(true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-10 11:36:45 +03:30
|
|
|
function cardsByMetal(metalId: number) {
|
2026-06-10 18:40:29 +03:30
|
|
|
return assetSheetInventoryCards(inventoryCards.value, metalId)
|
2026-06-10 11:36:45 +03:30
|
|
|
}
|
|
|
|
|
|
2026-06-09 21:04:22 +03:30
|
|
|
function formatMetalTotal(metal: WalletMetalTotal) {
|
|
|
|
|
return `${metal.total_weight} ${metal.unit}`
|
|
|
|
|
}
|
|
|
|
|
</script>
|