From 67eb3312b25d27ed4fa07b18d583e64f95177de4 Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 8 Jun 2026 17:24:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20R5=E4=BF=AE=E5=A4=8D=20=E2=80=94=20?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F/box-sizing/=E5=8F=8C=E9=87=8D?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC/=E6=8B=92=E5=8D=95/=E6=9C=AA=E8=AF=BB?= =?UTF-8?q?=E8=AE=A1=E6=95=B0/ProductCard=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ProductCard.vue | 8 ++++---- pages.json | 19 ++++++++++--------- pages/chat/chat.vue | 15 +++++++-------- pages/index/index.vue | 32 +++++++++++++++++--------------- pages/staff/board.vue | 5 ++++- pages/staff/chat.vue | 6 ++++-- stores/card.js | 6 +++++- stores/staff.js | 6 +++++- uni.scss | 2 ++ 9 files changed, 58 insertions(+), 41 deletions(-) diff --git a/components/ProductCard.vue b/components/ProductCard.vue index 6455950..45d1b47 100644 --- a/components/ProductCard.vue +++ b/components/ProductCard.vue @@ -22,12 +22,12 @@ export default { diff --git a/pages.json b/pages.json index 2e105bd..fdfc2ca 100644 --- a/pages.json +++ b/pages.json @@ -1,16 +1,17 @@ { "pages": [ - { "path": "pages/index/index", "style": { "navigationBarTitleText": "纯瘾大" } }, - { "path": "pages/menu/menu", "style": { "navigationBarTitleText": "酒水单" } }, - { "path": "pages/confirm/confirm", "style": { "navigationBarTitleText": "确认下单" } }, - { "path": "pages/orders/orders", "style": { "navigationBarTitleText": "我的订单" } }, - { "path": "pages/chat/chat", "style": { "navigationBarTitleText": "对话" } }, - { "path": "pages/staff/login", "style": { "navigationBarTitleText": "调酒师登录" } }, - { "path": "pages/staff/board", "style": { "navigationBarTitleText": "订单看板" } }, - { "path": "pages/staff/detail", "style": { "navigationBarTitleText": "订单详情" } }, - { "path": "pages/staff/chat", "style": { "navigationBarTitleText": "客人对话" } } + { "path": "pages/index/index", "style": { "navigationStyle": "custom" } }, + { "path": "pages/menu/menu", "style": { "navigationStyle": "custom" } }, + { "path": "pages/confirm/confirm", "style": { "navigationStyle": "custom" } }, + { "path": "pages/orders/orders", "style": { "navigationStyle": "custom" } }, + { "path": "pages/chat/chat", "style": { "navigationStyle": "custom" } }, + { "path": "pages/staff/login", "style": { "navigationStyle": "custom" } }, + { "path": "pages/staff/board", "style": { "navigationStyle": "custom" } }, + { "path": "pages/staff/detail", "style": { "navigationStyle": "custom" } }, + { "path": "pages/staff/chat", "style": { "navigationStyle": "custom" } } ], "globalStyle": { + "navigationStyle": "custom", "navigationBarTextStyle": "white", "navigationBarTitleText": "纯瘾大", "navigationBarBackgroundColor": "#0D0D0D", diff --git a/pages/chat/chat.vue b/pages/chat/chat.vue index 06b20e1..854b5a3 100644 --- a/pages/chat/chat.vue +++ b/pages/chat/chat.vue @@ -19,7 +19,7 @@ diff --git a/pages/staff/board.vue b/pages/staff/board.vue index e501a52..b7c483b 100644 --- a/pages/staff/board.vue +++ b/pages/staff/board.vue @@ -26,6 +26,7 @@ + @@ -70,6 +71,7 @@ export default { } function switchTab(s) { activeTab.value = s; loadOrders() } async function onConfirm(id) { try { await post(API.STAFF_CONFIRM, { id }); uni.showToast({ title: '已接单 ✅', icon: 'none' }); loadOrders(); loadCounts() } catch (e) {} } + async function onCancel(id) { try { await post(API.STAFF_CANCEL, { id }); uni.showToast({ title: '已拒单 ❌', icon: 'none' }); loadOrders(); loadCounts() } catch (e) {} } async function onDone(id) { try { const res = await post(API.STAFF_DONE, { id }); uni.showToast({ title: res && res.released ? '已结单 ✔ 号码已释放' : '已结单 ✔', icon: 'none' }); loadOrders(); loadCounts() } catch (e) {} } function onDetail(order) { uni.navigateTo({ url: '/pages/staff/detail?id=' + order.id }) } function onRecipe(order) { recipeCardNo.value = order.cardNo; recipeItems.value = order.items; recipeVisible.value = true } @@ -79,7 +81,7 @@ export default { onMounted(() => { loadOrders(); loadCounts(); startPoll('board', () => { loadOrders(); loadCounts() }, 10000) }) onUnmounted(() => stopPoll('board')) - return { staff, tabs, activeTab, orders, counts, recipeVisible, recipeCardNo, recipeItems, switchTab, onConfirm, onDone, onDetail, onRecipe, onChat, onLogout } + return { staff, tabs, activeTab, orders, counts, recipeVisible, recipeCardNo, recipeItems, switchTab, onConfirm, onCancel, onDone, onDetail, onRecipe, onChat, onLogout } } } @@ -101,6 +103,7 @@ export default { .ba-btn{padding:12rpx 24rpx;border-radius:24rpx;font-size:24rpx;font-weight:600;border:none} .ba-gold{background:rgba(245,166,35,.15);color:var(--gold)} .ba-blue{background:rgba(74,144,217,.15);color:var(--blue)} +.ba-red{background:rgba(255,59,59,.15);color:var(--red)} .empty-state{flex:1;display:flex;align-items:center;justify-content:center;flex-direction:column} .empty-icon{font-size:112rpx;opacity:.3} .empty-text{font-size:28rpx;color:var(--text-muted);margin-top:16rpx} diff --git a/pages/staff/chat.vue b/pages/staff/chat.vue index fe59f11..b1a7ff6 100644 --- a/pages/staff/chat.vue +++ b/pages/staff/chat.vue @@ -40,6 +40,8 @@ export default { try { const res = await get(API.MESSAGE_LIST, { card_no: cardNo.value, since: lastId }) if (Array.isArray(res) && res.length > 0) { + const newMsgs = res.filter(m => m.senderType === 'customer') + if (newMsgs.length > 0) staff.incrementUnread(newMsgs.length) messages.value = [...messages.value, ...res] lastId = res[res.length - 1].id scrollToId.value = 'chat-bottom' @@ -57,9 +59,9 @@ export default { } catch (e) {} } - function goBack() { uni.navigateBack() } + function goBack() { staff.clearUnread(); uni.navigateBack() } - onMounted(() => { loadMessages(); startPoll('staffChat', loadMessages, 5000) }) + onMounted(() => { staff.clearUnread(); loadMessages(); startPoll('staffChat', loadMessages, 5000) }) onUnmounted(() => stopPoll('staffChat')) return { cardNo, messages, inputText, scrollToId, sendMsg, goBack } diff --git a/stores/card.js b/stores/card.js index 388dc5f..0de28f9 100644 --- a/stores/card.js +++ b/stores/card.js @@ -4,6 +4,7 @@ import { ref } from 'vue' export const useCardStore = defineStore('card', () => { const cardNo = ref(uni.getStorageSync('cardNo') || '') const dismissed = ref(false) + const unread = ref(0) function setCardNo(no) { cardNo.value = no @@ -15,5 +16,8 @@ export const useCardStore = defineStore('card', () => { uni.removeStorageSync('cardNo') } - return { cardNo, dismissed, setCardNo, clearCard } + function incrementUnread(n = 1) { unread.value += n } + function clearUnread() { unread.value = 0 } + + return { cardNo, dismissed, unread, setCardNo, clearCard, incrementUnread, clearUnread } }) diff --git a/stores/staff.js b/stores/staff.js index f8bf9c2..0d9ec8b 100644 --- a/stores/staff.js +++ b/stores/staff.js @@ -22,10 +22,14 @@ export const useStaffStore = defineStore('staff', () => { token.value = '' nickname.value = '' staffId.value = '' + unread.value = 0 uni.removeStorageSync('staffToken') uni.removeStorageSync('staffNickname') uni.removeStorageSync('staffId') } - return { token, nickname, staffId, unread, isLoggedIn, login, logout } + function incrementUnread(n = 1) { unread.value += n } + function clearUnread() { unread.value = 0 } + + return { token, nickname, staffId, unread, isLoggedIn, login, logout, incrementUnread, clearUnread } }) diff --git a/uni.scss b/uni.scss index 87a3137..8a1e6f9 100644 --- a/uni.scss +++ b/uni.scss @@ -1,4 +1,6 @@ // 纯瘾大 全局样式 (严格对齐 UI/css/miniapp.css) +*,*::before,*::after{box-sizing:border-box} + page { --bg: #0D0D0D; --bg-card: #1A1A1A;