widthdraw and deposit
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
:show-search="false"
|
||||
value-name="value"
|
||||
:allow-clear="false"
|
||||
:placeholder="isBuy?'نحوه خرید را انتخاب کنید':' نحوه فروش را انتخاب کنید'"
|
||||
:placeholder="getProductDealMethodPlaceholder(isBuy)"
|
||||
size="large"
|
||||
:has-tooltip="false" />
|
||||
</a-form-item>
|
||||
@@ -103,7 +103,9 @@
|
||||
<div v-else-if="isBuy && form.method === 'cash'" class="font-bold text-xs">
|
||||
{{ cashWalletBalanceText }}
|
||||
</div>
|
||||
<div class="font-bold text-xs" v-else>{{ `موجودی محصول: ${getInventoryById(props?.ProductItem?.id)} ${getProductQuantityUnit(props?.ProductItem)}` }}
|
||||
<div class="font-bold text-xs" v-else>
|
||||
<div>{{ `موجودی محصول: ${getInventoryById(props?.ProductItem?.id)} ${getProductQuantityUnit(props?.ProductItem)}` }}</div>
|
||||
<div v-if="isMetalReceiveDeal" class="mt-1">{{ sellMetalWalletBalanceText }}</div>
|
||||
</div>
|
||||
</Transition>
|
||||
<Transition mode="out-in" name="fade">
|
||||
@@ -225,10 +227,15 @@
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between mt-3">
|
||||
<div>{{ isBuy ? 'قیمت قابل پرداخت:' : 'مبلغ دریافتی:' }}</div>
|
||||
<div>{{ isBuy ? 'قیمت قابل پرداخت:' : (isMetalReceiveDeal ? 'دریافت:' : 'مبلغ دریافتی:') }}</div>
|
||||
<div class="flex items-center">
|
||||
<div>{{ usePriceWithoutType(form.goldCash ?? 0) }}</div>
|
||||
<div class="text-xs mr-1">ریال</div>
|
||||
<template v-if="!isBuy && isMetalReceiveDeal">
|
||||
<div>{{ sellReceivedMetalText }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div>{{ usePriceWithoutType(form.goldCash ?? 0) }}</div>
|
||||
<div class="text-xs mr-1">ریال</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -269,9 +276,13 @@ import { useFundUserStore } from '@/store/fundStore'
|
||||
import {
|
||||
getDefaultProductDealMethod,
|
||||
getProductDealMethodOptions,
|
||||
getProductDealMethodPlaceholder,
|
||||
formatCashWalletBalanceText,
|
||||
formatGoldWalletBalanceText,
|
||||
formatMainMetalWalletBalanceText,
|
||||
formatMainMetalReceiveText,
|
||||
calcSellReceivedMetalWeight,
|
||||
isMainMetalWalletDealMethod,
|
||||
formatProductWeightAmount,
|
||||
getProductQuantityUnit,
|
||||
getProductTotalWeightLabel,
|
||||
@@ -286,7 +297,17 @@ import {
|
||||
productMinOrderCash
|
||||
} from '@/utils/productOrderLimit'
|
||||
|
||||
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type))
|
||||
const typeDeal = computed(() => getProductDealMethodOptions(props?.ProductItem?.group_type, isBuy.value))
|
||||
|
||||
const isMetalReceiveDeal = computed(() =>
|
||||
!isBuy.value && isMainMetalWalletDealMethod(form.value.method)
|
||||
)
|
||||
|
||||
const sellReceivedMetalText = computed(() =>
|
||||
formatMainMetalReceiveText(
|
||||
calcSellReceivedMetalWeight(form.value.goldValue, props?.ProductItem)
|
||||
)
|
||||
)
|
||||
|
||||
const productGroupType = computed(() => props?.ProductItem?.group_type)
|
||||
const isCountBasedProductItem = computed(() => isCountBasedProduct(props?.ProductItem))
|
||||
@@ -314,6 +335,10 @@ const buyMetalWalletBalanceText = computed(() =>
|
||||
: goldWalletBalanceText.value
|
||||
)
|
||||
|
||||
const sellMetalWalletBalanceText = computed(() =>
|
||||
formatMainMetalWalletBalanceText(walletStore?.walletInfo?.gold ?? 0)
|
||||
)
|
||||
|
||||
const cashWalletBalanceText = computed(() =>
|
||||
formatCashWalletBalanceText(
|
||||
usePriceWithoutType(walletStore?.walletInfo?.cash ?? 0),
|
||||
@@ -339,6 +364,7 @@ interface Prop {
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Prop>(), {})
|
||||
const emit = defineEmits<{ ordered: [] }>()
|
||||
const isBuy = ref<boolean>(true)
|
||||
const buyTotalPrice = computed(() => {
|
||||
const item = props?.ProductItem
|
||||
@@ -520,7 +546,7 @@ const form = ref<Gold>({
|
||||
})
|
||||
|
||||
function resetDealMethod() {
|
||||
form.value.method = getDefaultProductDealMethod(props?.ProductItem?.group_type)
|
||||
form.value.method = getDefaultProductDealMethod(props?.ProductItem?.group_type, isBuy.value)
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -772,20 +798,21 @@ async function ok() {
|
||||
method: form.value.method,
|
||||
number: form.value.goldValue ?? 0
|
||||
})
|
||||
confirmAction.value = false
|
||||
emit('ordered')
|
||||
await userStore.getMyInfo()
|
||||
await walletStore.getMyWallet()
|
||||
await fundStore.getMyFund()
|
||||
message.success('سفارش شما با موفقیت انجام شد')
|
||||
await router.push({ name: 'transactions' })
|
||||
form.value = {
|
||||
goldValue: undefined,
|
||||
goldCash: undefined,
|
||||
percentWallet: undefined,
|
||||
method: getDefaultProductDealMethod(props?.ProductItem?.group_type)
|
||||
method: getDefaultProductDealMethod(props?.ProductItem?.group_type, isBuy.value)
|
||||
}
|
||||
// refreshTable()
|
||||
await fundStore.getMyFund()
|
||||
message.success('سفارش شما با موفقیت انجام شد')
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
// await initPrice()
|
||||
} finally {
|
||||
loading.value = false
|
||||
infoVisible.value = false
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<!-- <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>{{usePrice((props.ProductItem.price ?? 0) + (props.ProductItem.cash_fee_buy ?? 0))}}</div>-->
|
||||
<div v-if="props.ProductItem.group_type=='آبشده'">{{usePrice(goldPriceValue)}}</div>
|
||||
<div v-if="isMeltedTradeGroup(props.ProductItem.group_type)">{{usePrice(goldPriceValue)}}</div>
|
||||
<div v-else>{{usePrice(price)}}</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>-->
|
||||
@@ -33,6 +33,7 @@ import {usePrice} from '@/utils/usePrice';
|
||||
import {getFileUrl} from '@/utils/file';
|
||||
import {computed, ref} from "vue";
|
||||
import { getProductBuyPrice } from '@/utils/productPrice'
|
||||
import { isMeltedTradeGroup } from '@/utils/productCategories'
|
||||
|
||||
interface Prop {
|
||||
ProductItem: Product
|
||||
@@ -58,6 +59,8 @@ const defaultImages: Record<string, string> = {
|
||||
'مس': mesImg,
|
||||
'نقره': noghrehImg,
|
||||
'سکه پارسیان': parsianImg,
|
||||
'کاتد مس': defaultImg,
|
||||
'طلا': defaultImg,
|
||||
}
|
||||
|
||||
const displayImage = computed(() => {
|
||||
@@ -111,7 +114,7 @@ const goldPriceValue = computed(() => getProductBuyPrice(props.ProductItem))
|
||||
<div class="m-1 flex flex-col gap-1 justify-center">
|
||||
<div class="text-base font-500">{{ props.ProductItem.title }}</div>
|
||||
<br>
|
||||
<div v-if="props.ProductItem.group_type=='آبشده'">{{usePrice(goldPriceValue)}}</div>
|
||||
<div v-if="isMeltedTradeGroup(props.ProductItem.group_type)">{{usePrice(goldPriceValue)}}</div>
|
||||
<div v-else>{{usePrice(price)}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
<!-- </BasicActionSheet>-->
|
||||
|
||||
<BasicActionSheet placement="bottom" v-model:show="showFilter">
|
||||
<div class="">
|
||||
<indexGold v-if="['آبشده'].includes(selectedProduct?.group_type) && !isBoursecuProject()"
|
||||
<div v-if="showFilter" :key="orderSheetKey">
|
||||
<indexGold v-if="isMeltedTradeGroup(selectedProduct?.group_type)"
|
||||
:ProductItem="selectedProduct"
|
||||
>
|
||||
</indexGold>
|
||||
<CopperSilver v-else-if="['مس','نقره'].includes(selectedProduct?.group_type) && !isBoursecuDealProductGroup(selectedProduct?.group_type)"
|
||||
<CopperSilver v-else-if="isMetalCommodityGroup(selectedProduct?.group_type) && !isBoursecuDealProductGroup(selectedProduct?.group_type)"
|
||||
:ProductItem="selectedProduct"
|
||||
>
|
||||
</CopperSilver>
|
||||
<DealProduct v-else :ProductItem="selectedProduct"></DealProduct>
|
||||
<DealProduct v-else :ProductItem="selectedProduct" @ordered="onProductOrdered"></DealProduct>
|
||||
</div>
|
||||
</BasicActionSheet>
|
||||
|
||||
@@ -105,12 +105,13 @@ import { cloneDeep } from 'lodash'
|
||||
import img from "@/assets/img/user_ly1.svg";
|
||||
import BasicModal from "@/components/BasicPacks/BasicModal.vue";
|
||||
import { isProductPriceInactive } from '@/utils/productPrice'
|
||||
import { isBoursecuProject } from '@/utils/config'
|
||||
import { isMetalCommodityGroup, isMeltedTradeGroup } from '@/utils/productCategories'
|
||||
import { isBoursecuDealProductGroup } from '@/utils/productDealMethod'
|
||||
import { loadServiceFeeFromSettings } from '@/utils/serviceFee'
|
||||
|
||||
const activekey = ref('طلا' ||'آبشده')
|
||||
const showFilter = ref(false)
|
||||
const orderSheetKey = ref(0)
|
||||
const selectedProduct = ref<Product>()
|
||||
const closeTime = ref<string>('')
|
||||
const openTime = ref<string>('')
|
||||
@@ -137,10 +138,21 @@ function clickProduct(item?: Product) {
|
||||
return
|
||||
}
|
||||
|
||||
orderSheetKey.value += 1
|
||||
selectedProduct.value = cloneDeep(item)
|
||||
showFilter.value = true
|
||||
}
|
||||
|
||||
function onProductOrdered() {
|
||||
showFilter.value = false
|
||||
}
|
||||
|
||||
watch(showFilter, (open) => {
|
||||
if (!open) {
|
||||
orderSheetKey.value += 1
|
||||
}
|
||||
})
|
||||
|
||||
function changeTab() {
|
||||
if (activekey.value != 'همه') {
|
||||
items.value = firstItems.value?.filter((val) =>
|
||||
|
||||
Reference in New Issue
Block a user