diff --git a/yshop-drink-uniapp-vue3/pages.json b/yshop-drink-uniapp-vue3/pages.json index ab5398d..f997788 100644 --- a/yshop-drink-uniapp-vue3/pages.json +++ b/yshop-drink-uniapp-vue3/pages.json @@ -13,7 +13,7 @@ "path" : "pages/menu/menu", "style" : { - "navigationBarTitleText": "点餐", + "navigationBarTitleText": "点单", "enablePullDownRefresh": true } @@ -224,7 +224,7 @@ }, { "pagePath": "pages/menu/menu", - "text": "点餐", + "text": "点单", "iconPath": "static/images/tabBar/drink.png", "selectedIconPath": "static/images/tabBar/drink-selected.png" }, { diff --git a/yshop-drink-uniapp-vue3/pages/index/index.vue b/yshop-drink-uniapp-vue3/pages/index/index.vue index b37b6ae..7318f46 100644 --- a/yshop-drink-uniapp-vue3/pages/index/index.vue +++ b/yshop-drink-uniapp-vue3/pages/index/index.vue @@ -77,7 +77,7 @@ 自取 下单免排队 - 去下单 > + 去下单 > 外卖 美食送到家 - 去下单 > + 去下单 > 可抵扣商品价格哦 - 去领个券 > + 去领个券 > @@ -127,7 +127,7 @@ 进入积分商城兑换优惠券 - 逛一逛 > + 逛一逛 > diff --git a/yshop-drink-uniapp-vue3/pages/menu/menu.vue b/yshop-drink-uniapp-vue3/pages/menu/menu.vue index 058484d..0861d72 100644 --- a/yshop-drink-uniapp-vue3/pages/menu/menu.vue +++ b/yshop-drink-uniapp-vue3/pages/menu/menu.vue @@ -147,7 +147,7 @@ @tap="onCartPayTap" :disabled="cart.length > 0 && disabledPay" > - {{ !cart.length ? '去点餐' : (disabledPay ? `差${spread}元起送` : '去结算') }} + {{ !cart.length ? '去点单' : (disabledPay ? `差${spread}元起送` : '去结算') }} @@ -390,25 +390,40 @@ const formatMoney = (n) => { return Math.round(x * 100) % 100 === 0 ? String(Math.round(x)) : x.toFixed(2) } const deliveryTipText = computed(() => { - if (!canShowDeliveryTip.value || !deliveryTipReady.value) return '' - const fee = menuDeliveryFee.value - const freeAt = freeDeliveryAmount.value const cartAmount = parseFloat(getCartGoodsPrice.value) || 0 - if (fee <= 0) { - return cartAmount > 0 ? '已免配送费' : (freeAt > 0 - ? `另需配送费 0 元(满 ${formatMoney(freeAt)} 元免配送费)` - : '') - } - if (cartAmount <= 0) { - return freeAt > 0 - ? `另需配送费 ${formatMoney(fee)} 元(满 ${formatMoney(freeAt)} 元免配送费)` + const minPrice = parseFloat(store.value?.minPrice) || 0 + const underMin = orderType.value === 'takeout' && minPrice > 0 && cartAmount < minPrice + const minOrderTip = underMin ? `满 ${formatMoney(minPrice)} 元起送` : '' + + if (canShowDeliveryTip.value && deliveryTipReady.value) { + const fee = menuDeliveryFee.value + const freeAt = freeDeliveryAmount.value + let suffix = '' + if (underMin) { + suffix = minOrderTip + } else if (freeAt > 0 && fee > 0) { + if (cartAmount <= 0) { + suffix = `满 ${formatMoney(freeAt)} 元免配送费` + } else { + const need = Math.max(0, parseFloat((freeAt - cartAmount).toFixed(2))) + suffix = `还需 ${formatMoney(need)} 元免配送费` + } + } + + if (fee <= 0) { + if (cartAmount > 0 && !underMin) return '已免配送费' + return suffix || '' + } + return suffix + ? `另需配送费 ${formatMoney(fee)} 元(${suffix})` : `另需配送费 ${formatMoney(fee)} 元` } - if (freeAt > 0) { - const need = Math.max(0, parseFloat((freeAt - cartAmount).toFixed(2))) - return `另需配送费 ${formatMoney(fee)} 元(还需 ${formatMoney(need)} 元免配送费)` + + // 未达起送价时,即使暂无配送费预估也展示起送提示 + if (minOrderTip && (cart.value.length > 0 || canShowDeliveryTip.value)) { + return minOrderTip } - return `另需配送费 ${formatMoney(fee)} 元` + return '' }) const filteredGoods = computed(() => { const query = keyword.value.trim().toLowerCase()