1404/11/04- first
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
<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.is_archive" placement="bottom" class="cursor-pointer">
|
||||
<template #title>
|
||||
<span>{{ record.is_archive ? 'بیرون بردن از بایگانی' : 'بایگانی کردن' }}</span>
|
||||
</template>
|
||||
<a-popconfirm
|
||||
title="آیا مشتری را از بایگانی خارج می کنید؟"
|
||||
ok-text="تایید"
|
||||
cancel-text="رد"
|
||||
placement="topLeft"
|
||||
@confirm="archiveFunction(record.id)"
|
||||
@cancel=""
|
||||
>
|
||||
<!-- <template #icon><question-circle-outlined style="color: red" /></template>-->
|
||||
<Icon class="cursor-pointer" icon="vuesax-linear:archive-slash" color="#e3bf00" />
|
||||
</a-popconfirm>
|
||||
</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('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,
|
||||
changeCustomerArchive,
|
||||
changeCustomerOrderActivation,
|
||||
getCustomerArchiveTable,
|
||||
getCustomerTable
|
||||
} from '@/api/customer'
|
||||
import { cols } from '../hooks/archiveColumns'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { usePrefix } from '@core/composable/usePrefix'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
/*const select = (val) => {
|
||||
val.sts === 1 ? return ['1'] : ['2']
|
||||
}*/
|
||||
//emits
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'charge'])
|
||||
|
||||
const { prefixCls } = usePrefix('pophoverstatus')
|
||||
|
||||
//permission
|
||||
function checkPermission(temp: string) {
|
||||
const store = useUserStore()
|
||||
return store.canAccess(temp)
|
||||
}
|
||||
|
||||
//define table
|
||||
const table = ref(null)
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: (params: TableInput) => {
|
||||
return getCustomerArchiveTable(params)
|
||||
}
|
||||
//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
|
||||
}
|
||||
}
|
||||
|
||||
async function changeCustomerOrderActivationFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerOrderActivation(id)
|
||||
reload()
|
||||
message.success('تغییر وضعیت سفارش دهی با موفقیت انجام شد')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
async function archiveFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerArchive(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,163 @@
|
||||
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: 'name',
|
||||
key: 'name',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'شماره موبایل',
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile',
|
||||
type: 'Number'
|
||||
},
|
||||
/* {
|
||||
title: 'نام',
|
||||
dataIndex: 'shop_name',
|
||||
key: 'shop_name',
|
||||
type: 'Text'
|
||||
},*/
|
||||
{
|
||||
title: 'وضعیت کاربر',
|
||||
dataIndex: 'active',
|
||||
key: 'active',
|
||||
type: 'Boolean',
|
||||
customRender: ({ record }) => {
|
||||
return record.active ? (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
فعال
|
||||
</CustomTag>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
غیر فعال
|
||||
</CustomTag>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'وضعیت سفارش دهی',
|
||||
dataIndex: 'trade_active',
|
||||
key: 'trade_active',
|
||||
type: 'Boolean',
|
||||
customRender: ({ record }) => {
|
||||
return record.trade_active ? (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
مجاز
|
||||
</CustomTag>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
غیر مجاز
|
||||
</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
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,307 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <BasicMainCard>-->
|
||||
<div class="flex w-full h-full">
|
||||
<tbl ref="table" class="w-full h-full" @info="info" @edit="edit" @charge="walletCharge" />
|
||||
|
||||
<!-- <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>
|
||||
<BasicModal
|
||||
v-model:visible="userInfoVisible"
|
||||
width="40vw"
|
||||
title="اطلاعات کاربر"
|
||||
custom-footer
|
||||
@close="userInfoVisible = false"
|
||||
>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="col-span-4 bg-gray-100 w-full rounded-lg flex p-3 justify-between">
|
||||
<div>
|
||||
<div class="font-bold">{{ userInfo.name }}</div>
|
||||
<div class="mt-1">{{ userInfo?.mobile }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>{{ toJalaliNoTime(userInfo?.created_at) }}</div>
|
||||
<div class="mt-2">
|
||||
<CustomTag
|
||||
:textColor="userInfo?.active ? '#25855A' : '#C53030'"
|
||||
:bgColor="userInfo?.active ? '#E3F4E9' : '#FECACA'"
|
||||
class="font-bold px-6"
|
||||
>
|
||||
{{ userInfo?.active ? 'فعال' : 'غیرفعال' }}
|
||||
</CustomTag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BasicInfoItem title="کد کاربری" :value="userInfo?.id" />
|
||||
<BasicInfoItem title="نوع کاربر" :value="userInfo?.type_str" />
|
||||
<BasicInfoItem
|
||||
title="تاریخ تولد"
|
||||
:value="userInfo?.birth_date ? toJalaliNoTime(userInfo?.birth_date) : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="شماره ملی" :value="userInfo?.n_code ?? '_'" />
|
||||
<BasicInfoItem title="نام استان" :value="userInfo?.province ?? '_'" />
|
||||
<BasicInfoItem title="نام شهر" :value="userInfo?.city ?? '_'" />
|
||||
<BasicInfoItem title="سقف اعتبار" :value="userInfo?.gram ? `${userInfo?.gram} گرم` : '_'" />
|
||||
<BasicInfoItem title="کد معرف" :value="userInfo?.referral_id" />
|
||||
<BasicInfoItem
|
||||
title="کد معرف کاربر"
|
||||
:value="userInfo?.referral ? userInfo?.referral?.id : '_'"
|
||||
/>
|
||||
<BasicInfoItem
|
||||
title="نام معرف کاربر"
|
||||
:value="userInfo?.referral ? userInfo?.referral?.name : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="وضعیت سفارش دهی">
|
||||
<CustomTag
|
||||
:textColor="userInfo?.trade_active === 1 ? '#25855A' : '#C53030'"
|
||||
:bgColor="userInfo?.trade_active === 1 ? '#E3F4E9' : '#FECACA'"
|
||||
class="font-bold px-6"
|
||||
>
|
||||
{{ userInfo?.trade_active === 1 ? 'مجاز' : 'غیر مجاز' }}
|
||||
</CustomTag>
|
||||
</BasicInfoItem>
|
||||
<div class="col-span-4 grid grid-cols-2 gap-3">
|
||||
<div
|
||||
v-for="(item, index) in userInfo.wallet"
|
||||
:key="index"
|
||||
class="grid grid-cols-2 bg-orange-50 gap-2 rounded-lg p-2"
|
||||
>
|
||||
<BasicInfoItem
|
||||
title="نام قلک"
|
||||
:value="item?.fund ? item?.fund?.title : 'کیف پول طلایی'"
|
||||
/>
|
||||
<BasicInfoItem title="مقدار طلا" :value="`${item?.gold} گرم`" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BasicModal>
|
||||
|
||||
<BasicModal
|
||||
v-model:visible="showWalletCharge"
|
||||
width="30rem"
|
||||
title="شارژ کیف پول"
|
||||
@ok="charge"
|
||||
:loading="loading"
|
||||
@close="showWalletCharge = false"
|
||||
>
|
||||
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
|
||||
<a-form-item label="مقدار شارژ (ریال)" name="value" :rules="inputRules()">
|
||||
<BasicInput v-model:value="formCharge.value" type="number" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</BasicModal>
|
||||
</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 } from 'lodash'
|
||||
import type { Item } from '@/model/Item'
|
||||
import type { Customer } from '@/model/customer'
|
||||
import { createCustomer, deleteCustomer, updateCustomer } from '@/api/customer'
|
||||
import type { Charge } from '@/model/wallet'
|
||||
import customers from '@/router/routes/customers'
|
||||
import { chargeWallet } from '@/api/wallet'
|
||||
|
||||
//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)
|
||||
|
||||
//role confirm items
|
||||
const confirmItems: Array<Item> = [
|
||||
{
|
||||
value: 'بله',
|
||||
key: true
|
||||
},
|
||||
{
|
||||
value: 'خیر',
|
||||
key: false
|
||||
}
|
||||
]
|
||||
|
||||
//wallet
|
||||
const showWalletCharge = ref<boolean>(false)
|
||||
|
||||
//form
|
||||
const form = ref<Customer>({})
|
||||
const formCharge = ref<Charge>({})
|
||||
const formRef = ref<FormInstance>()
|
||||
const formChargeRef = ref<FormInstance>()
|
||||
const userInfo = ref<Customer>()
|
||||
|
||||
//info
|
||||
let infoParams = reactive<Info>({})
|
||||
|
||||
function info(val: Customer) {
|
||||
userInfoVisible.value = true
|
||||
userInfo.value = cloneDeep(val)
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
async function walletCharge(val: Customer) {
|
||||
showWalletCharge.value = true
|
||||
formCharge.value.customer_id = val.id
|
||||
}
|
||||
|
||||
async function charge() {
|
||||
formChargeRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
await chargeMoneyWallet(formCharge.value)
|
||||
message.success('افزایش اعتبار با موفقیت انجام شد')
|
||||
showWalletCharge.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
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></style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<CollapsePanel :key="activeKey">
|
||||
<template #header>
|
||||
<div class="w-full">
|
||||
<div class="flex justify-between items-center mb-3">
|
||||
<span>{{ props.title }}</span>
|
||||
<BaseIcon :class="[{ rotate: props.actives.includes(props.activeKey) }]" icon="vuesax-linear:arrow-left-1" size="17" />
|
||||
</div>
|
||||
<div :class="[{ open: props.actives.includes(props.activeKey) }]"></div>
|
||||
</div>
|
||||
</template>
|
||||
<slot name="content"></slot>
|
||||
</CollapsePanel>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
import {CollapsePanel} from "ant-design-vue";
|
||||
|
||||
interface Props {
|
||||
title: string,
|
||||
activeKey: string | number,
|
||||
actives: string[] | number[]
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
.open {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #E5E7EB;
|
||||
|
||||
}
|
||||
|
||||
.rotate {
|
||||
transform: rotate(-90deg);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.ant-collapse > .ant-collapse-item > .ant-collapse-header {
|
||||
direction: rtl !important;
|
||||
justify-content: space-between !important;
|
||||
background-color: #fff !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ant-collapse{
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.ant-collapse > .ant-collapse-item {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
.ant-collapse-content {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.ant-collapse > .ant-collapse-item > .ant-collapse-header .ant-collapse-arrow {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.ant-collapse > .ant-collapse-item > .ant-collapse-header {
|
||||
padding: 12px 16px 0 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicShowContext title="لیست قلک ها">
|
||||
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
|
||||
</BaseTable>
|
||||
</BasicShowContext>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup>
|
||||
import type {TableInput} from '@core/type/baseTable'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import {
|
||||
changeCustomerActivation,
|
||||
changeCustomerArchive,
|
||||
changeCustomerOrderActivation,
|
||||
confirmUser,
|
||||
getCustomerTable
|
||||
} from '@/api/customer'
|
||||
import {cols} from '@/pages/menuPages/customers/base/hooks/fundsColumns'
|
||||
import {useUserStore} from '@/store/userStore'
|
||||
import {usePrefix} from '@core/composable/usePrefix'
|
||||
import {message} from 'ant-design-vue'
|
||||
import {inputRules} from '@/utils/inputRules'
|
||||
import type {User} from '@/model/user'
|
||||
import {toJalaliNoTime} from '@core/utils/useDataTime'
|
||||
import type {Customer} from '@/model/customer'
|
||||
import {onMounted} from 'vue'
|
||||
import {getFundsTable} from "@/api/user";
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
|
||||
interface Prop {
|
||||
customerId?: number
|
||||
}
|
||||
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'chargeMoney', 'chargeGold'])
|
||||
const props = defineProps<Prop>()
|
||||
|
||||
const {prefixCls} = usePrefix('pophoverstatus')
|
||||
|
||||
//permission
|
||||
function checkPermission(temp: string) {
|
||||
const store = useUserStore()
|
||||
return store.canAccess(temp)
|
||||
}
|
||||
|
||||
//define table
|
||||
const table = ref(null)
|
||||
|
||||
const confirmVisible = ref<boolean>(false)
|
||||
const confirmInfo = ref<Customer>()
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: (params: TableInput) => {
|
||||
return getFundsTable(params, props.customerId)
|
||||
}
|
||||
//bordered: true
|
||||
})
|
||||
const refPop = ref()
|
||||
|
||||
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';
|
||||
.ant-popover,
|
||||
.ant-tooltip {
|
||||
z-index: 10 !important;
|
||||
}
|
||||
|
||||
.@{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,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicShowContext title="لیست معرفی کرده ها">
|
||||
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
|
||||
</BaseTable>
|
||||
</BasicShowContext>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup>
|
||||
import type {TableInput} from '@core/type/baseTable'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import {
|
||||
changeCustomerActivation,
|
||||
changeCustomerArchive,
|
||||
changeCustomerOrderActivation,
|
||||
confirmUser,
|
||||
getCustomerTable
|
||||
} from '@/api/customer'
|
||||
import {cols} from '@/pages/menuPages/customers/base/hooks/referralColumns'
|
||||
import {useUserStore} from '@/store/userStore'
|
||||
import {usePrefix} from '@core/composable/usePrefix'
|
||||
import {message} from 'ant-design-vue'
|
||||
import {inputRules} from '@/utils/inputRules'
|
||||
import type {User} from '@/model/user'
|
||||
import {toJalaliNoTime} from '@core/utils/useDataTime'
|
||||
import type {Customer} from '@/model/customer'
|
||||
import {onMounted} from 'vue'
|
||||
import {getReferralsTable} from "@/api/user";
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
|
||||
interface Prop {
|
||||
customerId?: number
|
||||
}
|
||||
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'chargeMoney', 'chargeGold'])
|
||||
const props = defineProps<Prop>()
|
||||
|
||||
const {prefixCls} = usePrefix('pophoverstatus')
|
||||
|
||||
//permission
|
||||
function checkPermission(temp: string) {
|
||||
const store = useUserStore()
|
||||
return store.canAccess(temp)
|
||||
}
|
||||
|
||||
//define table
|
||||
const table = ref(null)
|
||||
|
||||
const confirmVisible = ref<boolean>(false)
|
||||
const confirmInfo = ref<Customer>()
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: (params: TableInput) => {
|
||||
|
||||
return getReferralsTable(params, props.customerId)
|
||||
}
|
||||
//bordered: true
|
||||
})
|
||||
const refPop = ref()
|
||||
|
||||
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';
|
||||
.ant-popover,
|
||||
.ant-tooltip {
|
||||
z-index: 10 !important;
|
||||
}
|
||||
|
||||
.@{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,611 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="md:flex pr-3">
|
||||
<div class="content-center">فعال سازی محصولات:</div>
|
||||
<div class="ml-2 content-center mt-1 md:mt-unset md:mr-4">زمان شروع </div>
|
||||
<div>
|
||||
<TimePicker
|
||||
v-model:value="startTime"
|
||||
:locale="customLocale"
|
||||
placeholder="انتخاب زمان"
|
||||
:defaultValue="dayjs('00:00:00', 'HH:mm:ss')"
|
||||
/>
|
||||
</div>
|
||||
<div class="md:mr-4 ml-2 mt-2 md:mt-unset content-center">زمان پایان </div>
|
||||
<div>
|
||||
<TimePicker
|
||||
v-model:value="endTime"
|
||||
:locale="customLocale"
|
||||
placeholder="انتخاب زمان"
|
||||
:defaultValue="dayjs('00:00:00', 'HH:mm:ss')"
|
||||
/>
|
||||
</div>
|
||||
<BaseButton @click="setTimeActive(startTime , endTime)" class="mt-2 md:mt-unset md:mr-2">ثبت</BaseButton>
|
||||
</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:box" Size="16px" />
|
||||
</BaseButton>
|
||||
</template>
|
||||
<template #action="{ column, record }">
|
||||
<div class="gap-2 flex justify-center">
|
||||
<a-tooltip class="cursor-pointer" :key="record.open_buy">
|
||||
<template v-if="!record.open_buy" #title><span>فعال کردن خرید</span></template>
|
||||
<template v-else #title><span>غیر فعال کردن خرید</span></template>
|
||||
<BaseIcon
|
||||
icon="vuesax-linear:money-receive"
|
||||
:color="record.open_buy ? '#16A34A' : '#DC2626'"
|
||||
@click="activeBuy(record)"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip class="cursor-pointer" :key="record.open_sell">
|
||||
<template v-if="!record.open_sell" #title><span>فعال کردن فروش</span></template>
|
||||
<template v-else #title><span>غیر فعال کردن فروش</span></template>
|
||||
<BaseIcon
|
||||
icon="vuesax-linear:money-send"
|
||||
:color="record.open_sell ? '#16A34A' : '#DC2626'"
|
||||
@click="activeSell(record)"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip class="cursor-pointer" :key="record.active">
|
||||
<template v-if="!record.active" #title><span>فعال کردن محصول</span></template>
|
||||
<template v-else #title><span>غیر فعال کردن محصول</span></template>
|
||||
<BaseIcon
|
||||
v-if="!record.active"
|
||||
icon="vuesax-linear:close-circle"
|
||||
color="#DC2626"
|
||||
@click="activeProduct(record)"
|
||||
/>
|
||||
<BaseIcon
|
||||
v-else
|
||||
icon="vuesax-linear:tick-circle"
|
||||
color="#16A34A"
|
||||
@click="activeProduct(record)"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<!-- <a-tooltip class="cursor-pointer" :key="record.show">
|
||||
<template v-if="!record.show" #title><span>نشان دادن محصول</span></template>
|
||||
<template v-else #title><span>مخفی کردن محصول</span></template>
|
||||
<BaseIcon
|
||||
v-if="!record.show"
|
||||
icon="vuesax-linear:chart-fail"
|
||||
color="#DC2626"
|
||||
@click="visibilityProduct(record)"
|
||||
/>
|
||||
<BaseIcon
|
||||
v-else
|
||||
icon="vuesax-linear:chart-success"
|
||||
color="#16A34A"
|
||||
@click="visibilityProduct(record)"
|
||||
/>
|
||||
</a-tooltip>-->
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="emits('edit', record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>ویرایش</span>
|
||||
</template>
|
||||
<BaseIcon icon="vuesax-linear:edit" color="#4572E9" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<!-- <div class="md:hidden">-->
|
||||
<!-- <a-popover title="" placement="right" @cancel="">
|
||||
<template #content>
|
||||
<div class="flex flex-col gap-3">
|
||||
<a-tooltip :key="record.is_archive" placement="bottom" class="cursor-pointer">
|
||||
<template #title>
|
||||
<span>{{
|
||||
record.is_archive ? 'بیرون بردن از بایگانی' : 'بایگانی کردن'
|
||||
}}</span>
|
||||
</template>
|
||||
<a-popconfirm
|
||||
title="آیا مشتری را بایگانی می کنید؟"
|
||||
ok-text="تایید"
|
||||
cancel-text="رد"
|
||||
placement="topLeft"
|
||||
@confirm="archiveFunction(record.id)"
|
||||
@cancel=""
|
||||
>
|
||||
<!– <template #icon><question-circle-outlined style="color: red" /></template>–>
|
||||
<Icon
|
||||
class="cursor-pointer"
|
||||
icon="vuesax-linear:archive-tick"
|
||||
color="#e3bf00"
|
||||
/>
|
||||
</a-popconfirm>
|
||||
</a-tooltip>
|
||||
<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:user-tick' : 'vuesax-linear:user-remove'
|
||||
"
|
||||
:color="record.active ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="emits('chargeMoney', record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>شارژ کیف پول ریالی</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:wallet-add" color="#9333ea" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="emits('chargeGold', record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>شارژ کیف پول طلایی</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:wallet-money" color="#ea580c" />
|
||||
</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
|
||||
:key="record.trade_active"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="changeCustomerOrderActivationFunction(record.id)"
|
||||
>
|
||||
<template #title>
|
||||
<span>
|
||||
{{
|
||||
record.trade_active ? 'غیر مجاز کردن سفارش دهی' : 'مجاز کردن سفارش دهی'
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<Icon
|
||||
:icon="
|
||||
record.trade_active === 1
|
||||
? 'vuesax-linear:box-tick'
|
||||
: 'vuesax-linear:box-remove'
|
||||
"
|
||||
:color="record.trade_active === 1 ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="!record.is_legal"
|
||||
:key="record.trade_active"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openConfirmUser(record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>تایید کاربر</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:user-search" color="#0d9488" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<!– <template #icon><question-circle-outlined style="color: red" /></template>–>
|
||||
<Icon class="cursor-pointer" icon="vuesax-linear:setting" color="#000" />
|
||||
</a-popover>
|
||||
</div>
|
||||
<div class="gap-2 hidden md:flex justify-center">
|
||||
<a-tooltip :key="record.is_archive" placement="bottom" class="cursor-pointer">
|
||||
<template #title>
|
||||
<span>{{ record.is_archive ? 'بیرون بردن از بایگانی' : 'بایگانی کردن' }}</span>
|
||||
</template>
|
||||
<a-popconfirm
|
||||
title="آیا مشتری را بایگانی می کنید؟"
|
||||
ok-text="تایید"
|
||||
cancel-text="رد"
|
||||
placement="topLeft"
|
||||
@confirm="archiveFunction(record.id)"
|
||||
@cancel=""
|
||||
>
|
||||
<!– <template #icon><question-circle-outlined style="color: red" /></template>–>
|
||||
<Icon class="cursor-pointer" icon="vuesax-linear:archive-tick" color="#e3bf00" />
|
||||
</a-popconfirm>
|
||||
</a-tooltip>
|
||||
<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:user-tick' : 'vuesax-linear:user-remove'"
|
||||
:color="record.active ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="emits('chargeMoney', record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>شارژ کیف پول ریالی</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:wallet-add" color="#9333ea" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="emits('chargeGold', record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>شارژ کیف پول طلایی</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:wallet-money" color="#ea580c" />
|
||||
</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
|
||||
:key="record.trade_active"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="changeCustomerOrderActivationFunction(record.id)"
|
||||
>
|
||||
<template #title>
|
||||
<span>{{
|
||||
record.trade_active ? 'غیر مجاز کردن سفارش دهی' : 'مجاز کردن سفارش دهی'
|
||||
}}</span>
|
||||
</template>
|
||||
<Icon
|
||||
:icon="
|
||||
record.trade_active === 1 ? 'vuesax-linear:box-tick' : 'vuesax-linear:box-remove'
|
||||
"
|
||||
:color="record.trade_active === 1 ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="!record.is_legal"
|
||||
:key="record.trade_active"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openConfirmUser(record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>تایید کاربر</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:user-search" color="#0d9488" />
|
||||
</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>
|
||||
<BasicModal
|
||||
v-model:visible="confirmVisible"
|
||||
width="50vw"
|
||||
title="تایید مشتری"
|
||||
@ok="confirmUserFunction"
|
||||
ok-text="تایید"
|
||||
:loading="loading"
|
||||
@close="confirmVisible = false"
|
||||
>
|
||||
<div class="mt-[-10px] mb-10 font-bold">آیا از اطلاعات وارد شده اطمینان دارید؟</div>
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<BasicInfoItem title="نام و نام خانوادگی" :value="confirmInfo?.name" />
|
||||
<BasicInfoItem title="شماره همراه" :value="confirmInfo?.mobile" />
|
||||
<BasicInfoItem
|
||||
title="تاریخ تولد"
|
||||
:value="confirmInfo?.birth_date ? toJalaliNoTime(confirmInfo?.birth_date) : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="شماره تلفن" :value="confirmInfo?.phone_number ?? '_'" />
|
||||
<BasicInfoItem title="نام استان" :value="confirmInfo?.province" />
|
||||
<BasicInfoItem title="نام شهر" :value="confirmInfo?.city" />
|
||||
<BasicInfoItem title="شماره ملی" :value="confirmInfo?.n_code" />
|
||||
</div>
|
||||
</BasicModal>
|
||||
</BasicShowContext>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup>
|
||||
import type { TableInput } from '@core/type/baseTable'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import {
|
||||
changeActiveProduct,
|
||||
changeBuyActiveProduct,
|
||||
changeCustomerArchive,
|
||||
changeCustomerOrderActivation,
|
||||
changeProductActivation, changeSellActiveProduct, changeVisibilityProduct,
|
||||
confirmUser,
|
||||
getCustomerTable, setActiveTime
|
||||
} from "@/api/product";
|
||||
import { cols } from '@/pages/menuPages/products/base/hooks/customerColumns'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { usePrefix } from '@core/composable/usePrefix'
|
||||
import { message, type TimePickerProps } from "ant-design-vue";
|
||||
import { inputRules } from '@/utils/inputRules'
|
||||
import type { User } from '@/model/user'
|
||||
import { toJalaliNoTime } from '@core/utils/useDataTime'
|
||||
import type { Customer } from '@/model/customer'
|
||||
import { onMounted } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
import type {Product} from "@/model/product";
|
||||
import {resolve} from "path";
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
/*const select = (val) => {
|
||||
val.sts === 1 ? return ['1'] : ['2']
|
||||
}*/
|
||||
//emits
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'chargeMoney', 'chargeGold'])
|
||||
|
||||
const { prefixCls } = usePrefix('pophoverstatus')
|
||||
|
||||
//permission
|
||||
function checkPermission(temp: string) {
|
||||
const store = useUserStore()
|
||||
return store.canAccess(temp)
|
||||
}
|
||||
|
||||
//define table
|
||||
const table = ref(null)
|
||||
const data = ref()
|
||||
const confirmVisible = ref<boolean>(false)
|
||||
const confirmInfo = ref<Customer>()
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: async (params: TableInput) => {
|
||||
const data = await getCustomerTable(params)
|
||||
startTime.value = dayjs(data?.auto_open_at, 'HH:mm:ss')
|
||||
endTime.value = dayjs(data?.auto_close_at, 'HH:mm:ss')
|
||||
return data
|
||||
},
|
||||
//bordered: true
|
||||
})
|
||||
const refPop = ref()
|
||||
|
||||
// function edit(recordId){
|
||||
// emits('edit', recordId);
|
||||
// console.log( recordId);
|
||||
// console.log( visibleAction.value[parseInt(recordId)]);
|
||||
// visibleAction.value[recordId]=false
|
||||
// console.log('ddddd')
|
||||
// }
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
function openConfirmUser(user: Customer) {
|
||||
confirmInfo.value = user
|
||||
confirmVisible.value = true
|
||||
}
|
||||
|
||||
async function archiveFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerArchive(id)
|
||||
reload()
|
||||
message.success('مشتری با موفقیت بایگانی شد.')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmUserFunction() {
|
||||
try {
|
||||
loading.value = true
|
||||
await confirmUser(confirmInfo.value?.id)
|
||||
reload()
|
||||
confirmVisible.value = false
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function changeCustomerOrderActivationFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerOrderActivation(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
|
||||
})
|
||||
|
||||
const activeSell = async (product: Product) => {
|
||||
Modal.confirm({
|
||||
title: 'وضعیت فروش محصول تغییر خواهد یافت.آیا مطمئن هستید؟',
|
||||
okText: 'بله',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
onOk: async () => {
|
||||
await changeSellActiveProduct(product.id)
|
||||
reload()
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const activeBuy = async (product: Product) => {
|
||||
Modal.confirm({
|
||||
title: 'وضعیت خرید محصول تغییر خواهد یافت.آیا مطمئن هستید؟',
|
||||
okText: 'بله',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
onOk: async () => {
|
||||
await changeBuyActiveProduct(product.id)
|
||||
reload()
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel')
|
||||
}
|
||||
})
|
||||
}
|
||||
const activeProduct = async (product: Product) => {
|
||||
Modal.confirm({
|
||||
title: 'آیا مطمئن به انجام این عملیات هستید؟',
|
||||
okText: 'بله',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
onOk: async () => {
|
||||
await changeActiveProduct(product.id)
|
||||
reload()
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const visibilityProduct = async (product: Product) => {
|
||||
Modal.confirm({
|
||||
title: 'آیا مطمئن به انجام این عملیات هستید؟',
|
||||
okText: 'بله',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
onOk: async () => {
|
||||
await changeVisibilityProduct(product.id)
|
||||
reload()
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
import { ref } from 'vue'
|
||||
import { TimePicker } from 'ant-design-vue'
|
||||
import dayjs from 'dayjs';
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||
import locale from "ant-design-vue/es/date-picker/locale/fa_IR"
|
||||
const startTime = ref(dayjs('00:00:00', 'HH:mm:ss'))
|
||||
const endTime = ref(dayjs('00:00:00', 'HH:mm:ss'))
|
||||
dayjs.extend(customParseFormat)
|
||||
const customLocale = ref({
|
||||
...locale,
|
||||
lang: {
|
||||
...locale.lang,
|
||||
now: "اکنون",
|
||||
ok: "ثبت",
|
||||
},
|
||||
})
|
||||
async function setTimeActive(start: string, end: string) {
|
||||
try {
|
||||
const startTimeFormatted = dayjs(start, 'HH:mm:ss').format('HH:mm:ss')
|
||||
const endTimeFormatted = dayjs(end, 'HH:mm:ss').format('HH:mm:ss')
|
||||
await setActiveTime(startTimeFormatted, endTimeFormatted)
|
||||
message.success('با موفقیت ثبت شد.')
|
||||
} catch (e) {
|
||||
message.error('زمان را وارد کنید.')
|
||||
// console.log(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@prefix: ~'@{prefixCls}-pophoverstatus';
|
||||
.ant-popover,
|
||||
.ant-tooltip {
|
||||
z-index: 10 !important;
|
||||
}
|
||||
|
||||
.@{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,291 @@
|
||||
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 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: 'title',
|
||||
key: 'title',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'تصویر',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'وزن',
|
||||
dataIndex: 'amount',
|
||||
key: 'amount',
|
||||
type: 'Number'
|
||||
},
|
||||
{
|
||||
title: 'واحد',
|
||||
dataIndex: 'unit',
|
||||
key: 'unit',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'دسته بندی',
|
||||
dataIndex: 'group_type',
|
||||
key: 'group_type',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'قیمت',
|
||||
dataIndex: 'price',
|
||||
key: 'price',
|
||||
type: 'Text',
|
||||
},
|
||||
{
|
||||
title: 'متد',
|
||||
dataIndex: 'reading_method',
|
||||
key: 'reading_method',
|
||||
type: 'Text',
|
||||
customRender: (record) => {
|
||||
return (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag>
|
||||
{record?.record.reading_method ? record?.record.reading_method : 'دستی'}
|
||||
</CustomTag>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
/*{
|
||||
title: 'کارمزد درصدی موقع خرید',
|
||||
dataIndex: 'percent_fee_buy',
|
||||
key: 'percent_fee_buy',
|
||||
type: 'Number'
|
||||
},
|
||||
{
|
||||
title: 'کارمزد درصدی موقع فروش',
|
||||
dataIndex: 'percent_fee_sell',
|
||||
key: 'percent_fee_sell',
|
||||
type: 'Number'
|
||||
},*/
|
||||
{
|
||||
title: 'هزینه نقدی موقع خرید',
|
||||
dataIndex: 'cash_fee_buy',
|
||||
key: 'cash_fee_buy',
|
||||
type: 'Number'
|
||||
},
|
||||
{
|
||||
title: 'هزینه نقدی موقع فروش',
|
||||
dataIndex: 'cash_fee_sell',
|
||||
key: 'cash_fee_sell',
|
||||
type: 'Number'
|
||||
},
|
||||
{
|
||||
title: 'وضعیت محصول',
|
||||
dataIndex: 'active',
|
||||
key: 'active',
|
||||
type: 'Boolean',
|
||||
customRender: (record) => {
|
||||
return (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag
|
||||
class="px-3 font-bold py-1"
|
||||
textColor={record?.record.active ? '#65a30d' : '#dc2626'}
|
||||
bgColor={record?.record.active ? '#ecfccb' : '#fee2e2'}
|
||||
>
|
||||
{record?.record.active ? 'باز' : 'بسته'}
|
||||
</CustomTag>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'عملیات',
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
slot: 'action',
|
||||
filterable: false
|
||||
}
|
||||
|
||||
// {
|
||||
// title: 'کد معرف',
|
||||
// dataIndex: 'referral_id',
|
||||
// key: 'referral_id',
|
||||
// type: 'Text'
|
||||
// },
|
||||
// {
|
||||
// title: 'نام معرف کاربر',
|
||||
// dataIndex: 'referral.name',
|
||||
// key: 'referral.name',
|
||||
// type: 'Text'
|
||||
// },
|
||||
// {
|
||||
// title: 'موجودی ریالی (ریال)',
|
||||
// dataIndex: 'wallet.cash',
|
||||
// key: 'wallet.cash',
|
||||
// type: 'Number',
|
||||
// customRender(data) {
|
||||
// return usePrice(data.record?.wallet[0]?.cash ?? 0, true, '')
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: 'موجودی طلایی (گرم)',
|
||||
// dataIndex: 'wallet.gold',
|
||||
// key: 'wallet.gold',
|
||||
// type: 'Number',
|
||||
// filterable: false,
|
||||
// customRender(data) {
|
||||
// let sum = 0
|
||||
// data.record.wallet.forEach((x) => (sum += x.gold))
|
||||
// return sum.toFixed(3)
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: 'اخرین بازدید',
|
||||
// dataIndex: 'last_seen_at',
|
||||
// key: 'last_seen_at',
|
||||
// type: 'DateTime',
|
||||
// customRender(data) {
|
||||
// return toJalali(data.record.last_seen_at)
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: 'وضعیت کاربر',
|
||||
// dataIndex: 'active',
|
||||
// key: 'active',
|
||||
// type: 'Boolean',
|
||||
// customRender: ({ record }) => {
|
||||
// return record.active ? (
|
||||
// <div class="flex justify-center">
|
||||
// <CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
// فعال
|
||||
// </CustomTag>
|
||||
// </div>
|
||||
// ) : (
|
||||
// <div class="flex justify-center">
|
||||
// <CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
// غیر فعال
|
||||
// </CustomTag>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// title: 'وضعیت سفارش دهی',
|
||||
// dataIndex: 'trade_active',
|
||||
// key: 'trade_active',
|
||||
// sortable: false,
|
||||
// type: 'Boolean',
|
||||
// customRender: ({ record }) => {
|
||||
// return record.trade_active ? (
|
||||
// <div class="flex justify-center">
|
||||
// <CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
// مجاز
|
||||
// </CustomTag>
|
||||
// </div>
|
||||
// ) : (
|
||||
// <div class="flex justify-center">
|
||||
// <CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
// غیر مجاز
|
||||
// </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
|
||||
// }
|
||||
]
|
||||
@@ -0,0 +1,54 @@
|
||||
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: 'fund.title',
|
||||
key: 'fund.title',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'موجودی طلا',
|
||||
dataIndex: 'gold',
|
||||
key: 'gold',
|
||||
type: 'Number'
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,163 @@
|
||||
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: 'name',
|
||||
key: 'name',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'شماره موبایل',
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile',
|
||||
type: 'Number'
|
||||
},
|
||||
{
|
||||
title: 'نوع کاربر',
|
||||
dataIndex: 'type_str',
|
||||
key: 'type_str',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'کد معرف',
|
||||
dataIndex: 'referral_id',
|
||||
key: 'referral_id',
|
||||
type: 'Text'
|
||||
},
|
||||
{
|
||||
title: 'وضعیت کاربر',
|
||||
dataIndex: 'active',
|
||||
key: 'active',
|
||||
type: 'Boolean',
|
||||
customRender: ({ record }) => {
|
||||
return record.active ? (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
فعال
|
||||
</CustomTag>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
غیر فعال
|
||||
</CustomTag>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'وضعیت سفارش دهی',
|
||||
dataIndex: 'active',
|
||||
key: 'active',
|
||||
filterable: false,
|
||||
sortable: false,
|
||||
customRender: ({ record }) => {
|
||||
return record.trade_active === 1 ? (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#25855A" bgColor="#E3F4E9" class={'font-bold px-6'}>
|
||||
مجاز
|
||||
</CustomTag>
|
||||
</div>
|
||||
) : (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#C53030" bgColor="#FECACA" class={'font-bold px-6'}>
|
||||
غیر مجاز
|
||||
</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)
|
||||
}
|
||||
},*/
|
||||
]
|
||||
@@ -0,0 +1,842 @@
|
||||
<template xmlns="http://www.w3.org/1999/html">
|
||||
<div>
|
||||
<!-- <BasicMainCard>-->
|
||||
<div class="flex w-full h-full">
|
||||
<tbl
|
||||
ref="table"
|
||||
class="w-full h-full"
|
||||
@info="info"
|
||||
@edit="edit"
|
||||
@add="add"
|
||||
@chargeMoney="walletMoneyCharge"
|
||||
@chargeGold="walletGoldCharge"
|
||||
/>
|
||||
|
||||
<!-- <BasicMenu :menu="menu" width="13rem" @onChange="tabSelected" />
|
||||
<component :is="selectedComponent" class="mr-5" />-->
|
||||
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
|
||||
</div>
|
||||
<!-- </BasicMainCard>-->n
|
||||
<BasicModal
|
||||
v-model:visible="addUserVisible"
|
||||
width="50rem"
|
||||
:title="`${editId ? 'ویرایش' : 'افزودن'} محصول`"
|
||||
@ok="ok"
|
||||
:loading="loading"
|
||||
@close="addUserVisible = false"
|
||||
>
|
||||
<Collapse class="grid grid-cols-1 gap-2" v-model:activeKey="activeKey_">
|
||||
<BaseCollapse title="اطلاعات محصول" active-key="0" :actives="activeKey_">
|
||||
<template #content>
|
||||
<!-- <div class="flex justify-between h-full w-full">-->
|
||||
<div
|
||||
v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
class="md:flex justify-between border-1 border-solid rounded-lg border-gray-200 p-2"
|
||||
>
|
||||
<div class="items-center">
|
||||
<span class="ml-4">دریافت قیمت از :</span>
|
||||
<a-radio-group v-model:value="methodOption" name="radioGroup">
|
||||
<a-radio class="items-center" value="1">دستی</a-radio>
|
||||
<a-radio class="" value="2">اتوماتیک</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="methodOption === '1'" class="md:flex items-center justify-between md:w-[25rem]">
|
||||
<div class=" ">قیمت وسط :</div>
|
||||
<BasicInput class="mt-1 md:mt-unset" addon-before="ریال" type="price" v-model:value="form.price" />
|
||||
<AButton
|
||||
class="border-green text-green mt-1 md:mt-unset rounded-full aspect-square"
|
||||
size="small"
|
||||
shape="circle"
|
||||
@click="addPrice()"
|
||||
>
|
||||
<template #icon>
|
||||
<div class="flex items-center justify-center">
|
||||
<Icon icon="vuesax-linear:add" size="20" />
|
||||
</div>
|
||||
</template>
|
||||
</AButton>
|
||||
<AButton
|
||||
class="border-red text-red mr-1 md:mr-unset rounded-full"
|
||||
size="small"
|
||||
shape="circle"
|
||||
@click="minusPrice()"
|
||||
>
|
||||
<template #icon>
|
||||
<div class="flex items-center justify-center">
|
||||
<Icon icon="vuesax-linear:minus" size="20" />
|
||||
</div>
|
||||
</template>
|
||||
</AButton>
|
||||
</div>
|
||||
<div v-if="methodOption === '2'" class=" md:flex justify-between items-center">
|
||||
<div class="ml-4">قیمت :</div>
|
||||
<div class="">
|
||||
<BasicSelect
|
||||
class="w-11rem method_style"
|
||||
allowClear
|
||||
:items="pricesList"
|
||||
valueName="name"
|
||||
keyName="id"
|
||||
v-model:value="form.reading_method"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
class="md:flex justify-between p-2 border-1 border-solid rounded-lg border-gray-200 mt-2">
|
||||
<div>
|
||||
<span class="ml-4">وزن :</span>
|
||||
<a-radio-group v-model:value="weightOption" name="radioGroup" class="">
|
||||
<a-radio value="1">دارد</a-radio>
|
||||
<a-radio value="2">ندارد</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<div v-if="weightOption === '1'" class="flex items-center">
|
||||
<span class="ml-4 ">وزن به گرم :</span>
|
||||
<div class="">
|
||||
<BasicInput v-model:value="form.amount" type="number" />
|
||||
</div>
|
||||
<div class="mt-1 mr-4" v-if="form.amount && form.amount < 1 && 0 < form.amount">
|
||||
معادل {{ form.amount * 1000 }} سوت
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a-form :model="form" ref="formRef" autocomplete="off">
|
||||
<div class="grid md:grid-cols-2 gap-4">
|
||||
<a-form-item label="عنوان" name="title" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.title" />
|
||||
</a-form-item>
|
||||
<a-form-item label="دسته بندی" name="group_type" :rules="inputRules()">
|
||||
<BasicSelect
|
||||
v-model:value="form.group_type"
|
||||
:items="categoryItems"
|
||||
valueName="value"
|
||||
keyName="value"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="واحد" name="unit" :rules="inputRules()">
|
||||
<BasicSelect
|
||||
v-model:value="form.unit"
|
||||
:items="unitItems"
|
||||
valueName="value"
|
||||
keyName="value"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item v-if="weightOption === '1'" label="وزن به گرم" name="amount" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.amount" type="number" />
|
||||
</a-form-item>-->
|
||||
<a-form-item v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
label="کارمزد درصدی موقع خرید" name="percent_fee_buy" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.percent_fee_buy" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
label="هزینه نقدی موقع خرید" name="cash_fee_buy" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.cash_fee_buy" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
label="کارمزد درصدی موقع فروش" name="percent_fee_sell" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.percent_fee_sell" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="form.group_type === '' && form.group_type !== 'آبشده'"
|
||||
label="هزینه نقدی موقع فروش" name="cash_fee_sell" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.cash_fee_sell" type="number" />
|
||||
</a-form-item>
|
||||
<a-form-item label="زمان شروع فعال سازی" name="auto_open_at">
|
||||
<TimePicker
|
||||
v-model:value="form.auto_open_at"
|
||||
:locale="customLocale"
|
||||
placeholder="انتخاب زمان"
|
||||
:defaultValue="dayjs('00:00:00', 'HH:mm:ss')"
|
||||
/>
|
||||
<!-- <a-time-picker v-model:value="form.auto_open_at"/>-->
|
||||
</a-form-item>
|
||||
<a-form-item label="زمان پایان فعال سازی" name="auto_close_at">
|
||||
<TimePicker
|
||||
v-model:value="form.auto_close_at"
|
||||
:locale="customLocale"
|
||||
placeholder="انتخاب زمان"
|
||||
:defaultValue="dayjs('00:00:00', 'HH:mm:ss')"
|
||||
/>
|
||||
<!-- <a-time-picker v-model:value="form.auto_close_at"/>-->
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</template>
|
||||
</BaseCollapse>
|
||||
<BaseCollapse title="تصاویر محصول" active-key="1" :actives="activeKey_">
|
||||
<template #content>
|
||||
<div class="flex gap-2">
|
||||
<IndexImageUploader
|
||||
v-model:file-list="ProductIndexImage"
|
||||
@ok="uploadedIndexFile"
|
||||
@delete="deleteIndexFile"
|
||||
/>
|
||||
<ProductImageUploader
|
||||
v-model:file-list="ImageFileList"
|
||||
@ok="uploadedFile"
|
||||
@delete="deleteFile"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</BaseCollapse>
|
||||
</Collapse>
|
||||
</BasicModal>
|
||||
|
||||
<BasicModal
|
||||
v-model:visible="userInfoVisible"
|
||||
width="100vw"
|
||||
title="اطلاعات کاربر"
|
||||
:loading="loading"
|
||||
custom-footer
|
||||
@close="userInfoVisible = false"
|
||||
>
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="اطلاعات جامع" tab="اطلاعات جامع">
|
||||
<div class="grid grid-cols-4 gap-2">
|
||||
<div class="col-span-4 bg-gray-100 w-full rounded-lg flex p-3 justify-between">
|
||||
<div>
|
||||
<div class="font-bold">{{ userInfo.name }}</div>
|
||||
<div class="mt-1">{{ userInfo?.mobile }}</div>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center items-center pl-3">
|
||||
<div class="flex flex-col justify-center items-center">
|
||||
<Icon
|
||||
:icon="
|
||||
userInfo.is_legal === 0
|
||||
? 'vuesax-linear:close-circle'
|
||||
: 'vuesax-linear:verify'
|
||||
"
|
||||
:key="userInfo.is_legal"
|
||||
:color="userInfo.is_legal === 0 ? '#ff0000' : '#008000'"
|
||||
/>
|
||||
<p
|
||||
class="text-[11px] mt-2"
|
||||
:class="userInfo.is_legal === 0 ? 'reject' : 'success'"
|
||||
>
|
||||
{{ userStatus(userInfo.is_legal).title }}
|
||||
</p>
|
||||
</div>
|
||||
<div>{{ toJalaliNoTime(userInfo?.created_at) }}</div>
|
||||
<div class="mt-2">
|
||||
<CustomTag
|
||||
:textColor="userInfo?.active ? '#25855A' : '#C53030'"
|
||||
:bgColor="userInfo?.active ? '#E3F4E9' : '#FECACA'"
|
||||
class="font-bold px-6"
|
||||
>
|
||||
{{ userInfo?.active ? "فعال" : "غیرفعال" }}
|
||||
</CustomTag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BasicInfoItem title="کد کاربری" :value="userInfo?.id" />
|
||||
<BasicInfoItem title="نوع کاربر" :value="userInfo?.type_str" />
|
||||
<BasicInfoItem
|
||||
title="تاریخ تولد"
|
||||
:value="userInfo?.birth_date ? toJalaliNoTime(userInfo?.birth_date) : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="شماره ملی" :value="userInfo?.n_code ?? '_'" />
|
||||
<BasicInfoItem title="نام استان" :value="userInfo?.province ?? '_'" />
|
||||
<BasicInfoItem title="نام شهر" :value="userInfo?.city ?? '_'" />
|
||||
<BasicInfoItem
|
||||
title="سقف اعتبار"
|
||||
:value="userInfo?.gram ? `${userInfo?.gram} گرم` : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="کد معرف" :value="userInfo?.referral_id" />
|
||||
<BasicInfoItem
|
||||
title="کد معرف کاربر"
|
||||
:value="userInfo?.referral ? userInfo?.referral?.id : '_'"
|
||||
/>
|
||||
<BasicInfoItem
|
||||
title="نام معرف کاربر"
|
||||
:value="userInfo?.referral ? userInfo?.referral?.name : '_'"
|
||||
/>
|
||||
<BasicInfoItem
|
||||
title="میزان سود معرفی"
|
||||
:value="userInfo?.profit_amount ? `${userInfo?.profit_amount} گرم` : '_'"
|
||||
/>
|
||||
<BasicInfoItem
|
||||
title="حداکثر معرفی"
|
||||
:value="userInfo?.add_user_limit ? `${userInfo?.add_user_limit} نفر` : '_'"
|
||||
/>
|
||||
<BasicInfoItem title="آخرین بازدید" :value="toJalali(userInfo?.last_seen_at)" />
|
||||
<BasicInfoItem title="وضعیت سفارش دهی">
|
||||
<CustomTag
|
||||
:textColor="userInfo?.trade_active === 1 ? '#25855A' : '#C53030'"
|
||||
:bgColor="userInfo?.trade_active === 1 ? '#E3F4E9' : '#FECACA'"
|
||||
class="font-bold px-6"
|
||||
>
|
||||
{{ userInfo?.trade_active === 1 ? "مجاز" : "غیر مجاز" }}
|
||||
</CustomTag>
|
||||
</BasicInfoItem>
|
||||
<div class="col-span-4 grid grid-cols-2 gap-3">
|
||||
<div
|
||||
v-for="(item, index) in userInfo.wallet"
|
||||
:key="index"
|
||||
class="grid grid-cols-2 bg-orange-50 gap-2 rounded-lg p-2"
|
||||
>
|
||||
<BasicInfoItem
|
||||
title="نام قلک"
|
||||
:value="item?.fund ? item?.fund?.title : 'کیف پول طلایی'"
|
||||
/>
|
||||
<BasicInfoItem title="مقدار طلا" :value="`${item?.gold} گرم`" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="لیست سفارشات" tab="لیست سفارشات">
|
||||
<orders-tbl ref="orderTable" :customerId="userInfo?.id" @info="infoOrder" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="لیست تراکنش ها" tab="لیست تراکنش ها">
|
||||
<transactions-tbl ref="transactionTable" :customerId="userInfo?.id" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="پیامک ها" tab="پیامک ها">
|
||||
<sms-tbl ref="smsTable" :mobile="userInfo?.mobile" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="معرفی کرده ها" tab="معرفی کرده ها">
|
||||
<ReferralsTable ref="referralTable" :customerId="userInfo?.id" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="قلک ها" tab="قلک ها">
|
||||
<FundsTable ref="fundTable" :customerId="userInfo?.id" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</BasicModal>
|
||||
<BasicModal
|
||||
v-model:visible="showMoneyWalletCharge"
|
||||
width="20rem"
|
||||
title="شارژ کیف پول ریالی"
|
||||
@ok="chargeMoneyWallet"
|
||||
:loading="loading"
|
||||
@close="showMoneyWalletCharge = false"
|
||||
>
|
||||
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
|
||||
<a-form-item label="مقدار شارژ " name="value" :rules="inputRules()">
|
||||
<BasicInput addon-before="ریال" v-model:value="formCharge.value" type="price" />
|
||||
<div v-show="formCharge.value > 10">
|
||||
معادل {{ usePrice(formCharge.value / 10, true, "تومان") }}
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="علت شارژ " name="value" :rules="inputRules()">
|
||||
<BasicInput v-model:value="formCharge.note" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</BasicModal>
|
||||
<BasicModal
|
||||
v-model:visible="showGoldWalletCharge"
|
||||
width="20rem"
|
||||
title="شارژ کیف پول طلایی"
|
||||
@ok="chargeGoldWallet"
|
||||
:loading="loading"
|
||||
@close="showGoldWalletCharge = false"
|
||||
>
|
||||
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
|
||||
<a-form-item label="مقدار شارژ " name="value" :rules="inputRules()">
|
||||
<BasicInput addon-before="گرم" v-model:value="formCharge.value" type="number" />
|
||||
<!-- <div v-show="formCharge.value > 10">
|
||||
معادل {{ usePrice(formCharge.value / 10, true, 'تومان') }}
|
||||
</div>-->
|
||||
</a-form-item>
|
||||
<a-form-item label="علت شارژ " name="value" :rules="inputRules()">
|
||||
<BasicInput v-model:value="formCharge.note" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</BasicModal>
|
||||
<BasicInfoModal
|
||||
v-model:visible="userInfoOrderVisible"
|
||||
@close="userInfoOrderVisible = 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 { Collapse, FormItem, message, Textarea, Form, TimePicker } from "ant-design-vue";
|
||||
import { inputLenRules, inputRules } from "@/utils/inputRules";
|
||||
import { useStaticApiListsStore } from "@/store/staticApisStore";
|
||||
import { ref, watch } from "vue";
|
||||
import tbl from "./components/table.vue";
|
||||
import type { FormInstance } from "ant-design-vue";
|
||||
import BasicInfoModal from "@/components/BasicInfoModal/index.vue";
|
||||
import type { Info } from "@/components/BasicInfoModal/model/Info";
|
||||
import { toJalali, 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 { createProduct, deleteCustomer, updateCustomer } from "@/api/product";
|
||||
import type { Charge } from "@/model/wallet";
|
||||
import customers from "@/router/routes/products";
|
||||
import { chargeWallet } from "@/api/wallet";
|
||||
import { usePrice } from "@core/utils/usePrice";
|
||||
import jalaliday from "jalaliday";
|
||||
import ordersTbl from "@/pages/menuPages/orders/components/table.vue";
|
||||
import transactionsTbl from "@/pages/menuPages/transactions/components/table.vue";
|
||||
import smsTbl from "@/pages/menuPages/sms/components/table.vue";
|
||||
import FundsTable from "@/pages/menuPages/customers/base/components/fundsTable.vue";
|
||||
import ReferralsTable from "@/pages/menuPages/customers/base/components/referralsTable.vue";
|
||||
import type { Order } from "@/model/order";
|
||||
import Icon from "@core/components/BaseIcon/src/Icon.vue";
|
||||
import type { MethodePrices, Product } from "@/model/product";
|
||||
import IndexImageUploader from "@/components/ProductUploader/IndexImageUploader.vue";
|
||||
import ProductImageUploader from "@/components/ProductUploader/ProductImageUploader.vue";
|
||||
|
||||
//tabs
|
||||
const activeKey = ref("اطلاعات جامع");
|
||||
|
||||
//loading
|
||||
const loading = ref<boolean>(false);
|
||||
|
||||
//define store
|
||||
const store = useStaticApiListsStore();
|
||||
|
||||
//define tbl
|
||||
const table = ref(null);
|
||||
const orderTable = ref(null);
|
||||
const transactionTable = ref(null);
|
||||
const smsTable = ref(null);
|
||||
const referralTable = ref(null);
|
||||
const fundTable = ref(null);
|
||||
const refreshTable = () => table?.value?.fetch();
|
||||
const refreshOrderTable = () => orderTable?.value?.fetch();
|
||||
const refreshTransactionTable = () => transactionTable?.value?.fetch();
|
||||
const refreshSMSTable = () => smsTable?.value?.fetch();
|
||||
const refreshReferralTable = () => referralTable?.value?.fetch();
|
||||
const refreshFundTable = () => fundTable?.value?.fetch();
|
||||
const methodOption = ref<string>("1");
|
||||
const weightOption = ref<string>("1");
|
||||
|
||||
const activeKey_ = ref(["0"]);
|
||||
const ImageFileList = ref<Array<FileList>>([]);
|
||||
|
||||
function uploadedFile(id: number) {
|
||||
// console.log(id)
|
||||
let arr: number[] | undefined = form.value.image_ids;
|
||||
arr?.push(id);
|
||||
form.value.image_ids = arr;
|
||||
}
|
||||
|
||||
function deleteFile() {
|
||||
form.value.image_ids = ImageFileList?.value.map((x: FileList) => x.uid);
|
||||
}
|
||||
|
||||
import BaseCollapse from "@/pages/menuPages/products/base/components/BaseCollapse.vue";
|
||||
import { methodePrices } from "@/api/price";
|
||||
import { getAllPrices } from "@/api/dashboard";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const ProductIndexImage = ref<Array<FileList>>([]);
|
||||
|
||||
function uploadedIndexFile(id: number) {
|
||||
// console.log(id)
|
||||
form.value.original_image_id = id;
|
||||
}
|
||||
|
||||
function deleteIndexFile() {
|
||||
form.value.original_image_id = null;
|
||||
form.value.original_image = null;
|
||||
ProductIndexImage.value = [];
|
||||
}
|
||||
|
||||
let updateKey = ref<number>(0);
|
||||
|
||||
|
||||
//role confirm items
|
||||
const confirmItems: Array<Item> = [
|
||||
{
|
||||
value: "بله",
|
||||
key: true
|
||||
},
|
||||
{
|
||||
value: "خیر",
|
||||
key: false
|
||||
}
|
||||
];
|
||||
const customerItems: Array<Item> = [
|
||||
{
|
||||
value: "همکار",
|
||||
key: 1
|
||||
},
|
||||
{
|
||||
value: "خانگی",
|
||||
key: 2
|
||||
},
|
||||
{
|
||||
value: "سرمایه گذار",
|
||||
key: 3
|
||||
}
|
||||
];
|
||||
|
||||
//wallet
|
||||
const showMoneyWalletCharge = ref<boolean>(false);
|
||||
const showGoldWalletCharge = ref<boolean>(false);
|
||||
const userInfoOrderVisible = ref<boolean>(false);
|
||||
|
||||
//form
|
||||
const form = ref<Partial<Product>>({
|
||||
auto_close_at: dayjs("00:00:00", "HH:mm:ss"),
|
||||
auto_open_at: dayjs("00:00:00", "HH:mm:ss")
|
||||
});
|
||||
|
||||
// const form = ref<Order>({
|
||||
// direction: 1,
|
||||
// price: 0,
|
||||
// amount: undefined,
|
||||
// pay_at: '',
|
||||
// difference: '',
|
||||
// customer_id: undefined,
|
||||
// goldCash: undefined,
|
||||
// goldValue: undefined
|
||||
// })
|
||||
const formCharge = ref<Charge>({});
|
||||
const formRef = ref<FormInstance>();
|
||||
const formChargeRef = ref<FormInstance>();
|
||||
|
||||
//info
|
||||
let infoParams = reactive<Info>({});
|
||||
|
||||
function infoOrder(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: usePrice(val.price ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "قیمت کل برای مشتری (ریال)",
|
||||
value: usePrice(val.total_price ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "/قیمت هر گرم طلا بدون سود (ریال)",
|
||||
value: usePrice(val.price_original ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "قیمت کل بدون سود (ریال)",
|
||||
value: usePrice(val.total_price_original ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "سود هر گرم (ریال)",
|
||||
value: usePrice(val.fee ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "سود کل (ریال)",
|
||||
value: usePrice(val.total_fee ?? 0) ?? "-"
|
||||
},
|
||||
{
|
||||
key: "کد کاربری",
|
||||
value: val.customer.id ?? "-"
|
||||
},
|
||||
{
|
||||
key: "شماره ملی",
|
||||
value: val.customer.n_code ?? "-"
|
||||
},
|
||||
/* {
|
||||
key: "کارمزد ریالی",
|
||||
value: usePrice(val.service_charge_price ?? 0)
|
||||
},*/
|
||||
{
|
||||
key: "کارمزد طلایی",
|
||||
value: val.service_charge ?? "-" + " گرم"
|
||||
},
|
||||
/* {
|
||||
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 ?? '-'
|
||||
}*/
|
||||
];
|
||||
userInfoOrderVisible.value = true;
|
||||
}
|
||||
|
||||
async function info(val: Customer) {
|
||||
activeKey.value = "اطلاعات جامع";
|
||||
userInfo.value = cloneDeep(val);
|
||||
userInfoVisible.value = true;
|
||||
await nextTick(() => {
|
||||
loading.value = true;
|
||||
refreshFundTable();
|
||||
refreshReferralTable();
|
||||
refreshSMSTable();
|
||||
refreshTransactionTable();
|
||||
refreshOrderTable();
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
//edit
|
||||
let editId: number | undefined = undefined;
|
||||
|
||||
async function edit(record: Customer) {
|
||||
addUserVisible.value = true;
|
||||
editId = record.id;
|
||||
console.log(record);
|
||||
const customForm = cloneDeep(record);
|
||||
const start = dayjs(customForm.auto_open_at, "HH:mm:ss");
|
||||
const close = dayjs(customForm.auto_close_at, "HH:mm:ss");
|
||||
delete customForm.auto_open_at;
|
||||
delete customForm.auto_close_at;
|
||||
form.value.auto_open_at = start;
|
||||
form.value.auto_close_at = close;
|
||||
console.log(form.value);
|
||||
form.value = cloneDeep(customForm);
|
||||
}
|
||||
|
||||
//add
|
||||
async function add() {
|
||||
loading.value = true;
|
||||
editId = undefined;
|
||||
// await store.getUsersList()
|
||||
addUserVisible.value = true;
|
||||
updateKey.value++;
|
||||
resetData();
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function walletMoneyCharge(val: Customer) {
|
||||
showMoneyWalletCharge.value = true;
|
||||
formCharge.value.customer_id = val.id;
|
||||
}
|
||||
|
||||
async function walletGoldCharge(val: Customer) {
|
||||
showGoldWalletCharge.value = true;
|
||||
formCharge.value.customer_id = val.id;
|
||||
}
|
||||
|
||||
async function chargeMoneyWallet() {
|
||||
formChargeRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await chargeWallet(formCharge.value, "money");
|
||||
formCharge.value.value = undefined;
|
||||
message.success("افزایش اعتبار با موفقیت انجام شد");
|
||||
showMoneyWalletCharge.value = false;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function chargeGoldWallet() {
|
||||
formChargeRef.value?.validateFields().then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await chargeWallet(formCharge.value, "gold");
|
||||
formCharge.value.value = undefined;
|
||||
message.success("افزایش اعتبار با موفقیت انجام شد");
|
||||
showMoneyWalletCharge.value = false;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//reset data
|
||||
const resetData = () => {
|
||||
formRef.value?.resetFields();
|
||||
form.value = {
|
||||
unit: "",
|
||||
group_type: "",
|
||||
amount: undefined,
|
||||
percent_fee_buy: 0,
|
||||
cash_fee_buy: 0,
|
||||
percent_fee_sell: 0,
|
||||
cash_fee_sell: 0
|
||||
};
|
||||
};
|
||||
|
||||
//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);
|
||||
const userInfo = ref<Customer>();
|
||||
|
||||
//submit user
|
||||
async function ok() {
|
||||
formRef.value?.validateFields().then(async () => {
|
||||
// console.log('salam', form.value)
|
||||
// return
|
||||
loading.value = true;
|
||||
try {
|
||||
if (methodOption.value === "1") delete form.value.reading_method;
|
||||
else delete form.value.price;
|
||||
if (weightOption.value === "2")
|
||||
form.value.amount = 1;
|
||||
form.value.auto_open_at = dayjs(form.value.auto_open_at).format("HH:mm:ss");
|
||||
form.value.auto_close_at = dayjs(form.value.auto_close_at).format("HH:mm:ss");
|
||||
await methodePrices(form.value);
|
||||
if (editId) {
|
||||
await updateCustomer(editId, form.value);
|
||||
} else {
|
||||
await createProduct(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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const result = {
|
||||
title: ""
|
||||
};
|
||||
const userStatus = (status: number) => {
|
||||
switch (status) {
|
||||
case 0:
|
||||
result.title = "احراز هویت نشده";
|
||||
break;
|
||||
case 1:
|
||||
result.title = "احراز هویت شده توسط سامانه هوشمند";
|
||||
break;
|
||||
case 2:
|
||||
result.title = "احراز هویت شده توسط کارشناس";
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
const unitItems: Array<Item> = [
|
||||
{
|
||||
value: "عدد"
|
||||
},
|
||||
{
|
||||
value: "گرم"
|
||||
}
|
||||
];
|
||||
|
||||
const categoryItems: Array<Item> = [
|
||||
{
|
||||
value: "آبشده"
|
||||
},
|
||||
{
|
||||
value: "مکعب"
|
||||
},
|
||||
{
|
||||
value: "گوی"
|
||||
},
|
||||
{
|
||||
value: "سکه"
|
||||
},
|
||||
{
|
||||
value: "سکه پارسیان"
|
||||
}
|
||||
];
|
||||
|
||||
const data = ref<MethodePrices[]>([]);
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
data.value = await methodePrices();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const pricesList = computed(() => {
|
||||
return data.value.map((x) => {
|
||||
return {
|
||||
id: `${x.name}`,
|
||||
// id: x.id,
|
||||
name: `${x.name}(${usePrice(x.price)})`
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
|
||||
const addPrice = () => {
|
||||
if (form.value.price) form.value.price = parseInt(form.value.price) + 10000;
|
||||
else form.value.price = 0 + 10000;
|
||||
};
|
||||
|
||||
const minusPrice = () => {
|
||||
if (form.value.price) form.value.price = parseInt(form.value.price) - 10000;
|
||||
else form.value.price = 0 - 10000;
|
||||
};
|
||||
|
||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
||||
import locale from "ant-design-vue/es/date-picker/locale/fa_IR";
|
||||
|
||||
dayjs.extend(customParseFormat);
|
||||
const customLocale = ref({
|
||||
...locale,
|
||||
lang: {
|
||||
...locale.lang,
|
||||
now: "اکنون",
|
||||
ok: "ثبت"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.reject {
|
||||
color: #ff0000 !important;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #008000 !important;
|
||||
}
|
||||
|
||||
.method_style .ant-select-selector {
|
||||
width: 15rem !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicMainCard>
|
||||
<div class="flex flex-col md:flex-row md:h-full">
|
||||
<!-- {{ menu }}-->
|
||||
<BasicMenu width="11rem" :menu="menu" mode="horizontal" class="md:hidden overflow-auto" />
|
||||
<BasicMenu
|
||||
width="13rem"
|
||||
:menu="menu"
|
||||
class="hidden md:inline overflow-auto min-w-[13.5rem]"
|
||||
/>
|
||||
<!-- <component :is="selectedComponent" class="mr-5" />-->
|
||||
<RouterView class="md:mr-5 md:mt-0 mt-5 w-full"></RouterView>
|
||||
</div>
|
||||
</BasicMainCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BasicMenu from '@/components/BasicMenu/index.vue'
|
||||
import { useRouterStore } from '@core/stores/router'
|
||||
import { get } from 'lodash'
|
||||
//import Nature from '@/pages/menuPages/setting/limitedOrder/index.vue'
|
||||
//s import test from './limitedOrder'
|
||||
//import Budget from '@/pages/menuPages/setting/budget/index.vue'
|
||||
//import ProjectType from '@/pages/menuPages/setting/projectType/index.vue'
|
||||
//import DocumentType from '@/pages/menuPages/setting/documentType/index.vue'
|
||||
// import Management from '@/pages/menuPages/setting/management/index.vue'
|
||||
//import Accessibility from '@/pages/menuPages/setting/accessibility/index.vue'
|
||||
//import SubmitProcess from '@/pages/menuPages/setting/submitProcess/index.vue'
|
||||
//import documentGroup from '@/pages/menuPages/setting/documentGroup/index.vue'
|
||||
//import userType from '@/pages/menuPages/setting/userType/index.vue'
|
||||
|
||||
const routerStore = useRouterStore()
|
||||
const menu = computed(() => {
|
||||
const item = routerStore.routes.find((item) => item.name === 'products')
|
||||
//console.log('aaaa', get(item, 'children[0].children', []))
|
||||
return get(item, 'children[0].children', [])
|
||||
})
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -0,0 +1,5 @@
|
||||
<template></template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
Reference in New Issue
Block a user