limit added

This commit is contained in:
2026-06-06 22:41:42 +03:30
parent 183fd09289
commit a984710c0a
5 changed files with 127 additions and 6 deletions
@@ -79,6 +79,10 @@
<div>{{ usePrice(form.goldCash ?? 0) }}</div>
</div>
<div v-if="cashValidationMessage" class="text-red-700 text-xs font-bold mt-2">
{{ cashValidationMessage }}
</div>
<div v-if="shouldShowProductTotalWeight(props?.ProductItem)" class="flex justify-between">
<div>وزن کل</div>
<div>{{ totalWeightDisplay }}</div>
@@ -276,6 +280,11 @@ import {
isCountBasedProduct,
shouldShowProductTotalWeight,
} from '@/utils/productDealMethod'
import {
productCashValidationMessage,
productMaxOrderCash,
productMinOrderCash
} from '@/utils/productOrderLimit'
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type))
@@ -377,14 +386,25 @@ const sellPagination = ref<TableEngineInput>({
const finalPrice = computed(() => (form.value?.goldValue * (isBuy.value ? props.ProductItem?.price ?? 0 : props.ProductItem?.sellPrice ?? 0)))
const payablePrice = computed(() => finalPrice.value)
const minOrderCash = computed(() => productMinOrderCash(props.ProductItem, isBuy.value))
const maxOrderCash = computed(() => productMaxOrderCash(props.ProductItem))
const cashValidationMessage = computed(() =>
productCashValidationMessage(props.ProductItem, form.value?.goldCash, isBuy.value, usePriceWithoutType)
)
const disableTransaction = computed(() =>
loading.value ||
form.value?.goldValue === undefined ||
form.value?.goldValue === '' ||
form.value?.goldCash === '' ||
form.value?.goldCash === undefined ||
(isBuy.value ? (form.value?.goldCash ?? 0) < 500000 : (form.value?.goldValue ?? 0) < 0.001) ||
// (!isBuy.value && form.value.goldValue > walletStore?.walletInfo?.gold) ||
(isBuy.value
? (form.value?.goldCash ?? 0) < minOrderCash.value
: (productMinOrderCash(props.ProductItem, false) > 0 || productMaxOrderCash(props.ProductItem) != null
? ((form.value?.goldCash ?? 0) < minOrderCash.value || (maxOrderCash.value != null && (form.value?.goldCash ?? 0) > maxOrderCash.value))
: (form.value?.goldValue ?? 0) < 0.001)) ||
(maxOrderCash.value != null && (form.value?.goldCash ?? 0) > maxOrderCash.value) ||
cashValidationMessage.value !== '' ||
!lastPrice.value ||
(isBuy.value ? getTradeBuyPrice(lastPrice.value) <= 0 : getTradeSellPrice(lastPrice.value) <= 0))