diff --git a/pages/staff/board.vue b/pages/staff/board.vue index 789c096..afe9876 100644 --- a/pages/staff/board.vue +++ b/pages/staff/board.vue @@ -10,15 +10,12 @@ - - 🧑‍🍳 {{ staff.nickname }} — 别摸鱼了! - 💬 {{ staff.unread }}条新消息 - + 🧑‍🍳 {{ staff.nickname }} — 别摸鱼了! {{ t.label }} - {{ counts[t.status] }} + {{ counts[t.status] || 0 }} @@ -26,7 +23,7 @@ @@ -62,6 +59,9 @@ export default { const activeTab = ref(0) const orders = ref([]) const counts = ref({ 0: 0, 1: 0, 2: 0 }) + const recipeVisible = ref(false) + const recipeCardNo = ref('') + const recipeItems = ref([]) async function loadOrders() { try { @@ -73,9 +73,11 @@ export default { } async function loadCounts() { 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 = { 0: Array.isArray(r0) ? r0.length : 0, 1: Array.isArray(r1) ? r1.length : 0, @@ -84,9 +86,9 @@ export default { } 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) {} } - 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 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' }) } @@ -107,9 +109,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);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.active{color:var(--gold);border-bottom-color:var(--gold)} .tab-count{margin-left:8rpx;color:var(--red);font-size:22rpx} diff --git a/pages/staff/login.vue b/pages/staff/login.vue index e3343b9..7dce488 100644 --- a/pages/staff/login.vue +++ b/pages/staff/login.vue @@ -6,13 +6,13 @@ 别再摸鱼了,起来干活! - - - + + + - - ← 返回顾客端 + + ← 返回顾客端 @@ -36,13 +36,20 @@ export default { uni.showToast({ title: '请输入账号密码', icon: 'none' }) return } + if (loading.value) return loading.value = true try { const res = await post(API.STAFF_LOGIN, { username: username.value, password: password.value }) + if (!res || !res.token) { + uni.showToast({ title: '登录失败', icon: 'none' }) + loading.value = false + return + } staff.login(res.token, res.nickname, res.staffId) - uni.redirectTo({ url: '/pages/staff/board' }) - } catch (e) {} - loading.value = false + uni.reLaunch({ url: '/pages/staff/board' }) + } catch (e) { + loading.value = false + } } function goBack() { uni.navigateBack() } @@ -61,5 +68,6 @@ export default { .login-form{width:100%} .form-input{width:100%;height:96rpx;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 32rpx;font-size:30rpx;color:var(--text);margin-bottom:24rpx} .login-submit{width:100%;height:96rpx;border-radius:24rpx;background:linear-gradient(135deg,var(--gold-dark),var(--gold));color:#1A1A1A;border:none;font-size:32rpx;font-weight:800;margin-top:16rpx;display:flex;align-items:center;justify-content:center} +.back-link{margin-top:24rpx;color:var(--text-muted);font-size:24rpx} @keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-16rpx)}} diff --git a/uni.scss b/uni.scss index 8d04cf4..a3f6308 100644 --- a/uni.scss +++ b/uni.scss @@ -1,5 +1,5 @@ // 纯瘾大 全局样式 -view,text,button,input,scroll-view,image,navigator,swiper,swiper-item{box-sizing:border-box} +page,view,text,button,input,scroll-view,image,navigator,swiper,swiper-item{box-sizing:border-box} page { --bg: #0D0D0D; @@ -22,19 +22,13 @@ page { --radius-xs: 12rpx; --nav-h: 100rpx; --safe-b: 68rpx; - --status-h: var(--status-bar-height); background-color: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 28rpx; min-height: 100vh; width: 100%; -} - -// 自定义导航栏基类(所有页面 nav-bar 继承) -page .nav-bar { - padding-top: var(--status-bar-height); - box-sizing: content-box; + padding-top: 44px; } // 动画