Transaction confirmation ( 2 )
+ Transaction confirmation ( {{ props.buyDataArr.length }} )
NFT
Token ID
Price
+
-
@@ -40,7 +40,7 @@
0.08
-
-
+
- NFT Name
+ {{ item.nft.name }}
2516
+ {{ item.nft.token_id }}
-
0.08
+ {{ priceCalculated(item.event.data.buy[0].amount) }}


$ 400
+
Confirm
@@ -63,6 +63,8 @@ const props = defineProps({
},
});
+console.log(toRaw(props.buyDataArr))
+
const emit = defineEmits(['handleClose'])
const handleOk = (e) => {
@@ -80,9 +82,22 @@ const buyConfirm = async () => {
let res = await pass.beginBuy(toRaw(props.buyDataArr)[0].nft.token_id)
console.log('购买', res)
}
-// const priceAmount = () => {
-// return priceCalculated(price)
-// }
+
+//计算对象数组中某个属性合计
+const totalPrice = () => {
+ // toRaw(props.buyDataArr).reduce((arr, amount)) => {
+ // return arr +
+ // }
+ // return priceCalculated(price)
+ // countTotal(arr, amount) {
+ // let $total = 0
+ // $total = arr.reduce((total, currentValue, currentIndex, arr) => {
+ // return currentValue[keyName] ? total + currentValue[keyName] * currentValue[keyNameTwo] : total
+ // }, 0)
+ // return $total
+ // }
+
+}
const handleCancel = (e) => {
emit('handleClose')
diff --git a/src/components/cart/index.vue b/src/components/cart/index.vue
index fb7e2d0..5a77b06 100644
--- a/src/components/cart/index.vue
+++ b/src/components/cart/index.vue
@@ -62,7 +62,7 @@ const clearCart = async () => {
}
const getCartList = async () => {
- console.log(await useMarketplaceStore().getCartList(),'-------------------------------------------------------')
+ // console.log(await useMarketplaceStore().getCartListState(),'-------------------------------------------------------')
// let token = localStorage.getItem('assessToken')
// if(token) {
// try {
diff --git a/src/components/marketplace/mktContent.vue b/src/components/marketplace/mktContent.vue
index 054ff00..0014e57 100644
--- a/src/components/marketplace/mktContent.vue
+++ b/src/components/marketplace/mktContent.vue
@@ -84,7 +84,6 @@ import Rank from "@/components/common/searchView/rank.vue"
import Gold from "@/components/common/searchView/gold.vue"
import LoadingDialog from "@/components/Dialogs/loadingDialog.vue"
import NftId from "@/configs/item.json"
-import Axios from "axios"
import {apiMarketplaceState} from "@/utils/marketplace.js"
import { useMarketplaceStore } from "@/store/marketplace"
const marketplaceList = useMarketplaceStore()
@@ -159,7 +158,7 @@ const searchName = (id) => {
const getHeroData = async () => {
let data = {
- page_size: 0,
+ page_size: 20,
cursor: '',
search: {
name: '',
@@ -181,11 +180,12 @@ const getHeroData = async () => {
}
loadingDialogVisible.value = false;
try {
- let res = await apiMarketplaceState(data)
+ let res = await marketplaceList.getMarketplaceState(data)
nftList.value = res.rows
- loadingDialogVisible.value = false;
+ console.log(res,'-----')
+ // loadingDialogVisible.value = false;
} catch(e) {
- loadingDialogVisible.value = false;
+ // loadingDialogVisible.value = false;
}
}
diff --git a/src/configs/priceCalculate.js b/src/configs/priceCalculate.js
index 8ff8997..c91b827 100644
--- a/src/configs/priceCalculate.js
+++ b/src/configs/priceCalculate.js
@@ -1,6 +1,5 @@
// 计算价格精度
export const priceCalculated = (price) => {
- console.log('----')
let priceNum = Number(price)/1e18
if(isNaN(priceNum)){return priceNum}
let str = ''+priceNum
diff --git a/src/main.js b/src/main.js
index 97d29f4..fc5943b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,7 +19,6 @@ import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import {PassportWallet} from '@/wallet/passPort';
const passPortCallback = new PassportWallet()
-console.log(passPortCallback,'---')
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
diff --git a/src/store/marketplace.js b/src/store/marketplace.js
index e10ebbb..a62988e 100644
--- a/src/store/marketplace.js
+++ b/src/store/marketplace.js
@@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
-import { apiGetCartList } from "@/utils/marketplace"
+import { apiMarketplaceState, apiGetCartList, } from "@/utils/marketplace"
export const useMarketplaceStore = defineStore('marketplace', () => {
const overview = ref('')
@@ -37,20 +37,21 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
status.value = _connected;
}
- // async function getMarketPlaceData() {
- // const result = async apiMarketplaceState(13473,'0x8c10Ae04BF525734eaC00d5F7c062567461c207F')
- // console.log(result)
- // }
+ async function getMarketplaceState(_connected) {
+ const res = await apiMarketplaceState(_connected)
+ console.log(_connected)
+ return res
+ }
// actions: {
// const getCartList = async () => {
// return '可以'
// }
// }
- async function getCartList() {
+ async function getCartListState() {
// cartList.value = '可以'
let res = await apiGetCartList()
- console.log(res)
+ // console.log(res)
return res
}
@@ -63,7 +64,8 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
rank, updateRankStatus,
gold, updateGoldStatus,
status, updateStatusStatus,
- cartList, getCartList,
+ getMarketplaceState,
+ cartList, getCartListState,
}
},
{
diff --git a/src/utils/marketplace.js b/src/utils/marketplace.js
index 32393f7..f3d7b26 100644
--- a/src/utils/marketplace.js
+++ b/src/utils/marketplace.js
@@ -56,8 +56,8 @@ export const apiHangingState = async (account_address, data) => {
// 账号交易历史
export const apiHistoryState = async (account_address,data) => {
- const url = `${API_BASE}/api/market/transaction/history/${net_id}/${account_address}?type=${data.type}?ge_size=${data.page_size}?cursor=${data.cursor}`
- return httpGet(url, {})
+ const url = `${API_BASE}/api/market/transaction/history/${net_id}/${account_address}`
+ return httpGet(url, data)
}
// 详情