修改购物车数据获取方式
This commit is contained in:
parent
c4dd560aa3
commit
c009eab0d6
@ -87,6 +87,7 @@ function hideModal(result = null) {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
.cf-overlay {
|
.cf-overlay {
|
||||||
|
z-index: 1000;
|
||||||
width: 1140px;
|
width: 1140px;
|
||||||
min-height: 500px;
|
min-height: 500px;
|
||||||
background: #1a1821;
|
background: #1a1821;
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, inject } from "vue"
|
import { ref, onMounted, inject, computed } from "vue"
|
||||||
const message = inject('$message')
|
const message = inject('$message')
|
||||||
import ImgCard from "@/components/common/imgCard.vue"
|
import ImgCard from "@/components/common/imgCard.vue"
|
||||||
import ConfirmDialog from "@/components/Dialogs/confirmDialog.vue";
|
import ConfirmDialog from "@/components/Dialogs/confirmDialog.vue";
|
||||||
@ -68,11 +68,26 @@ import {
|
|||||||
apiDelCartList,
|
apiDelCartList,
|
||||||
apiClearCartList,
|
apiClearCartList,
|
||||||
} from "@/utils/marketplace"
|
} from "@/utils/marketplace"
|
||||||
import { computed } from "vue";
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const emit = defineEmits(['clickStatusChild'])
|
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 = () => {
|
const closeCart = () => {
|
||||||
emit('closeCart')
|
emit('closeCart')
|
||||||
@ -120,23 +135,7 @@ const getCartList = async () => {
|
|||||||
// if(token) {
|
// if(token) {
|
||||||
try {
|
try {
|
||||||
let res = await marketplaceList.getCartListState()
|
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
|
marketplaceList.getCartList = res
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user