添加购物车时, 判断出售的货币是否和购物车里的相同
This commit is contained in:
parent
bc3df5383b
commit
6868d11062
@ -41,8 +41,6 @@ import ImgCard from "@/components/common/imgCard.vue"
|
|||||||
import {priceCalculated} from "@/configs/priceCalculate.js"
|
import {priceCalculated} from "@/configs/priceCalculate.js"
|
||||||
import {walletStore} from "@/store/wallet";
|
import {walletStore} from "@/store/wallet";
|
||||||
import { BlockChain } from "@/components/chain/BlockChain"
|
import { BlockChain } from "@/components/chain/BlockChain"
|
||||||
import LazyLoadImg from "@/components/lazyloadimg"
|
|
||||||
import placeholderImg from '@/assets/img/marketplace/GenesisHeroes_NFT.png'
|
|
||||||
import {
|
import {
|
||||||
useMarketplaceStore
|
useMarketplaceStore
|
||||||
} from "@/store/marketplace"
|
} from "@/store/marketplace"
|
||||||
@ -113,7 +111,22 @@ const addCart = async (val) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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)
|
const { errcode, errmsg } = await marketplaceList.addCartListState(data)
|
||||||
console.log(errcode, errmsg)
|
console.log(errcode, errmsg)
|
||||||
if(errcode == 0) {
|
if(errcode == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user