|
|
@ -10,15 +10,12 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="staff-info"> |
|
|
|
|
|
🧑🍳 {{ staff.nickname }} — 别摸鱼了! |
|
|
|
|
|
<text v-if="staff.unread > 0" class="staff-unread">💬 {{ staff.unread }}条新消息</text> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="staff-info">🧑🍳 {{ staff.nickname }} — 别摸鱼了!</view> |
|
|
|
|
|
|
|
|
<view class="board-tabs"> |
|
|
<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)"> |
|
|
<view v-for="t in tabs" :key="t.status" class="board-tab" :class="{ active: activeTab === t.status }" @tap="switchTab(t.status)"> |
|
|
{{ t.label }} |
|
|
{{ t.label }} |
|
|
<text class="tab-count">{{ counts[t.status] }}</text> |
|
|
|
|
|
|
|
|
<text class="tab-count">{{ counts[t.status] || 0 }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
@ -26,7 +23,7 @@ |
|
|
<OrderCard v-for="o in orders" :key="o.id" :order="o"> |
|
|
<OrderCard v-for="o in orders" :key="o.id" :order="o"> |
|
|
<template #actions> |
|
|
<template #actions> |
|
|
<view class="board-actions"> |
|
|
<view class="board-actions"> |
|
|
<button class="ba-btn ba-gold" @tap="onDetail(o)">📖 配方</button> |
|
|
|
|
|
|
|
|
<button class="ba-btn ba-gold" @tap="onDetail(o)">📖 详情</button> |
|
|
<button class="ba-btn ba-blue" @tap="onChat(o)">💬 聊天</button> |
|
|
<button class="ba-btn ba-blue" @tap="onChat(o)">💬 聊天</button> |
|
|
<button v-if="o.status===0" class="ba-btn ba-gold" @tap="onConfirm(o.id)">✅ 接单</button> |
|
|
<button v-if="o.status===0" class="ba-btn ba-gold" @tap="onConfirm(o.id)">✅ 接单</button> |
|
|
<button v-if="o.status===0" class="ba-btn ba-red" @tap="onCancel(o.id)">❌ 拒单</button> |
|
|
<button v-if="o.status===0" class="ba-btn ba-red" @tap="onCancel(o.id)">❌ 拒单</button> |
|
|
@ -41,7 +38,7 @@ |
|
|
<text class="empty-text">暂无订单</text> |
|
|
<text class="empty-text">暂无订单</text> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<RecipeModal :visible="recipeVisible" :cardNo="recipeCardNo" :items="recipeItems" @close="recipeVisible=false" /> |
|
|
|
|
|
|
|
|
<RecipeModal v-if="recipeVisible" :visible="recipeVisible" :cardNo="recipeCardNo" :items="recipeItems" @close="recipeVisible=false" /> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -62,6 +59,9 @@ export default { |
|
|
const activeTab = ref(0) |
|
|
const activeTab = ref(0) |
|
|
const orders = ref([]) |
|
|
const orders = ref([]) |
|
|
const counts = ref({ 0: 0, 1: 0, 2: 0 }) |
|
|
const counts = ref({ 0: 0, 1: 0, 2: 0 }) |
|
|
|
|
|
const recipeVisible = ref(false) |
|
|
|
|
|
const recipeCardNo = ref('') |
|
|
|
|
|
const recipeItems = ref([]) |
|
|
|
|
|
|
|
|
async function loadOrders() { |
|
|
async function loadOrders() { |
|
|
try { |
|
|
try { |
|
|
@ -73,9 +73,11 @@ export default { |
|
|
} |
|
|
} |
|
|
async function loadCounts() { |
|
|
async function loadCounts() { |
|
|
try { |
|
|
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 }) |
|
|
|
|
|
|
|
|
const [r0, r1, r2] = await Promise.all([ |
|
|
|
|
|
get(API.STAFF_ORDERS, { status: 0 }), |
|
|
|
|
|
get(API.STAFF_ORDERS, { status: 1 }), |
|
|
|
|
|
get(API.STAFF_ORDERS, { status: 2, include_cancel: 1 }) |
|
|
|
|
|
]) |
|
|
counts.value = { |
|
|
counts.value = { |
|
|
0: Array.isArray(r0) ? r0.length : 0, |
|
|
0: Array.isArray(r0) ? r0.length : 0, |
|
|
1: Array.isArray(r1) ? r1.length : 0, |
|
|
1: Array.isArray(r1) ? r1.length : 0, |
|
|
@ -84,9 +86,9 @@ export default { |
|
|
} catch (e) {} |
|
|
} catch (e) {} |
|
|
} |
|
|
} |
|
|
function switchTab(s) { activeTab.value = s; loadOrders() } |
|
|
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) {} } |
|
|
|
|
|
|
|
|
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 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 } |
|
|
function onRecipe(order) { recipeCardNo.value = order.cardNo; recipeItems.value = order.items; recipeVisible.value = true } |
|
|
function onChat(order) { uni.setStorageSync('chatCardNo', order.cardNo); uni.navigateTo({ url: '/pages/staff/chat' }) } |
|
|
function onChat(order) { uni.setStorageSync('chatCardNo', order.cardNo); uni.navigateTo({ url: '/pages/staff/chat' }) } |
|
|
@ -107,9 +109,8 @@ export default { |
|
|
.nav-logo{font-size:44rpx} |
|
|
.nav-logo{font-size:44rpx} |
|
|
.nav-brand{font-size:32rpx;font-weight:900;color:var(--gold)} |
|
|
.nav-brand{font-size:32rpx;font-weight:900;color:var(--gold)} |
|
|
.logout-btn{font-size:26rpx;color:var(--red)} |
|
|
.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);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} |
|
|
|
|
|
|
|
|
.staff-info{background:var(--bg-card);padding:16rpx 32rpx;font-size:24rpx;color:var(--text-dim);border-bottom:1px solid var(--border)} |
|
|
|
|
|
.board-tabs{display:flex;border-bottom:1px solid var(--border);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{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)} |
|
|
.board-tab.active{color:var(--gold);border-bottom-color:var(--gold)} |
|
|
.tab-count{margin-left:8rpx;color:var(--red);font-size:22rpx} |
|
|
.tab-count{margin-left:8rpx;color:var(--red);font-size:22rpx} |
|
|
|