draft acquisition
This commit is contained in:
@@ -12,8 +12,8 @@ import { RouterLink, RouterView } from 'vue-router';
|
||||
<RouterLink to="/market/scan" class="tab">
|
||||
<span>Scan</span>
|
||||
</RouterLink>
|
||||
<RouterLink to="/market/track" class="tab">
|
||||
<span>Tracking</span>
|
||||
<RouterLink to="/market/acquisition" class="tab">
|
||||
<span>Acquisitions</span>
|
||||
</RouterLink>
|
||||
</div>
|
||||
<RouterView />
|
||||
|
||||
43
src/pages/market/Acquisitions.vue
Normal file
43
src/pages/market/Acquisitions.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { MarketTypePrice, getMarketTypes, useApraisalStore } from "@/market";
|
||||
import { AcquiredItem, AcquisitionResultTable, BuyModal, SellModal, useAcquiredItemStore } from '@/market/acquisition';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const buyModal = ref<typeof BuyModal>();
|
||||
const sellModal = ref<typeof SellModal>();
|
||||
|
||||
|
||||
const apraisalStore = useApraisalStore();
|
||||
const acquiredItemStore = useAcquiredItemStore();
|
||||
const items = ref<AcquiredItem[]>([]);
|
||||
|
||||
watch(() => acquiredItemStore.items, async itms => {
|
||||
if (itms.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prices = await apraisalStore.getPrices(await getMarketTypes(itms.map(i => i.type)));
|
||||
|
||||
items.value = itms.map(i => {
|
||||
const price = prices.find(p => p.type.id === i.type) as MarketTypePrice;
|
||||
|
||||
return {
|
||||
...i,
|
||||
type: price.type,
|
||||
buy: price.buy,
|
||||
sell: price.sell
|
||||
};
|
||||
});
|
||||
}, { immediate: true })
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<template v-if="items.length > 0">
|
||||
<AcquisitionResultTable :items="items" @buy="(type, price, buy, sell) => buyModal?.open(type, { 'Price': price, 'Buy': buy, 'Sell': sell })" @sell="type => sellModal?.open(type)" />
|
||||
<BuyModal ref="buyModal" />
|
||||
<SellModal ref="sellModal" />
|
||||
</template>
|
||||
</div>
|
||||
</template>@/market/acquisition
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { MarketType, MarketTypeInput, MarketTypePrice, getHistory, getMarketTypes, jitaId, useApraisalStore } from "@/market";
|
||||
import { ScanResult, ScanResultTable, createResult, useMarketScanStore } from '@/market/scan';
|
||||
import { BuyModal } from '@/market/track';
|
||||
import { BuyModal } from '@/market/acquisition';
|
||||
import { ScanResult, ScanResultTable, useMarketScanStore } from '@/market/scan';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
|
||||
@@ -73,4 +73,4 @@ watch(() => markeyScanStore.types, async t => {
|
||||
<ScanResultTable :items="items" @buy="(type, buy, sell) => buyModal?.open(type, { 'Buy': buy, 'Sell': sell })" @remove="removeItem" />
|
||||
<BuyModal ref="buyModal" />
|
||||
</template>
|
||||
</template>
|
||||
</template>@/market/acquisition
|
||||
@@ -1,38 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { MarketTypePrice, getMarketTypes, useApraisalStore } from "@/market";
|
||||
import { BuyModal, SellModal, TrackResultTable, TrackedItem, useTrackedItemStore } from '@/market/track';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const buyModal = ref<typeof BuyModal>();
|
||||
const sellModal = ref<typeof SellModal>();
|
||||
|
||||
|
||||
const apraisalStore = useApraisalStore();
|
||||
const trackedItemStore = useTrackedItemStore();
|
||||
const items = ref<TrackedItem[]>([]);
|
||||
|
||||
watch(() => trackedItemStore.items.value, async itms => {
|
||||
if (itms.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prices = await apraisalStore.getPrices(await getMarketTypes(itms.map(i => i.typeID)));
|
||||
|
||||
items.value = itms.map(i => {
|
||||
const price = prices.find(p => p.type.id === i.typeID) as MarketTypePrice;
|
||||
|
||||
return { ...i, ...price };
|
||||
});
|
||||
}, { immediate: true })
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<template v-if="items.length > 0">
|
||||
<TrackResultTable :items="items" @buy="(type, price, buy, sell) => buyModal?.open(type, { 'Price': price, 'Buy': buy, 'Sell': sell })" @sell="type => sellModal?.open(type)" />
|
||||
<BuyModal ref="buyModal" />
|
||||
<SellModal ref="sellModal" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user