修改购物车数据获取方式

This commit is contained in:
CounterFire2023 2024-07-03 23:57:30 +08:00
parent c4dd560aa3
commit c009eab0d6
2 changed files with 20 additions and 20 deletions

View File

@ -87,6 +87,7 @@ function hideModal(result = null) {
} */
.cf-overlay {
z-index: 1000;
width: 1140px;
min-height: 500px;
background: #1a1821;

View File

@ -53,7 +53,7 @@
</template>
<script setup>
import { ref, onMounted, inject } from "vue"
import { ref, onMounted, inject, computed } from "vue"
const message = inject('$message')
import ImgCard from "@/components/common/imgCard.vue"
import ConfirmDialog from "@/components/Dialogs/confirmDialog.vue";
@ -68,11 +68,26 @@ import {
apiDelCartList,
apiClearCartList,
} from "@/utils/marketplace"
import { computed } from "vue";
const router = useRouter();
const emit = defineEmits(['clickStatusChild'])
const cartList = ref()
// const cartList = ref()
const cartList = computed(() => {
let datas = marketplaceList.getCartList.data
for (let sub of datas) {
if (sub.event?.data) {
const _data = formatPrice(sub.event.data)
sub.icon = _data.icon
sub.usd = _data.usd
sub.currencyName = _data.currencyName
sub.amount = _data.amount
sub.tokenAmount = _data.tokenAmount
sub.decimals = _data.decimals
}
}
return datas
})
const closeCart = () => {
emit('closeCart')
@ -120,23 +135,7 @@ const getCartList = async () => {
// if(token) {
try {
let res = await marketplaceList.getCartListState()
console.log(res)
if (res.data && res.data.length > 0) {
for (let sub of res.data) {
if (sub.event?.data) {
const _data = formatPrice(sub.event.data)
sub.icon = _data.icon
sub.usd = _data.usd
sub.currencyName = _data.currencyName
sub.amount = _data.amount
sub.tokenAmount = _data.tokenAmount
sub.decimals = _data.decimals
}
}
}
console.log(res)
cartList.value = res.data
marketplaceList.getCartList = res
} catch (e) {
console.log(e)