feat: 购物车为空时底部不显示“去结算”

This commit is contained in:
2026-06-05 17:20:49 +08:00
parent 70cbccbb52
commit 2449d67e53
7 changed files with 104 additions and 73 deletions
+10 -16
View File
@@ -1,6 +1,10 @@
<template>
<view>
<view class="card_payment flex-center ju-between bg16 h_128 p-l-34 p-r-40" :style="{ bottom: props.bottomOffset + 'px' }">
<view
v-if="barVisible"
class="card_payment flex-center ju-between bg16 h_128 p-l-34 p-r-40"
:style="{ bottom: props.bottomOffset + 'px' }"
>
<view class="flex-center ju-flex-start flex1" @click="showPopup">
<uni-badge :text="num" absolute="rightTop" :offset="[13, 6]">
<view class="w_80 h_80 m-r-24">
@@ -120,14 +124,9 @@
const cartList = ref([]);
let price = ref(0);
let num = ref(0);
let addShow1 = ref(false)
watch(() => props.addShow, () => {
addShow1.value = props.addShow
}, {
immediate: true,
deep: true
})
const getCartList = (val : any = true) => {
const barVisible = computed(() => Array.isArray(cartList.value) && cartList.value.length > 0);
const getCartList = () => {
num.value = 0;
price.value = 0;
SpuApi.getShopCartList({}).then((res) => {
@@ -146,14 +145,9 @@
});
price.value += e.discountedPrice;
});
addShow1.value = true
} else {
if (!val) {
addShow1.value = false
}
}
cartList.value = list;
proxy.$emit('updatePrice', addShow1.value);
proxy.$emit('updatePrice', list.length > 0);
});
};
@@ -252,7 +246,7 @@
// 删除接口
SpuApi.deleteShopCart({ id: v.id }).then((res) => {
if (res.code === 0) {
getCartList(false);
getCartList();
proxy.$emit('updataList');
}
});