From 99f2b8f0841725a045f5c931dff346a8cad35c85 Mon Sep 17 00:00:00 2001 From: mohammad sedighi Date: Thu, 2 Jul 2026 00:52:52 +0330 Subject: [PATCH] fix sql --- .../components/WithdrawMobileDetailSheet.vue | 2 ++ .../menuPages/withdraw/components/table.vue | 13 +++++--- src/pages/menuPages/withdraw/index.vue | 8 +++-- .../withdraw/utils/withdrawDisplay.ts | 30 +++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/pages/menuPages/withdraw/components/WithdrawMobileDetailSheet.vue b/src/pages/menuPages/withdraw/components/WithdrawMobileDetailSheet.vue index 062797c..ed3be19 100644 --- a/src/pages/menuPages/withdraw/components/WithdrawMobileDetailSheet.vue +++ b/src/pages/menuPages/withdraw/components/WithdrawMobileDetailSheet.vue @@ -15,6 +15,7 @@ @click="$emit('withdraw', row)" /> + + + + {{ confirmLabelForRecord(record, props.flowType) }} + +
@@ -60,8 +66,7 @@
- - + ارسال به ته‌حساب - @@ -119,7 +123,8 @@ import { isMobile } from '@core/utils/is' import type { WithdrawFlowType } from '../types' import { confirmLabelForRecord, - needsTrackingConfirmation + needsTrackingConfirmation, + needsWeightAssignment } from '@/pages/menuPages/withdraw/utils/withdrawDisplay' import TahesabRetryModal from '@/components/TahesabRetryModal.vue' import { initTahesabSettingFromApi, tahesabEnabledSetting } from '@/utils/config' diff --git a/src/pages/menuPages/withdraw/index.vue b/src/pages/menuPages/withdraw/index.vue index cac0362..04c1a4a 100644 --- a/src/pages/menuPages/withdraw/index.vue +++ b/src/pages/menuPages/withdraw/index.vue @@ -66,7 +66,7 @@ >({}) async function openWeight(val: Withdraw) { + if (!needsWeightAssignment(val)) { + message.info('تعیین وزن فقط برای تراکنش‌های «در انتظار تعیین مجدد قیمت» فعال است') + return + } try { loading.value = true newWeightArray.value = {} diff --git a/src/pages/menuPages/withdraw/utils/withdrawDisplay.ts b/src/pages/menuPages/withdraw/utils/withdrawDisplay.ts index 7688fc1..a935225 100644 --- a/src/pages/menuPages/withdraw/utils/withdrawDisplay.ts +++ b/src/pages/menuPages/withdraw/utils/withdrawDisplay.ts @@ -109,3 +109,33 @@ export function needsTrackingConfirmation(record: Pick): boolean { + return Number(record.sts ?? 0) === 53 +} + +function transactionWeightCount(item: { gold?: number }): number { + const count = Math.floor(Math.abs(Number(item?.gold ?? 0))) + return Number.isFinite(count) ? count : 0 +} + +/** تعیین وزن — فقط برداشت فیزیکی (۵۰–۵۲) یا تراکنش طلایی با تعداد واحد ≥ ۱ */ +export function needsWeightAssignment( + record: Pick +): boolean { + const sts = Number(record.sts ?? 0) + if (sts >= 50 && sts <= 52) return true + + if (Array.isArray(record.transaction)) { + return record.transaction.some((tx) => transactionWeightCount(tx) > 0) + } + + if (isMoneyWithdraw(record)) return false + + return transactionWeightCount(record) > 0 +} + +export function weightCountForTransaction(item: { gold?: number }): number { + return transactionWeightCount(item) +}