import type { BaseTableColumn } from '@core/type/baseTable' import { toJalali, toJalaliNoTime, toTime } from '@core/utils/useDataTime' import CustomTag from '@/components/CustomTag.vue' import WithdrawStatus from "@/pages/menuPages/withdraw/components/WithdrawStatus.vue"; import { formatWithdrawAmountDisplay, isMoneyWithdraw, withdrawAmountColorClass, withdrawTypeLabel } from '@/pages/menuPages/withdraw/utils/withdrawDisplay' /*import BudgetSelect from '@/components/BudgetSelect.vue' import { useStaticApiListsStore } from '@/store/staticApisStore' import type { FilterSelect } from '@/model/filterSelect' import type { DocItem } from '@/model/docType'*/ //define store //const store = useStaticApiListsStore() //document types /*let docTypes: DocItem[]*/ /*onMounted(async () => { docTypes = await store.readyDocTypeList() }) const filteredDocTypes: FilterSelect = docTypes?.map((x: DocItem) => { return { label: x.title, value: x.id } })*/ export const WITHDRAW_NOTE_OPTIONS = [ { label: 'برداشت ریالی', value: 'برداشت ریالی' }, { label: 'کارت هدیه', value: 'کارت هدیه' }, { label: 'واریز آنلاین', value: 'واریز آنلاین' }, { label: 'واریز ریالی', value: 'واریز ریالی' }, { label: 'واریز درگاه', value: 'واریز درگاه' }, { label: 'واریز نقدی (فیش بانکی)', value: 'واریز نقدی (فیش بانکی)' }, { label: 'واریز نقدی', value: 'واریز نقدی' }, { label: 'شارژ حساب (فیش بانکی)', value: 'شارژ حساب (فیش بانکی)' }, { label: 'درخواست واریز نقدی (فیش بانکی)', value: 'درخواست واریز نقدی (فیش بانکی)' }, { label: 'شارژ کیف پول', value: 'شارژ کیف پول' }, { label: 'کسر از کیف پول', value: 'کسر از کیف پول' }, { label: 'برداشت فیزیکی', value: 'برداشت فیزیکی' }, { label: 'خرید اقساطی', value: 'خرید اقساطی' }, { label: 'پاداش بابت ثبت نام', value: 'پاداش بابت ثبت نام' }, { label: 'پاداش اولین سفارش', value: 'پاداش اولین سفارش' }, { label: 'پاداش اولین سفارش زیرمجموعه', value: 'پاداش اولین سفارش زیرمجموعه' }, { label: 'پاداش خرید اول زیرمجموعه', value: 'پاداش خرید اول زیرمجموعه' }, { label: 'کارمزد ثبت سفارش شرطی', value: 'کارمزد ثبت سفارش شرطی' }, { label: 'انتقال به کیف اصلی', value: 'انتقال به کیف اصلی' }, { label: 'انتقال از کیف محصول', value: 'انتقال از کیف محصول' } ] export function getWithdrawColumns(): BaseTableColumn[] { return [ { title: 'ردیف', dataIndex: 'id', key: 'id', filterable: false, sortable: false, customRender: (record: any) => { return record.index + 1 } }, { title: 'علت تراکنش', dataIndex: 'note', key: 'note', type: 'Select', filterComponentProps: { placeholder: 'انتخاب علت تراکنش', allowClear: true, showSearch: true, options: WITHDRAW_NOTE_OPTIONS, filterOption: (input: string, option: any) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) } }, { title: 'شماره پیگیری', dataIndex: 'tracked_number', key: 'tracked_number', type: 'Number', slot: 'tracked', customRender: (record: any) => record.record.tracked_number ?? '__' // className: 'column-money' }, { title: 'کد سفارش', dataIndex: 'id', key: 'id', type: 'Number' // className: 'column-money' }, { title: 'کد کاربر', dataIndex: 'customer_id', key: 'customer_id', type: 'Number' }, { title: 'نام و نام خانوادگی', dataIndex: 'customer.name', key: 'customer.name', type: 'Text' }, { title: 'شناسه واریز', dataIndex: 'deposit_identifier', key: 'deposit_identifier', type: 'Text', customRender: ({ record }: any) => { const val = record?.deposit_identifier || record?.customer?.n_code return val ? {val} : '-' } }, { title: 'فیش واریزی', dataIndex: 'receipt_url', key: 'receipt_url', slot: 'receipt', filterable: false, sortable: false }, { title: 'نوع', dataIndex: 'asset_type', key: 'asset_type', filterable: false, sortable: false, customRender: ({ record }) => { const label = withdrawTypeLabel(record) if (label === '-') { return
-
} return (
{label}
) } }, { title: 'مقدار', dataIndex: 'amount', key: 'amount', type: 'Number', customRender: ({ record }) => { const colorClass = withdrawAmountColorClass(record) return (
{formatWithdrawAmountDisplay(record)}
) } }, { title: 'شماره کارت', dataIndex: 'bank_account.cart_number', key: 'bank_account.cart_number', type: 'Number', customRender: (data) => { return data.record.bank_account?.cart_number ?? '_' } }, { title: 'شماره شبا', dataIndex: 'bank_account.shaba_number', key: 'bank_account.shaba_number', type: 'Text', customRender: (data) => { return data.record.bank_account?.shaba_number ?? '_' } }, { title: 'وضعیت', dataIndex: 'sts', key: 'sts', filterable: false, /*customRender: ({ record }) => { switch (record.sts) { case 1: return (
{record.sts_str}
) case 2: return (
{record.sts_str}
) case 4: return (
{record.sts_str}
) default: return (
{record.sts_str}
) } }*/ customRender: ({ record }: any) => { let textColor = '#ca8a04' let bgColor = '#fef3c7' if (record?.sts === 2 || record?.sts === 4) { textColor = '#25855A' bgColor = '#E3F4E9' } else if (record?.sts === 3) { textColor = '#C53030' bgColor = '#FECACA' } return ( {record?.sts_str || '-'} ) }, }, { title: 'تاریخ ثبت', dataIndex: 'created_at', key: 'created_at', type: 'DateTime', customRender: (record: any) => { return toJalali(record.record.created_at) } }, { title: 'عملیات', dataIndex: 'action', key: 'action', width: 200, slot: 'action', filterable: false } /* { title: 'تاریخ تایید', dataIndex: 'updated_at', key: 'updated_at', type: 'DateTime', customRender: (record: any) => { return toJalaliNoTime(record.record.created_at) } },*/ /*{ title: 'نقش', dataIndex: 'user_type_record', key: 'user_type_record', type: 'Select', filterable: false, sortable: false, filterComponentProps: { multiple: true }, filterField: 'user_type_obj.id', filterComponent: ReadyUserTypeSelect, /!* customRender: (record: any) => { return record.record.user_type_record?.value }*!/ customRender: ({ record }) => { const items = record.is_admin ? ( ادمین ) : ( record.user_type_obj.map((item: { title: any }, index: any) => { if (item) { return ( {item?.title} ) } }) ) return
{items}
} }, { title: 'حوزه', dataIndex: 'section', key: 'section' }, { title: 'شماره موبایل', dataIndex: 'mobile', type: 'Number', key: 'mobile' },*/ /* { title: 'عملیات', dataIndex: 'action', key: 'action', slot: 'action', fixed: 'right', filterable: false }*/ ] }