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