|
|
|
@ -10,12 +10,15 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="staff-info">🧑🍳 {{ staff.nickname }} — 别摸鱼了!</view> |
|
|
|
<view class="staff-info"> |
|
|
|
🧑🍳 {{ staff.nickname }} — 别摸鱼了! |
|
|
|
<text v-if="staff.unread > 0" class="staff-unread">💬 {{ 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)"> |
|
|
|
{{ t.label }} |
|
|
|
<text v-if="t.status !== 2" class="tab-count">{{ counts[t.status] }}</text> |
|
|
|
<text class="tab-count">{{ counts[t.status] }}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -58,16 +61,27 @@ export default { |
|
|
|
const tabs = [{ status: 0, label: '🔔 新订单' },{ status: 1, label: '⚡ 进行中' },{ status: 2, label: '✅ 已完成' }] |
|
|
|
const activeTab = ref(0) |
|
|
|
const orders = ref([]) |
|
|
|
const counts = ref({ 0: 0, 1: 0 }) |
|
|
|
const recipeVisible = ref(false) |
|
|
|
const recipeCardNo = ref('') |
|
|
|
const recipeItems = ref([]) |
|
|
|
const counts = ref({ 0: 0, 1: 0, 2: 0 }) |
|
|
|
|
|
|
|
async function loadOrders() { |
|
|
|
try { const res = await get(API.STAFF_ORDERS, { status: activeTab.value }); if (Array.isArray(res)) orders.value = res } catch (e) {} |
|
|
|
try { |
|
|
|
const params = { status: activeTab.value } |
|
|
|
if (activeTab.value === 2) params.include_cancel = 1 |
|
|
|
const res = await get(API.STAFF_ORDERS, params) |
|
|
|
if (Array.isArray(res)) orders.value = res |
|
|
|
} catch (e) {} |
|
|
|
} |
|
|
|
async function loadCounts() { |
|
|
|
try { const r0 = await get(API.STAFF_ORDERS, { status: 0 }); const r1 = await get(API.STAFF_ORDERS, { status: 1 }); counts.value = { 0: Array.isArray(r0) ? r0.length : 0, 1: Array.isArray(r1) ? r1.length : 0 } } catch (e) {} |
|
|
|
try { |
|
|
|
const r0 = await get(API.STAFF_ORDERS, { status: 0 }) |
|
|
|
const r1 = await get(API.STAFF_ORDERS, { status: 1 }) |
|
|
|
const r2 = await get(API.STAFF_ORDERS, { status: 2, include_cancel: 1 }) |
|
|
|
counts.value = { |
|
|
|
0: Array.isArray(r0) ? r0.length : 0, |
|
|
|
1: Array.isArray(r1) ? r1.length : 0, |
|
|
|
2: Array.isArray(r2) ? r2.length : 0 |
|
|
|
} |
|
|
|
} 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) {} } |
|
|
|
@ -93,7 +107,8 @@ export default { |
|
|
|
.nav-logo{font-size:44rpx} |
|
|
|
.nav-brand{font-size:32rpx;font-weight:900;color:var(--gold)} |
|
|
|
.logout-btn{font-size:26rpx;color:var(--red)} |
|
|
|
.staff-info{background:var(--bg-card);padding:16rpx 32rpx;font-size:24rpx;color:var(--text-dim);border-bottom:1px solid var(--border)} |
|
|
|
.staff-info{background:var(--bg-card);padding:16rpx 32rpx;font-size:24rpx;color:var(--text-dim);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between} |
|
|
|
.staff-unread{color:var(--red);font-weight:700;font-size:22rpx} |
|
|
|
.board-tabs{display:flex;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:50;background:var(--bg);flex-shrink:0} |
|
|
|
.board-tab{flex:1;padding:24rpx;text-align:center;font-size:26rpx;font-weight:600;color:var(--text-dim);border-bottom:4rpx solid transparent} |
|
|
|
.board-tab.active{color:var(--gold);border-bottom-color:var(--gold)} |
|
|
|
|