1404/11/04- first

This commit is contained in:
2026-01-24 17:45:54 +03:30
commit edf1824229
554 changed files with 59581 additions and 0 deletions
@@ -0,0 +1,117 @@
<template>
<div>
<BasicShowContext title="لیست حساب ها">
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
<template #extraHeader>
<!-- <BaseButton type="primary" size="small" class="flex" @click="emits('add')">
<div>افزودن مشتری عمده</div>
<BaseIcon icon="vuesax-linear:user-add" Size="16px" />
</BaseButton>-->
</template>
<template #action="{ column, record }">
<div class="gap-2 flex justify-center">
<a-tooltip
:key="record.sts"
placement="bottom"
class="cursor-pointer"
@click="changeAccountStsFunction(record)"
>
<template #title>
<span>{{ record.sts !== 2 ? 'فعال سازی' : 'غیر فعال سازی' }}</span>
</template>
<Icon
:icon="record.sts !== 2 ? 'vuesax-linear:card-remove' : 'vuesax-linear:card-tick'"
:color="record.sts !== 2 ? 'red' : 'green'"
/>
</a-tooltip>
</div>
</template>
</BaseTable>
</BasicShowContext>
</div>
</template>
<script lang="tsx" setup>
import type { TableInput } from '@core/type/baseTable'
import useBaseTable from '@core/components/BaseTableOld/hooks/useBaseTable'
import Icon from '@core/components/BaseIcon/src/Icon.vue'
import { changeCustomerActivation, getCustomerTable } from '@/api/customer'
import { cols } from '../hooks/cardColumns'
import { useUserStore } from '@/store/userStore'
import { usePrefix } from '@core/composable/usePrefix'
import { message } from 'ant-design-vue'
import { getOrderTable } from '@/api/order'
import { getWithdrawTable } from '@/api/wallet'
import { changeAccountSts, getAccountTable } from '@/api/card'
import type { Card } from '@/model/card'
const [submit, reload] = useBaseTable()
/*const select = (val) => {
val.sts === 1 ? return ['1'] : ['2']
}*/
//emits
const emits = defineEmits(['delete', 'edit', 'add', 'withdraw'])
const { prefixCls } = usePrefix('pophoverstatus')
//permission
function checkPermission(temp: string) {
const store = useUserStore()
return store.canAccess(temp)
}
async function changeAccountStsFunction(val: Card) {
try {
loading.value = true
await changeAccountSts({ id: val.id, sts: val.sts !== 2 ? 2 : 3 })
message.success(val.sts !== 2 ? 'با موفقیت تایید شد' : 'با موفقیت رد شد')
reload()
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
}
//define table
const table = ref(null)
const tblProps = ref<any>({
columns: cols,
api: (params: TableInput) => {
return getAccountTable(params)
}
//bordered: true
})
const loading = ref<boolean>(false)
const fetch = () => {
// console.log('sss')
reload()
}
// const spinTable = (val: boolean) => {
// // console.log('sss')
// table?.value?.loading.value = val
// }
defineExpose({
fetch
// spinTable
})
</script>
<style lang="less">
@prefix: ~'@{prefixCls}-pophoverstatus';
.@{prefix} {
.ant-menu-rtl.ant-menu-inline,
.ant-menu-rtl.ant-menu-vertical {
border-left: none;
}
.ant-menu-item-only-child {
border-radius: @border-radius-base;
}
//bor
/* .ant-input-group-addon:first-child {
!* border: #d9d9d9 1px solid;
border-radius: 0 6px 6px 0;*!
}*/
}
</style>
@@ -0,0 +1,183 @@
import type { BaseTableColumn } from '@core/type/baseTable'
import { toJalaliNoTime, toTime } from '@core/utils/useDataTime'
import CustomTag from '@/components/CustomTag.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: '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: 'bank_name',
key: 'bank_name',
type: 'Text'
},
{
title: 'شماره حساب',
dataIndex: 'account_number',
key: 'account_number',
type: 'Number'
},
{
title: 'شماره کارت',
dataIndex: 'cart_number',
key: 'cart_number',
type: 'Number'
},
{
title: 'شماره شبا',
dataIndex: 'shaba_number',
key: 'shaba_number',
type: '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>
)
default:
return (
<div class="flex justify-center font-bold px-2">
<CustomTag textColor="#C53030" bgColor="#FECACA" class="px-2">
{record.sts_str}
</CustomTag>
</div>
)
}
}
},
{
title: 'تاریخ ثبت',
dataIndex: 'created_at',
key: 'created_at',
type: 'DateTime',
customRender: (record: any) => {
return toJalaliNoTime(record.record.created_at)
}
},
/* {
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
}
]
+221
View File
@@ -0,0 +1,221 @@
<template>
<div>
<BasicMainCard>
<div class="flex w-full h-full">
<tbl
ref="table"
class="w-full h-full"
@edit="edit"
@delete="deleteItem"
@withdraw="openWithdraw"
/>
<!-- <BasicMenu :menu="menu" width="13rem" @onChange="tabSelected" />
<component :is="selectedComponent" class="mr-5" />-->
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
</div>
</BasicMainCard>
<!-- <BasicInfoModal
v-model:visible="userInfoVisible"
@close="userInfoVisible = false"
:title="infoParams.title"
:date="infoParams.date"
:time="infoParams.time"
:type="infoParams.type"
:name="infoParams.name"
:items="infoParams.items"
/>-->
</div>
</template>
<script setup lang="ts">
// import BasicInfoModal from '@/components/BasicInfoModal'
import { inputLenRules, inputRules } from '@/utils/inputRules'
import { useStaticApiListsStore } from '@/store/staticApisStore'
import { ref } from 'vue'
import { DatePicker } from 'ant-design-vue'
import tbl from './components/table.vue'
import type { FormInstance } from 'ant-design-vue'
import BasicInfoModal from '@/components/BasicInfoModal/index.vue'
import { message } from 'ant-design-vue/es'
import type { Info } from '@/components/BasicInfoModal/model/Info'
import { toJalaliNoTime, toTime } from '@core/utils/useDataTime'
import { confirmDeleteItem } from '@/utils/confirmModal'
import { cloneDeep } from 'lodash'
import type { Item } from '@/model/Item'
import type { Customer } from '@/model/customer'
import { createCustomer, deleteCustomer, updateCustomer } from '@/api/customer'
import type { Order } from '@/model/order'
import type { Wallet, Withdraw } from '@/model/wallet'
import { completeWithdraw } from '@/api/wallet'
//import DatePicker from '@core/components/_sample/components/datePicker.vue'
//loading
const loading = ref<boolean>(false)
//define store
const store = useStaticApiListsStore()
//define tbl
const table = ref(null)
const refreshTable = () => table?.value?.fetch()
let updateKey = ref<number>(0)
//form
const form = ref<Withdraw>({})
const formRef = ref<FormInstance>()
//info
let infoParams = reactive<Info>({})
/*
function info(val: Order) {
infoParams.name = val.customer.name
infoParams.type = val.customer.mobile
infoParams.date = toJalaliNoTime(val.created_at)
infoParams.time = toTime(val.created_at)
infoParams.itemsTitle = 'اطلاعات کاربری'
infoParams.items = [
{
key: 'مقدار (گرم)',
value: val.amount ?? '-'
},
{
key: 'قیمت هر گرم طلا برای مشتری (ریال)',
value: val.price ?? '-'
},
{
key: 'قیمت کل برای مشتری (ریال)',
value: val.total_price ?? '-'
},
{
key: '/قیمت هر گرم طلا بدون سود (ریال)',
value: val.price_original ?? '-'
},
{
key: 'قیمت کل بدون سود (ریال)',
value: val.total_price_original ?? '-'
},
{
key: 'سود هر گرم (ریال)',
value: val.fee ?? '-'
},
{
key: 'سود کل (ریال)',
value: val.total_fee ?? '-'
},
{
key: 'کد کاربری',
value: val.customer.id ?? '-'
},
{
key: 'شماره ملی',
value: val.customer.n_code ?? '-'
},
{
key: 'تاریخ تولد',
value: toJalaliNoTime(val.customer.birth_date) ?? '-'
},
{
key: 'نام فروشگاه',
value: val.customer.shop_name ?? '-'
},
{
key: 'شماره تلفن فروشگاه',
value: val.customer.phone_number ?? '-'
},
{
key: 'نام استان',
value: val.customer.province ?? '-'
},
{
key: 'نام شهر',
value: val.customer.city ?? '-'
}
/!* {
key: 'نام چاپی',
value: val.print_name ?? '-'
}*!/
]
userInfoVisible.value = true
}
*/
//edit
let editId: number | undefined = undefined
async function edit(record: Customer) {
confirmWithdrawVisible.value = true
editId = record.id
form.value = cloneDeep(record)
}
//add
/*async function add() {
loading.value = true
editId = undefined
// await store.getUsersList()
confirmWithdrawVisible.value = true
updateKey.value++
resetData()
loading.value = false
}*/
function openWithdraw(val: number) {
confirmWithdrawId = val
confirmWithdrawVisible.value = true
}
//reset data
const resetData = () => {
formRef.value?.resetFields()
form.value = {
tracked_number: undefined
}
}
//delete
const deleteItem = (id: number) => confirmDeleteItem('کاربر', id, deleteCustomer, refreshTable)
//define selects
onMounted(async () => {
loading.value = true
// await getResponsible()
// await getQC()
// await getManager()
loading.value = false
})
//add project modal
const confirmWithdrawVisible = ref<boolean>(false)
let confirmWithdrawId: number
// const userInfoVisible = ref<boolean>(false)
//submit user
async function okWithdraw() {
formRef.value?.validateFields().then(async () => {
// console.log('salam', form.value)
// return
loading.value = true
try {
form.value.id = confirmWithdrawId
await completeWithdraw(form.value)
confirmWithdrawVisible.value = false
refreshTable()
resetData()
message.success('شماره پیگیری با موفقیت تایید شد')
// await getResponsible()
// await getQC()
// await getManager()
} catch (e) {
console.error(e)
// message.error('خطا در بارگذاری اطلاعات')
} finally {
loading.value = false
}
})
}
</script>
<style scoped></style>