fix sql
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
@click="$emit('withdraw', row)"
|
||||
/>
|
||||
<MobileIconButton
|
||||
v-if="needsWeightAssignment(row)"
|
||||
plain
|
||||
icon="vuesax-linear:3d-cube-scan"
|
||||
color="#1D4ED8"
|
||||
@@ -121,6 +122,7 @@ import {
|
||||
formatWithdrawAmountDisplay,
|
||||
isMoneyWithdraw,
|
||||
needsTrackingConfirmation,
|
||||
needsWeightAssignment,
|
||||
withdrawAmountValue,
|
||||
withdrawTypeLabel
|
||||
} from '@/pages/menuPages/withdraw/utils/withdrawDisplay'
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
<Icon icon="vuesax-linear:message-text" color="#64748b" />
|
||||
</a-badge>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="needsTrackingConfirmation(record)" class="cursor-pointer">
|
||||
<template #title><span>{{ confirmLabelForRecord(record, props.flowType) }}</span></template>
|
||||
<BaseButton size="small" type="primary" @click="emits('withdraw', record)">
|
||||
{{ confirmLabelForRecord(record, props.flowType) }}
|
||||
</BaseButton>
|
||||
</a-tooltip>
|
||||
<div class="flex gap-2" v-if="record.sts <= 70 && record.sts >= 50">
|
||||
<a-tooltip class="cursor-pointer">
|
||||
<template #title><span>دریافت فاکتور</span></template>
|
||||
@@ -60,8 +66,7 @@
|
||||
</ADropdown>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<!-- <div v-if="record.sts == 53">-->
|
||||
<a-tooltip class="cursor-pointer">
|
||||
<a-tooltip v-if="needsWeightAssignment(record)" class="cursor-pointer">
|
||||
<template #title><span>تعیین وزن</span></template>
|
||||
<Icon
|
||||
icon="vuesax-linear:3d-cube-scan"
|
||||
@@ -77,7 +82,6 @@
|
||||
<template #title><span>ارسال به تهحساب</span></template>
|
||||
<Icon icon="vuesax-linear:refresh-circle" color="#CA8A04" />
|
||||
</a-tooltip>
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
</BaseTable>
|
||||
@@ -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'
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<BasicModal
|
||||
v-model:visible="confirmWeightVisible"
|
||||
width="40rem"
|
||||
title="ثبت اطلاعات"
|
||||
title="تعیین وزن"
|
||||
wrap-class-name="withdraw-stack-modal"
|
||||
:loading="loading"
|
||||
@close="confirmWeightVisible = false"
|
||||
@@ -117,7 +117,7 @@ import type { Wallet, Withdraw } from '@/model/wallet'
|
||||
import {completeWithdraw, exportWithdrawReport, getWithdrawById, sendWeights} from '@/api/wallet'
|
||||
import Button from "@core/components/BaseButton";
|
||||
import type { WithdrawFlowType } from '@/pages/menuPages/withdraw/types'
|
||||
import { confirmLabelForRecord } from '@/pages/menuPages/withdraw/utils/withdrawDisplay'
|
||||
import { confirmLabelForRecord, needsWeightAssignment } from '@/pages/menuPages/withdraw/utils/withdrawDisplay'
|
||||
import { openHtmlPrintWindow } from '@/pages/menuPages/withdraw/utils/openHtmlPrintWindow'
|
||||
//import DatePicker from '@core/components/_sample/components/datePicker.vue'
|
||||
|
||||
@@ -328,6 +328,10 @@ async function okWithdraw() {
|
||||
const newWeightArray = ref<Record<number, number | undefined>>({})
|
||||
|
||||
async function openWeight(val: Withdraw) {
|
||||
if (!needsWeightAssignment(val)) {
|
||||
message.info('تعیین وزن فقط برای تراکنشهای «در انتظار تعیین مجدد قیمت» فعال است')
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
newWeightArray.value = {}
|
||||
|
||||
@@ -109,3 +109,33 @@ export function needsTrackingConfirmation(record: Pick<Withdraw, 'sts' | 'tracke
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/** تعیین وزن — فقط وضعیت «در انتظار تعیین مجدد قیمت» (sts=53) */
|
||||
export function needsWeightAssignment(record: Pick<Withdraw, 'sts'>): 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<Withdraw, 'gold' | 'cash' | 'sts' | 'transaction'>
|
||||
): 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user