fix pargar bugs
This commit is contained in:
@@ -73,7 +73,7 @@ const items = computed(() => {
|
||||
{ label: 'نوع', value: detail.value?.type },
|
||||
{ label: 'مقدار', value: detail.value?.amount },
|
||||
{ label: 'شرح', value: detail.value?.desc },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(detail.value?.sync_status, detail.value?.pargar_ref) },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(detail.value?.sync_status, detail.value?.pargar_ref, detail.value?.desc) },
|
||||
{ label: 'کد پرگار', value: detail.value?.pargar_ref }
|
||||
]
|
||||
})
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<MobileDetailRow label="نوع" :value="row.type || '-'" />
|
||||
<MobileDetailRow label="مقدار" :value="row.amount ?? '-'" />
|
||||
<MobileDetailRow label="شرح" full-width :value="row.desc || '-'" />
|
||||
<MobileDetailRow label="وضعیت" :value="pargarStatusLabel(row.sync_status, row.pargar_ref)" />
|
||||
<MobileDetailRow label="وضعیت" :value="pargarStatusLabel(row.sync_status, row.pargar_ref, row.desc)" />
|
||||
<MobileDetailRow label="کد پرگار" :value="row.pargar_ref || '-'" />
|
||||
<MobileDetailRow label="زمان" :value="row.created_at ? toJalali(row.created_at) : '-'" />
|
||||
<MobileDetailRow v-if="row.res" label="پاسخ API" full-width :value="row.res" />
|
||||
|
||||
@@ -35,7 +35,7 @@ const createdAtLabel = computed(() =>
|
||||
props.item.created_at ? toJalali(props.item.created_at) : '-'
|
||||
)
|
||||
const statusText = computed(() =>
|
||||
pargarStatusLabel(props.item.sync_status, props.item.pargar_ref)
|
||||
pargarStatusLabel(props.item.sync_status, props.item.pargar_ref, props.item.desc)
|
||||
)
|
||||
const statusClass = computed(() => {
|
||||
const text = statusText.value
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<!-- دکمه ۲: ثبت مشتری در پرگار (فقط اگر سند هنوز ثبت نشده و مشتری کد ندارد) -->
|
||||
<a-tooltip
|
||||
v-if="!record.pargar_ref && !record.customer?.pargar_account_id"
|
||||
v-if="canRetryPargar(record) && !record.customer?.pargar_account_id"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openRegister(record)"
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<!-- دکمه ۳: ارسال به پرگار (فقط اگر هنوز در پرگار ثبت نشده) -->
|
||||
<a-tooltip
|
||||
v-if="!record.pargar_ref"
|
||||
v-if="canRetryPargar(record)"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openSend(record)"
|
||||
@@ -91,7 +91,7 @@ import { isMobile } from '@core/utils/is'
|
||||
import BasicModal from '@/components/BasicModal.vue'
|
||||
import PargarRetryModal from '@/components/PargarRetryModal.vue'
|
||||
import PargarMobileCardList from '@/pages/menuPages/accounting/components/PargarMobileCardList.vue'
|
||||
import { pargarStatusLabel } from '@/pages/menuPages/accounting/utils/pargarStatus'
|
||||
import { canRetryPargar, pargarStatusLabel } from '@/pages/menuPages/accounting/utils/pargarStatus'
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
|
||||
const [submit, reload] = useBaseTable()
|
||||
@@ -120,7 +120,7 @@ const columns = [
|
||||
key: 'sync_status',
|
||||
type: 'Text',
|
||||
filterable: false,
|
||||
customRender: (r: any) => pargarStatusLabel(r.record.sync_status, r.record.pargar_ref)
|
||||
customRender: (r: any) => pargarStatusLabel(r.record.sync_status, r.record.pargar_ref, r.record.desc)
|
||||
},
|
||||
{
|
||||
title: 'زمان',
|
||||
@@ -155,7 +155,7 @@ const infoItems = computed(() => {
|
||||
{ label: 'مقدار', value: row.amount },
|
||||
{ label: 'شرح', value: row.desc },
|
||||
{ label: 'زمان ثبت', value: row.created_at ? toJalali(row.created_at) : '-' },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(row.sync_status, row.pargar_ref) },
|
||||
{ label: 'وضعیت', value: pargarStatusLabel(row.sync_status, row.pargar_ref, row.desc) },
|
||||
{ label: 'کد پرگار', value: row.pargar_ref || 'ثبت نشده' }
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export function pargarStatusLabel(status?: string, pargarId?: string | null): string {
|
||||
export function pargarStatusLabel(status?: string, pargarId?: string | null, desc?: string | null): string {
|
||||
if (desc && desc.includes('اختلاف مانده')) return 'اختلاف مانده'
|
||||
if (pargarId && String(pargarId).startsWith('skip:')) return 'بدون سند'
|
||||
if (pargarId) return 'موفق'
|
||||
if (status === 'failed') return 'ناموفق'
|
||||
if (status === 'success') return 'موفق'
|
||||
@@ -6,7 +8,13 @@ export function pargarStatusLabel(status?: string, pargarId?: string | null): st
|
||||
return 'ارسال نشده'
|
||||
}
|
||||
|
||||
export function canRetryPargar(record: { pargar_ref?: string | null; sync_status?: string }): boolean {
|
||||
export function canRetryPargar(record: {
|
||||
pargar_ref?: string | null
|
||||
sync_status?: string
|
||||
type?: string
|
||||
}): boolean {
|
||||
if (record.type === 'mande') return false
|
||||
if (record.pargar_ref && String(record.pargar_ref).startsWith('skip:')) return false
|
||||
return !record.pargar_ref || record.sync_status === 'failed'
|
||||
}
|
||||
|
||||
|
||||
@@ -299,6 +299,8 @@ const KEY_TYPE_FALLBACK: Record<string, SettingFieldType> = {
|
||||
pargar_username: 'text',
|
||||
pargar_password: 'text',
|
||||
pargar_api_token: 'text',
|
||||
pargar_item_id_rial: 'number',
|
||||
pargar_item_id_gold: 'number',
|
||||
support_messengers: 'longtext',
|
||||
tracking_systems: 'longtext',
|
||||
tracking_systems_enabled: 'switch',
|
||||
@@ -714,6 +716,10 @@ const KEY_HELP_FALLBACK: Record<string, string> = {
|
||||
'رمز عبور login API پرگار — در پنل ثبت میشود و به پرگار داده میشود.',
|
||||
pargar_api_token:
|
||||
'توکن ثابت اختیاری برای احراز API پرگار (جایگزین توکن login).',
|
||||
pargar_item_id_rial:
|
||||
'کد کالای ریال در پرگار برای اسناد واریز/برداشت ریالی. اگر خالی یا صفر باشد از کد طلا استفاده میشود و وزن صفر ارسال میشود.',
|
||||
pargar_item_id_gold:
|
||||
'کد کالای طلا (کیف اصلی) در پرگار — پیشفرض ۱۱.',
|
||||
tahesab_host:
|
||||
'آدرس سرور نرمافزار تهحساب در شبکه.',
|
||||
tahesab_port:
|
||||
@@ -797,6 +803,8 @@ export const KEY_LABEL_FALLBACK: Record<string, string> = {
|
||||
sms_notif_fund_withdraw_admin: 'پیامک برداشت قلک به ادمین',
|
||||
sms_notif_fund_withdraw_customer: 'پیامک برداشت قلک به مشتری',
|
||||
sms_notif_price_trigger: 'پیامک هشدار قیمت',
|
||||
pargar_item_id_rial: 'کد کالای ریال پرگار',
|
||||
pargar_item_id_gold: 'کد کالای طلا پرگار',
|
||||
sms_notif_wallet_alert: 'پیامک هشدار اعتبار پنل پیامک',
|
||||
auto_active_customer: 'فعالسازی خودکار پس از ثبتنام',
|
||||
balance_report_exclude_customer_id: 'حذف مشتری از گزارش تراز',
|
||||
@@ -868,6 +876,7 @@ export const SETTING_LOCKED_KEYS = new Set([
|
||||
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
|
||||
'tracking_systems', 'tracking_systems_enabled',
|
||||
'pargar_api_token', 'pargar_password', 'pargar_username',
|
||||
'pargar_item_id_rial', 'pargar_item_id_gold',
|
||||
'telegram_bot_token', 'rubika_bot_token',
|
||||
'price_channel_bale_to', 'price_channel_telegram_to', 'price_channel_rubika_to',
|
||||
'unit',
|
||||
|
||||
Reference in New Issue
Block a user