|
|
|
@ -10,7 +10,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="staff-info">🧑🍳 {{ staff.nickname }} — 别摸鱼了!<text v-if="staff.unread > 0" style="color:var(--red);margin-left:16rpx">💬 {{ staff.unread }}条新消息</text></view> |
|
|
|
<view class="staff-info">🧑🍳 {{ staff.nickname }} — 别摸鱼了!<text v-if="staff.unread > 0" style="color:var(--red);margin-left:16rpx">💬 {{ staff.unread > 9 ? '9+' : staff.unread }}条新消息</text></view> |
|
|
|
|
|
|
|
<view class="board-tabs"> |
|
|
|
<view v-for="t in tabs" :key="t.status" class="board-tab" :class="{ active: activeTab === t.status }" @tap="switchTab(t.status)"> |
|
|
|
@ -85,6 +85,14 @@ export default { |
|
|
|
} |
|
|
|
} catch (e) {} |
|
|
|
} |
|
|
|
async function checkUnread() { |
|
|
|
try { |
|
|
|
const res = await get(API.MESSAGE_UNREAD, { card_no: 'all', staff_id: staff.staffId }) |
|
|
|
if (res && typeof res.count !== 'undefined') { |
|
|
|
staff.unread = res.count |
|
|
|
} |
|
|
|
} catch (e) {} |
|
|
|
} |
|
|
|
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) {} } |
|
|
|
@ -95,11 +103,11 @@ export default { |
|
|
|
function onLogout() { staff.logout(); uni.redirectTo({ url: '/pages/staff/login' }) } |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
loadOrders(); loadCounts(); startPoll('board', () => { loadOrders(); loadCounts() }, 10000) |
|
|
|
loadOrders(); loadCounts(); checkUnread(); startPoll('board', () => { loadOrders(); loadCounts(); checkUnread() }, 10000) |
|
|
|
}) |
|
|
|
onUnmounted(() => stopPoll('board')) |
|
|
|
|
|
|
|
return { staff, tabs, activeTab, orders, counts, recipeVisible, recipeCardNo, recipeItems, switchTab, onConfirm, onCancel, onDone, onDetail, onRecipe, onChat, onLogout } |
|
|
|
return { staff, tabs, activeTab, orders, counts, recipeVisible, recipeCardNo, recipeItems, switchTab, onConfirm, onCancel, onDone, onDetail, onRecipe, onChat, onLogout, checkUnread } |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
@ -126,3 +134,4 @@ export default { |
|
|
|
.empty-icon{font-size:112rpx;opacity:.3} |
|
|
|
.empty-text{font-size:28rpx;color:var(--text-muted);margin-top:16rpx} |
|
|
|
</style> |
|
|
|
|