2024-06-24 11:27:51 +08:00

138 lines
2.9 KiB
Vue

<template>
<div class="cart">
<div class="cart-header">
<div>My Cart ( 0 ) <span @click="clearCart">Clear</span></div>
<div class="close" @click="closeCart">
<img src="@/assets/img/marketplace/closeicon.png" alt="">
</div>
</div>
<div class="cart-content">
<div class="cart-not">
<p>You have no items in your cart</p>
</div>
<div class="cart-list">
</div>
<!-- <div class="cart-price">
<div class="left">Total Price</div>
<div class="right">
<div>0.08 <img src="@/assets/img/marketplace/ETHicon.png" alt=""></div>
<div> {{ 200 }}$</div>
</div>
</div> -->
<!-- <div class="cart-btn">Buy All</div> -->
<div class="cart-btn" @click="toMarketplace">Selet NFTs to Buy</div>
</div>
</div>
</template>
<script setup>
import { ref, defineEmits, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router";
import { useImmutableStore } from "@/store/immutable"
import {
apiGetCartList,
apiClearCartList,
} from "@/utils/marketplace"
const router = useRouter();
// console.log(marketplaceStore.cartList,'Cart-------')
const emit = defineEmits(['clickStatusChild'])
const immutableStore = useImmutableStore()
// const token = immutableStore.accessToken
const closeCart = () => {
emit('closeCart')
}
const toMarketplace = () => {
emit('closeCart')
router.push('/marketplace');
}
const clearCart = async () => {
console.log('清楚购物车')
try {
let res = await apiClearCartList()
console.log(res)
} catch (e) {
console.log(e)
}
}
const getCartList = async () => {
let token = localStorage.getItem('assessToken')
if(token) {
try {
let res = await apiGetCartList()
console.log(res,'----')
} catch (e) {
console.log(e)
}
}
}
onMounted(()=> {
getCartList()
})
</script>
<style lang="scss" scoped>
.cart {
width: 480px;
// height: 100%;
color: #BB7FFF;
.cart-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30px;
padding-bottom: 5px;
border-bottom: 2px solid #3D4057;
div {
font-family: 'Poppins';
font-weight: bold;
font-size: 22px;
color: #fefefe;
span {
color: #00FF00;
margin-left: 10px;
cursor: pointer;
}
}
.close {
width: 30px;
height: 30px;
cursor: pointer;
img {
width: 100%;
height: 100%;
}
}
}
.cart-content {
padding: 30px;
.cart-not {
text-align: center;
margin-bottom: 30px;
font-size: 24px;
color: #fff;
}
.cart-list {}
.cart-btn {
width: 100%;
height: 60px;
line-height: 60px;
font-family: 'Poppins';
font-weight: bold;
font-size: 30px;
background: #6336D7;
color: #fff;
text-align: center;
border-radius: 18px;
cursor: pointer;
}
}
}
</style>