fix bugs and added some feature for withdraw handling
This commit is contained in:
@@ -19,6 +19,17 @@
|
||||
افزودن مشتری
|
||||
</BaseButton>
|
||||
</template>
|
||||
<template #accountingCode="{ record }">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 border-none bg-transparent p-0 text-sm cursor-pointer"
|
||||
style="color: var(--admin-text)"
|
||||
@click="openAccountingCodeEdit(record)"
|
||||
>
|
||||
<span dir="ltr">{{ accountingCodeOf(record) }}</span>
|
||||
<Icon icon="vuesax-linear:edit-2" size="16" color="#4572E9" />
|
||||
</button>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<div class="gap-2 hidden md:flex justify-center">
|
||||
<a-tooltip :key="record.is_archive" placement="bottom" class="cursor-pointer">
|
||||
@@ -54,7 +65,7 @@
|
||||
<Icon icon="vuesax-linear:wallet-add" color="#9333ea" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="tahesabEnabled && !record.moshtari_code"
|
||||
v-if="tahesabEnabled && !isValidAccountingCode(record.moshtari_code)"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openTahesabRegister(record)"
|
||||
@@ -63,7 +74,7 @@
|
||||
<Icon icon="vuesax-linear:profile-add" color="#CA8A04" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="pargarEnabled && !record.pargar_account_id"
|
||||
v-if="pargarEnabled && !isValidAccountingCode(record.pargar_account_id)"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openPargarRegister(record)"
|
||||
@@ -71,6 +82,15 @@
|
||||
<template #title><span>در پرگار ثبت نشده — کلیک برای ثبت</span></template>
|
||||
<Icon icon="vuesax-linear:profile-add" color="#7C3AED" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="accountingEnabled"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openAccountingCodeEdit(record)"
|
||||
>
|
||||
<template #title><span>ویرایش کد حسابداری</span></template>
|
||||
<Icon icon="vuesax-linear:card-edit" color="#0d9488" />
|
||||
</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" />
|
||||
@@ -127,11 +147,19 @@
|
||||
@toggleTrade="(item) => changeCustomerOrderActivationFunction(item.id)"
|
||||
@confirmUser="openConfirmUser"
|
||||
@sendSms="openDirectSms"
|
||||
@editAccounting="openAccountingCodeEdit"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<CustomerDirectSmsModal v-model:visible="directSmsVisible" :customer="directSmsCustomer" />
|
||||
|
||||
<CustomerAccountingCodeModal
|
||||
v-model:visible="accountingCodeVisible"
|
||||
:customer="accountingCodeCustomer"
|
||||
:provider="accountingProviderSetting"
|
||||
@success="fetch"
|
||||
/>
|
||||
|
||||
<BasicModal
|
||||
v-model:visible="confirmVisible"
|
||||
:width="isMobile ? '92vw' : '50vw'"
|
||||
@@ -178,7 +206,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import { onMounted, ref, computed } from 'vue'
|
||||
import {
|
||||
changeCustomerActivation,
|
||||
changeCustomerArchive,
|
||||
@@ -189,6 +217,7 @@ import {
|
||||
import { buildCustomerColumns } from '@/pages/menuPages/customers/base/hooks/customerColumns'
|
||||
import CustomerMobileCardList from '@/pages/menuPages/customers/base/components/CustomerMobileCardList.vue'
|
||||
import CustomerDirectSmsModal from '@/pages/menuPages/customers/base/components/CustomerDirectSmsModal.vue'
|
||||
import CustomerAccountingCodeModal from '@/pages/menuPages/customers/base/components/CustomerAccountingCodeModal.vue'
|
||||
import Icon from '@core/components/BaseIcon/src/Icon.vue'
|
||||
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
|
||||
import type { TableInput } from '@core/type/baseTable'
|
||||
@@ -201,10 +230,12 @@ import PargarRetryModal from '@/components/PargarRetryModal.vue'
|
||||
import {
|
||||
tahesabEnabledSetting,
|
||||
pargarEnabledSetting,
|
||||
accountingProviderSetting,
|
||||
customerDirectSmsEnabledSetting,
|
||||
initAccountingSettingsFromApi,
|
||||
initWalletSettingsFromApi
|
||||
} from '@/utils/config'
|
||||
import { displayAccountingCode, isValidAccountingCode } from '@/utils/accountingCode'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
const emits = defineEmits(['delete', 'edit', 'add', 'info', 'chargeWallet'])
|
||||
@@ -219,16 +250,43 @@ const pargarRegisterVisible = ref(false)
|
||||
const pargarCustomer = ref<Customer>()
|
||||
const pargarEnabled = pargarEnabledSetting
|
||||
const customerDirectSmsEnabled = customerDirectSmsEnabledSetting
|
||||
const accountingCodeVisible = ref(false)
|
||||
const accountingCodeCustomer = ref<Customer | null>(null)
|
||||
const accountingEnabled = computed(() => {
|
||||
const provider = accountingProviderSetting.value
|
||||
return provider === 'pargar' || provider === 'tahesab'
|
||||
})
|
||||
|
||||
function accountingCodeOf(record: Customer) {
|
||||
const provider = accountingProviderSetting.value
|
||||
if (provider === 'pargar') return displayAccountingCode(record.pargar_account_id)
|
||||
if (provider === 'tahesab') return displayAccountingCode(record.moshtari_code)
|
||||
return '-'
|
||||
}
|
||||
|
||||
function openAccountingCodeEdit(user: Customer) {
|
||||
accountingCodeCustomer.value = user
|
||||
accountingCodeVisible.value = true
|
||||
}
|
||||
const directSmsVisible = ref(false)
|
||||
const directSmsCustomer = ref<Customer | null>(null)
|
||||
const mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
|
||||
const catalogMetals = ref<Parameters<typeof buildCustomerColumns>[0]>([])
|
||||
|
||||
function rebuildColumns(metals = catalogMetals.value) {
|
||||
catalogMetals.value = metals
|
||||
tblProps.value.columns = buildCustomerColumns(metals, {
|
||||
accountingProvider: accountingProviderSetting.value
|
||||
})
|
||||
}
|
||||
|
||||
const tblProps = ref<any>({
|
||||
columns: buildCustomerColumns(),
|
||||
columns: buildCustomerColumns([], { accountingProvider: accountingProviderSetting.value }),
|
||||
api: async (params: TableInput) => {
|
||||
await initAccountingSettingsFromApi()
|
||||
const data = await getCustomerTable(params)
|
||||
const metals = data?.catalogMetals ?? []
|
||||
tblProps.value.columns = buildCustomerColumns(metals)
|
||||
rebuildColumns(metals)
|
||||
return data
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user