Fixing the account balance entry error

This commit is contained in:
2026-10-03 15:28:08 +03:30
parent 2e315c9cfd
commit c322a24424
+10 -7
View File
@@ -269,8 +269,8 @@ async function searchTahesab(mode: 'range' | 'filter') {
const fromRaw = String(sync.fromCode ?? '').trim();
const toRaw = String(sync.toCode ?? '').trim();
if (!fromRaw && !toRaw) {
body.fromCode = 1;
body.toCode = 5000;
// API برای «همه» فلگ listAll دارد؛ ارسال ۱…۵۰۰۰ با سقف ۲۰۰۰ کد رد می‌شود
body.listAll = true;
} else {
const fromCode = fromRaw ? Number(fromRaw) : 1;
const toCode = toRaw ? Number(toRaw) : fromCode + 1999;
@@ -278,6 +278,10 @@ async function searchTahesab(mode: 'range' | 'filter') {
error.value = 'بازه کد مشتری نامعتبر است.';
return;
}
if (toCode - fromCode > 2000) {
error.value = 'حداکثر طول بازه در هر درخواست ۲۰۰۰ کد است. برای همه، از و تا را خالی بگذارید.';
return;
}
body.fromCode = fromCode;
body.toCode = toCode;
}
@@ -294,7 +298,7 @@ async function searchTahesab(mode: 'range' | 'filter') {
const { data } = await api.post<{ results: SyncResult[] }>(
'/integrations/tahesab/sync/search',
body,
{ timeout: 60_000 },
{ timeout: body.listAll ? 180_000 : 60_000 },
);
syncResults.value = data.results ?? [];
if (!syncResults.value.length) {
@@ -360,13 +364,12 @@ async function importBulk(mode: 'results' | 'range') {
if (!fromRaw && !toRaw) {
if (
!confirm(
`کل مشتریان از کد ۱ تا ۵۰۰۰ از ته‌حساب به‌عنوان شخص وارد ${brand.nameFa} می‌شوند. ادامه؟`,
`کل مشتریان قابل‌خواندن از ته‌حساب به‌عنوان شخص وارد ${brand.nameFa} می‌شوند. ادامه؟`,
)
) {
return;
}
body.fromCode = 1;
body.toCode = 5000;
body.listAll = true;
} else {
const fromCode = fromRaw ? Number(fromRaw) : 1;
const toCode = toRaw ? Number(toRaw) : fromCode + 1999;
@@ -665,7 +668,7 @@ onMounted(load);
<div class="sync-sub-section">
<h4 class="sync-subhead">۱) وارد کردن دسته‌ای با بازه کد مشتری</h4>
<p class="sync-sub-desc">
در صورت خالی بودن «از» و «تا»، مشتریان کد ۱ تا ۵۰۰۰ بررسی می‌شوند (حداکثر ۲۰۰۰ کد در هر درخواست).
بازهٔ دستی حداکثر ۲۰۰۰ کد است. اگر «از» و «تا» خالی باشد، همهٔ مشتریان خوانده می‌شوند.
</p>
<div class="crm-form-grid-2">
<UiInput v-model="sync.fromCode" type="number" min="1" dir="ltr" placeholder="از کد (مثلاً ۱)" />