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,202 @@
<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:wallet-add" Size="16px" />
</BaseButton>
</template>-->
<template #extraHeader>
<div class="w-60vw hidden md:block">
<div class="grid grid-cols-2 gap-3 w-full py-2 px-5">
<div
:class="
sums?.cash >= 0
? sums?.cash === 0
? 'bg-amber-100'
: 'bg-green-100'
: 'bg-red-100'
"
class="rounded-lg p-2"
>
<div class="mb-1">مجموع موجودی کیف پول:</div>
<div class="flex gap-2">
<div
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
>
<div class="font-bold">{{ usePrice(sums?.cash ?? 0) }}</div>
</div>
<div
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
>
<div class="font-bold">
{{ usePrice(sums?.cashToGold.toFixed(2) ?? 0, true, 'گرم') }}
</div>
</div>
</div>
</div>
<div
:class="
sums?.gold >= 0
? sums?.gold === 0
? 'bg-amber-100'
: 'bg-green-100'
: 'bg-red-100'
"
class="rounded-lg p-2"
>
<div class="mb-1">مجموع موجودی کیف طلا:</div>
<div class="flex gap-2">
<div
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
>
<div class="font-bold">{{ usePrice(sums?.gold ?? 0, true, 'گرم') }}</div>
</div>
<div
class="gap-5 rounded-lg border-1 border-solid border-gray flex-1 p-1 text-center"
>
<div class="font-bold">{{ usePrice(sums?.goldToCash ?? 0) }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<template #action="{ column, record }">
<div class="gap-2 flex justify-center">
<!-- <a-tooltip
:key="record.active"
placement="bottom"
class="cursor-pointer"
@click="changeCustomerActivationFunction(record.id)"
>
<template #title>
<span>{{ record.active ? 'غیرفعال کردن' : 'فعال کردن' }}</span>
</template>
<Icon
:icon="record.active ? 'vuesax-linear:tick-circle' : 'vuesax-linear:close-circle'"
:color="record.active ? '#54AD06' : '#ad0627'"
/>
</a-tooltip>-->
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('info', record)">
<template #title>
<span>مشخصات</span>
</template>
<Icon icon="vuesax-linear:stickynote" color="#10913A" />
</a-tooltip>
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('edit', record)">
<template #title>
<span>ویرایش</span>
</template>
<Icon icon="vuesax-linear:edit" color="#4572E9" />
</a-tooltip>
<!-- <a-tooltip
placement="bottom"
class="cursor-pointer"
@click="emits('delete', record.id)"
>
<template #title>
<span>حذف</span>
</template>
<Icon icon="vuesax-linear:trash" color="#EB3535" />
</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/walletColumns'
import { useUserStore } from '@/store/userStore'
import { usePrefix } from '@core/composable/usePrefix'
import { message } from 'ant-design-vue'
import { getWalletTable } from '@/api/wallet'
import { usePrice } from '../../../../core/utils/usePrice'
const [submit, reload] = useBaseTable()
/*const select = (val) => {
val.sts === 1 ? return ['1'] : ['2']
}*/
//emits
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'sums'])
const { prefixCls } = usePrefix('pophoverstatus')
//permission
/*function checkPermission(temp: string) {
const store = useUserStore()
return store.canAccess(temp)
}*/
//define table
const table = ref(null)
const sums = ref<any>()
const tblProps = ref<any>({
columns: cols,
api: async (params: TableInput) => {
const data = await getWalletTable(params)
sums.value = data?.sums
emits('sums', data?.sums)
console.log(sums.value)
return data
}
//bordered: true
})
const loading = ref<boolean>(false)
async function changeCustomerActivationFunction(id: number) {
try {
loading.value = true
await changeCustomerActivation(id)
reload()
message.success('تغییر وضعیت با موفقیت انجام شد')
} catch (e) {
console.error(e)
} finally {
loading.value = 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,157 @@
import type { BaseTableColumn } from '@core/type/baseTable'
import { toJalaliNoTime, toTime } from '@core/utils/useDataTime'
import CustomTag from '@/components/CustomTag.vue'
import { usePrice } from '@core/utils/usePrice'
/*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.name',
key: 'customer.name',
type: 'Text'
},
{
title: 'موجودی کیف پول (ریال)',
dataIndex: 'cash',
key: 'cash',
type: 'Text',
customRender(data) {
return usePrice(data.record.cash, true, '')
}
},
{
title: 'موجودی کیف طلا (گرم)',
dataIndex: 'gold',
key: 'gold',
type: 'Text'
}
/* {
title: 'شماره موبایل',
dataIndex: 'mobile',
key: 'mobile',
type: 'Number'
},*/
/* {
title: 'نام فروشگاه',
dataIndex: 'shop_name',
key: 'shop_name',
type: 'Text'
},*/
/* {
title: 'وضعیت',
dataIndex: 'active',
key: 'active',
customRender: ({ record }) => {
return record.active ? (
<div class="flex justify-center">
<CustomTag textColor="#25855A" bgColor="#E3F4E9">
فعال
</CustomTag>
</div>
) : (
<div class="flex justify-center">
<CustomTag textColor="#C53030" bgColor="#FECACA">
غیر فعال
</CustomTag>
</div>
)
}
},*/
/*{
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: 'created_at',
key: 'created_at',
type: 'DateTime',
customRender: (record: any) => {
return toJalaliNoTime(record.record.created_at)
}
},*/
/* {
title: 'عملیات',
dataIndex: 'action',
key: 'action',
slot: 'action',
fixed: 'right',
filterable: false
}*/
]
+330
View File
@@ -0,0 +1,330 @@
<template>
<div>
<BasicMainCard>
<div class="md:hidden">
<!-- <div class="bg-gray-100 grid grid-cols-2 gap-3 w-full py-2 px-5">
<div class="gap-5 text-xs">
<div>مجموع موجودی کیف پول:</div>
<div class="font-bold">{{ usePrice(sums?.cash ?? 0) }}</div>
</div>
<div class="gap-5 text-xs">
<div>مجموع موجودی کیف پول:</div>
<div class="font-bold">
{{ usePrice(sums?.cashToGold.toFixed(2) ?? 0, true, 'گرم') }}
</div>
</div>
<div class="gap-5 text-xs">
<div>مجموع موجودی کیف طلا:</div>
<div class="font-bold">{{ usePrice(sums?.gold ?? 0, true, 'گرم') }}</div>
</div>
<div class="gap-5 text-xs">
<div>مجموع موجودی کیف طلا:</div>
<div class="font-bold">{{ usePrice(sums?.goldToCash ?? 0) }}</div>
</div>
</div>-->
<div class="grid grid-cols-3 gap-1 text-xs">
<div class="bg-blue-600 text-white rounded p-1">مجموع</div>
<div class="bg-blue-600 text-white rounded p-1">ریال</div>
<div class="bg-blue-600 text-white rounded p-1">گرم</div>
<div class="bg-blue-600 text-white rounded p-1">کیف طلا</div>
<div
class="text-white rounded p-1"
:class="
sums?.goldToCash >= 0
? sums?.goldToCash === 0
? 'bg-amber-600'
: 'bg-green-600'
: 'bg-red-600'
"
>
{{ usePrice(sums?.goldToCash ?? 0, true, '') }}
</div>
<div
class="text-white rounded p-1"
:class="
sums?.gold >= 0 ? (sums?.gold === 0 ? 'bg-amber-600' : 'bg-green-600') : 'bg-red-600'
"
>
{{ usePrice(sums?.gold ?? 0, true, '') }}
</div>
<div class="bg-blue-600 text-white rounded p-1">کیف پول</div>
<div
class="text-white rounded p-1"
:class="
sums?.cash >= 0 ? (sums?.cash === 0 ? 'bg-amber-600' : 'bg-green-600') : 'bg-red-600'
"
>
{{ usePrice(sums?.cash ?? 0, true, '') }}
</div>
<div
class="text-white rounded p-1"
:class="
sums?.cashToGold >= 0
? sums?.cashToGold === 0
? 'bg-amber-600'
: 'bg-green-600'
: 'bg-red-600'
"
>
{{ usePrice(sums?.cashToGold ?? 0, true, '') }}
</div>
</div>
</div>
<div class="flex w-full h-full">
<tbl
ref="table"
class="w-full h-full"
@info="info"
@edit="edit"
@sums="setSums"
@delete="deleteItem"
@add="add"
/>
<!-- <BasicMenu :menu="menu" width="13rem" @onChange="tabSelected" />
<component :is="selectedComponent" class="mr-5" />-->
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
</div>
</BasicMainCard>
<BasicModal
v-model:visible="addUserVisible"
width="40rem"
:title="`${editId ? 'ویرایش' : 'افزودن'} کاربر`"
@ok="ok"
:loading="loading"
@close="addUserVisible = false"
>
<a-form :model="form" ref="formRef" autocomplete="off">
<div class="grid md:grid-cols-2 gap-4">
<a-form-item label="نام" name="fname" :rules="inputRules()">
<BasicInput v-model:value="form.fname" />
</a-form-item>
<a-form-item label="نام خانوادگی" name="lname" :rules="inputRules()">
<BasicInput v-model:value="form.lname" />
</a-form-item>
<a-form-item label="شماره همراه" name="mobile" :rules="inputLenRules(11)">
<BasicInput v-model:value="form.mobile" type="number" />
</a-form-item>
<a-form-item label="تاریخ تولد" name="birth_date" :rules="inputRules()">
<BaseDatePicker v-model:value="form.birth_date" />
</a-form-item>
<!-- <a-form-item label="ایمیل" name="email" :rules="inputRules()">
<BasicInput v-model:value="form.email" />
</a-form-item>-->
<!-- <a-form-item label="نام فروشگاه" name="shop_name" :rules="inputRules()">
<BasicInput v-model:value="form.shop_name" />
</a-form-item>-->
<a-form-item label="شماره تلفن" name="phone_number" :rules="inputRules()">
<BasicInput v-model:value="form.phone_number" type="number" />
</a-form-item>
<a-form-item label="نام استان" name="province" :rules="inputRules()">
<BasicInput v-model:value="form.province" />
</a-form-item>
<a-form-item label="نام شهر" name="city" :rules="inputRules()">
<BasicInput v-model:value="form.city" />
</a-form-item>
<a-form-item label="شماره ملی" name="n_code" :rules="inputRules()">
<BasicInput v-model:value="form.n_code" />
</a-form-item>
<!-- <a-form-item label="نام چاپی" name="print_name" :rules="inputRules()">
<BasicInput v-model:value="form.print_name" />
</a-form-item>-->
</div>
</a-form>
</BasicModal>
<BasicInfoModal
v-model:visible="userInfoVisible"
@close="userInfoVisible = false"
:title="infoParams.title"
:date="infoParams.date"
:time="infoParams.time"
:type="infoParams.type"
itemsTitle="اطلاعات فردی"
: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 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, sum } from 'lodash'
import type { Item } from '@/model/Item'
import type { Customer } from '@/model/customer'
import { createCustomer, deleteCustomer, updateCustomer } from '@/api/customer'
import { usePrice } from '@core/utils/usePrice'
//loading
const loading = ref<boolean>(false)
//define store
const store = useStaticApiListsStore()
const sums = ref()
//define tbl
const table = ref(null)
const refreshTable = () => table?.value?.fetch()
let updateKey = ref<number>(0)
//role confirm items
const confirmItems: Array<Item> = [
{
value: 'بله',
key: true
},
{
value: 'خیر',
key: false
}
]
//form
const form = ref<Customer>({})
const formRef = ref<FormInstance>()
//info
let infoParams = reactive<Info>({})
function setSums(val) {
sums.value = val
}
function info(val: Customer) {
infoParams.name = val.name
infoParams.type = val.mobile
infoParams.date = toJalaliNoTime(val.created_at)
infoParams.time = toTime(val.created_at)
infoParams.itemsTitle = 'اطلاعات کاربری'
infoParams.items = [
{
key: 'کد کاربری',
value: val.id ?? '-'
},
{
key: 'شماره ملی',
value: val.n_code ?? '-'
},
{
key: 'تاریخ تولد',
value: toJalaliNoTime(val.birth_date) ?? '-'
},
/* {
key: 'ایمیل',
value: val.email ?? '-'
},*/
/* {
key: 'نام فروشگاه',
value: val.shop_name ?? '-'
},*/
{
key: 'شماره تلفن',
value: val.phone_number ?? '-'
},
{
key: 'نام استان',
value: val.province ?? '-'
},
{
key: 'نام شهر',
value: val.city ?? '-'
}
/* {
key: 'نام چاپی',
value: val.print_name ?? '-'
}*/
]
userInfoVisible.value = true
}
//edit
let editId: number | undefined = undefined
async function edit(record: Customer) {
addUserVisible.value = true
editId = record.id
form.value = cloneDeep(record)
}
//add
async function add() {
loading.value = true
editId = undefined
// await store.getUsersList()
addUserVisible.value = true
updateKey.value++
resetData()
loading.value = false
}
//reset data
const resetData = () => {
formRef.value?.resetFields()
form.value = {
fname: '',
lname: '',
active: false,
avatar_id: undefined,
sts: undefined,
id: undefined,
mobile: 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 addUserVisible = ref<boolean>(false)
const userInfoVisible = ref<boolean>(false)
//submit user
async function ok() {
formRef.value?.validateFields().then(async () => {
// console.log('salam', form.value)
// return
loading.value = true
try {
if (editId) {
await updateCustomer(editId, form.value)
} else {
await createCustomer(form.value)
}
addUserVisible.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>