From 6868d11062eee872c88113f8ce47dd73818ec195 Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Sat, 29 Jun 2024 14:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E6=97=B6,=20=E5=88=A4=E6=96=AD=E5=87=BA=E5=94=AE=E7=9A=84?= =?UTF-8?q?=E8=B4=A7=E5=B8=81=E6=98=AF=E5=90=A6=E5=92=8C=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E9=87=8C=E7=9A=84=E7=9B=B8=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/card.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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) {