|
|
|
@ -27,7 +27,7 @@ |
|
|
|
<!-- 底部栏: 红酒杯(左) + 出餐铃(中) --> |
|
|
|
<view class="bottom-bar"> |
|
|
|
<view class="wine-glass" @tap="showCart = true"> |
|
|
|
<text class="glass-icon">🍷</text> |
|
|
|
<text class="glass-icon">🍸</text> |
|
|
|
<text v-if="cart.totalCount > 0" class="glass-count">{{ cart.totalCount }}</text> |
|
|
|
</view> |
|
|
|
<view class="press-bell-wrapper" @tap="onBellPress"> |
|
|
|
@ -92,15 +92,27 @@ export default { |
|
|
|
try { |
|
|
|
const res = await get(API.MENU_CATEGORIES) |
|
|
|
if (Array.isArray(res)) { |
|
|
|
// 智能排序:全部 + 鸡尾酒优先,其余按后端顺序 |
|
|
|
const cocktail = res.filter(c => c.includes('鸡尾酒')) |
|
|
|
const others = res.filter(c => !c.includes('鸡尾酒')) |
|
|
|
const sorted = ['all', ...cocktail, ...others] |
|
|
|
// 智能排序:全部 + 鸡尾酒 + 限定特调 + 嗨棒 + 其他 |
|
|
|
const priority = ['鸡尾酒', '限定特调', '嗨棒'] |
|
|
|
const matched = [] |
|
|
|
const rest = [] |
|
|
|
for (const c of res) { |
|
|
|
if (priority.some(k => c.includes(k))) matched.push(c) |
|
|
|
else rest.push(c) |
|
|
|
} |
|
|
|
// 按 priority 顺序排列 matched |
|
|
|
matched.sort((a, b) => { |
|
|
|
const ai = priority.findIndex(k => a.includes(k)) |
|
|
|
const bi = priority.findIndex(k => b.includes(k)) |
|
|
|
return ai - bi |
|
|
|
}) |
|
|
|
const sorted = ['all', ...matched, ...rest] |
|
|
|
categories.value = sorted |
|
|
|
// 默认选中鸡尾酒;没有则选全部 |
|
|
|
if (cocktail.length > 0) { |
|
|
|
activeCate.value = cocktail[0] |
|
|
|
await loadProducts(cocktail[0]) |
|
|
|
const cocktail = sorted.find(c => c.includes('鸡尾酒')) |
|
|
|
if (cocktail) { |
|
|
|
activeCate.value = cocktail |
|
|
|
await loadProducts(cocktail) |
|
|
|
} else { |
|
|
|
await loadProducts('all') |
|
|
|
} |
|
|
|
@ -197,3 +209,4 @@ export default { |
|
|
|
.cart-footer{padding:24rpx 40rpx 40rpx;flex-shrink:0} |
|
|
|
.next-btn{width:100%;height:96rpx;border-radius:28rpx;background:linear-gradient(135deg,var(--orange),var(--red));color:#fff;border:none;font-size:32rpx;font-weight:800;box-shadow:0 8rpx 40rpx rgba(255,107,53,.35)} |
|
|
|
</style> |
|
|
|
|