227 lines
5.9 KiB
TypeScript
227 lines
5.9 KiB
TypeScript
import type { BaseTableColumn } from '@core/type/baseTable'
|
|
import { toJalali, toJalaliNoTime, toTime } from '@core/utils/useDataTime'
|
|
import CustomTag from '@/components/CustomTag.vue'
|
|
import { usePrice } from '@core/utils/usePrice'
|
|
import WithdrawStatus from "@/pages/menuPages/withdraw/components/WithdrawStatus.vue";
|
|
/*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 cols: BaseTableColumn[] = [
|
|
{
|
|
title: 'ردیف',
|
|
dataIndex: 'id',
|
|
key: 'id',
|
|
filterable: false,
|
|
sortable: false,
|
|
customRender: (record: any) => {
|
|
return record.index + 1
|
|
}
|
|
},
|
|
{
|
|
title: 'علت تراکنش',
|
|
dataIndex: 'note',
|
|
key: 'note',
|
|
type: 'Number'
|
|
// className: 'column-money'
|
|
},
|
|
{
|
|
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: 'cash',
|
|
key: 'cash',
|
|
type: 'Number',
|
|
customRender: ({ record }) => {
|
|
return (
|
|
<div class="flex justify-center">
|
|
<div class={'font-bold px-6 text-red'}>{usePrice(record.cash ?? 0, true, '')}</div>
|
|
</div>
|
|
)
|
|
}
|
|
},
|
|
{
|
|
title: 'طلا',
|
|
dataIndex: 'gold',
|
|
key: 'gold',
|
|
type: 'Number',
|
|
},
|
|
{
|
|
title: 'شماره کارت',
|
|
dataIndex: 'bank_account.cart_number',
|
|
key: 'bank_account.cart_number',
|
|
type: 'Number',
|
|
customRender: (data) => {
|
|
return data.record.bank_account?.cart_number ?? '_'
|
|
}
|
|
},
|
|
{
|
|
title: 'وضعیت',
|
|
dataIndex: 'sts',
|
|
key: 'sts',
|
|
filterable: false,
|
|
/*customRender: ({ record }) => {
|
|
switch (record.sts) {
|
|
case 1:
|
|
return (
|
|
<div class="flex justify-center font-bold">
|
|
<CustomTag textColor="#ca8a04" bgColor="#fef3c7" class="px-2">
|
|
{record.sts_str}
|
|
</CustomTag>
|
|
</div>
|
|
)
|
|
case 2:
|
|
return (
|
|
<div class="flex justify-center font-bold px-2">
|
|
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class="px-2">
|
|
{record.sts_str}
|
|
</CustomTag>
|
|
</div>
|
|
)
|
|
case 4:
|
|
return (
|
|
<div class="flex justify-center font-bold px-2">
|
|
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class="px-2">
|
|
{record.sts_str}
|
|
</CustomTag>
|
|
</div>
|
|
)
|
|
default:
|
|
return (
|
|
<div class="flex justify-center font-bold px-2">
|
|
<CustomTag textColor="#C53030" bgColor="#FECACA" class="px-2">
|
|
{record.sts_str}
|
|
</CustomTag>
|
|
</div>
|
|
)
|
|
}
|
|
}*/
|
|
customRender: ({ record }) => {
|
|
return (
|
|
<CustomTag textColor='#ca8a04' bgColor='#fef3c7'>{record?.sts_str}</CustomTag>
|
|
)
|
|
},
|
|
},
|
|
{
|
|
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 ? (
|
|
<CustomTag textColor="#25855A" bgColor="#E3F4E9">
|
|
ادمین
|
|
</CustomTag>
|
|
) : (
|
|
record.user_type_obj.map((item: { title: any }, index: any) => {
|
|
if (item) {
|
|
return (
|
|
<CustomTag textColor="#25855A" bgColor="#E3F4E9">
|
|
{item?.title}
|
|
</CustomTag>
|
|
)
|
|
}
|
|
})
|
|
)
|
|
return <div class="flex justify-center items-center gap-2">{items}</div>
|
|
}
|
|
},
|
|
{
|
|
title: 'حوزه',
|
|
dataIndex: 'section',
|
|
key: 'section'
|
|
},
|
|
{
|
|
title: 'شماره موبایل',
|
|
dataIndex: 'mobile',
|
|
type: 'Number',
|
|
key: 'mobile'
|
|
},*/
|
|
|
|
/* {
|
|
title: 'عملیات',
|
|
dataIndex: 'action',
|
|
key: 'action',
|
|
slot: 'action',
|
|
fixed: 'right',
|
|
filterable: false
|
|
}*/
|
|
]
|