diff --git a/src/components/common/card.vue b/src/components/common/card.vue index 65caf74..fabc9d9 100644 --- a/src/components/common/card.vue +++ b/src/components/common/card.vue @@ -41,8 +41,6 @@ import ImgCard from "@/components/common/imgCard.vue" import {priceCalculated} from "@/configs/priceCalculate.js" import {walletStore} from "@/store/wallet"; import { BlockChain } from "@/components/chain/BlockChain" -import LazyLoadImg from "@/components/lazyloadimg" -import placeholderImg from '@/assets/img/marketplace/GenesisHeroes_NFT.png' import { useMarketplaceStore } from "@/store/marketplace" @@ -113,7 +111,22 @@ const addCart = async (val) => { } ] } + try { + + let res = await marketplaceList.getCartListState() + if (res.data && res.data.length) { + const currency = res.data[0].event?.data?.buy[0].contract_address || '' + const type = res.data[0].event?.data?.buy[0].item_type || '' + const currentCurrency = val.event?.data?.buy[0].contract_address || '' + const currentType = val.event?.data?.buy[0].item_type || '' + if (currency != currentCurrency || type != currentType) { + // TODO: 提示用户添加相同类型的商品 + alert('Please add the same type of item to the shopping cart') + return + } + } + const { errcode, errmsg } = await marketplaceList.addCartListState(data) console.log(errcode, errmsg) if(errcode == 0) {