添加购物车时, 判断出售的货币是否和购物车里的相同

This commit is contained in:
CounterFire2023 2024-06-29 14:08:39 +08:00
parent bc3df5383b
commit 6868d11062

View File

@ -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) {