diff --git a/pages.json b/pages.json index 605e1945..97b986cd 100644 --- a/pages.json +++ b/pages.json @@ -91,6 +91,41 @@ "navigationStyle": "custom" } }, + { + "path": "pages/mall/delivery/tasks", + "style": { + "navigationBarTitleText": "全部任务", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mall/delivery/task-detail", + "style": { + "navigationBarTitleText": "任务详情", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mall/delivery/profile-edit", + "style": { + "navigationBarTitleText": "编辑个人资料", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mall/delivery/ratings", + "style": { + "navigationBarTitleText": "评价", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mall/delivery/vehicle", + "style": { + "navigationBarTitleText": "车辆管理", + "navigationStyle": "custom" + } + }, { "path": "pages/mall/delivery/settings", "style": { diff --git a/pages/mall/delivery/index.uvue b/pages/mall/delivery/index.uvue index 1883070e..e3de0549 100644 --- a/pages/mall/delivery/index.uvue +++ b/pages/mall/delivery/index.uvue @@ -208,7 +208,7 @@ export default { data() { return { - isOnline: false, + isOnline: true, driverInfo: { id: '', @@ -429,6 +429,9 @@ // 任务操作方法 acceptTask() { // TODO: 调用API接受任务 + if (this.currentTask) { + this.currentTask.status = 2 // 更新状态为“已接取” + } uni.showToast({ title: '任务已接受', icon: 'success' @@ -437,6 +440,9 @@ startPickup() { // TODO: 调用API开始取货 + if (this.currentTask) { + this.currentTask.status = 3 // 更新状态为“取货中” + } uni.showToast({ title: '开始取货', icon: 'success' @@ -445,6 +451,9 @@ confirmPickup() { // TODO: 调用API确认取货 + if (this.currentTask) { + this.currentTask.status = 4 // 更新状态为“已取货” + } uni.showToast({ title: '取货完成', icon: 'success' @@ -453,6 +462,9 @@ startDelivery() { // TODO: 调用API开始配送 + if (this.currentTask) { + this.currentTask.status = 5 // 更新状态为“配送中” + } uni.showToast({ title: '开始配送', icon: 'success' @@ -460,13 +472,20 @@ }, confirmDelivery() { - // TODO: 调用API确认送达 - uni.showToast({ - title: '配送完成', - icon: 'success' - }) - this.currentTask = null - this.loadAvailableOrders() + // TODO: 调用API确认送达 + if (this.currentTask) { + // 1. 假设将订单状态更新为“已完成” (假设5表示已完成) + this.currentTask.status = 5; + // 2. 将已完成的任务保存到本地存储,以便历史订单页面可以读取 + const completedOrder = {...this.currentTask}; // 创建副本,避免引用问题 + uni.setStorageSync('completed_order_for_history', completedOrder); + } + uni.showToast({ + title: '配送完成', + icon: 'success' + }) + this.currentTask = null + this.loadAvailableOrders() }, contactCustomer() { @@ -1008,4 +1027,4 @@ text-align: center; font-weight: 500; } - + \ No newline at end of file diff --git a/pages/mall/delivery/order-history.uvue b/pages/mall/delivery/order-history.uvue index b7740adb..f069b122 100644 --- a/pages/mall/delivery/order-history.uvue +++ b/pages/mall/delivery/order-history.uvue @@ -1,311 +1,172 @@ - \ No newline at end of file diff --git a/pages/mall/delivery/profile.uvue b/pages/mall/delivery/profile.uvue index 1fd1882c..05e07c0b 100644 --- a/pages/mall/delivery/profile.uvue +++ b/pages/mall/delivery/profile.uvue @@ -1,8 +1,13 @@