122 lines
3.4 KiB
Vue
122 lines
3.4 KiB
Vue
<template>
|
|
<div>
|
|
<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()">
|
|
<BasicIcon icon="vuesax-linear:arrow-right-1"/>
|
|
</div>
|
|
<div class="mr-2">قلک</div>
|
|
</div>
|
|
<div class="bg-[#EFCED9] w-screen md:w-full h-[70vh] fixed md:absolute">
|
|
<div class="pt-15 flex flex-col">
|
|
<div class="text-gray-500 font-bold mr-5 z-20">موجودی قلک ها</div>
|
|
<div class="flex items-baseline justify-center mt-2 w-full z-20">
|
|
<div class="text-3xl font-bold">{{ inventory }}</div>
|
|
/گرم
|
|
</div>
|
|
<img :src="img" alt="" class="mt-[-4rem] mr-10 max-w-[22rem] self-end">
|
|
</div>
|
|
</div>
|
|
<div class="pt-[20rem] ">
|
|
<div class="bg-gray-100 w-screen md:w-full z-20 relative rounded-t-3xl h-[calc(100vh-20rem-70px)] overflow-y-auto pb-15"
|
|
style="box-shadow: 0px -2px 4px -2px #0000001A;">
|
|
|
|
<div v-if="items.length === 0 && !loading" class="w-full h-full flex justify-center items-center">
|
|
<div>
|
|
<img :src="empty" alt="" class="w-70 ">
|
|
<div class="text-center text-lg">یک قلک جدید بساز!</div>
|
|
</div>
|
|
</div>
|
|
|
|
<a-spin :spinning="loading">
|
|
<div :class="loading? 'h-[40vh]':''" class="grid grid-cols-2 gap-3 p-5">
|
|
<Item v-for="item in items" :item="item"
|
|
@click="router.push({name: 'fund_info', params:{id:item.id}})"/>
|
|
</div>
|
|
</a-spin>
|
|
</div>
|
|
</div>
|
|
<div class="fixed w-full flex justify-center bottom-23 z-200 md:right-0">
|
|
<div class="rounded-3xl bg-primary text-white px-5 py-2" @click="router.push({name: 'fund_add'})">افزودن قلک
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import router from "@/router";
|
|
import BasicIcon from "@/components/BasicPacks/BasicIcon.vue";
|
|
import img from '@/assets/img/cash_img.svg'
|
|
import empty from '@/assets/img/cash_empty.svg'
|
|
import Item from './components/Item.vue'
|
|
import {onMounted, ref} from "vue";
|
|
import {loading} from "@/utils";
|
|
import type {TableOutput} from "@/models/table";
|
|
import type {Fund} from "@/models/fund";
|
|
import {useFundUserStore} from "@/store/fundStore";
|
|
|
|
const items = ref<Fund[]>([])
|
|
const tableOutput = ref<TableOutput<Fund> | null>(null)
|
|
const inventory = ref<number>(0)
|
|
const fundStore = useFundUserStore()
|
|
|
|
onMounted(() => {
|
|
initTable()
|
|
})
|
|
|
|
async function initTable() {
|
|
try {
|
|
loading.value = true
|
|
tableOutput.value = fundStore.myFunds ?? await fundStore.getMyFund() ?? null
|
|
// console.log(tableOutput.value)
|
|
items.value.push(...tableOutput.value?.rows ?? [])
|
|
items.value.forEach(x => {
|
|
// console.log(x.wallet[0]?.gold)
|
|
inventory.value += x?.wallet[0]?.gold ?? 0
|
|
// console.log(inventory.value)
|
|
})
|
|
// console.log(tableOutput.value)
|
|
} catch (e) {
|
|
console.log(e)
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
/*watch(()=> router.currentRoute.value.name, () =>{
|
|
console.log('salammmmmmmmmmmmmmmmmmmmmmmmmmm')
|
|
})*/
|
|
/*
|
|
const items = [
|
|
{
|
|
type: 'home',
|
|
amount: 2.7
|
|
},
|
|
{
|
|
type: 'gift',
|
|
amount: 13.1
|
|
},
|
|
{
|
|
type: 'saving',
|
|
amount: 6.4
|
|
},
|
|
{
|
|
type: 'repairs',
|
|
amount: 16.6
|
|
},
|
|
{
|
|
type: 'circulation',
|
|
amount: 5.4
|
|
},
|
|
{
|
|
type: 'love',
|
|
amount: 3.7
|
|
},
|
|
]
|
|
*/
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |