Files
boursecu_admin/src/pages/menuPages/wallet/components/WalletMobileListItem.vue
T

44 lines
1.3 KiB
Vue
Raw Normal View History

2026-05-31 11:51:52 +03:30
<template>
<MobileCard clickable @click="$emit('open', item)">
<div class="space-y-1">
<div class="flex items-center justify-between gap-2">
<span class="min-w-0 truncate text-sm font-700 text-gray-900">{{ customerName }}</span>
<span class="shrink-0 text-xs text-gray-400">#{{ item.id ?? '-' }}</span>
</div>
<div class="flex items-center justify-between gap-2 text-xs text-gray-600">
<span>
<span class="text-gray-500">ریال:</span>
<span class="font-600 text-gray-900">{{ cashLabel }}</span>
</span>
<span>
<span class="text-gray-500">طلا:</span>
<span class="font-700 text-gray-900">{{ goldLabel }}</span>
</span>
</div>
</div>
</MobileCard>
</template>
<script setup lang="ts">
import type { Wallet } from '@/model/wallet'
import MobileCard from '@/components/mobile/MobileCard.vue'
import { usePrice } from '@core/utils/usePrice'
const props = defineProps<{
item: Wallet
}>()
defineEmits<{
(e: 'open', item: Wallet): void
}>()
const customerName = computed(() => props.item.customer?.name || '-')
const cashLabel = computed(() => usePrice(props.item.cash ?? 0, true, ''))
const goldLabel = computed(() => {
const gold = props.item.gold
if (gold == null) return '-'
return `${Number(Number(gold).toFixed(3))} گرم`
})
</script>