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
+9 -15
View File
@@ -154,12 +154,12 @@
</view>
</view>
<view v-if="payShow">
<view v-if="index === 0">
<card_payment
ref="paymentRef"
@updataList="clearSearch"
@updatePrice="updatePrice"
:addShow="addShow"
:addShow="hasPaymentBar"
:minSalesCountShow="navName === '折扣区'"
:bottomOffset="tabbarBottomOffset"
/>
@@ -216,7 +216,7 @@
const getCartList = async () => {
const res = await api.getShopCartList({});
if (res.code === 0) {
payShow.value = index.value === 0 && Boolean(res.data.length || addShow.value);
hasPaymentBar.value = index.value === 0 && Boolean(res.data.length);
}
};
@@ -255,13 +255,12 @@
const index = ref(0);
const height = ref(`${baseHeight}px`);
const payShow = ref(false);
const addShow = ref(false);
const hasPaymentBar = ref(false);
watch(
() => payShow.value,
() => hasPaymentBar.value,
() => {
const extra = payShow.value ? paymentBarReserve : 0;
const extra = hasPaymentBar.value ? paymentBarReserve : 0;
height.value = `${baseHeight - extra}px`;
},
{ immediate: true },
@@ -342,11 +341,7 @@
const paymentRef = ref(null);
const addCar = (data) => {
payShow.value = index.value === 0;
addShow.value = true;
setTimeout(() => {
paymentRef.value?.addCar(data);
}, 500);
paymentRef.value?.addCar(data);
};
const navChange = (i) => {
@@ -356,13 +351,12 @@
if (index.value === 0) {
getCartList();
} else {
payShow.value = false;
hasPaymentBar.value = false;
}
};
const updatePrice = (val) => {
addShow.value = val;
getCartList();
hasPaymentBar.value = Boolean(val);
};
function shipment() {