地图订单修改
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// 员工界面 - 全屏工作面板
|
||||
import { UserInfo } from '../../types';
|
||||
import userService from '../../services/userService';
|
||||
import statisticsService from '../../services/statisticsService';
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@@ -81,15 +82,22 @@ Page({
|
||||
/**
|
||||
* 加载工作统计数据
|
||||
*/
|
||||
loadWorkStats() {
|
||||
// 模拟加载工作统计数据
|
||||
this.setData({
|
||||
workStats: {
|
||||
todayOrders: 8,
|
||||
completedOrders: 5,
|
||||
pendingOrders: 3
|
||||
}
|
||||
});
|
||||
async loadWorkStats() {
|
||||
try {
|
||||
// 调用API获取工作统计数据
|
||||
const workStats = await statisticsService.getWorkStats();
|
||||
this.setData({ workStats });
|
||||
} catch (error) {
|
||||
console.error('加载工作统计数据失败:', error);
|
||||
// 如果API调用失败,设置默认值
|
||||
this.setData({
|
||||
workStats: {
|
||||
todayOrders: 0,
|
||||
completedOrders: 0,
|
||||
pendingOrders: 0
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -260,8 +260,10 @@ Page({
|
||||
},
|
||||
endPoint: {
|
||||
name: endName,
|
||||
longitude: 102.715 + (Math.random() - 0.5) * 0.1,
|
||||
latitude: 25.045 + (Math.random() - 0.5) * 0.1
|
||||
// 后端服务器应该根据地址名称进行地理编码
|
||||
// 这里只提供地址名称,由后端处理坐标获取
|
||||
longitude: 0,
|
||||
latitude: 0
|
||||
},
|
||||
status: 'pending',
|
||||
goodsType,
|
||||
@@ -316,21 +318,17 @@ Page({
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 调用删除订单接口
|
||||
// orderService.deleteOrder(orderId).then(() => {
|
||||
// this.showSuccess('订单删除成功');
|
||||
// this.refreshData();
|
||||
// }).catch(error => {
|
||||
// console.error('删除订单失败:', error);
|
||||
// this.showError('删除订单失败');
|
||||
// });
|
||||
|
||||
// 暂时使用模拟删除
|
||||
const orders = this.data.orders.filter(order => order.id !== orderId);
|
||||
this.setData({
|
||||
orders
|
||||
orderService.deleteOrder(orderId).then((result) => {
|
||||
if (result.success) {
|
||||
this.showSuccess('订单删除成功');
|
||||
this.refreshData();
|
||||
} else {
|
||||
this.showError(result.message || '删除失败');
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('删除订单失败:', error);
|
||||
this.showError('删除订单失败');
|
||||
});
|
||||
this.filterOrders();
|
||||
this.showSuccess('订单删除成功');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -426,6 +424,11 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 阻止事件冒泡
|
||||
stopPropagation(e: any) {
|
||||
// 阻止事件冒泡,不执行任何操作
|
||||
},
|
||||
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
wx.navigateBack();
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="order-actions" wx:if="{{item.status === 'pending'}}">
|
||||
<view class="order-actions" wx:if="{{item.status === 'pending'}}" catchtap="stopPropagation">
|
||||
<button class="action-btn assign-btn" bindtap="handleOrderTap" data-id="{{item.id}}">分配</button>
|
||||
<button class="action-btn delete-btn" bindtap="deleteOrder" data-id="{{item.id}}">删除</button>
|
||||
</view>
|
||||
|
||||
@@ -11,9 +11,9 @@ Page({
|
||||
totalOrders: 0, // 总订单数
|
||||
completedOrders: 0, // 已完成订单数
|
||||
pendingOrders: 0, // 待处理订单数
|
||||
deliveryRate: 0, // 配送成功率
|
||||
averageTime: 0 // 平均配送时间
|
||||
},
|
||||
averageDeliveryTime: 0, // 平均配送时间(分钟)
|
||||
timestamp: 0 // 数据时间戳
|
||||
} as any,
|
||||
// 系统统计数据
|
||||
systemStats: {
|
||||
employeeCount: 0, // 员工总数
|
||||
@@ -103,15 +103,9 @@ Page({
|
||||
*/
|
||||
async getPersonalStats() {
|
||||
try {
|
||||
// 这里应该调用个人统计API
|
||||
// 暂时使用模拟数据
|
||||
return {
|
||||
totalOrders: 156,
|
||||
completedOrders: 142,
|
||||
pendingOrders: 14,
|
||||
deliveryRate: 91.0,
|
||||
averageTime: 45
|
||||
};
|
||||
// 调用个人统计API
|
||||
const personalStats = await statisticsService.getPersonalStats();
|
||||
return personalStats;
|
||||
} catch (error) {
|
||||
console.error('获取个人统计数据失败:', error);
|
||||
// 返回默认值
|
||||
@@ -119,8 +113,8 @@ Page({
|
||||
totalOrders: 0,
|
||||
completedOrders: 0,
|
||||
pendingOrders: 0,
|
||||
deliveryRate: 0,
|
||||
averageTime: 0
|
||||
averageDeliveryTime: 0,
|
||||
timestamp: Date.now()
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user