fix bug
This commit is contained in:
@@ -239,6 +239,7 @@ import {useConfigStore} from "@/store/configStore";
|
||||
import { calcFeeInGrams } from '@/utils/serviceFee'
|
||||
import { formatCashWalletBalanceText, formatGoldWalletBalanceText } from '@/utils/productDealMethod'
|
||||
import { getCashWalletBalance } from '@/utils/productAssets'
|
||||
import { isStoreClosed, STORE_CLOSED_MESSAGE } from '@/utils/storeHours'
|
||||
|
||||
const infoVisible = ref(false)
|
||||
const walletStore = useWalletStore()
|
||||
@@ -325,6 +326,7 @@ const equivalentPrice = computed(() => usePriceWithoutType(feeInRial.value.toFix
|
||||
|
||||
const disableTransaction = computed(() =>
|
||||
loading.value ||
|
||||
isStoreClosed() ||
|
||||
form.value?.goldValue === undefined ||
|
||||
form.value?.goldValue === '' ||
|
||||
form.value?.goldCash === '' ||
|
||||
@@ -640,10 +642,18 @@ async function initPrice() {
|
||||
}
|
||||
|
||||
function okConfirm() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
confirmAction.value = true
|
||||
}
|
||||
|
||||
async function ok() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
infoVisible.value = true
|
||||
|
||||
@@ -236,6 +236,7 @@ import type { Product } from '@/models/products'
|
||||
import { useFundUserStore } from '@/store/fundStore'
|
||||
import {useConfigStore} from "@/store/configStore";
|
||||
import { calcFeeInGrams, loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
||||
import { isStoreClosed, STORE_CLOSED_MESSAGE } from '@/utils/storeHours'
|
||||
import { formatCashWalletBalanceText, getWeightUnit } from '@/utils/productDealMethod'
|
||||
import { formatProductWalletBalanceText, getCashWalletBalance, getProductInventoryQuantity } from '@/utils/productAssets'
|
||||
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||
@@ -344,6 +345,7 @@ const priceUnavailable = computed(() => {
|
||||
|
||||
const disableTransaction = computed(() =>
|
||||
loading.value ||
|
||||
isStoreClosed() ||
|
||||
form.value?.goldValue === undefined ||
|
||||
form.value?.goldValue === '' ||
|
||||
form.value?.goldCash === '' ||
|
||||
@@ -633,6 +635,10 @@ async function initPrice() {
|
||||
}
|
||||
|
||||
function okConfirm() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
if (cashValidationMessage.value) {
|
||||
message.warning(cashValidationMessage.value)
|
||||
return
|
||||
@@ -641,6 +647,10 @@ function okConfirm() {
|
||||
}
|
||||
|
||||
async function ok() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
infoVisible.value = true
|
||||
|
||||
@@ -297,6 +297,7 @@ import {
|
||||
} from '@/utils/productOrderLimit'
|
||||
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||
import { formatProductWalletBalanceText, getCashWalletBalance, getProductInventoryQuantity } from '@/utils/productAssets'
|
||||
import { isStoreClosed, STORE_CLOSED_MESSAGE } from '@/utils/storeHours'
|
||||
|
||||
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type, isBuy.value))
|
||||
|
||||
@@ -438,6 +439,7 @@ const cashValidationMessage = computed(() =>
|
||||
|
||||
const disableTransaction = computed(() =>
|
||||
loading.value ||
|
||||
isStoreClosed() ||
|
||||
form.value?.goldValue === undefined ||
|
||||
form.value?.goldValue === '' ||
|
||||
form.value?.goldCash === '' ||
|
||||
@@ -795,11 +797,19 @@ async function initPrice() {
|
||||
// })
|
||||
|
||||
function okConfirm() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
confirmAction.value = true
|
||||
refInput.value?.validateFields()
|
||||
}
|
||||
|
||||
async function ok() {
|
||||
if (isStoreClosed()) {
|
||||
message.warning(STORE_CLOSED_MESSAGE)
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
infoVisible.value = true
|
||||
|
||||
@@ -103,7 +103,13 @@ import { isMetalCommodityGroup, isMeltedTradeGroup } from '@/utils/productCatego
|
||||
import { isBoursecuDealProductGroup } from '@/utils/productDealMethod'
|
||||
import { loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
||||
import { loadProductCategoryTabNames } from '@/utils/categoryTabs'
|
||||
import { getLastPrices, startLastPricePolling, stopLastPricePolling } from '@/utils/price'
|
||||
import { getLastPrices, lastPrice, startLastPricePolling, stopLastPricePolling } from '@/utils/price'
|
||||
import {
|
||||
formatTradingTimeDisplay,
|
||||
getStoreTradingHours,
|
||||
isStoreClosed,
|
||||
STORE_CLOSED_MESSAGE
|
||||
} from '@/utils/storeHours'
|
||||
|
||||
const activekey = ref('طلا' ||'آبشده')
|
||||
const showFilter = ref(false)
|
||||
@@ -114,20 +120,26 @@ const openTime = ref<string>('')
|
||||
const isAfterCloseTime = ref<boolean>(false)
|
||||
const isProductInactive = ref<boolean>(false)
|
||||
|
||||
watch([openTime, closeTime], ([open, close]) => {
|
||||
if (!open || !close) return
|
||||
const now = new Date()
|
||||
const currentSeconds = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()
|
||||
const [oh, om, os] = open.split(':').map(Number)
|
||||
const [ch, cm, cs] = close.split(':').map(Number)
|
||||
const openSeconds = oh * 3600 + om * 60 + os
|
||||
const closeSeconds = ch * 3600 + cm * 60 + cs
|
||||
isAfterCloseTime.value = currentSeconds < openSeconds || currentSeconds > closeSeconds
|
||||
watch([openTime, closeTime], () => {
|
||||
syncStoreClosedState()
|
||||
})
|
||||
|
||||
function syncStoreClosedState() {
|
||||
if (isStoreClosed()) {
|
||||
showFilter.value = false
|
||||
isAfterCloseTime.value = true
|
||||
}
|
||||
}
|
||||
|
||||
function clickProduct(item?: Product) {
|
||||
if (!item?.show) return
|
||||
|
||||
if (isStoreClosed()) {
|
||||
showFilter.value = false
|
||||
isAfterCloseTime.value = true
|
||||
return
|
||||
}
|
||||
|
||||
if (isProductPriceInactive(item)) {
|
||||
showFilter.value = false
|
||||
isProductInactive.value = true
|
||||
@@ -144,6 +156,11 @@ function onProductOrdered() {
|
||||
}
|
||||
|
||||
watch(showFilter, (open) => {
|
||||
if (open && isStoreClosed()) {
|
||||
showFilter.value = false
|
||||
isAfterCloseTime.value = true
|
||||
return
|
||||
}
|
||||
if (!open) {
|
||||
orderSheetKey.value += 1
|
||||
}
|
||||
@@ -212,6 +229,8 @@ async function refreshProducts() {
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => lastPrice.value?.closed, syncStoreClosedState)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
@@ -219,10 +238,10 @@ onMounted(async () => {
|
||||
startLastPricePolling()
|
||||
items.value = await getProducts()
|
||||
|
||||
if (items.value?.length) {
|
||||
closeTime.value = items.value[0].auto_close_at
|
||||
openTime.value = items.value[0].auto_open_at
|
||||
}
|
||||
const hours = getStoreTradingHours()
|
||||
openTime.value = formatTradingTimeDisplay(hours.start)
|
||||
closeTime.value = formatTradingTimeDisplay(hours.end)
|
||||
syncStoreClosedState()
|
||||
|
||||
await loadCategoryTabs()
|
||||
firstItems.value = items.value
|
||||
@@ -239,7 +258,9 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
if (router.currentRoute.value.query.state) {
|
||||
if (router.currentRoute.value.query.product) {
|
||||
if (isStoreClosed()) {
|
||||
isAfterCloseTime.value = true
|
||||
} else if (router.currentRoute.value.query.product) {
|
||||
clickProduct(items.value?.find(x => x.title === 'سکه'))
|
||||
} else {
|
||||
clickProduct(items.value?.find(x => x.title === 'آبشده نقدی'))
|
||||
|
||||
Reference in New Issue
Block a user