change responsive]
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<MobileCardList
|
||||
v-model:search="search"
|
||||
:loading="loading"
|
||||
:has-more="hasMore"
|
||||
:show-empty="!loading && items.length === 0"
|
||||
empty-text="محصولی یافت نشد"
|
||||
search-placeholder="جستجو محصول"
|
||||
show-refresh
|
||||
@search="reload"
|
||||
@refresh="reload"
|
||||
@load-more="loadMore"
|
||||
>
|
||||
<ArchiveMobileListItem
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@info="$emit('info', $event)"
|
||||
@unarchive="$emit('unarchive', $event)"
|
||||
/>
|
||||
</MobileCardList>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getProductArchiveTable } from '@/api/product'
|
||||
import type { Product } from '@/model/product'
|
||||
import MobileCardList from '@/components/mobile/MobileCardList.vue'
|
||||
import { useMobileTableList } from '@/components/mobile/composables/useMobileTableList'
|
||||
import ArchiveMobileListItem from './ArchiveMobileListItem.vue'
|
||||
|
||||
defineEmits<{
|
||||
(e: 'info', item: Product): void
|
||||
(e: 'unarchive', item: Product): void
|
||||
}>()
|
||||
|
||||
const { loading, search, items, hasMore, reload, loadMore, fetch } = useMobileTableList<Product>({
|
||||
fetchApi: getProductArchiveTable
|
||||
})
|
||||
|
||||
onMounted(() => reload())
|
||||
|
||||
defineExpose({ fetch })
|
||||
</script>
|
||||
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<MobileCard>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="inline-block h-2.5 w-2.5 rounded-full" :class="item.active ? 'bg-green-500' : 'bg-red-400'" />
|
||||
<span class="truncate text-sm font-700 text-gray-900">{{ item.title || '-' }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<MobileIconButton icon="vuesax-linear:archive-slash" color="#e3bf00" @click="$emit('unarchive', item)" />
|
||||
<MobileIconButton icon="vuesax-linear:stickynote" color="#10913A" @click="$emit('info', item)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-between gap-2">
|
||||
<span class="truncate text-xs text-gray-500">قیمت: {{ usePrice(item.price || 0) }}</span>
|
||||
<span class="text-xs font-700" :class="item.open_buy ? 'text-green-700' : 'text-red-600'">
|
||||
{{ item.open_buy ? 'خرید: باز' : 'خرید: بسته' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-2 flex items-center justify-between">
|
||||
<span class="text-xs text-gray-500">کد محصول: {{ item.id ?? '-' }}</span>
|
||||
<span class="text-xs font-700" :class="item.open_sell ? 'text-green-700' : 'text-red-600'">
|
||||
{{ item.open_sell ? 'فروش: باز' : 'فروش: بسته' }}
|
||||
</span>
|
||||
</div>
|
||||
</MobileCard>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Product } from '@/model/product'
|
||||
import MobileCard from '@/components/mobile/MobileCard.vue'
|
||||
import MobileIconButton from '@/components/mobile/MobileIconButton.vue'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
|
||||
defineProps<{
|
||||
item: Product
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
(e: 'info', item: Product): void
|
||||
(e: 'unarchive', item: Product): void
|
||||
}>()
|
||||
</script>
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="h-full min-h-0 min-w-0 max-w-full overflow-hidden">
|
||||
<BasicShowContext title="لیست محصولات بایگانی شده">
|
||||
<BaseTable v-bind="tblProps" @register="submit" ref="tbl">
|
||||
<div class="flex h-full min-h-0 flex-col">
|
||||
<BaseTable v-if="!isMobile" class="h-full min-h-0 min-w-0" v-bind="tblProps" @register="submit" ref="tbl">
|
||||
<!-- <template #extraHeader>
|
||||
<BaseButton type="primary" size="small" class="flex" @click="emits('add')">
|
||||
<div>افزودن مشتری عمده</div>
|
||||
@@ -46,6 +47,14 @@
|
||||
</div>
|
||||
</template>
|
||||
</BaseTable>
|
||||
<ArchiveMobileCardList
|
||||
v-else
|
||||
ref="mobileListRef"
|
||||
class="min-h-0 flex-1"
|
||||
@info="emits('info', $event)"
|
||||
@unarchive="archiveFunction($event.id)"
|
||||
/>
|
||||
</div>
|
||||
</BasicShowContext>
|
||||
</div>
|
||||
</template>
|
||||
@@ -65,6 +74,9 @@ import { cols } from '../hooks/archiveColumns'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { usePrefix } from '@core/composable/usePrefix'
|
||||
import { message } from 'ant-design-vue'
|
||||
import ArchiveMobileCardList from './ArchiveMobileCardList.vue'
|
||||
import { getProductArchiveTable } from '@/api/product'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
/*const select = (val) => {
|
||||
@@ -87,7 +99,7 @@ const table = ref(null)
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: (params: TableInput) => {
|
||||
return getCustomerArchiveTable(params)
|
||||
return getProductArchiveTable(params)
|
||||
}
|
||||
//bordered: true
|
||||
})
|
||||
@@ -122,7 +134,7 @@ async function archiveFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerArchive(id)
|
||||
reload()
|
||||
await Promise.allSettled([reload(), mobileListRef.value?.fetch?.() as Promise<void>])
|
||||
message.success('مشتری با موفقیت از بایگانی خارج شد.')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
@@ -130,9 +142,10 @@ async function archiveFunction(id: number) {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
const fetch = () => {
|
||||
// console.log('sss')
|
||||
reload()
|
||||
const mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
|
||||
|
||||
const fetch = async () => {
|
||||
await Promise.allSettled([reload(), mobileListRef.value?.fetch?.() as Promise<void>])
|
||||
}
|
||||
// const spinTable = (val: boolean) => {
|
||||
// // console.log('sss')
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<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,137 @@
|
||||
<template>
|
||||
<Collapse class="grid grid-cols-1 gap-2" :activeKey="activeKey" @update:activeKey="$emit('update:activeKey', $event)">
|
||||
<BaseCollapse title="اطلاعات محصول" active-key="0" :actives="activeKey">
|
||||
<template #content>
|
||||
<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 :value="methodOption" name="radioGroup" @update:value="$emit('update:methodOption', $event)">
|
||||
<a-radio class="items-center" value="1">دستی</a-radio>
|
||||
<a-radio 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>قیمت وسط :</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="$emit('addPrice')">
|
||||
<template #icon><Icon icon="vuesax-linear:add" size="20" /></template>
|
||||
</AButton>
|
||||
<AButton class="border-red text-red mr-1 md:mr-unset rounded-full" size="small" shape="circle" @click="$emit('minusPrice')">
|
||||
<template #icon><Icon icon="vuesax-linear:minus" size="20" /></template>
|
||||
</AButton>
|
||||
</div>
|
||||
<div v-if="methodOption === '2'" class="md:flex justify-between items-center">
|
||||
<div class="ml-4">قیمت :</div>
|
||||
<BasicSelect class="w-11rem method_style" allowClear :items="pricesList" valueName="name" keyName="id" v-model:value="form.reading_method" />
|
||||
</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 :value="weightOption" name="radioGroup" @update:value="$emit('update:weightOption', $event)">
|
||||
<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>
|
||||
<BasicInput v-model:value="form.amount" type="number" />
|
||||
<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 v-if="getConfigApp('name') === 'garoosi'" label="دسته بندی" name="group_type" :rules="inputRules()">
|
||||
<BasicSelect v-model:value="form.group_type" :items="garoosiCategoryItems" valueName="value" keyName="value" />
|
||||
</a-form-item>
|
||||
<a-form-item v-else 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="metal_id" :rules="inputRules()">
|
||||
<BasicSelect v-model:value="form.metal_id" :items="metalItems" valueName="value" keyName="key" />
|
||||
</a-form-item>
|
||||
<a-form-item label="نوع قیمت" name="direct_price" :rules="inputRules()">
|
||||
<BasicSelect v-model:value="form.direct_price" :items="priceItems" valueName="value" keyName="key" />
|
||||
</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="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="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-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-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</template>
|
||||
</BaseCollapse>
|
||||
|
||||
<BaseCollapse title="تصاویر محصول" active-key="1" :actives="activeKey">
|
||||
<template #content>
|
||||
<IndexImageUploader
|
||||
:key="editId ?? 'new-product'"
|
||||
:file-list="productIndexImage"
|
||||
@update:file-list="$emit('update:productIndexImage', $event)"
|
||||
@ok="(id, res) => $emit('uploadedIndexFile', id, res)"
|
||||
@delete="$emit('deleteIndexFile')"
|
||||
/>
|
||||
</template>
|
||||
</BaseCollapse>
|
||||
</Collapse>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Collapse, TimePicker } from 'ant-design-vue'
|
||||
import { inputRules } from '@/utils/inputRules'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import BaseCollapse from '@/components/BaseCollapse.vue'
|
||||
import IndexImageUploader from '@/components/ProductUploader/IndexImageUploader.vue'
|
||||
import { getConfigApp } from '@/utils/config'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
defineProps<{
|
||||
form: any
|
||||
formRef: any
|
||||
methodOption: string
|
||||
weightOption: string
|
||||
activeKey: string[]
|
||||
pricesList: Array<{ id: string; name: string }>
|
||||
garoosiCategoryItems: any[]
|
||||
categoryItems: any[]
|
||||
metalItems: any[]
|
||||
priceItems: any[]
|
||||
unitItems: any[]
|
||||
customLocale: any
|
||||
productIndexImage: any[]
|
||||
editId?: number
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
(e: 'addPrice'): void
|
||||
(e: 'minusPrice'): void
|
||||
(e: 'update:methodOption', value: string): void
|
||||
(e: 'update:weightOption', value: string): void
|
||||
(e: 'update:activeKey', value: string[]): void
|
||||
(e: 'update:productIndexImage', value: any[]): void
|
||||
(e: 'uploadedIndexFile', id: number, response?: Record<string, any>): void
|
||||
(e: 'deleteIndexFile'): void
|
||||
}>()
|
||||
</script>
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<MobileCardList
|
||||
v-model:search="search"
|
||||
:loading="loading"
|
||||
:has-more="hasMore"
|
||||
search-placeholder="جستجو محصول"
|
||||
show-refresh
|
||||
@search="reload"
|
||||
@refresh="reload"
|
||||
@load-more="loadMore"
|
||||
>
|
||||
<ProductMobileListItem
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:item="item"
|
||||
@open="openSheet"
|
||||
@edit="$emit('edit', $event)"
|
||||
/>
|
||||
</MobileCardList>
|
||||
|
||||
<ProductMobileDetailSheet
|
||||
v-model:visible="sheetVisible"
|
||||
:item="selectedItem"
|
||||
@toggleBuy="$emit('toggleBuy', $event)"
|
||||
@toggleSell="$emit('toggleSell', $event)"
|
||||
@toggleActive="$emit('toggleActive', $event)"
|
||||
@edit="$emit('edit', $event)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getCustomerTable } from '@/api/product'
|
||||
import type { Product } from '@/model/product'
|
||||
import MobileCardList from '@/components/mobile/MobileCardList.vue'
|
||||
import { useMobileDetailSheet } from '@/components/mobile/composables/useMobileDetailSheet'
|
||||
import { useMobileTableList } from '@/components/mobile/composables/useMobileTableList'
|
||||
import ProductMobileListItem from './ProductMobileListItem.vue'
|
||||
import ProductMobileDetailSheet from './ProductMobileDetailSheet.vue'
|
||||
|
||||
defineEmits<{
|
||||
(e: 'edit', item: Product): void
|
||||
(e: 'toggleBuy', item: Product): void
|
||||
(e: 'toggleSell', item: Product): void
|
||||
(e: 'toggleActive', item: Product): void
|
||||
}>()
|
||||
|
||||
const { sheetVisible, selectedItem, openSheet, syncSelectedItem } = useMobileDetailSheet<Product>()
|
||||
|
||||
const { loading, search, items, hasMore, reload, loadMore, fetch } = useMobileTableList<Product>({
|
||||
fetchApi: getCustomerTable,
|
||||
onFetched: (rows) => syncSelectedItem(rows)
|
||||
})
|
||||
|
||||
onMounted(() => reload())
|
||||
|
||||
defineExpose({ fetch })
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<MobileDetailSheet v-model:visible="visibleProxy" :item="item" :title="item?.title || ''">
|
||||
<template #default="{ item: row }">
|
||||
<MobileSheetHeader :subtitle="updatedAtLabel(row)" :show-title="isMobile">
|
||||
<template #title>
|
||||
<div class="flex w-full items-center justify-between gap-3">
|
||||
<span class="min-w-0 truncate">{{ row.title || '-' }}</span>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<MobileIconButton
|
||||
plain
|
||||
:key="`buy-${row.id}-${row.open_buy}`"
|
||||
icon="vuesax-linear:money-receive"
|
||||
:color="row.open_buy ? '#16A34A' : '#DC2626'"
|
||||
:size="22"
|
||||
@click="$emit('toggleBuy', row)"
|
||||
/>
|
||||
<MobileIconButton
|
||||
plain
|
||||
:key="`sell-${row.id}-${row.open_sell}`"
|
||||
icon="vuesax-linear:money-send"
|
||||
:color="row.open_sell ? '#16A34A' : '#DC2626'"
|
||||
:size="22"
|
||||
@click="$emit('toggleSell', row)"
|
||||
/>
|
||||
<MobileIconButton
|
||||
plain
|
||||
:key="`active-${row.id}-${row.active}`"
|
||||
:icon="row.active ? 'vuesax-linear:tick-circle' : 'vuesax-linear:close-circle'"
|
||||
:color="row.active ? '#16A34A' : '#DC2626'"
|
||||
:size="22"
|
||||
@click="$emit('toggleActive', row)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</MobileSheetHeader>
|
||||
|
||||
<MobileStatCard variant="success" bordered label="قیمت محصول" :value="usePrice(row.price || 0)">
|
||||
<template #prefix>
|
||||
<BaseIcon icon="vuesax-linear:money-send" size="18" color="#15803d" />
|
||||
</template>
|
||||
</MobileStatCard>
|
||||
|
||||
<MobileStatCard variant="danger" bordered label="کارمزد نقدی" :value="cashFeeLabel(row)">
|
||||
<template #prefix>
|
||||
<BaseIcon icon="vuesax-linear:empty-wallet" size="18" color="#dc2626" />
|
||||
</template>
|
||||
</MobileStatCard>
|
||||
|
||||
<div class="flex items-center justify-between rounded-xl border border-gray-200 bg-white px-4 py-3">
|
||||
<div class="flex items-center">
|
||||
<BaseIcon icon="vuesax-linear:calendar" size="18" color="#2563eb" />
|
||||
<span class="mr-2 font-700 text-primary">درصد کارمزد</span>
|
||||
</div>
|
||||
<div class="text-2xl font-800">
|
||||
<span class="text-gray-900">{{ row.percent_fee_buy || 0 }}</span>
|
||||
<span class="mx-1 text-green-600">=</span>
|
||||
<span class="text-green-600">{{ row.percent_fee_sell || 0 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MobileInfoGrid>
|
||||
<MobileDetailRow label="کد محصول" :value="row.id ?? '-'" />
|
||||
<MobileDetailRow label="دسته بندی محصول" :value="row.group_type || '-'" />
|
||||
<MobileDetailRow label="واحد" :value="row.unit || '-'" />
|
||||
<MobileDetailRow label="وزن" :value="row.amount ?? '-'" />
|
||||
</MobileInfoGrid>
|
||||
</template>
|
||||
</MobileDetailSheet>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Product } from '@/model/product'
|
||||
import MobileDetailRow from '@/components/mobile/MobileDetailRow.vue'
|
||||
import MobileDetailSheet from '@/components/mobile/MobileDetailSheet.vue'
|
||||
import MobileIconButton from '@/components/mobile/MobileIconButton.vue'
|
||||
import MobileInfoGrid from '@/components/mobile/MobileInfoGrid.vue'
|
||||
import MobileSheetHeader from '@/components/mobile/MobileSheetHeader.vue'
|
||||
import MobileStatCard from '@/components/mobile/MobileStatCard.vue'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
item: Product | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void
|
||||
(e: 'toggleBuy', item: Product): void
|
||||
(e: 'toggleSell', item: Product): void
|
||||
(e: 'toggleActive', item: Product): void
|
||||
(e: 'edit', item: Product): void
|
||||
}>()
|
||||
|
||||
const visibleProxy = computed({
|
||||
get: () => props.visible,
|
||||
set: (value: boolean) => emit('update:visible', value)
|
||||
})
|
||||
|
||||
function updatedAtLabel(row: Product) {
|
||||
return row.created_at ? `آخرین بروزرسانی: ${toJalali(row.created_at)}` : '-'
|
||||
}
|
||||
|
||||
function cashFeeLabel(row: Product) {
|
||||
return usePrice((row.cash_fee_buy || 0) + (row.cash_fee_sell || 0))
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<MobileCard>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="inline-block h-2.5 w-2.5 shrink-0 rounded-full" :class="statusDotClass" />
|
||||
<button
|
||||
type="button"
|
||||
class="truncate border-none bg-transparent p-0 text-right text-sm font-700 text-gray-900 cursor-pointer"
|
||||
@click="$emit('open', item)"
|
||||
>
|
||||
{{ item.title || '-' }}
|
||||
</button>
|
||||
</div>
|
||||
<MobileIconButton icon="vuesax-linear:edit" color="#2563eb" :size="20" @click="$emit('edit', item)" />
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-between gap-2">
|
||||
<span class="text-xs text-gray-500">کد محصول: {{ item.id ?? '-' }}</span>
|
||||
<span class="text-sm font-600 text-gray-700">{{ priceLabel }}</span>
|
||||
</div>
|
||||
</MobileCard>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Product } from '@/model/product'
|
||||
import MobileCard from '@/components/mobile/MobileCard.vue'
|
||||
import MobileIconButton from '@/components/mobile/MobileIconButton.vue'
|
||||
import { usePrice } from '@core/utils/usePrice'
|
||||
|
||||
const props = defineProps<{
|
||||
item: Product
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
(e: 'open', item: Product): void
|
||||
(e: 'edit', item: Product): void
|
||||
}>()
|
||||
|
||||
const statusDotClass = computed(() => (props.item.active ? 'bg-green-500' : 'bg-red-400'))
|
||||
const priceLabel = computed(() => (props.item.price ? usePrice(props.item.price) : '-'))
|
||||
</script>
|
||||
@@ -1,103 +0,0 @@
|
||||
<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: 1001 !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>
|
||||
@@ -1,104 +0,0 @@
|
||||
<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: 1001 !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>
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="md:flex pr-3">
|
||||
<div class="flex h-full min-h-0 min-w-0 max-w-full flex-col overflow-hidden">
|
||||
<div class="shrink-0 pr-3 md:flex">
|
||||
<div class="content-center">فعال سازی محصولات:</div>
|
||||
<div class="ml-2 content-center mt-1 md:mt-unset md:mr-4">زمان شروع </div>
|
||||
<div class="ml-2 content-center mt-1 md:mt-unset md:mr-4">زمان شروع</div>
|
||||
<div>
|
||||
<TimePicker
|
||||
v-model:value="startTime"
|
||||
@@ -11,7 +11,7 @@
|
||||
: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 class="md:mr-4 ml-2 mt-2 md:mt-unset content-center">زمان پایان</div>
|
||||
<div>
|
||||
<TimePicker
|
||||
v-model:value="endTime"
|
||||
@@ -20,592 +20,179 @@
|
||||
:defaultValue="dayjs('00:00:00', 'HH:mm:ss')"
|
||||
/>
|
||||
</div>
|
||||
<BaseButton @click="setTimeActive(startTime , endTime)" class="mt-2 md:mt-unset md:mr-2">ثبت</BaseButton>
|
||||
<BaseButton class="mt-2 md:mt-unset md:mr-2" @click="setTimeActive(startTime, endTime)">ثبت</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
|
||||
|
||||
<BasicShowContext title="لیست محصولات" class="min-h-0 flex-1">
|
||||
<template #extra>
|
||||
<BaseButton type="primary" size="small" class="flex shrink-0 md:hidden" @click="emits('add')">
|
||||
<div>افزودن</div>
|
||||
<BaseIcon icon="vuesax-linear:box" Size="16px" />
|
||||
</BaseButton>
|
||||
</template>
|
||||
<div class="flex h-full min-h-0 flex-col">
|
||||
<BaseTable v-if="!isMobile" class="h-full min-h-0 min-w-0" 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="{ record }">
|
||||
<div class="gap-2 flex justify-center">
|
||||
<a-tooltip class="cursor-pointer" :key="`buy-${record.id}-${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
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip class="cursor-pointer" :key="`sell-${record.id}-${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>
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip class="cursor-pointer" :key="`active-${record.id}-${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 placement="bottom" class="cursor-pointer" @click="emits('edit', record)">
|
||||
<template #title><span>ویرایش</span></template>
|
||||
<BaseIcon icon="vuesax-linear:edit" color="#4572E9" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</BaseTable>
|
||||
|
||||
<ProductMobileCardList
|
||||
v-else
|
||||
ref="mobileListRef"
|
||||
class="min-h-0 flex-1"
|
||||
@edit="emits('edit', $event)"
|
||||
@toggleBuy="activeBuy"
|
||||
@toggleSell="activeSell"
|
||||
@toggleActive="activeProduct"
|
||||
/>
|
||||
</div>
|
||||
</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'
|
||||
<script setup lang="ts">
|
||||
import { message, Modal, TimePicker } from 'ant-design-vue'
|
||||
import locale from 'ant-design-vue/es/date-picker/locale/fa_IR'
|
||||
import dayjs from 'dayjs'
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||
import { ref } from '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";
|
||||
changeSellActiveProduct,
|
||||
getCustomerTable,
|
||||
setActiveTime
|
||||
} from '@/api/product'
|
||||
import { cols } from '@/pages/menuPages/products/base/hooks/productColumns'
|
||||
import ProductMobileCardList from '@/pages/menuPages/products/base/components/ProductMobileCardList.vue'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import type { TableInput } from '@core/type/baseTable'
|
||||
import type { Product } from '@/model/product'
|
||||
import { isMobile } from '@core/utils/is'
|
||||
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
/*const select = (val) => {
|
||||
val.sts === 1 ? return ['1'] : ['2']
|
||||
}*/
|
||||
//emits
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'chargeMoney', 'chargeGold'])
|
||||
const emits = defineEmits(['edit', 'add'])
|
||||
|
||||
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 mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
|
||||
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
|
||||
now: 'اکنون',
|
||||
ok: 'ثبت'
|
||||
}
|
||||
})
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: cols,
|
||||
api: async (params: TableInput) => {
|
||||
const data = (await getCustomerTable(params)) as any
|
||||
startTime.value = dayjs(data?.auto_open_at, 'HH:mm:ss')
|
||||
endTime.value = dayjs(data?.auto_close_at, 'HH:mm:ss')
|
||||
return data
|
||||
}
|
||||
})
|
||||
|
||||
const fetch = async () => {
|
||||
await Promise.allSettled([reload(), mobileListRef.value?.fetch?.() as Promise<void>])
|
||||
}
|
||||
|
||||
defineExpose({ fetch })
|
||||
|
||||
function confirmToggle(title: string, onOk: () => Promise<void>) {
|
||||
Modal.confirm({
|
||||
title,
|
||||
okText: 'بله',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
onOk
|
||||
})
|
||||
}
|
||||
|
||||
const activeSell = (product: Product) =>
|
||||
confirmToggle('وضعیت فروش محصول تغییر خواهد یافت.آیا مطمئن هستید؟', async () => {
|
||||
await changeSellActiveProduct(product.id)
|
||||
await fetch()
|
||||
})
|
||||
|
||||
const activeBuy = (product: Product) =>
|
||||
confirmToggle('وضعیت خرید محصول تغییر خواهد یافت.آیا مطمئن هستید؟', async () => {
|
||||
await changeBuyActiveProduct(product.id)
|
||||
await fetch()
|
||||
})
|
||||
|
||||
const activeProduct = (product: Product) =>
|
||||
confirmToggle('آیا مطمئن به انجام این عملیات هستید؟', async () => {
|
||||
await changeActiveProduct(product.id)
|
||||
await fetch()
|
||||
})
|
||||
|
||||
async function setTimeActive(start: dayjs.Dayjs | string, end: dayjs.Dayjs | string) {
|
||||
try {
|
||||
const startTimeFormatted = dayjs(start).format('HH:mm:ss')
|
||||
const endTimeFormatted = dayjs(end).format('HH:mm:ss')
|
||||
await setActiveTime(startTimeFormatted, endTimeFormatted)
|
||||
message.success('با موفقیت ثبت شد.')
|
||||
} catch {
|
||||
message.error('زمان را وارد کنید.')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@prefix: ~'@{prefixCls}-pophoverstatus';
|
||||
.ant-popover,
|
||||
.ant-tooltip {
|
||||
z-index: 1001 !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>
|
||||
|
||||
@@ -1,291 +0,0 @@
|
||||
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
|
||||
// }
|
||||
]
|
||||
@@ -1,54 +0,0 @@
|
||||
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,92 @@
|
||||
import type { BaseTableColumn } from '@core/type/baseTable'
|
||||
import CustomTag from '@/components/CustomTag.vue'
|
||||
|
||||
export const cols: BaseTableColumn[] = [
|
||||
{
|
||||
title: 'ردیف',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
filterable: false,
|
||||
sortable: false,
|
||||
customRender: (record: any) => record.index + 1
|
||||
},
|
||||
{
|
||||
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) => (
|
||||
<div class="flex justify-center">
|
||||
<CustomTag textColor="#1d4ed8" bgColor="#dbeafe">
|
||||
{record?.record.reading_method ? record?.record.reading_method : 'دستی'}
|
||||
</CustomTag>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
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) => (
|
||||
<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
|
||||
}
|
||||
]
|
||||
@@ -1,163 +0,0 @@
|
||||
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)
|
||||
}
|
||||
},*/
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="h-full min-h-0">
|
||||
<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" />
|
||||
<div class="flex h-full min-h-0 min-w-0 flex-col md:flex-row">
|
||||
<BasicMenu width="11rem" :menu="menu" mode="horizontal" class="shrink-0 overflow-auto md:hidden" />
|
||||
<BasicMenu
|
||||
width="13rem"
|
||||
:menu="menu"
|
||||
class="hidden md:inline overflow-auto min-w-[13.5rem]"
|
||||
class="hidden min-w-[13.5rem] shrink-0 overflow-auto md:inline"
|
||||
/>
|
||||
<!-- <component :is="selectedComponent" class="mr-5" />-->
|
||||
<RouterView class="md:mr-5 md:mt-0 mt-5 w-full"></RouterView>
|
||||
<RouterView class="mt-5 min-h-0 min-w-0 w-full flex-1 overflow-hidden md:mr-5 md:mt-0" />
|
||||
</div>
|
||||
</BasicMainCard>
|
||||
</div>
|
||||
@@ -20,21 +18,9 @@
|
||||
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', []))
|
||||
const item = routerStore.routes.find((item) => item.name === 'products')
|
||||
return get(item, 'children[0].children', [])
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user