fix bug
This commit is contained in:
@@ -97,6 +97,22 @@
|
|||||||
window.__APP_CONFIG__ = config
|
window.__APP_CONFIG__ = config
|
||||||
window.__CONFIG_READY__ = true
|
window.__CONFIG_READY__ = true
|
||||||
|
|
||||||
|
if (config?.user?.name_fa) {
|
||||||
|
document.title = config.user.name_fa
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config?.user?.avatar) {
|
||||||
|
const faviconUrl = config.user.avatar
|
||||||
|
const existingIcons = document.querySelectorAll('link[rel*="icon"]')
|
||||||
|
existingIcons.forEach((icon) => icon.remove())
|
||||||
|
|
||||||
|
const link = document.createElement('link')
|
||||||
|
link.rel = 'icon'
|
||||||
|
link.type = 'image/png'
|
||||||
|
link.href = faviconUrl + '?v=' + Date.now()
|
||||||
|
document.head.appendChild(link)
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve the promise
|
// Resolve the promise
|
||||||
if (configResolve) {
|
if (configResolve) {
|
||||||
configResolve(config)
|
configResolve(config)
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import {computed, ref} from 'vue'
|
|||||||
import type {Rule} from 'ant-design-vue/es/form'
|
import type {Rule} from 'ant-design-vue/es/form'
|
||||||
import {useWalletStore} from "@/store/walletStore";
|
import {useWalletStore} from "@/store/walletStore";
|
||||||
import { isCashLikeDealMethod, isMainMetalWalletDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
|
import { isCashLikeDealMethod, isMainMetalWalletDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
|
||||||
|
import { getCashWalletBalance } from '@/utils/productAssets'
|
||||||
|
|
||||||
export const mobileValidation = (title?: string): Rule => {
|
export const mobileValidation = (title?: string): Rule => {
|
||||||
const label = title ?? 'شماره تلفن'
|
const label = title ?? 'شماره تلفن'
|
||||||
@@ -160,13 +161,14 @@ const checkNumber = async (_rule: Rule, value: number) => {
|
|||||||
return Promise.reject('استفاده از اعداد اعشاری مجاز نمی باشد')
|
return Promise.reject('استفاده از اعداد اعشاری مجاز نمی باشد')
|
||||||
}
|
}
|
||||||
if (isBuyP){
|
if (isBuyP){
|
||||||
if (!walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP)){
|
const availableCash = getCashWalletBalance(walletCash?.walletInfo)
|
||||||
|
if (!availableCash && isCashLikeDealMethod(methodP)){
|
||||||
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
||||||
}
|
}
|
||||||
if (!walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP)){
|
if (!walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP)){
|
||||||
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
||||||
}
|
}
|
||||||
if (priceP * value > walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP))
|
if (priceP * value > availableCash && isCashLikeDealMethod(methodP))
|
||||||
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
||||||
if (amountP * value > walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP))
|
if (amountP * value > walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP))
|
||||||
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
||||||
|
|||||||
@@ -334,17 +334,32 @@ export function getTotalMetalWeight(
|
|||||||
return Number(walletInfo?.treasure ?? walletInfo?.gold_sum ?? walletInfo?.count_gold ?? 0)
|
return Number(walletInfo?.treasure ?? walletInfo?.gold_sum ?? walletInfo?.count_gold ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** فقط موجودی نقدی کیف اصلی — فیلد gold (مثل 0.3 کیلوگرم) جزو دارایی ریالی نیست */
|
/** موجودی ریالی کیف اصلی — با main_wallet_products فیلد cash ممکن است کیف محصول باشد */
|
||||||
export function getRialCashAmount(
|
export function getRialCashAmount(
|
||||||
walletInfo?: Record<string, unknown> | null,
|
walletInfo?: Record<string, unknown> | null,
|
||||||
wallets?: UserWalletLine[] | null
|
wallets?: UserWalletLine[] | null
|
||||||
): number {
|
): number {
|
||||||
|
const aggregated = walletInfo?.count_cash_wallet ?? walletInfo?.count_cash
|
||||||
|
if (aggregated != null && aggregated !== '') {
|
||||||
|
const parsed = Number(aggregated)
|
||||||
|
if (!Number.isNaN(parsed)) {
|
||||||
|
return parsed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mainCash = getMainWalletCash(wallets)
|
const mainCash = getMainWalletCash(wallets)
|
||||||
if (mainCash > 0) {
|
if (mainCash > 0) {
|
||||||
return mainCash
|
return mainCash
|
||||||
}
|
}
|
||||||
|
|
||||||
return Number(walletInfo?.count_cash ?? walletInfo?.cash ?? 0)
|
return Number(walletInfo?.cash ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCashWalletBalance(
|
||||||
|
walletInfo?: Record<string, unknown> | null,
|
||||||
|
wallets?: UserWalletLine[] | null
|
||||||
|
): number {
|
||||||
|
return getRialCashAmount(walletInfo, wallets)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTotalRialEquivalent(walletInfo?: Record<string, unknown> | null): number {
|
export function getTotalRialEquivalent(walletInfo?: Record<string, unknown> | null): number {
|
||||||
|
|||||||
+55
-21
@@ -11,50 +11,84 @@ function applyPriceOffsetPercent(basePrice: number, offsetPercent?: number | nul
|
|||||||
return Math.round(basePrice * (1 + offset / 100))
|
return Math.round(basePrice * (1 + offset / 100))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و اکشنشیت نشان داده میشود) */
|
/** قیمت پایه بدون کارمزد — اگر صفر باشد نباید فقط cash_fee بهعنوان قیمت نمایش داده شود */
|
||||||
export function getProductBuyPrice(product: Product): number {
|
export function getProductBaseBuyPrice(product: Product): number {
|
||||||
if (isMeltedProductUsingAppPrice(product)) {
|
if (isMeltedProductUsingAppPrice(product)) {
|
||||||
const tradeBuy = getTradeBuyPrice(lastPrice.value)
|
const tradeBuy = getTradeBuyPrice(lastPrice.value)
|
||||||
const base = tradeBuy > 0
|
if (tradeBuy > 0) {
|
||||||
? applyPriceOffsetPercent(tradeBuy, product.price_offset_percent)
|
return applyPriceOffsetPercent(tradeBuy, product.price_offset_percent)
|
||||||
: (product.price ?? 0)
|
}
|
||||||
return base + (product.cash_fee_buy ?? 0)
|
// provider صفر — آخرین قیمت ذخیرهشده از API (وقتی use_last_price_if_zero فعال است)
|
||||||
|
return Number(product.price ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMeltedTradeGroup(product.group_type)) {
|
if (isMeltedTradeGroup(product.group_type)) {
|
||||||
return (product.price ?? 0) + (product.cash_fee_buy ?? 0)
|
return Number(product.price ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMetalCommodityGroup(product.group_type)) {
|
if (isMetalCommodityGroup(product.group_type)) {
|
||||||
const base = (product.price_profit ?? 0) + (product.price ?? 0)
|
return Number(product.price_profit ?? 0) + Number(product.price ?? 0)
|
||||||
return base + (product.cash_fee_buy ?? 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const basePrice = (product.price ?? 0) + (product.cash_fee_buy ?? 0)
|
return Number(product.price ?? 0)
|
||||||
return product.direct_price === 0
|
|
||||||
? basePrice * (product.amount ?? 0)
|
|
||||||
: basePrice
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** قیمت فروش نمایشی محصول آبشدهای */
|
/** قیمت خرید نمایشی محصول (همان مقداری که در لیست و اکشنشیت نشان داده میشود) */
|
||||||
export function getProductSellPrice(product: Product): number {
|
export function getProductBuyPrice(product: Product): number {
|
||||||
|
const base = getProductBaseBuyPrice(product)
|
||||||
|
if (base <= 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const fee = Number(product.cash_fee_buy ?? 0)
|
||||||
|
|
||||||
|
if (
|
||||||
|
isMeltedProductUsingAppPrice(product)
|
||||||
|
|| isMeltedTradeGroup(product.group_type)
|
||||||
|
|| isMetalCommodityGroup(product.group_type)
|
||||||
|
) {
|
||||||
|
return base + fee
|
||||||
|
}
|
||||||
|
|
||||||
|
const withFee = base + fee
|
||||||
|
return product.direct_price === 0
|
||||||
|
? withFee * Number(product.amount ?? 0)
|
||||||
|
: withFee
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProductBaseSellPrice(product: Product): number {
|
||||||
if (isMeltedProductUsingAppPrice(product)) {
|
if (isMeltedProductUsingAppPrice(product)) {
|
||||||
const tradeSell = getTradeSellPrice(lastPrice.value)
|
const tradeSell = getTradeSellPrice(lastPrice.value)
|
||||||
const base = tradeSell > 0
|
if (tradeSell > 0) {
|
||||||
? applyPriceOffsetPercent(tradeSell, product.price_offset_percent)
|
return applyPriceOffsetPercent(tradeSell, product.price_offset_percent)
|
||||||
: (product.price ?? 0)
|
}
|
||||||
return base - (product.cash_fee_sell ?? 0)
|
// provider صفر — همان آخرین قیمت ذخیرهشده (فروش از همان مبنا)
|
||||||
|
return Number(product.price ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMeltedTradeGroup(product.group_type)) {
|
if (isMeltedTradeGroup(product.group_type)) {
|
||||||
return (product.price ?? 0) - (product.cash_fee_sell ?? 0)
|
return Number(product.price ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
return getTradeSellPrice(lastPrice.value)
|
return getTradeSellPrice(lastPrice.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** قیمت فروش نمایشی محصول آبشدهای */
|
||||||
|
export function getProductSellPrice(product: Product): number {
|
||||||
|
const base = getProductBaseSellPrice(product)
|
||||||
|
if (base <= 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMeltedProductUsingAppPrice(product) || isMeltedTradeGroup(product.group_type)) {
|
||||||
|
return base - Number(product.cash_fee_sell ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return base
|
||||||
|
}
|
||||||
|
|
||||||
export function isProductPriceInactive(product: Product): boolean {
|
export function isProductPriceInactive(product: Product): boolean {
|
||||||
return getProductBuyPrice(product) <= 0
|
return getProductBaseBuyPrice(product) <= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export { isMeltedTradeGroup, isMeltedProductUsingAppPrice } from '@/utils/productCategories'
|
export { isMeltedTradeGroup, isMeltedProductUsingAppPrice } from '@/utils/productCategories'
|
||||||
|
|||||||
@@ -68,14 +68,14 @@
|
|||||||
</div>-->
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="font-bold text-xs">
|
<div v-else class="font-bold text-xs">
|
||||||
{{ formatCashWalletBalanceText(usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0), props?.ProductItem?.group_type) }}
|
{{ formatCashWalletBalanceText(usePriceWithoutType(cashWalletBalance), props?.ProductItem?.group_type) }}
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
<Transition mode="out-in" name="fade">
|
<Transition mode="out-in" name="fade">
|
||||||
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3 ">
|
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3 ">
|
||||||
<!-- {{ isBuy }}-->
|
<!-- {{ isBuy }}-->
|
||||||
<a-slider v-model:value="form.percentWallet"
|
<a-slider v-model:value="form.percentWallet"
|
||||||
:disabled="isBuy? walletStore?.walletInfo?.cash <= 0: false"
|
:disabled="isBuy? cashWalletBalance <= 0: false"
|
||||||
:max="100"
|
:max="100"
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="10"
|
:step="10"
|
||||||
@@ -238,10 +238,14 @@ import { useFundUserStore } from '@/store/fundStore'
|
|||||||
import {useConfigStore} from "@/store/configStore";
|
import {useConfigStore} from "@/store/configStore";
|
||||||
import { calcFeeInGrams } from '@/utils/serviceFee'
|
import { calcFeeInGrams } from '@/utils/serviceFee'
|
||||||
import { formatCashWalletBalanceText, formatGoldWalletBalanceText } from '@/utils/productDealMethod'
|
import { formatCashWalletBalanceText, formatGoldWalletBalanceText } from '@/utils/productDealMethod'
|
||||||
|
import { getCashWalletBalance } from '@/utils/productAssets'
|
||||||
|
|
||||||
const infoVisible = ref(false)
|
const infoVisible = ref(false)
|
||||||
const walletStore = useWalletStore()
|
const walletStore = useWalletStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
const cashWalletBalance = computed(() =>
|
||||||
|
getCashWalletBalance(walletStore.walletInfo, userStore.userInfo?.wallets)
|
||||||
|
)
|
||||||
const fundStore = useFundUserStore()
|
const fundStore = useFundUserStore()
|
||||||
const confirmAction = ref<boolean>(false)
|
const confirmAction = ref<boolean>(false)
|
||||||
const noCompleteVisible = ref<boolean>(false)
|
const noCompleteVisible = ref<boolean>(false)
|
||||||
@@ -490,7 +494,7 @@ const unitGoldCalculator = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const unitCashCalculator = computed(() => {
|
const unitCashCalculator = computed(() => {
|
||||||
return (walletStore?.walletInfo?.cash ?? 0) / 100
|
return cashWalletBalance.value / 100
|
||||||
})
|
})
|
||||||
|
|
||||||
const limitedPrice = computed(() => {
|
const limitedPrice = computed(() => {
|
||||||
|
|||||||
@@ -70,14 +70,14 @@
|
|||||||
</div>-->
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="font-bold text-xs">
|
<div v-else class="font-bold text-xs">
|
||||||
{{ formatCashWalletBalanceText(usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0), props?.ProductItem?.group_type) }}
|
{{ formatCashWalletBalanceText(usePriceWithoutType(cashWalletBalance), props?.ProductItem?.group_type) }}
|
||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
<Transition mode="out-in" name="fade">
|
<Transition mode="out-in" name="fade">
|
||||||
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3 ">
|
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3 ">
|
||||||
<!-- {{ isBuy }}-->
|
<!-- {{ isBuy }}-->
|
||||||
<a-slider v-model:value="form.percentWallet"
|
<a-slider v-model:value="form.percentWallet"
|
||||||
:disabled="isBuy? walletStore?.walletInfo?.cash <= 0: false"
|
:disabled="isBuy? cashWalletBalance <= 0: false"
|
||||||
:max="100"
|
:max="100"
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="10"
|
:step="10"
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
({{ productWalletBalance }}{{ weightUnit }}) می باشد.
|
({{ productWalletBalance }}{{ weightUnit }}) می باشد.
|
||||||
</div>
|
</div>
|
||||||
<!-- <div>{{form?.goldValue? true: false}}</div>-->
|
<!-- <div>{{form?.goldValue? true: false}}</div>-->
|
||||||
<div v-if="isBuy ? (form?.goldCash > walletStore?.walletInfo?.cash) : false"
|
<div v-if="isBuy ? (form?.goldCash > cashWalletBalance) : false"
|
||||||
class="text-red-700 text-xs font-bold mt-2">
|
class="text-red-700 text-xs font-bold mt-2">
|
||||||
موجودی کیف پول ناکافی می باشد.
|
موجودی کیف پول ناکافی می باشد.
|
||||||
</div>
|
</div>
|
||||||
@@ -237,7 +237,7 @@ import { useFundUserStore } from '@/store/fundStore'
|
|||||||
import {useConfigStore} from "@/store/configStore";
|
import {useConfigStore} from "@/store/configStore";
|
||||||
import { calcFeeInGrams, loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
import { calcFeeInGrams, loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
||||||
import { formatCashWalletBalanceText, getWeightUnit } from '@/utils/productDealMethod'
|
import { formatCashWalletBalanceText, getWeightUnit } from '@/utils/productDealMethod'
|
||||||
import { formatProductWalletBalanceText, getProductInventoryQuantity } from '@/utils/productAssets'
|
import { formatProductWalletBalanceText, getCashWalletBalance, getProductInventoryQuantity } from '@/utils/productAssets'
|
||||||
import { useWalletAssets } from '@/composables/useWalletAssets'
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||||
import { isMeltedTradeGroup } from '@/utils/productCategories'
|
import { isMeltedTradeGroup } from '@/utils/productCategories'
|
||||||
import { useSettingsStore } from '@/store/settingsStore'
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
@@ -256,6 +256,9 @@ const { meltedGoldLabel } = storeToRefs(settingsStore)
|
|||||||
const weightUnit = computed(() => getWeightUnit())
|
const weightUnit = computed(() => getWeightUnit())
|
||||||
const fundStore = useFundUserStore()
|
const fundStore = useFundUserStore()
|
||||||
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
||||||
|
const cashWalletBalance = computed(() =>
|
||||||
|
getCashWalletBalance(walletStore.walletInfo, userStore.userInfo?.wallets)
|
||||||
|
)
|
||||||
const confirmAction = ref<boolean>(false)
|
const confirmAction = ref<boolean>(false)
|
||||||
const noCompleteVisible = ref<boolean>(false)
|
const noCompleteVisible = ref<boolean>(false)
|
||||||
const buyItems = ref<Transaction[]>([])
|
const buyItems = ref<Transaction[]>([])
|
||||||
@@ -514,7 +517,7 @@ function percentChange(val: number) {
|
|||||||
const unitGoldCalculator = computed(() => productWalletBalance.value / 100)
|
const unitGoldCalculator = computed(() => productWalletBalance.value / 100)
|
||||||
|
|
||||||
const unitCashCalculator = computed(() => {
|
const unitCashCalculator = computed(() => {
|
||||||
return (walletStore?.walletInfo?.cash ?? 0) / 100
|
return cashWalletBalance.value / 100
|
||||||
})
|
})
|
||||||
|
|
||||||
const limitedPrice = computed(() => {
|
const limitedPrice = computed(() => {
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ import {
|
|||||||
productMinOrderCash
|
productMinOrderCash
|
||||||
} from '@/utils/productOrderLimit'
|
} from '@/utils/productOrderLimit'
|
||||||
import { useWalletAssets } from '@/composables/useWalletAssets'
|
import { useWalletAssets } from '@/composables/useWalletAssets'
|
||||||
import { formatProductWalletBalanceText, getProductInventoryQuantity } from '@/utils/productAssets'
|
import { formatProductWalletBalanceText, getCashWalletBalance, getProductInventoryQuantity } from '@/utils/productAssets'
|
||||||
|
|
||||||
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type, isBuy.value))
|
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type, isBuy.value))
|
||||||
|
|
||||||
@@ -352,16 +352,20 @@ const buyMetalWalletBalanceText = computed(() =>
|
|||||||
: goldWalletBalanceText.value
|
: goldWalletBalanceText.value
|
||||||
)
|
)
|
||||||
|
|
||||||
const cashWalletBalanceText = computed(() =>
|
|
||||||
formatCashWalletBalanceText(
|
|
||||||
usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0),
|
|
||||||
productGroupType.value
|
|
||||||
)
|
|
||||||
)
|
|
||||||
const infoVisible = ref(false)
|
const infoVisible = ref(false)
|
||||||
const walletStore = useWalletStore()
|
const walletStore = useWalletStore()
|
||||||
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
const { assetsSummary, loadWalletAssets } = useWalletAssets()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
const cashWalletBalance = computed(() =>
|
||||||
|
getCashWalletBalance(walletStore.walletInfo, userStore.userInfo?.wallets)
|
||||||
|
)
|
||||||
|
|
||||||
|
const cashWalletBalanceText = computed(() =>
|
||||||
|
formatCashWalletBalanceText(
|
||||||
|
usePriceWithoutType(cashWalletBalance.value),
|
||||||
|
productGroupType.value
|
||||||
|
)
|
||||||
|
)
|
||||||
const confirmAction = ref<boolean>(false)
|
const confirmAction = ref<boolean>(false)
|
||||||
const noCompleteVisible = ref<boolean>(false)
|
const noCompleteVisible = ref<boolean>(false)
|
||||||
const buyItems = ref<Transaction[]>([])
|
const buyItems = ref<Transaction[]>([])
|
||||||
@@ -622,7 +626,7 @@ const unitGoldCalculator = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const unitCashCalculator = computed(() => {
|
const unitCashCalculator = computed(() => {
|
||||||
return (walletStore?.walletInfo?.cash ?? 0) / 100
|
return cashWalletBalance.value / 100
|
||||||
})
|
})
|
||||||
|
|
||||||
const limitedPrice = computed(() => {
|
const limitedPrice = computed(() => {
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
<!-- <div v-if="props.ProductItem.group_type!='آبشده'" class="text-secondary font-500">{{ props.ProductItem.amount }}گرم</div>-->
|
<!-- <div v-if="props.ProductItem.group_type!='آبشده'" class="text-secondary font-500">{{ props.ProductItem.amount }}گرم</div>-->
|
||||||
<!-- <div v-else class="text-secondary font-500">حداقل خرید یک گرم</div>-->
|
<!-- <div v-else class="text-secondary font-500">حداقل خرید یک گرم</div>-->
|
||||||
<!-- <div>{{usePrice((props.ProductItem.price ?? 0) + (props.ProductItem.cash_fee_buy ?? 0))}}</div>-->
|
<!-- <div>{{usePrice((props.ProductItem.price ?? 0) + (props.ProductItem.cash_fee_buy ?? 0))}}</div>-->
|
||||||
<div v-if="isMeltedTradeGroup(props.ProductItem.group_type)">{{usePrice(goldPriceValue)}}</div>
|
<div>{{ usePrice(getProductBuyPrice(props.ProductItem)) }}</div>
|
||||||
<div v-else>{{usePrice(price)}}</div>
|
|
||||||
<!-- <div v-if="props.ProductItem.group_type!='آبشده'" class="text-xs text-gray-400">شامل 33 هزار تومان اجرت</div>-->
|
<!-- <div v-if="props.ProductItem.group_type!='آبشده'" class="text-xs text-gray-400">شامل 33 هزار تومان اجرت</div>-->
|
||||||
<!-- <div v-else class="text-xs text-gray-400">محاسبه بر اساس قیمت روز</div>-->
|
<!-- <div v-else class="text-xs text-gray-400">محاسبه بر اساس قیمت روز</div>-->
|
||||||
</div>
|
</div>
|
||||||
@@ -33,7 +32,6 @@ import {usePrice} from '@/utils/usePrice';
|
|||||||
import {getFileUrl} from '@/utils/file';
|
import {getFileUrl} from '@/utils/file';
|
||||||
import {computed, ref} from "vue";
|
import {computed, ref} from "vue";
|
||||||
import { getProductBuyPrice } from '@/utils/productPrice'
|
import { getProductBuyPrice } from '@/utils/productPrice'
|
||||||
import { isMeltedTradeGroup } from '@/utils/productCategories'
|
|
||||||
|
|
||||||
interface Prop {
|
interface Prop {
|
||||||
ProductItem: Product
|
ProductItem: Product
|
||||||
@@ -68,29 +66,6 @@ const displayImage = computed(() => {
|
|||||||
if (fileUrl) return fileUrl
|
if (fileUrl) return fileUrl
|
||||||
return defaultImages[props.ProductItem.group_type] ?? defaultImg
|
return defaultImages[props.ProductItem.group_type] ?? defaultImg
|
||||||
})
|
})
|
||||||
// const typeOfProduct=(val:string)=>{
|
|
||||||
// if (val.includes('گوی'))
|
|
||||||
// return 'گوی'
|
|
||||||
// if (val.includes('شمش'))
|
|
||||||
// return 'شمش'
|
|
||||||
// if (val.includes('مکعب'))
|
|
||||||
// return 'مکعب'
|
|
||||||
// if (val.includes('24 عیار'))
|
|
||||||
// return '24 عیار'
|
|
||||||
//
|
|
||||||
// return 'آب شده'
|
|
||||||
// }
|
|
||||||
|
|
||||||
const price = computed(()=>{
|
|
||||||
if(props.ProductItem.direct_price === 0){
|
|
||||||
return ((props.ProductItem.price ?? 0) + (props.ProductItem.cash_fee_buy ?? 0)) * props.ProductItem.amount
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ((props.ProductItem.price ?? 0) + (props.ProductItem.cash_fee_buy ?? 0))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const goldPriceValue = computed(() => getProductBuyPrice(props.ProductItem))
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,12 @@
|
|||||||
<div v-if="!isDeposit">
|
<div v-if="!isDeposit">
|
||||||
<div class="text-red text-xs font-bold mb-2">حداقل مبلغ برداشتی 100 هزار تومان می باشد.</div>
|
<div class="text-red text-xs font-bold mb-2">حداقل مبلغ برداشتی 100 هزار تومان می باشد.</div>
|
||||||
<div class="font-bold text-xs">
|
<div class="font-bold text-xs">
|
||||||
{{ formatCashWalletBalanceText(usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0)) }}
|
{{ formatCashWalletBalanceText(usePriceWithoutType(cashWalletBalance)) }}
|
||||||
</div>
|
</div>
|
||||||
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3">
|
<a-form-item v-if="walletStore?.walletInfo" class="!mt-3">
|
||||||
<a-slider
|
<a-slider
|
||||||
v-model:value="form.percentWallet"
|
v-model:value="form.percentWallet"
|
||||||
:disabled="walletStore?.walletInfo?.cash <= 0"
|
:disabled="cashWalletBalance <= 0"
|
||||||
:max="100"
|
:max="100"
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="10"
|
:step="10"
|
||||||
@@ -372,6 +372,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { formatCashWalletBalanceText } from '@/utils/productDealMethod'
|
import { formatCashWalletBalanceText } from '@/utils/productDealMethod'
|
||||||
|
import { getCashWalletBalance } from '@/utils/productAssets'
|
||||||
import { usePriceWithoutType } from '@/utils/usePrice'
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
import { loading, loadingMore } from '@/utils'
|
import { loading, loadingMore } from '@/utils'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
@@ -413,6 +414,9 @@ import {
|
|||||||
const isDeposit = ref<boolean>(true)
|
const isDeposit = ref<boolean>(true)
|
||||||
const walletStore = useWalletStore()
|
const walletStore = useWalletStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
const cashWalletBalance = computed(() =>
|
||||||
|
getCashWalletBalance(walletStore.walletInfo, userStore.userInfo?.wallets)
|
||||||
|
)
|
||||||
const showAddCard = ref<boolean>(false)
|
const showAddCard = ref<boolean>(false)
|
||||||
const chargeAccountModal = ref<boolean>(false)
|
const chargeAccountModal = ref<boolean>(false)
|
||||||
const showConfirmCode = ref<boolean>(false)
|
const showConfirmCode = ref<boolean>(false)
|
||||||
@@ -458,11 +462,11 @@ const cardForm = ref<Card>({
|
|||||||
|
|
||||||
const disableButton = computed(() => {
|
const disableButton = computed(() => {
|
||||||
if (!loading.value) {
|
if (!loading.value) {
|
||||||
if (walletStore?.walletInfo?.cash && !isDeposit.value) {
|
if (cashWalletBalance.value && !isDeposit.value) {
|
||||||
if (cardItems.value.length > 0) {
|
if (cardItems.value.length > 0) {
|
||||||
return (
|
return (
|
||||||
walletStore?.walletInfo?.cash <= 0 ||
|
cashWalletBalance.value <= 0 ||
|
||||||
walletStore?.walletInfo?.cash < parseInt(form.value?.value) ||
|
cashWalletBalance.value < parseInt(form.value?.value) ||
|
||||||
isNaN(parseInt(form.value?.value)) ||
|
isNaN(parseInt(form.value?.value)) ||
|
||||||
parseInt(form.value?.value) < 1000000
|
parseInt(form.value?.value) < 1000000
|
||||||
)
|
)
|
||||||
@@ -477,7 +481,7 @@ const disableButton = computed(() => {
|
|||||||
const bganim = ref(null)
|
const bganim = ref(null)
|
||||||
|
|
||||||
const unitCalculator = computed(() => {
|
const unitCalculator = computed(() => {
|
||||||
return (walletStore?.walletInfo?.cash ?? 0) / 100
|
return cashWalletBalance.value / 100
|
||||||
})
|
})
|
||||||
|
|
||||||
function copyCode(val: string) {
|
function copyCode(val: string) {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ import DialogVantOneButton from '@/components/DialogVantOneButton.vue'
|
|||||||
import { registerCustomer } from '@/api/login'
|
import { registerCustomer } from '@/api/login'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import {useConfigStore} from "@/store/configStore";
|
import {useConfigStore} from "@/store/configStore";
|
||||||
import {getProjectLoginLogo, getProjectLoginTaglineLines, hasCustomLoginLogoLayout} from "@/utils/config";
|
import {getProjectLoginLogo, getProjectLoginTaglineLines, hasCustomLoginLogoLayout, isBoursecuProject} from "@/utils/config";
|
||||||
const config = useConfigStore()
|
const config = useConfigStore()
|
||||||
|
|
||||||
// const stepTwoVerify = ref<boolean>(false)
|
// const stepTwoVerify = ref<boolean>(false)
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none">
|
<img :src="img_pattern" alt="" class="absolute w-screen h-full object-none">
|
||||||
</div>
|
</div>
|
||||||
<div class="z-1000 w-full p-5">
|
<div class="z-1000 w-full p-5">
|
||||||
<transition mode="out-in" name="fade">
|
<!-- <transition mode="out-in" name="fade">-->
|
||||||
<Login v-if="!enterType" @register="setEnterType"/>
|
<Login v-if="!enterType" @register="setEnterType"/>
|
||||||
<Register v-else @register="setEnterType"/>
|
<Register v-else @register="setEnterType"/>
|
||||||
</transition>
|
<!-- </transition>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user