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
+1 -1
View File
@@ -11,7 +11,7 @@ export const useFundUserStore = defineStore('fund', () => {
async function getMyFund() { async function getMyFund() {
try { try {
console.log('fff') console.log('fff')
myFunds.value = await getProductInventory() myFunds.value = await getFundTable()
return myFunds.value return myFunds.value
} catch (e) { } catch (e) {
console.log(e) console.log(e)
+6 -17
View File
@@ -1,14 +1,8 @@
<template> <template>
<div v-if="item" class="bg-white flex flex-col items-center p-3 rounded-xl"> <div v-if="item" class="bg-white flex flex-col items-center p-3 rounded-xl">
<!-- <img v-lazy="{ src: itemImg, loading: logo,error: logo}" alt="" class="w-[87px] ">--> <img v-lazy="{ src: itemImg, loading: logo,error: logo}" alt="" class="w-[87px] ">
<img v-if="props.item.group_type=='گوی'" :src="goyImg">
<img v-if="props.item.group_type=='مکعب'" :src="mokaabImg">
<img v-if="props.item.group_type=='سکه'" :src="sekkeImg">
<!-- <img :src="props.item.img" alt="image">-->
<img v-if="props.item.group_type=='آبشده'|| props.item.group_type== null" :src="defaultImg">
<img v-if="props.item.group_type=='شمش ونوس'|| props.item.group_type== null" :src="venusImg">
<div class="mt-3">{{props.item?.title?? '-'}}</div> <div class="mt-3">{{props.item?.title?? '-'}}</div>
<div class="mt-1 flex gap-1"> <div class="font-bold"> {{props.item?.wallet?.gold?? '-'}} </div> {{props.item?.unit}} </div> <div class="mt-1 flex gap-1"><div class="font-bold">{{props.item?.wallet[0]?.gold?? '-'}}</div> گرم</div>
<!-- {{props.item?.wallet[0]?.cash}}--> <!-- {{props.item?.wallet[0]?.cash}}-->
</div> </div>
</template> </template>
@@ -20,19 +14,14 @@ import circulationImg from '@/assets/img/cash_circulation.svg'
import loveImg from '@/assets/img/cash_love.svg' import loveImg from '@/assets/img/cash_love.svg'
import repairsImg from '@/assets/img/cash_repairs.svg' import repairsImg from '@/assets/img/cash_repairs.svg'
import savingImg from '@/assets/img/cash_saving.svg' import savingImg from '@/assets/img/cash_saving.svg'
import {computed} from "vue" import {computed} from "vue";
import type {Fund} from "@/models/fund" import type {Fund} from "@/models/fund";
import defaultImg from "@/assets/img/defaultAbshodeh.svg" import logo from '@/assets/img/logo_full.svg'
import goyImg from "@/assets/img/goyImg.svg"
import mokaabImg from "@/assets/img/mokaabImg.svg"
import sekkeImg from "@/assets/img/sekkeImg.svg"
import venusImg from "@/assets/img/venousImg.svg"
import type { Product } from '@/models/products'
/*function itemImg() { /*function itemImg() {
}*/ }*/
interface Prop { interface Prop {
item: Product item: Fund
} }
const props = defineProps<Prop>() const props = defineProps<Prop>()
+15 -47
View File
@@ -1,34 +1,18 @@
<template> <template>
<div> <div>
<div class="bg-white w-full py-3 px-3 text-primary font-bold drop-shadow fixed md:absolute top-0 flex h-12 z-20"> <div class="bg-white w-full py-3 px-3 text-black font-bold drop-shadow fixed md:absolute top-0 flex h-12 z-20">
<div @click="router.back()"> <div @click="router.back()">
<BasicIcon icon="vuesax-linear:arrow-right-1"/> <BasicIcon icon="vuesax-linear:arrow-right-1"/>
</div> </div>
<div class="mr-2">دارایی ها</div> <div class="mr-2">قلک</div>
</div> </div>
<div class="bg-[#EFCED9] w-screen md:w-full h-[70vh] fixed md:absolute"> <div class="bg-[#EFCED9] w-screen md:w-full h-[70vh] fixed md:absolute">
<div class="pt-15 flex flex-col"> <div class="pt-15 flex flex-col">
<div class="text-gray-500 font-bold mr-5 z-20">موجودی دارایی ها</div> <div class="text-gray-500 font-bold mr-5 z-20">موجودی قلک ها</div>
<div class="flex justify-center mt-2 w-full z-20"> <div class="flex items-baseline justify-center mt-2 w-full z-20">
محصولات:
<div class="text-l mr-4 font-bold">{{ walletStore.walletInfo?.count_product ?? 0}}عدد</div>
</div>
<div class="flex justify-center mt-2 w-full z-20">
دارایی طلایی:
<div class="text-l mr-4 font-bold">{{ walletStore.walletInfo?.count_gold ?? 0}}گرم</div>
</div>
<div class="flex justify-center mt-2 w-full z-20">
دارایی ریالی:
<div class="text-l mr-4 font-bold">{{ usePriceWithoutType(walletStore.walletInfo?.count_cash ?? 0) }}ریال</div>
</div>
<!-- <div class="flex items-baseline justify-center mt-2 w-full z-20">
<div class="text-3xl font-bold">{{ inventory }}</div> <div class="text-3xl font-bold">{{ inventory }}</div>
/عدد
</div>
<div class="flex items-baseline justify-center mt-2 w-full z-20">
<div class="text-3xl font-bold">{{ (weight + ((userInfo?.gold) ?? 0)).toFixed(3)}}</div>
/گرم /گرم
</div>--> </div>
<img :src="img" alt="" class="mt-[-4rem] mr-10 max-w-[22rem] self-end"> <img :src="img" alt="" class="mt-[-4rem] mr-10 max-w-[22rem] self-end">
</div> </div>
</div> </div>
@@ -39,23 +23,22 @@
<div v-if="items.length === 0 && !loading" class="w-full h-full flex justify-center items-center"> <div v-if="items.length === 0 && !loading" class="w-full h-full flex justify-center items-center">
<div> <div>
<img :src="empty" alt="" class="w-70 "> <img :src="empty" alt="" class="w-70 ">
<div class="text-center text-lg">قطره قطره جمع گردد....</div> <div class="text-center text-lg">یک قلک جدید بساز!</div>
</div> </div>
</div> </div>
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<div :class="loading? 'h-[40vh]':''" class="grid grid-cols-2 gap-3 p-5"> <div :class="loading? 'h-[40vh]':''" class="grid grid-cols-2 gap-3 p-5">
<Item v-for="item in items.filter(x => x.title !== 'آبشده نقدی')" :item="item" <Item v-for="item in items" :item="item"
@click="router.push({name: 'fund_info', params:{id:item.id}})" @click="router.push({name: 'fund_info', params:{id:item.id}})"/>
/>
</div> </div>
</a-spin> </a-spin>
</div> </div>
</div> </div>
<!-- <div class="fixed w-full flex justify-center bottom-23 z-200 md:right-0"> <div class="fixed w-full flex justify-center bottom-23 z-200 md:right-0">
<div class="rounded-3xl bg-[#521620] text-white px-5 py-2" @click="router.push({name: 'fund_add'})">افزودن گنج <div class="rounded-3xl bg-[#0A1B37] text-white px-5 py-2" @click="router.push({name: 'fund_add'})">افزودن قلک
</div> </div>
</div>--> </div>
</div> </div>
</template> </template>
@@ -63,7 +46,6 @@
import router from "@/router"; import router from "@/router";
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue"; import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
import BasicModal from "@/components/BasicPacks/BasicModal.vue";
import img from '@/assets/img/cash_img.svg' import img from '@/assets/img/cash_img.svg'
import empty from '@/assets/img/cash_empty.svg' import empty from '@/assets/img/cash_empty.svg'
import Item from './components/Item.vue' import Item from './components/Item.vue'
@@ -72,39 +54,25 @@ import {loading} from "@/utils";
import type {TableOutput} from "@/models/table"; import type {TableOutput} from "@/models/table";
import type {Fund} from "@/models/fund"; import type {Fund} from "@/models/fund";
import {useFundUserStore} from "@/store/fundStore"; import {useFundUserStore} from "@/store/fundStore";
import { getMe } from '@/api/me'
import type { User } from '@/models/login'
import {usePriceWithoutType} from "../../../utils/usePrice";
import {useWalletStore} from "@/store/walletStore";
const openModal = ref<boolean>(false)
const items = ref<Fund[]>([]) const items = ref<Fund[]>([])
const tableOutput = ref<TableOutput<Fund> | null>(null) const tableOutput = ref<TableOutput<Fund> | null>(null)
const inventory = ref<number>(0) const inventory = ref<number>(0)
const fundStore = useFundUserStore() const fundStore = useFundUserStore()
const walletStore = useWalletStore()
const userInfo = ref<User>()
const weight = ref<number>(0)
const total = ref<number>(0)
onMounted(() => { onMounted(() => {
initTable() initTable()
}) })
async function initTable() { async function initTable() {
try { try {
userInfo.value = await getMe()
loading.value = true loading.value = true
tableOutput.value = fundStore.myFunds ?? await fundStore.getMyFund() ?? null tableOutput.value = fundStore.myFunds ?? await fundStore.getMyFund() ?? null
console.log(tableOutput.value) // console.log(tableOutput.value)
items.value.push(...tableOutput.value?.rows ?? []) items.value.push(...tableOutput.value?.rows ?? [])
items.value.forEach(x => { items.value.forEach(x => {
console.log(x.wallet) // console.log(x.wallet[0]?.gold)
if (x.title !== 'آبشده نقدی') inventory.value += x?.wallet[0]?.gold ?? 0
inventory.value += x?.wallet?.gold ?? 0
total.value += ((x?.wallet?.gold) ?? 0) * ((x?.price) ?? 0)
if (x.title !== 'آبشده نقدی' && x.title !== 'سکه')
weight.value += ((x?.wallet?.gold) ?? 0) * ((x?.amount) ?? 0)
// console.log(inventory.value) // console.log(inventory.value)
}) })
// console.log(tableOutput.value) // console.log(tableOutput.value)
+14 -15
View File
@@ -9,17 +9,17 @@
</div> </div>
<div class="w-full mr-3"> <div class="w-full mr-3">
<div class="flex justify-between w-full"> <div class="flex justify-between w-full">
<div>{{ item.title }}</div> <div>{{ item.type_str }}</div>
<div>{{ toJalaliNotime(item.expire_at) }}</div> <div>{{ toJalaliNotime(item.expire_at) }}</div>
</div> </div>
<div class="flex justify-between mt-2"> <div class="flex justify-between mt-2 ">
<div :class="item.gold >= 0? 'text-green-600':'text-red-600'" class="text-gray-500 text-xs number-ltr"> <div :class="item.gold >= 0? 'text-green-600':'text-red-600'" class="text-gray-500 text-xs number-ltr">
</div> </div>
<div class="text-gray-500 flex gap-1 text-xs items-center"> <div class="text-gray-500 flex gap-1 text-xs items-center">
<div :class="item.gold > 0 ? 'text-green-600':'text-red-600'" class="text-base number-ltr"> <div :class="item.gold > 0 ? 'text-green-600':'text-red-600'" class="text-base number-ltr">
{{ item.gold }} {{ item.gold }}
</div> </div>
{{item.unit}} گرم
</div> </div>
</div> </div>
</div> </div>
@@ -34,32 +34,32 @@
<!-- <div v-else class="h-8"></div>--> <!-- <div v-else class="h-8"></div>-->
<a-divider class="!my-3"/> <a-divider class="!my-3"/>
<BasicActionSheet v-model:show="infoVisible"> <BasicActionSheet v-model:show="infoVisible">
<div class="font-bold text-lg">{{ props.item.title }}</div> <div class="font-bold text-lg">{{ props.item.type_str }}</div>
<div class="pb-20 mt-5"> <div class="pb-20 mt-5">
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">مقدار {{props.title}} مبادله شده:</div> <div class="text-black">مقدار طلا مبادله شده:</div>
<div :class="item.gold >= 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center"> <div :class="item.gold >= 0? 'text-green-600' : 'text-red-600'" class="flex text-xs items-center">
<div class="text-base ml-1 number-ltr">{{ item.gold }}</div> <div class="text-base ml-1 number-ltr">{{ item.gold }}</div>
{{item.unit}} گرم
</div> </div>
</div> </div>
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">موجودی {{ props.title }}:</div> <div class="text-black">موجودی کیف طلا:</div>
<div class="flex text-xs text-yellow-700 items-center"> <div class="flex text-xs text-yellow-700 items-center">
<div class="text-base ml-1">{{ item.balance_gold }}</div> <div class="text-base ml-1">{{ item.balance_gold }}</div>
{{item.unit}} گرم
</div> </div>
</div> </div>
<!-- <div class="flex justify-between mb-3"> <!-- <div class="flex justify-between mb-3">
<div class="text-primary">موجودی کیف پول:</div> <div class="text-black">موجودی کیف پول:</div>
<div class="flex text-xs items-center" :class="isUp? 'text-green-600' : 'text-red-600'"><div class="text-base">{{usePriceWithoutType(12000000)}}</div>ریال</div> <div class="flex text-xs items-center" :class="isUp? 'text-green-600' : 'text-red-600'"><div class="text-base">{{usePriceWithoutType(12000000)}}</div>ریال</div>
</div> </div>
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">موجودی کیف طلا:</div> <div class="text-black">موجودی کیف طلا:</div>
<div class="flex items-center" :class="isUp? 'text-red-600' : 'text-green-600'">60 گرم</div> <div class="flex items-center" :class="isUp? 'text-red-600' : 'text-green-600'">60 گرم</div>
</div>--> </div>-->
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">وضعیت:</div> <div class="text-black">وضعیت:</div>
<div class="flex text-xs items-center"> <div class="flex text-xs items-center">
<ATag :color="item.active? 'blue': 'red'" class="!py-1 !px-6 !ml-0">{{ <ATag :color="item.active? 'blue': 'red'" class="!py-1 !px-6 !ml-0">{{
item.active ? 'موفق' : 'نا موفق' item.active ? 'موفق' : 'نا موفق'
@@ -68,11 +68,11 @@
</div> </div>
</div> </div>
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">تاریخ:</div> <div class="text-black">تاریخ:</div>
<div>{{ toJalaliNotime(item.expire_at) }}</div> <div>{{ toJalaliNotime(item.expire_at) }}</div>
</div> </div>
<div class="flex justify-between mb-3"> <div class="flex justify-between mb-3">
<div class="text-primary">زمان:</div> <div class="text-black">زمان:</div>
<div>{{ toTime(item.expire_at) }}</div> <div>{{ toTime(item.expire_at) }}</div>
</div> </div>
<BasicButton class="w-full mt-5" @click="infoVisible = false">بازگشت</BasicButton> <BasicButton class="w-full mt-5" @click="infoVisible = false">بازگشت</BasicButton>
@@ -94,12 +94,11 @@ const infoVisible = ref<boolean>(false)
interface Prop { interface Prop {
item: Transaction item: Transaction
title?: string
} }
const props = withDefaults(defineProps<Prop>(), {}) const props = withDefaults(defineProps<Prop>(), {})
const isUp = computed(() => props.item.type === 3 || props.item.type === 1) const isUp = computed(() => props.item.type === 3 || props.item.type === 1)
// const isGold = computed(() => props.item.type === 1 || props.item.type === 2 || props.item.type === 10) const isGold = computed(() => props.item.type === 1 || props.item.type === 2)
/*const title = computed(() => { /*const title = computed(() => {
if (isUp.value) { if (isUp.value) {
if (isGold.value) { if (isGold.value) {
+23 -35
View File
@@ -1,46 +1,41 @@
<template> <template>
<div> <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 class="flex ">
<div @click="router.back()" class="cursor-pointer"> <div @click="router.back()" class="cursor-pointer">
<BasicIcon icon="vuesax-linear:arrow-right-1" /> <BasicIcon icon="vuesax-linear:arrow-right-1" />
</div> </div>
<div class="mr-2">{{ info?.title }}</div> <div class="mr-2">{{ info?.title }}</div>
</div> </div>
<!-- <div @click="editShow = true"> <div @click="editShow = true">
<BasicIcon icon="vuesax-linear:setting-4" /> <BasicIcon icon="vuesax-linear:setting-4" />
</div>--> </div>
</div> </div>
<div class="pt-20 flex flex-col justify-center items-center"> <div class="pt-20 flex flex-col justify-center items-center">
<a-spin :spinning="loading"> <a-spin :spinning="loading">
<div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl"> <div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl">
<!-- <img v-if="!loading" :src="itemImg" alt="">--> <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">
</div> </div>
</a-spin> </a-spin>
<div class="mt-2 font-bold flex text-xs items-center text-gray-500"> <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> <div class="ml-1 text-base text-black">{{ info?.wallet[0]?.gold }}</div>
{{info?.unit}} گرم
</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 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" <BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:add-square" icon-size="18"
@click="()=> {transactionShow = true; isDeposit= false}">برداشت @click="()=> {transactionShow = true; isDeposit= false}">برداشت
</BasicButton> </BasicButton>
<BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:arrow-up" icon-size="18" <BasicButton class="w-full !bg-[#F3F0E9] !border-0 !rounded" icon="vuesax-linear:arrow-up" icon-size="18"
@click="()=> {transactionShow = true; isDeposit= true}">واریز @click="()=> {transactionShow = true; isDeposit= true}">واریز
</BasicButton> </BasicButton>
</div>--> </div>
<div class=" font-bold mt-5">تراکنش ها</div> <div class=" font-bold mt-5">تراکنش ها</div>
<!-- <a-spin :spinning="loading">--> <!-- <a-spin :spinning="loading">-->
<div class="mt-5 pb-17 overflow-y-scroll h-[54vh]"> <div class="mt-5 pb-17 overflow-y-scroll h-[54vh]">
<list-anim v-if="!loading"> <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> </list-anim>
<TransactionSkeleton v-for="i in 8" v-else :key="i" class="mt-1" /> <TransactionSkeleton v-for="i in 8" v-else :key="i" class="mt-1" />
<empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" /> <empty v-if="items.length === 0 && !loading" text="هیچ تراکنشی یافت نشد" />
@@ -58,11 +53,11 @@
size="large" /> size="large" />
<div v-if="isDeposit" class="mt-2 text-xs font-bold leading-5"> <div v-if="isDeposit" class="mt-2 text-xs font-bold leading-5">
<div>موجودی کیف طلا: {{ walletStore?.walletInfo?.gold }} گرم</div> <div>موجودی کیف طلا: {{ walletStore?.walletInfo?.gold }} گرم</div>
<div v-if="info?.wallet?.gold !== 0"> <div v-if="info?.wallet[0]?.gold !== 0">
{{ `موجودی قابل برداشت گنج: ${info?.wallet?.gold ?? 0} گرم` }} {{ `موجودی قابل برداشت قلک: ${info?.wallet[0]?.gold ?? 0} گرم` }}
</div> </div>
</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> </div>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
@@ -82,7 +77,7 @@
</a-form> </a-form>
</BasicActionSheet> </BasicActionSheet>
<BasicActionSheet v-model:show="editShow"> <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" <BasicButton class="mt-12 w-full" icon="vuesax-linear:edit"
icon-size="16" @click="$router.push({name: 'fund_add', query:{id:infoId}})"> icon-size="16" @click="$router.push({name: 'fund_add', query:{id:infoId}})">
@@ -104,7 +99,7 @@
<template v-slot:title> <template v-slot:title>
<div class="p-5 text-sm"> <div class="p-5 text-sm">
آیا از حذف گنج خود اطمینان دارید؟ آیا از حذف قلک خود اطمینان دارید؟
</div> </div>
</template> </template>
@@ -149,15 +144,8 @@ import ListAnim from '@/components/ListAnim.vue'
import TransactionSkeleton from '@/components/TransactionSkeleton.vue' import TransactionSkeleton from '@/components/TransactionSkeleton.vue'
import DialogVant from '@/components/DialogVant.vue' import DialogVant from '@/components/DialogVant.vue'
import { useFundUserStore } from '@/store/fundStore' 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 items = ref<Transaction[]>([])
const tableOutput = ref<TableOutput<Transaction> | null>(null) const tableOutput = ref<TableOutput<Transaction> | null>(null)
const pagination = ref<TableInput>({/*limit: 100, page: 0*/ }) const pagination = ref<TableInput>({/*limit: 100, page: 0*/ })
@@ -176,10 +164,10 @@ onMounted(() => {
}) })
function deleteFundConfirm() { 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 showDeleteConfirm.value = true
} else { } else {
message.error('ابتدا گنج خود را خالی کنید') message.error('ابتدا قلک خود را خالی کنید')
editShow.value = false editShow.value = false
} }
} }
@@ -191,7 +179,7 @@ async function deleteFundFunction() {
await deleteFund(infoId) await deleteFund(infoId)
await fundStore.getMyFund() await fundStore.getMyFund()
router.back() router.back()
message.success('گنج با موفقیت حذف شد') message.success('قلک با موفقیت حذف شد')
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} finally { } finally {
@@ -213,9 +201,9 @@ const transButtonDisable = computed(() => {
if (isDeposit.value) { if (isDeposit.value) {
return userFormState.value > walletStore?.walletInfo?.gold return userFormState.value > walletStore?.walletInfo?.gold
} else { } 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
} else { } else {
return true return true
@@ -226,7 +214,7 @@ const transButtonDisable = computed(() => {
async function initInfo() { async function initInfo() {
try { try {
loading.value = true loading.value = true
info.value = await getOneProductWallet(infoId) info.value = await getFundById(infoId)
//pagination.value.page=0 //pagination.value.page=0
await initTable() await initTable()
} catch (e) { } catch (e) {
@@ -241,7 +229,7 @@ async function initTable() {
try { try {
loading.value = true loading.value = true
items.value = [] 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 // pagination.value.fund_id = infoId
tableOutput.value = await getFundTransactionTable(pagination.value) tableOutput.value = await getFundTransactionTable(pagination.value)
items.value.push(...tableOutput.value.rows) items.value.push(...tableOutput.value.rows)
+8 -8
View File
@@ -1,11 +1,11 @@
<template> <template>
<div> <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 class="flex ">
<div @click="router.back()" class="cursor-pointer"> <div @click="router.back()" class="cursor-pointer">
<BasicIcon icon="vuesax-linear:arrow-right-1"/> <BasicIcon icon="vuesax-linear:arrow-right-1"/>
</div> </div>
<div class="mr-2">{{edit_id? `ویرایش گنج ${name}`: 'صندوق جدید'}}</div> <div class="mr-2">{{edit_id? `ویرایش قلک ${name}`: 'صندوق جدید'}}</div>
</div> </div>
<div @click="router.back()"> <div @click="router.back()">
<!-- <BasicIcon icon="vuesax-linear:setting-4"/>--> <!-- <BasicIcon icon="vuesax-linear:setting-4"/>-->
@@ -16,7 +16,7 @@
<div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl"><img :src="itemImg" alt=""></div> <div class="bg-sky-100 w-[120px] aspect-square flex justify-center rounded-xl"><img :src="itemImg" alt=""></div>
<!-- <div class="mt-1 text-xs">تغییر عکس</div>--> <!-- <div class="mt-1 text-xs">تغییر عکس</div>-->
<div class="flex mt-3 w-full relative px-5" :class="[prefixCls]"> <div class="flex mt-3 w-full relative px-5" :class="[prefixCls]">
<!-- <div class="text-primary font-bold mx-auto items-center">پس انداز</div> <!-- <div class="text-black font-bold mx-auto items-center">پس انداز</div>
<div class="absolute left-5 text-gray-400 text-xs">7/25</div>--> <div class="absolute left-5 text-gray-400 text-xs">7/25</div>-->
<van-field <van-field
v-model="name" v-model="name"
@@ -40,13 +40,13 @@
<div v-for="item in types" <div v-for="item in types"
class="border-1 px-3 py-2 flex-nowrap rounded text-xs color-transition background-color-transition" class="border-1 px-3 py-2 flex-nowrap rounded text-xs color-transition background-color-transition"
:key="item.name" :key="item.name"
:class="item.name === name? 'bg-[#521620] text-white':'bg-gray-200 text-gray-600'" :class="item.name === name? 'bg-[#0A1B37] text-white':'bg-gray-200 text-gray-600'"
@click="name = item.name"> @click="name = item.name">
{{ item.name }} {{ item.name }}
</div> </div>
</div> </div>
<!-- <div class="mt-2 font-bold flex text-xs items-center text-gray-500"> <!-- <div class="mt-2 font-bold flex text-xs items-center text-gray-500">
<div class="ml-1 text-base text-primary">{{ router.currentRoute.value.query.amount }}</div> <div class="ml-1 text-base text-black">{{ router.currentRoute.value.query.amount }}</div>
گرم گرم
</div> </div>
<div class="text-gray-400">موجودی صندوق {{itemName}}</div> <div class="text-gray-400">موجودی صندوق {{itemName}}</div>
@@ -63,7 +63,7 @@
<div class="wrap-fix flex justify-center bottom-23 px-5 z-200" @click="ok()"> <div class="wrap-fix flex justify-center bottom-23 px-5 z-200" @click="ok()">
<BasicButton class="rounded w-full px-5 py-2 text-center" type="primary" :disabled="loading"> <BasicButton class="rounded w-full px-5 py-2 text-center" type="primary" :disabled="loading">
<a-spin v-if="loading" size="small"/> <a-spin v-if="loading" size="small"/>
<div v-else>{{edit_id? 'ویرایش گنج':'ساخت گنج'}}</div> <div v-else>{{edit_id? 'ویرایش قلک':'ساخت قلک'}}</div>
</BasicButton> </BasicButton>
</div> </div>
</div> </div>
@@ -163,11 +163,11 @@ async function ok() {
loading.value = true loading.value = true
// console.log(name.value) // console.log(name.value)
name.value ? edit_id.value? await editFund(edit_id.value,{title: name.value}) :await createFund({title: name.value}) : () => { name.value ? edit_id.value? await editFund(edit_id.value,{title: name.value}) :await createFund({title: name.value}) : () => {
message.error('ابتدا نام گنج را وارد کنید') message.error('ابتدا نام قلک را وارد کنید')
return return
} }
await fundStore.getMyFund() await fundStore.getMyFund()
message.success(`گنج با موفقیت ${edit_id.value? 'ویرایش':'ساخته'} شد`) message.success(`قلک با موفقیت ${edit_id.value? 'ویرایش':'ساخته'} شد`)
router.back() router.back()
// name.value? message.warn('ss'): message.error('ابتدا نام صندوق را وارد کنید') // name.value? message.warn('ss'): message.error('ابتدا نام صندوق را وارد کنید')
} catch (e) { } catch (e) {
+14 -1
View File
@@ -67,7 +67,7 @@
</div>--> </div>-->
<!-- <div class="bg-gradient-to-l mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent ">--> <!-- <div class="bg-gradient-to-l mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent ">-->
<div class="mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent"> <div class="mt-3 p-1 shadow-lg from-primary rounded-lg p-px to-transparent">
<div class=" p-2 py-6 rounded-lg bg-tertiary"> <div class=" p-1 py-6 rounded-lg bg-tertiary">
<div class="flex justify-between "> <div class="flex justify-between ">
<!-- <div <!-- <div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_up" class="text-center w-full flex-flex-col items-center home_appear_fade_in_up"
@@ -138,6 +138,19 @@
</div> </div>
<div class="text-primary">کسب درآمد</div> <div class="text-primary">کسب درآمد</div>
</div> </div>
<div
class="text-center w-full flex-flex-col items-center home_appear_fade_in_down"
style="text-align: -webkit-center"
@click="router.push({ name: 'fund' })"
>
<div
class="rounded-full w-[50px] h-[50px] bg-primary flex items-center justify-center"
style=" border: solid 1px #521620"
>
<Icon class="text-tertiary font-bold" icon="vuesax-linear:archive-1" />
</div>
<div class="text-primary">قلک</div>
</div>
</div> </div>
</div> </div>
<!-- <ADivider></ADivider>--> <!-- <ADivider></ADivider>-->