handle mobile user
This commit is contained in:
@@ -1,35 +1,84 @@
|
||||
<template>
|
||||
<MobileDetailSheet v-model:visible="visibleProxy" :item="item" :title="item?.name || ''">
|
||||
<MobileDetailSheet v-model:visible="visibleProxy" :item="item" title="">
|
||||
<template #default="{ item: row }">
|
||||
<MobileSheetHeader :title="row.name || '-'" :show-title="isMobile">
|
||||
<template #actions>
|
||||
<MobileIconButton plain icon="vuesax-linear:archive-tick" color="#e3bf00" :size="22" @click="$emit('archive', row)" />
|
||||
<MobileIconButton
|
||||
plain
|
||||
:icon="row.active ? 'vuesax-linear:user-tick' : 'vuesax-linear:user-remove'"
|
||||
:color="row.active ? '#54AD06' : '#ad0627'"
|
||||
:size="22"
|
||||
@click="$emit('toggleActive', row)"
|
||||
/>
|
||||
<MobileIconButton plain icon="vuesax-linear:wallet-add" color="#9333ea" :size="22" @click="$emit('chargeMoney', row)" />
|
||||
<MobileIconButton plain icon="vuesax-linear:wallet-money" color="#ea580c" :size="22" @click="$emit('chargeGold', row)" />
|
||||
<MobileIconButton
|
||||
plain
|
||||
:icon="row.trade_active ? 'vuesax-linear:box-tick' : 'vuesax-linear:box-remove'"
|
||||
:color="row.trade_active ? '#54AD06' : '#ad0627'"
|
||||
:size="22"
|
||||
@click="$emit('toggleTrade', row)"
|
||||
/>
|
||||
<MobileIconButton
|
||||
v-if="!(row as any).is_legal"
|
||||
plain
|
||||
icon="vuesax-linear:user-search"
|
||||
color="#0d9488"
|
||||
:size="22"
|
||||
@click="$emit('confirmUser', row)"
|
||||
/>
|
||||
</template>
|
||||
</MobileSheetHeader>
|
||||
<h2 class="text-base font-700 leading-relaxed text-gray-900">{{ row.name || '-' }}</h2>
|
||||
<p v-if="row.mobile" class="text-sm text-gray-500" dir="ltr">{{ row.mobile }}</p>
|
||||
|
||||
<div class="customer-sheet-actions grid grid-cols-2 gap-2">
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="primary"
|
||||
icon="vuesax-linear:wallet-add"
|
||||
@click="$emit('chargeMoney', row)"
|
||||
>
|
||||
شارژ ریالی
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="primary"
|
||||
icon="vuesax-linear:wallet-money"
|
||||
@click="$emit('chargeGold', row)"
|
||||
>
|
||||
شارژ طلایی
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
v-if="!row.is_legal"
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="default"
|
||||
icon="vuesax-linear:user-search"
|
||||
@click="$emit('confirmUser', row)"
|
||||
>
|
||||
تایید کاربر
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="default"
|
||||
icon="vuesax-linear:stickynote"
|
||||
@click="$emit('info', row)"
|
||||
>
|
||||
مشخصات کامل
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="default"
|
||||
icon="vuesax-linear:edit"
|
||||
@click="$emit('edit', row)"
|
||||
>
|
||||
ویرایش
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
type="default"
|
||||
icon="vuesax-linear:archive-tick"
|
||||
@click="$emit('archive', row)"
|
||||
>
|
||||
بایگانی
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
:type="row.active ? 'default' : 'primary'"
|
||||
:icon="row.active ? 'vuesax-linear:user-remove' : 'vuesax-linear:user-tick'"
|
||||
@click="$emit('toggleActive', row)"
|
||||
>
|
||||
{{ row.active ? 'غیرفعال کردن' : 'فعال کردن' }}
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
class="customer-sheet-btn w-full"
|
||||
size="middle"
|
||||
:type="row.trade_active === 1 ? 'default' : 'primary'"
|
||||
:icon="row.trade_active === 1 ? 'vuesax-linear:box-remove' : 'vuesax-linear:box-tick'"
|
||||
@click="$emit('toggleTrade', row)"
|
||||
>
|
||||
{{ row.trade_active === 1 ? 'ممنوعیت سفارش' : 'مجاز کردن سفارش' }}
|
||||
</BaseButton>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<MobileStatCard bordered variant="success" label="موجودی طلایی" :value="`${goldBalance(row)} گرم`">
|
||||
@@ -56,9 +105,9 @@
|
||||
<MobileDetailRow
|
||||
label="وضعیت سفارش دهی"
|
||||
full-width
|
||||
:value-class="row.trade_active ? 'text-green-700' : 'text-red-600'"
|
||||
:value-class="row.trade_active === 1 ? 'text-green-700' : 'text-red-600'"
|
||||
>
|
||||
{{ row.trade_active ? 'مجاز' : 'غیر مجاز' }}
|
||||
{{ row.trade_active === 1 ? 'مجاز' : 'غیر مجاز' }}
|
||||
</MobileDetailRow>
|
||||
<MobileDetailRow label="کد کاربری" :value="row.id ?? '-'" />
|
||||
<MobileDetailRow label="نوع کاربر" :value="row.type_str || '-'" />
|
||||
@@ -76,11 +125,8 @@ import type { Customer } from '@/model/customer'
|
||||
import MobileDetailRow from '@/components/mobile/MobileDetailRow.vue'
|
||||
import MobileStatCard from '@/components/mobile/MobileStatCard.vue'
|
||||
import MobileDetailSheet from '@/components/mobile/MobileDetailSheet.vue'
|
||||
import MobileIconButton from '@/components/mobile/MobileIconButton.vue'
|
||||
import MobileInfoGrid from '@/components/mobile/MobileInfoGrid.vue'
|
||||
import MobileSheetHeader from '@/components/mobile/MobileSheetHeader.vue'
|
||||
import { getCashBalance, getGoldBalance } from '@/components/mobile/utils/wallet'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
|
||||
@@ -92,6 +138,7 @@ const props = defineProps<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void
|
||||
(e: 'info', item: Customer): void
|
||||
(e: 'edit', item: Customer): void
|
||||
(e: 'archive', item: Customer): void
|
||||
(e: 'toggleActive', item: Customer): void
|
||||
(e: 'chargeMoney', item: Customer): void
|
||||
@@ -117,3 +164,19 @@ function lastSeen(row: Customer) {
|
||||
return row.last_seen_at ? toJalali(row.last_seen_at) : '-'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.customer-sheet-actions {
|
||||
:deep(.customer-sheet-btn.ant-btn) {
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
justify-content: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
:deep(.customer-sheet-btn.ant-btn > div) {
|
||||
width: 100%;
|
||||
justify-content: right !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user