fix wallet ui
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
<CustomerMobileDetailSheet
|
||||
v-model:visible="sheetVisible"
|
||||
:item="selectedItem"
|
||||
:metals="catalogMetals"
|
||||
@info="forwardAndClose('info', $event)"
|
||||
@edit="forwardAndClose('edit', $event)"
|
||||
@archive="forwardAndClose('archive', $event)"
|
||||
|
||||
@@ -50,30 +50,7 @@
|
||||
</BaseButton>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<MobileStatCard
|
||||
v-for="entry in metalBalanceEntries(row)"
|
||||
:key="entry.metal_id"
|
||||
bordered
|
||||
variant="success"
|
||||
:label="customerWalletMetalBalanceTitle(entry.metal_id, entry.label)"
|
||||
:value="entry.value"
|
||||
>
|
||||
<template #prefix>
|
||||
<BaseIcon icon="vuesax-linear:coin" size="18" color="#15803d" />
|
||||
</template>
|
||||
</MobileStatCard>
|
||||
<MobileStatCard
|
||||
bordered
|
||||
variant="success"
|
||||
label="موجودی ریالی"
|
||||
:value="usePrice(cashBalance(row), true, '')"
|
||||
>
|
||||
<template #prefix>
|
||||
<BaseIcon icon="vuesax-linear:empty-wallet" size="18" color="#15803d" />
|
||||
</template>
|
||||
</MobileStatCard>
|
||||
</div>
|
||||
<CustomerWalletBalancePanel :customer-id="row?.id" />
|
||||
|
||||
<MobileInfoGrid>
|
||||
<MobileDetailRow label="وضعیت کاربر" full-width :value-class="row.active ? 'text-green-700' : 'text-red-600'">
|
||||
@@ -101,20 +78,15 @@ import { Modal } from 'ant-design-vue'
|
||||
import type { Customer } from '@/model/customer'
|
||||
import { MODAL_ABOVE_ACTION_SHEET_Z_INDEX } from '@/constants/overlayZIndex'
|
||||
import MobileDetailRow from '@/components/mobile/MobileDetailRow.vue'
|
||||
import MobileStatCard from '@/components/mobile/MobileStatCard.vue'
|
||||
import MobileDetailSheet from '@/components/mobile/MobileDetailSheet.vue'
|
||||
import MobileInfoGrid from '@/components/mobile/MobileInfoGrid.vue'
|
||||
import { getCashBalance } from '@/components/mobile/utils/wallet'
|
||||
import CustomerWalletBalancePanel from '@/components/customer/CustomerWalletBalancePanel.vue'
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
import { customerWalletMetalBalanceTitle, metalLabel } from '@/utils/adminMetalLabels'
|
||||
import type { CustomerMetalColumn } from '../hooks/customerColumns'
|
||||
import { formatMetalDisplayValue, metalCellValue, metalDisplayUnit } from '@/utils/metalWeight'
|
||||
import { metalLabel } from '@/utils/adminMetalLabels'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
item: Customer | null
|
||||
metals?: CustomerMetalColumn[]
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -163,30 +135,6 @@ function confirmToggleTrade(row: Customer) {
|
||||
})
|
||||
}
|
||||
|
||||
function cashBalance(row: Customer) {
|
||||
return getCashBalance(row.wallet)
|
||||
}
|
||||
|
||||
function metalBalanceEntries(row: Customer) {
|
||||
const metals = props.metals?.length
|
||||
? props.metals
|
||||
: [{ metal_id: 1, label: 'طلا' }]
|
||||
|
||||
return metals
|
||||
.map((metal) => {
|
||||
const value = metalCellValue(row as Record<string, unknown>, metal.metal_id, 'wallet_metal_gold')
|
||||
return {
|
||||
metal_id: metal.metal_id,
|
||||
label: metal.label,
|
||||
value: formatMetalDisplayValue(value, metal.metal_id)
|
||||
}
|
||||
})
|
||||
.filter((entry) => {
|
||||
const numeric = metalCellValue(row as Record<string, unknown>, entry.metal_id, 'wallet_metal_gold')
|
||||
return numeric !== 0
|
||||
})
|
||||
}
|
||||
|
||||
function lastSeen(row: Customer) {
|
||||
return row.last_seen_at ? toJalali(row.last_seen_at) : '-'
|
||||
}
|
||||
|
||||
@@ -180,19 +180,7 @@
|
||||
</BasicInfoItem>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
<div
|
||||
v-for="(item, index) in userInfo.wallet"
|
||||
:key="index"
|
||||
class="grid grid-cols-2 bg-orange-100 dark:bg-orange-500/15 gap-2 rounded-lg p-2"
|
||||
>
|
||||
<BasicInfoItem
|
||||
title="نام قلک"
|
||||
:value="item?.fund ? item?.fund?.title : metalLabel.goldWallet()"
|
||||
/>
|
||||
<BasicInfoItem :title="metalLabel.goldAmount()" :value="`${item?.gold} گرم`" />
|
||||
</div>
|
||||
</div>
|
||||
<CustomerWalletBalancePanel v-if="userInfo?.id" :customer-id="userInfo.id" class="mt-2" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="لیست سفارشات" tab="لیست سفارشات">
|
||||
@@ -226,18 +214,20 @@
|
||||
@ok="chargeMoneyWallet"
|
||||
@close="showMoneyWalletCharge = false"
|
||||
>
|
||||
<CustomerWalletBalancePanel v-if="formCharge.customer_id" :customer-id="formCharge.customer_id" class="mb-3" />
|
||||
<WalletChargeForm ref="moneyChargeFormRef" :model-value="formCharge" variant="money" />
|
||||
</BasicActionSheet>
|
||||
<BasicModal
|
||||
v-else
|
||||
v-model:visible="showMoneyWalletCharge"
|
||||
width="22rem"
|
||||
width="28rem"
|
||||
:title="moneyChargeTitle"
|
||||
:ok-text="moneyChargeOkText"
|
||||
@ok="chargeMoneyWallet"
|
||||
:loading="loading"
|
||||
@close="showMoneyWalletCharge = false"
|
||||
>
|
||||
<CustomerWalletBalancePanel v-if="formCharge.customer_id" :customer-id="formCharge.customer_id" class="mb-3" />
|
||||
<WalletChargeForm ref="moneyChargeFormRef" :model-value="formCharge" variant="money" />
|
||||
</BasicModal>
|
||||
|
||||
@@ -255,18 +245,20 @@
|
||||
@ok="chargeGoldWallet"
|
||||
@close="showGoldWalletCharge = false"
|
||||
>
|
||||
<CustomerWalletBalancePanel v-if="formCharge.customer_id" :customer-id="formCharge.customer_id" class="mb-3" />
|
||||
<WalletChargeForm ref="goldChargeFormRef" :model-value="formCharge" variant="gold" />
|
||||
</BasicActionSheet>
|
||||
<BasicModal
|
||||
v-else
|
||||
v-model:visible="showGoldWalletCharge"
|
||||
width="22rem"
|
||||
width="28rem"
|
||||
:title="goldChargeTitle"
|
||||
:ok-text="goldChargeOkText"
|
||||
@ok="chargeGoldWallet"
|
||||
:loading="loading"
|
||||
@close="showGoldWalletCharge = false"
|
||||
>
|
||||
<CustomerWalletBalancePanel v-if="formCharge.customer_id" :customer-id="formCharge.customer_id" class="mb-3" />
|
||||
<WalletChargeForm ref="goldChargeFormRef" :model-value="formCharge" variant="gold" />
|
||||
</BasicModal>
|
||||
<BasicInfoModal
|
||||
@@ -313,6 +305,7 @@ import type { Order } from '@/model/order'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
import WalletChargeForm from './components/WalletChargeForm.vue'
|
||||
import CustomerWalletBalancePanel from '@/components/customer/CustomerWalletBalancePanel.vue'
|
||||
import {
|
||||
buildChargePayload,
|
||||
createEmptyChargeForm,
|
||||
|
||||
Reference in New Issue
Block a user