change gift-card

This commit is contained in:
2026-09-21 11:10:34 +03:30
parent 8004dd52b3
commit 7e869902d6
7 changed files with 214 additions and 48 deletions
@@ -12,7 +12,13 @@
@close="close"
>
<div class="mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
<div class="min-w-0">
<div class="min-w-0 space-y-1">
<p v-if="giftCardCustomer" class="m-0 text-13px font-600" style="color: var(--admin-text)">
مشتری: {{ giftCardCustomer.name }} — <span dir="ltr">{{ giftCardCustomer.mobile }}</span>
</p>
<p v-else class="m-0 text-13px font-600" style="color: var(--admin-text)">
کد عمومی — بدون مشتری مشخص
</p>
<p class="m-0 text-13px text-[var(--admin-text-secondary)]">
{{ codes.length }} کد — دانلود به صورت اکسل یا PDF
</p>
@@ -102,6 +108,7 @@ import {
downloadGiftCardCodesPdf,
type GiftCardCodesExportMeta
} from '../utils/exportGiftCardCodes'
import { resolveGiftCardCustomer } from '../utils/giftCardCustomer'
import { SELECT_DROPDOWN_Z_INDEX } from '@/constants/overlayZIndex'
const props = defineProps<{
@@ -129,20 +136,22 @@ const columns = [
{ title: 'وضعیت', dataIndex: 'sts', key: 'sts' },
{ title: 'تاریخ انقضا', dataIndex: 'expiry_date', key: 'expiry_date' },
{ title: 'تاریخ استفاده', dataIndex: 'used_at', key: 'used_at' },
{ title: 'نام کاربر اختصاص داده شده', dataIndex: 'assigned_to.name', key: 'assigned_to_name' },
{ title: 'شماره موبایل کاربر اختصاص داده شده', dataIndex: 'assigned_to.mobile', key: 'assigned_to_mobile' }
{ title: 'نام استفاده‌کننده', dataIndex: 'assigned_to.name', key: 'assigned_to_name' },
{ title: 'موبایل استفاده‌کننده', dataIndex: 'assigned_to.mobile', key: 'assigned_to_mobile' }
]
function close() {
visibleProxy.value = false
}
const giftCardCustomer = computed(() => resolveGiftCardCustomer(props.giftCard))
const exportMeta = computed<GiftCardCodesExportMeta>(() => ({
id: props.giftCard?.id,
unit: props.giftCard?.unit,
count: props.giftCard?.count,
customerName: (props.giftCard as Giftcard & { customer?: { name?: string } })?.customer?.name,
customerMobile: (props.giftCard as Giftcard & { customer?: { mobile?: string } })?.customer?.mobile,
customerName: giftCardCustomer.value?.name,
customerMobile: giftCardCustomer.value?.mobile,
createdAt: props.giftCard?.created_at
}))