fix moshtari code

This commit is contained in:
2026-08-27 14:37:39 +03:30
parent 52057805ff
commit da5b113406
5 changed files with 108 additions and 39 deletions
@@ -239,7 +239,7 @@
<script setup lang="ts">
import { message, Modal } from 'ant-design-vue'
import { onMounted, ref, computed } from 'vue'
import { onMounted, ref, computed, watch } from 'vue'
import {
changeCustomerActivation,
changeCustomerArchive,
@@ -323,10 +323,15 @@ function rebuildColumns(metals = catalogMetals.value) {
})
}
watch(accountingProviderSetting, () => {
rebuildColumns()
})
const tblProps = ref<any>({
columns: buildCustomerColumns([], { accountingProvider: accountingProviderSetting.value }),
api: async (params: TableInput) => {
await initAccountingSettingsFromApi()
rebuildColumns(catalogMetals.value)
const data = await getCustomerTable(params)
const metals = data?.catalogMetals ?? []
rebuildColumns(metals)
@@ -341,8 +346,11 @@ const fetch = async () => {
defineExpose({ fetch })
onMounted(() => {
void initAccountingSettingsFromApi()
void initWalletSettingsFromApi()
void (async () => {
await initAccountingSettingsFromApi()
rebuildColumns()
await initWalletSettingsFromApi()
})()
})
function openDirectSms(user: Customer) {
@@ -15,12 +15,16 @@ export type CustomerColumnOptions = {
function accountingCodeColumn(provider: AccountingProvider | undefined): BaseTableColumn | null {
if (provider === 'pargar' || provider === 'tahesab' || provider === 'zarin') {
const field = provider === 'pargar' ? 'pargar_account_id' : 'moshtari_code'
return {
title: 'کد حسابداری',
dataIndex: provider === 'pargar' ? 'pargar_account_id' : 'moshtari_code',
dataIndex: field,
key: 'accounting_code',
filterField: field,
sortField: field,
type: 'Text',
filterable: false,
filterable: true,
sortable: true,
slot: 'accountingCode'
}
}
@@ -74,6 +78,8 @@ export function buildCustomerColumns(
dataIndex: 'wallet.cash',
key: 'wallet.cash',
type: 'Number',
filterable: false,
sortable: false,
customRender(data) {
return usePrice(getCashBalance(data.record?.wallet, { walletCash: data.record?.wallet_cash }), true, '')
}
@@ -116,18 +122,18 @@ export function buildCustomerColumns(
key: 'last_seen_at',
type: 'DateTime',
width: 130,
filterable: false,
filterable: true,
sortable: true,
customRender: ({ record }) => <CustomerPresenceCell lastSeenAt={record.last_seen_at} />
},
{
title: 'وضعیت',
title: 'وضعیت حساب',
dataIndex: 'active',
key: 'status',
type: 'Boolean',
width: 132,
filterable: false,
sortable: false,
filterable: true,
sortable: true,
customRender: ({ record }) => {
const userOk = Boolean(record.active)
const tradeOk = Boolean(record.trade_active)
@@ -151,6 +157,15 @@ export function buildCustomerColumns(
)
}
},
{
title: 'وضعیت سفارش',
dataIndex: 'trade_active',
key: 'trade_active',
type: 'Boolean',
filterable: true,
sortable: true,
show: false
},
{
title: 'عملیات',
dataIndex: 'action',