添加管理员逻辑
This commit is contained in:
160
miniprogram/pages/staff/employee-dashboard.ts
Normal file
160
miniprogram/pages/staff/employee-dashboard.ts
Normal file
@@ -0,0 +1,160 @@
|
||||
// 员工界面 - 全屏工作面板
|
||||
import { UserInfo } from '../../types';
|
||||
|
||||
Page({
|
||||
data: {
|
||||
userInfo: null as UserInfo | null,
|
||||
// Grid布局的功能菜单
|
||||
menuItems: [
|
||||
{
|
||||
id: 'orders',
|
||||
name: '我的订单',
|
||||
icon: '📦',
|
||||
color: '#3498db',
|
||||
description: '查看分配订单'
|
||||
},
|
||||
{
|
||||
id: 'location',
|
||||
name: '位置上报',
|
||||
icon: '📍',
|
||||
color: '#e74c3c',
|
||||
description: '上报当前位置'
|
||||
},
|
||||
{
|
||||
id: 'schedule',
|
||||
name: '工作安排',
|
||||
icon: '📅',
|
||||
color: '#f39c12',
|
||||
description: '查看工作计划'
|
||||
},
|
||||
{
|
||||
id: 'profile',
|
||||
name: '个人信息',
|
||||
icon: '👤',
|
||||
color: '#9b59b6',
|
||||
description: '个人资料管理'
|
||||
},
|
||||
{
|
||||
id: 'messages',
|
||||
name: '消息通知',
|
||||
icon: '📨',
|
||||
color: '#34495e',
|
||||
description: '查看系统消息'
|
||||
},
|
||||
{
|
||||
id: 'help',
|
||||
name: '帮助中心',
|
||||
icon: '❓',
|
||||
color: '#27ae60',
|
||||
description: '使用帮助文档'
|
||||
}
|
||||
],
|
||||
// 工作统计
|
||||
workStats: {
|
||||
todayOrders: 0,
|
||||
completedOrders: 0,
|
||||
pendingOrders: 0
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.getUserInfo();
|
||||
this.loadWorkStats();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.loadWorkStats();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
getUserInfo() {
|
||||
const app = getApp<any>();
|
||||
if (app.globalData.userInfo) {
|
||||
const userInfo = app.globalData.userInfo;
|
||||
this.setData({ userInfo });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载工作统计数据
|
||||
*/
|
||||
loadWorkStats() {
|
||||
// 模拟加载工作统计数据
|
||||
this.setData({
|
||||
workStats: {
|
||||
todayOrders: 8,
|
||||
completedOrders: 5,
|
||||
pendingOrders: 3
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 菜单项点击事件
|
||||
*/
|
||||
onMenuItemTap(e: any) {
|
||||
const itemId = e.currentTarget.dataset.id;
|
||||
|
||||
switch (itemId) {
|
||||
case 'orders':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/my-orders'
|
||||
});
|
||||
break;
|
||||
case 'location':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/location-report'
|
||||
});
|
||||
break;
|
||||
case 'schedule':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/work-schedule'
|
||||
});
|
||||
break;
|
||||
case 'profile':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/profile'
|
||||
});
|
||||
break;
|
||||
case 'messages':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/messages'
|
||||
});
|
||||
break;
|
||||
case 'help':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/help'
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回首页
|
||||
*/
|
||||
goBack() {
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
onRefresh() {
|
||||
this.loadWorkStats();
|
||||
wx.showToast({
|
||||
title: '数据已刷新',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 紧急联系
|
||||
*/
|
||||
onEmergencyContact() {
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: '400-123-4567'
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user