修正不同货币商品能同时加入购物车的bug

This commit is contained in:
CounterFire2023 2024-07-02 17:03:12 +08:00
parent 2fe89f5304
commit 9500eb815d

View File

@ -117,7 +117,7 @@ const addCart = async (val) => {
}
try {
debugger
let res = await marketplaceList.getCartListState()
if (res.data && res.data.length) {
let exists = res.data.find(item => {
@ -133,13 +133,15 @@ const addCart = async (val) => {
const currentCurrency = val.event?.data?.buy[0].contract_address || ''
const currentType = val.event?.data?.buy[0].item_type || ''
if (currency != currentCurrency || type != currentType) {
if (currency == currentCurrency && type == currentType) {
const { errcode, errmsg } = await marketplaceList.addCartListState(data)
console.log(errcode, errmsg)
if(errcode == 0) {
message.success('success! Add from cart')
marketplaceList.getCartList = await marketplaceList.getCartListState()
}
} else {
message.error('The currency is different, please empty the shopping cart first')
}
} else {
const { errcode, errmsg } = await marketplaceList.addCartListState(data)