This commit is contained in:
2025-10-26 15:55:00 +03:30
parent a0f528ab58
commit 0ce2d71484
7 changed files with 81 additions and 124 deletions
+23 -35
View File
@@ -1,46 +1,41 @@
<template>
<div>
<div class="bg-white wrap-fix py-3 px-3 text-primary font-bold drop-shadow flex h-12 z-20 justify-between">
<div class="bg-white wrap-fix py-3 px-3 text-black font-bold drop-shadow flex h-12 z-20 justify-between">
<div class="flex ">
<div @click="router.back()" class="cursor-pointer">
<BasicIcon icon="vuesax-linear:arrow-right-1" />
</div>
<div class="mr-2">{{ info?.title }}</div>
</div>
<!-- <div @click="editShow = true">
<div @click="editShow = true">
<BasicIcon icon="vuesax-linear:setting-4" />
</div>-->
</div>
</div>
<div class="pt-20 flex flex-col justify-center items-center">
<a-spin :spinning="loading">
<div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl">
<!-- <img v-if="!loading" :src="itemImg" alt="">-->
<img v-if="info?.group_type=='گوی'" :src="goyImg">
<img v-if="info?.group_type=='مکعب'" :src="mokaabImg">
<img v-if="info?.group_type=='سکه'" :src="sekkeImg">
<img v-if="info?.group_type=='شمش ونوس'" :src="venusImg">
<img v-if="info?.group_type=='آبشده'|| info?.group_type== null" :src="defaultImg">
<img v-if="!loading" :src="itemImg" alt="">
</div>
</a-spin>
<div class="mt-2 font-bold flex text-xs items-center text-gray-500">
<div class="ml-1 text-base text-primary">{{ info?.wallet?.gold?? 0 }}</div>
{{info?.unit}}
<div class="ml-1 text-base text-black">{{ info?.wallet[0]?.gold }}</div>
گرم
</div>
<div class="text-gray-400">موجودی گنج {{ info?.title }}</div>
<div class="text-gray-400">موجودی قلک {{ info?.title }}</div>
<div class="w-full p-5">
<!-- <div class="w-full flex gap-3">
<div class="w-full flex gap-3">
<BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:add-square" icon-size="18"
@click="()=> {transactionShow = true; isDeposit= false}">برداشت
</BasicButton>
<BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:arrow-up" icon-size="18"
@click="()=> {transactionShow = true; isDeposit= true}">واریز
</BasicButton>
</div>-->
</div>
<div class=" font-bold mt-5">تراکنش ها</div>
<!-- <a-spin :spinning="loading">-->
<div class="mt-5 pb-17 overflow-y-scroll h-[54vh]">
<list-anim v-if="!loading">
<Item v-for="item in items" :key="item.id" :item="item" :title="info?.title"/>
<Item v-for="item in items" :key="item.id" :item="item" />
</list-anim>
<TransactionSkeleton v-for="i in 8" v-else :key="i" class="mt-1" />
<empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" />
@@ -58,11 +53,11 @@
size="large" />
<div v-if="isDeposit" class="mt-2 text-xs font-bold leading-5">
<div>موجودی کیف طلا: {{ walletStore?.walletInfo?.gold }} گرم</div>
<div v-if="info?.wallet?.gold !== 0">
{{ `موجودی قابل برداشت گنج: ${info?.wallet?.gold ?? 0} گرم` }}
<div v-if="info?.wallet[0]?.gold !== 0">
{{ `موجودی قابل برداشت قلک: ${info?.wallet[0]?.gold ?? 0} گرم` }}
</div>
</div>
<div v-else class="mt-2 text-xs font-bold">موجودی گنج {{ info.title }}: {{ info?.wallet?.gold }} گرم
<div v-else class="mt-2 text-xs font-bold">موجودی قلک {{ info.title }}: {{ info?.wallet[0]?.gold }} گرم
</div>
</a-form-item>
<a-form-item>
@@ -82,7 +77,7 @@
</a-form>
</BasicActionSheet>
<BasicActionSheet v-model:show="editShow">
<div class="font-bold text-lg">گنج {{ info?.title }}</div>
<div class="font-bold text-lg">قلک {{ info?.title }}</div>
<BasicButton class="mt-12 w-full" icon="vuesax-linear:edit"
icon-size="16" @click="$router.push({name: 'fund_add', query:{id:infoId}})">
@@ -104,7 +99,7 @@
<template v-slot:title>
<div class="p-5 text-sm">
آیا از حذف گنج خود اطمینان دارید؟
آیا از حذف قلک خود اطمینان دارید؟
</div>
</template>
@@ -149,15 +144,8 @@ import ListAnim from '@/components/ListAnim.vue'
import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
import DialogVant from '@/components/DialogVant.vue'
import { useFundUserStore } from '@/store/fundStore'
import { getOneProductWallet } from '@/api/products'
import goyImg from '@/assets/img/goyImg.svg'
import mokaabImg from '@/assets/img/mokaabImg.svg'
import sekkeImg from "@/assets/img/sekkeImg.svg"
import defaultImg from '@/assets/img/defaultAbshodeh.svg'
import type { Product } from '@/models/products'
import venusImg from "@/assets/img/venousImg.svg"
const info = ref<Product>()
const info = ref<Fund>()
const items = ref<Transaction[]>([])
const tableOutput = ref<TableOutput<Transaction> | null>(null)
const pagination = ref<TableInput>({/*limit: 100, page: 0*/ })
@@ -176,10 +164,10 @@ onMounted(() => {
})
function deleteFundConfirm() {
if (info.value?.wallet === undefined || info.value?.wallet?.gold === 0) {
if (info.value?.wallet[0] === undefined || info.value?.wallet[0]?.gold === 0) {
showDeleteConfirm.value = true
} else {
message.error('ابتدا گنج خود را خالی کنید')
message.error('ابتدا قلک خود را خالی کنید')
editShow.value = false
}
}
@@ -191,7 +179,7 @@ async function deleteFundFunction() {
await deleteFund(infoId)
await fundStore.getMyFund()
router.back()
message.success('گنج با موفقیت حذف شد')
message.success('قلک با موفقیت حذف شد')
} catch (e) {
console.log(e)
} finally {
@@ -213,9 +201,9 @@ const transButtonDisable = computed(() => {
if (isDeposit.value) {
return userFormState.value > walletStore?.walletInfo?.gold
} else {
return userFormState.value > info.value?.wallet?.gold
return userFormState.value > info.value?.wallet[0]?.gold
}
// return isDeposit.value ? userFormState.value > walletStore?.walletInfo?.gold : userFormState.value > info.value?.wallet?.gold
// return isDeposit.value ? userFormState.value > walletStore?.walletInfo?.gold : userFormState.value > info.value?.wallet[0]?.gold
} else return true
} else {
return true
@@ -226,7 +214,7 @@ const transButtonDisable = computed(() => {
async function initInfo() {
try {
loading.value = true
info.value = await getOneProductWallet(infoId)
info.value = await getFundById(infoId)
//pagination.value.page=0
await initTable()
} catch (e) {
@@ -241,7 +229,7 @@ async function initTable() {
try {
loading.value = true
items.value = []
Object.assign(pagination.value, { wallet_id: info.value?.wallet?.id })
Object.assign(pagination.value, { wallet_id: info.value?.wallet[0]?.id })
// pagination.value.fund_id = infoId
tableOutput.value = await getFundTransactionTable(pagination.value)
items.value.push(...tableOutput.value.rows)