feat(tahesab): three-way mande decision UI including push to Tahesab

Clarify overwrite vs keep vs push-to-tahesab, warn when app balance is zero, and update colleague wait-callback help text.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 22:30:58 +03:30
co-authored by Cursor
parent e0b89223ac
commit 9ef381f00e
6 changed files with 208 additions and 42 deletions
@@ -39,6 +39,7 @@
<TahesabMandeDecisionModal
v-model:visible="decisionVisible"
:source-label="provider === 'zarin' ? 'زرین' : 'ته‌حساب'"
:allow-push="provider === 'tahesab'"
:app-gold="decision?.app_gold"
:app-cash="decision?.app_cash"
:tahesab-gold="decision?.tahesab_gold ?? decision?.zarin_gold"
@@ -120,8 +121,12 @@ async function saveCode(customerId: number, body: Record<string, string>) {
close()
}
async function applyWalletDecision(customerId: number, mode: 'overwrite' | 'keep') {
async function applyWalletDecision(customerId: number, mode: 'overwrite' | 'keep' | 'push') {
if (props.provider === 'zarin') {
if (mode === 'push') {
message.warning('اعمال مانده اپ روی زرین در این نسخه پشتیبانی نمی‌شود')
return { ok: false, message: 'پشتیبانی نمی‌شود' }
}
return syncCustomerWalletFromZarin(customerId, {
overwrite: mode === 'overwrite',
keep: mode === 'keep',
@@ -131,11 +136,12 @@ async function applyWalletDecision(customerId: number, mode: 'overwrite' | 'keep
return syncCustomerWalletFromTahesab(customerId, {
overwrite: mode === 'overwrite',
keep: mode === 'keep',
push_to_tahesab: mode === 'push',
ask_if_conflict: false,
})
}
async function onDecide(mode: 'overwrite' | 'keep') {
async function onDecide(mode: 'overwrite' | 'keep' | 'push') {
const pending = pendingPayload.value
decisionVisible.value = false
if (!pending) return
@@ -144,6 +150,7 @@ async function onDecide(mode: 'overwrite' | 'keep') {
await saveCode(pending.customerId, pending.body)
const res = await applyWalletDecision(pending.customerId, mode)
if (mode === 'keep') message.info(res.message || 'موجودی اپ حفظ شد')
else if (mode === 'push') message.success(res.message || 'مانده اپ روی ته‌حساب اعمال شد')
else message.success(res.message || 'مانده حسابداری روی کیف اعمال شد')
emit('success')
} catch (e) {