增加当前物品是否在购物车的判断
This commit is contained in:
parent
6868d11062
commit
f2aea33b9c
@ -116,10 +116,19 @@ const addCart = async (val) => {
|
||||
|
||||
let res = await marketplaceList.getCartListState()
|
||||
if (res.data && res.data.length) {
|
||||
let exists = res.data.find(item => {
|
||||
return item.nft.token_id == val.nft.token_id && item.nft.contract_address == val.nft.contract_address
|
||||
})
|
||||
if (exists) {
|
||||
alert('already in the shopping cart')
|
||||
return
|
||||
}
|
||||
|
||||
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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user