From 140afd88a19d4c022f1595ffb09c8aa792e8c033 Mon Sep 17 00:00:00 2001 From: Kroytz Date: Fri, 24 Jul 2026 14:08:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(menu):=20=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E8=8E=AB=E5=90=8D=E5=85=B6=E5=A6=99=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yshop-drink-uniapp-vue3/pages/menu/menu.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/yshop-drink-uniapp-vue3/pages/menu/menu.vue b/yshop-drink-uniapp-vue3/pages/menu/menu.vue index 0861d72..437a958 100644 --- a/yshop-drink-uniapp-vue3/pages/menu/menu.vue +++ b/yshop-drink-uniapp-vue3/pages/menu/menu.vue @@ -137,7 +137,7 @@ {{ getCartGoodsNumber }} - + ¥{{ getCartGoodsPrice }} {{ deliveryTipText }} @@ -462,14 +462,12 @@ onHide(() => { }) onShow(() => { //init(); + isCartShow.value = true refreshCart() shopAd.value = uni.getStorageSync('shopAd') loadAddressesForDelivery() }) -const openCartShow = () =>{ - isCartShow.value = false -} const in_array = (search, array) => { for (var i in array) { if (array[i] == search) { @@ -751,6 +749,7 @@ const calcSize = () => { sizeCalcState.value = true } const handleAddToCart = (cate, newGood, num) =>{ //添加到购物车 + isCartShow.value = true const valueStr = newGood.valueStr || '' const index = cart.value.findIndex(item => item.id === newGood.id && item.valueStr === valueStr) if (index > -1) { @@ -769,6 +768,7 @@ const handleAddToCart = (cate, newGood, num) =>{ //添加到购物车 uni.setStorageSync('cart', JSON.parse(JSON.stringify(cart.value))) } const adjustSimpleGood = (cate, newGood, num) => { + isCartShow.value = true const valueStr = defaultSpec(newGood) const index = cart.value.findIndex(item => item.id === newGood.id && item.valueStr === valueStr) if (num > 0) { @@ -848,6 +848,8 @@ const handleAddToCartInModal = () => { closeGoodDetailModal() } const openCartPopup = () => { //打开/关闭购物车列表popup + isCartShow.value = true + if (!cart.value.length) return popup.value.open() } const handleCartClear = () => { //清空购物车 @@ -866,10 +868,12 @@ const handleCartClear = () => { //清空购物车 }) } const handleCartItemAdd = (index) => { + isCartShow.value = true cart.value[index].number += 1 uni.setStorageSync('cart', JSON.parse(JSON.stringify(cart.value))) } const handleCartItemReduce = (index) => { + isCartShow.value = true if (cart.value[index].number === 1) { cart.value.splice(index, 1) } else { @@ -877,6 +881,7 @@ const handleCartItemReduce = (index) => { } if (!cart.value.length) { cartPopupVisible.value = false + popup.value?.close?.() } uni.setStorageSync('cart', JSON.parse(JSON.stringify(cart.value))) }