diff --git a/mini_program/driver-mp/.env.development b/mini_program/driver-mp/.env.development
new file mode 100644
index 0000000..0d59fd9
--- /dev/null
+++ b/mini_program/driver-mp/.env.development
@@ -0,0 +1,3 @@
+# 开发环境配置
+VUE_APP_API_BASE_URL=http://localhost:3002/api/driver
+VUE_APP_USE_MOCK=false
\ No newline at end of file
diff --git a/mini_program/driver-mp/.env.production b/mini_program/driver-mp/.env.production
new file mode 100644
index 0000000..f5565ae
--- /dev/null
+++ b/mini_program/driver-mp/.env.production
@@ -0,0 +1,3 @@
+# 生产环境配置
+VUE_APP_API_BASE_URL=https://yourdomain.com/api/driver
+VUE_APP_USE_MOCK=false
\ No newline at end of file
diff --git a/mini_program/driver-mp/README.md b/mini_program/driver-mp/README.md
new file mode 100644
index 0000000..0ab3d37
--- /dev/null
+++ b/mini_program/driver-mp/README.md
@@ -0,0 +1,122 @@
+# 司机端小程序
+
+活牛运输司机小程序,用于活牛采购智能数字化系统中的运输环节管理。
+
+## 项目介绍
+
+司机端小程序是活牛采购智能数字化系统的重要组成部分,主要服务于活牛运输司机,提供任务接收、位置上报、状态监控、交付确认等功能。
+
+## 功能特性
+
+- 用户认证:手机号验证码登录
+- 任务管理:查看、接受、拒绝运输任务
+- 运输监控:实时位置上报、牛只状态监控
+- 车辆管理:车辆信息维护
+- 交付确认:完成运输任务并确认交付
+
+## 技术栈
+
+- 框架:uni-app + Vue 3
+- 状态管理:Pinia
+- 语言:JavaScript/TypeScript
+- 构建工具:Vite
+- UI:uni-ui
+
+## 目录结构
+
+```
+src/
+├── components/ # 公共组件
+├── pages/ # 页面
+│ ├── auth/ # 认证相关页面
+│ ├── index/ # 首页
+│ ├── task/ # 任务相关页面
+│ ├── transport/ # 运输相关页面
+│ ├── delivery/ # 交付相关页面
+│ └── vehicle/ # 车辆相关页面
+├── static/ # 静态资源
+├── stores/ # 状态管理
+├── utils/ # 工具函数
+├── App.vue # 根组件
+├── main.js # 入口文件
+├── manifest.json # 项目配置
+└── pages.json # 页面配置
+```
+
+## 开发环境
+
+### 环境要求
+
+- Node.js >= 16.0.0
+- 微信开发者工具
+
+### 安装依赖
+
+```bash
+npm install
+```
+
+### 启动开发服务器
+
+```bash
+# 启动微信小程序开发环境
+npm run dev
+
+# 启动H5开发环境
+npm run dev:h5
+```
+
+### 构建生产版本
+
+```bash
+# 构建微信小程序生产版本
+npm run build
+
+# 构建H5生产版本
+npm run build:h5
+```
+
+## 页面说明
+
+| 页面路径 | 功能说明 |
+|---------|---------|
+| /pages/auth/login | 登录页面 |
+| /pages/index/index | 首页 |
+| /pages/task/task-list | 任务列表 |
+| /pages/task/task-detail | 任务详情 |
+| /pages/transport/location-report | 位置上报 |
+| /pages/transport/status-report | 状态上报 |
+| /pages/delivery/delivery-confirm | 交付确认 |
+| /pages/vehicle/vehicle-info | 车辆信息 |
+
+## 状态管理
+
+使用 Pinia 进行状态管理,包含以下模块:
+
+- user: 用户信息管理
+- task: 任务信息管理
+
+## 网络请求
+
+封装了统一的网络请求模块,包含:
+
+- request.js: 基础请求封装
+- api.js: 接口封装
+
+## 工具函数
+
+包含常用的工具函数:
+
+- formatDate: 时间格式化
+- debounce: 防抖函数
+- throttle: 节流函数
+- deepClone: 深拷贝
+- validatePhone: 手机号验证
+- validatePlateNumber: 车牌号验证
+
+## 注意事项
+
+1. 开发时请遵循项目代码规范
+2. 新增页面需要在 pages.json 中注册
+3. 接口请求统一使用封装的 request 模块
+4. 状态管理使用 Pinia,避免直接操作全局数据
\ No newline at end of file
diff --git a/mini_program/driver-mp/package.json b/mini_program/driver-mp/package.json
index f0e5ab2..bfc2f47 100644
--- a/mini_program/driver-mp/package.json
+++ b/mini_program/driver-mp/package.json
@@ -2,12 +2,25 @@
"name": "driver-mp",
"version": "1.0.0",
"description": "活牛运输司机小程序",
- "main": "main.js",
+ "main": "src/main.js",
"scripts": {
- "dev": "uni -p mp-weixin"
+ "dev": "uni -p mp-weixin",
+ "build": "uni build -p mp-weixin",
+ "dev:h5": "uni -p h5",
+ "build:h5": "uni build -p h5"
},
"dependencies": {
"@dcloudio/uni-app": "^3.0.0",
- "pinia": "^2.0.0"
+ "@dcloudio/uni-ui": "^1.4.0",
+ "pinia": "^2.0.0",
+ "@dcloudio/uni-components": "^3.0.0"
+ },
+ "devDependencies": {
+ "@dcloudio/uni-cli-shared": "^3.0.0",
+ "@dcloudio/uni-template-compiler": "^3.0.0",
+ "@dcloudio/types": "^3.3.0",
+ "typescript": "^5.0.0",
+ "vite": "^4.4.0",
+ "@vue/tsconfig": "^0.1.3"
}
}
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/App.vue b/mini_program/driver-mp/src/App.vue
new file mode 100644
index 0000000..45531dc
--- /dev/null
+++ b/mini_program/driver-mp/src/App.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/main.js b/mini_program/driver-mp/src/main.js
new file mode 100644
index 0000000..4f64df3
--- /dev/null
+++ b/mini_program/driver-mp/src/main.js
@@ -0,0 +1,11 @@
+import { createSSRApp } from 'vue';
+import App from './App.vue';
+import store from './stores';
+
+export function createApp() {
+ const app = createSSRApp(App);
+ app.use(store);
+ return {
+ app
+ };
+}
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/manifest.json b/mini_program/driver-mp/src/manifest.json
new file mode 100644
index 0000000..5038302
--- /dev/null
+++ b/mini_program/driver-mp/src/manifest.json
@@ -0,0 +1,19 @@
+{
+ "name": "driver-mp",
+ "appid": "__UNI__DRIVERMP",
+ "description": "活牛运输司机小程序",
+ "versionName": "1.0.0",
+ "versionCode": "100",
+ "transformPx": false,
+ "mp-weixin": {
+ "appid": "wx-your-driver-appid-here",
+ "setting": {
+ "urlCheck": false,
+ "es6": true,
+ "postcss": true,
+ "minified": true
+ },
+ "usingComponents": true
+ },
+ "vueVersion": "3"
+}
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages.json b/mini_program/driver-mp/src/pages.json
new file mode 100644
index 0000000..05acad7
--- /dev/null
+++ b/mini_program/driver-mp/src/pages.json
@@ -0,0 +1,84 @@
+{
+ "pages": [
+ {
+ "path": "pages/auth/login",
+ "style": {
+ "navigationBarTitleText": "登录"
+ }
+ },
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationBarTitleText": "司机首页"
+ }
+ },
+ {
+ "path": "pages/task/task-list",
+ "style": {
+ "navigationBarTitleText": "任务列表"
+ }
+ },
+ {
+ "path": "pages/task/task-detail",
+ "style": {
+ "navigationBarTitleText": "任务详情"
+ }
+ },
+ {
+ "path": "pages/transport/location-report",
+ "style": {
+ "navigationBarTitleText": "位置上报"
+ }
+ },
+ {
+ "path": "pages/transport/status-report",
+ "style": {
+ "navigationBarTitleText": "状态上报"
+ }
+ },
+ {
+ "path": "pages/delivery/delivery-confirm",
+ "style": {
+ "navigationBarTitleText": "交付确认"
+ }
+ },
+ {
+ "path": "pages/vehicle/vehicle-info",
+ "style": {
+ "navigationBarTitleText": "车辆信息"
+ }
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "司机端",
+ "navigationBarBackgroundColor": "#f8f8f8",
+ "backgroundColor": "#f8f8f8"
+ },
+ "tabBar": {
+ "color": "#7A7E83",
+ "selectedColor": "#1989fa",
+ "borderStyle": "black",
+ "backgroundColor": "#ffffff",
+ "list": [
+ {
+ "pagePath": "pages/index/index",
+ "iconPath": "static/tabbar/home.png",
+ "selectedIconPath": "static/tabbar/home-active.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/task/task-list",
+ "iconPath": "static/tabbar/task.png",
+ "selectedIconPath": "static/tabbar/task-active.png",
+ "text": "任务"
+ },
+ {
+ "pagePath": "pages/transport/location-report",
+ "iconPath": "static/tabbar/location.png",
+ "selectedIconPath": "static/tabbar/location-active.png",
+ "text": "运输"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/auth/login.vue b/mini_program/driver-mp/src/pages/auth/login.vue
new file mode 100644
index 0000000..92c6c8f
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/auth/login.vue
@@ -0,0 +1,241 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 登录即表示您同意《用户协议》和《隐私政策》
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue b/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue
new file mode 100644
index 0000000..da45874
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/delivery/delivery-confirm.vue
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+ 订单号:
+ {{ deliveryInfo.orderId }}
+
+
+ 供应商:
+ {{ deliveryInfo.supplier }}
+
+
+ 目的地:
+ {{ deliveryInfo.destination }}
+
+
+ 计划到达:
+ {{ deliveryInfo.plannedArrival }}
+
+
+ 实际到达:
+
+
+
+
+
+
+
+
+
+
+ 品种:
+ {{ deliveryInfo.cattleInfo.breed }}
+
+
+ 数量:
+ {{ deliveryInfo.cattleInfo.quantity }}头
+
+
+ 重量:
+ {{ deliveryInfo.cattleInfo.weight }}
+
+
+
+
+
+
+
+
+
+ 签收人:
+
+
+
+ 联系电话:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ×
+
+
+
+ +
+ 上传照片
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/index/index.vue b/mini_program/driver-mp/src/pages/index/index.vue
new file mode 100644
index 0000000..f721cb0
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/index/index.vue
@@ -0,0 +1,420 @@
+
+
+
+
+
+
+
+
+
+
+
+ 订单号:
+ {{ currentTask.orderId }}
+
+
+ 供应商:
+ {{ currentTask.supplier }}
+
+
+ 目的地:
+ {{ currentTask.destination }}
+
+
+ 预计时间:
+ {{ currentTask.estimatedTime }}
+
+
+
+
+
+
+
+
+
+
+ 快捷操作
+
+
+
+ {{ action.icon }}
+
+ {{ action.title }}
+
+
+
+
+
+
+
+
+
+ 姓名:
+ {{ userStore.userInfo.name }}
+
+
+ 手机号:
+ {{ userStore.userInfo.phone }}
+
+
+ 车牌号:
+ {{ userStore.userInfo.licensePlate || '未设置' }}
+
+
+
+
+
+
+
+
+
+ 系统通知
+
+
+ 您有1个新任务待接受
+ 5分钟前
+
+
+ 请记得每30分钟上报一次位置
+ 1小时前
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/task/task-detail.vue b/mini_program/driver-mp/src/pages/task/task-detail.vue
new file mode 100644
index 0000000..60f75b4
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/task/task-detail.vue
@@ -0,0 +1,287 @@
+
+
+
+
+
+
+ {{ taskDetail.statusText }}
+
+
+
+
+
+
+
+ 订单号:
+ {{ taskDetail.orderId }}
+
+
+ 创建时间:
+ {{ taskDetail.createTime }}
+
+
+
+
+
+
+
+
+
+ 品种:
+ {{ taskDetail.cattleInfo.breed }}
+
+
+ 数量:
+ {{ taskDetail.cattleInfo.quantity }}头
+
+
+ 重量:
+ {{ taskDetail.cattleInfo.weight }}
+
+
+
+
+
+
+
+
+
+ 名称:
+ {{ taskDetail.supplier }}
+
+
+ 联系人:
+ {{ taskDetail.supplierContact }}
+ 拨号
+
+
+
+
+
+
+
+
+
+ 地址:
+ {{ taskDetail.destination }}
+
+
+ 联系人:
+ {{ taskDetail.destinationContact }}
+ 拨号
+
+
+
+
+
+
+
+
+
+ 车牌号:
+ {{ taskDetail.vehicleInfo.plateNumber }}
+
+
+ 司机:
+ {{ taskDetail.vehicleInfo.driver }}
+
+
+ 预计发车:
+ {{ taskDetail.estimatedDeparture }}
+
+
+ 实际发车:
+ {{ taskDetail.actualDeparture }}
+
+
+ 预计到达:
+ {{ taskDetail.estimatedArrival }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/task/task-list.vue b/mini_program/driver-mp/src/pages/task/task-list.vue
new file mode 100644
index 0000000..e6ca93c
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/task/task-list.vue
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+ {{ status.name }}
+
+
+
+
+
+
+
+
+
+
+ 供应商:
+ {{ task.supplier }}
+
+
+ 目的地:
+ {{ task.destination }}
+
+
+ 创建时间:
+ {{ task.createTime }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/transport/location-report.vue b/mini_program/driver-mp/src/pages/transport/location-report.vue
new file mode 100644
index 0000000..f86ffde
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/transport/location-report.vue
@@ -0,0 +1,266 @@
+
+
+
+
+
+
+
+ 地图区域
+ 显示当前位置和行驶轨迹
+
+
+
+
+
+
+
+
+ 经度:
+ {{ locationInfo.longitude || '未获取' }}
+
+
+ 纬度:
+ {{ locationInfo.latitude || '未获取' }}
+
+
+ 地址:
+ {{ locationInfo.address || '未获取' }}
+
+
+ 获取时间:
+ {{ locationInfo.reportTime || '未获取' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ record.time }}
+ {{ record.address }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/transport/status-report.vue b/mini_program/driver-mp/src/pages/transport/status-report.vue
new file mode 100644
index 0000000..1fc5f9e
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/transport/status-report.vue
@@ -0,0 +1,354 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 📹
+ 点击上传视频
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ×
+
+
+
+ +
+ 上传图片
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/pages/vehicle/vehicle-info.vue b/mini_program/driver-mp/src/pages/vehicle/vehicle-info.vue
new file mode 100644
index 0000000..adfc805
--- /dev/null
+++ b/mini_program/driver-mp/src/pages/vehicle/vehicle-info.vue
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
+
+ 车牌号
+
+
+
+
+ 车辆类型
+ vehicleForm.vehicleType = vehicleTypes[e.detail.value].value"
+ >
+
+ {{ vehicleTypes.find(item => item.value === vehicleForm.vehicleType)?.label || '请选择车辆类型' }}
+
+
+
+
+
+ 载重量(吨)
+
+
+
+
+
+
+
+
+
+
+
+
+ ×
+
+
+
+ +
+ 上传照片
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/stores/index.js b/mini_program/driver-mp/src/stores/index.js
new file mode 100644
index 0000000..5c81454
--- /dev/null
+++ b/mini_program/driver-mp/src/stores/index.js
@@ -0,0 +1,5 @@
+import { createPinia } from 'pinia';
+
+const store = createPinia();
+
+export default store;
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/stores/task.js b/mini_program/driver-mp/src/stores/task.js
new file mode 100644
index 0000000..9fd8370
--- /dev/null
+++ b/mini_program/driver-mp/src/stores/task.js
@@ -0,0 +1,62 @@
+import { defineStore } from 'pinia';
+
+export const useTaskStore = defineStore('task', {
+ state: () => ({
+ // 任务列表
+ taskList: [],
+ // 当前任务
+ currentTask: null,
+ // 任务状态筛选
+ taskFilter: 'all'
+ }),
+
+ getters: {
+ // 根据状态筛选的任务列表
+ filteredTasks: (state) => {
+ if (state.taskFilter === 'all') {
+ return state.taskList;
+ }
+ return state.taskList.filter(task => task.status === state.taskFilter);
+ },
+
+ // 当前进行中的任务
+ ongoingTask: (state) => {
+ return state.taskList.find(task => task.status === 'ongoing') || null;
+ }
+ },
+
+ actions: {
+ // 设置任务列表
+ setTaskList(tasks) {
+ this.taskList = tasks;
+ },
+
+ // 添加任务
+ addTask(task) {
+ this.taskList.unshift(task);
+ },
+
+ // 更新任务
+ updateTask(updatedTask) {
+ const index = this.taskList.findIndex(task => task.id === updatedTask.id);
+ if (index !== -1) {
+ this.taskList[index] = { ...this.taskList[index], ...updatedTask };
+ }
+ },
+
+ // 设置当前任务
+ setCurrentTask(task) {
+ this.currentTask = task;
+ },
+
+ // 设置任务筛选状态
+ setTaskFilter(filter) {
+ this.taskFilter = filter;
+ },
+
+ // 根据ID获取任务详情
+ getTaskById(id) {
+ return this.taskList.find(task => task.id === id) || null;
+ }
+ }
+});
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/stores/user.js b/mini_program/driver-mp/src/stores/user.js
new file mode 100644
index 0000000..58cb72a
--- /dev/null
+++ b/mini_program/driver-mp/src/stores/user.js
@@ -0,0 +1,62 @@
+import { defineStore } from 'pinia';
+
+export const useUserStore = defineStore('user', {
+ state: () => ({
+ // 用户信息
+ userInfo: {
+ id: '',
+ name: '',
+ phone: '',
+ licensePlate: '',
+ vehicleType: ''
+ },
+ // 登录状态
+ isLogin: false,
+ // token
+ token: ''
+ }),
+
+ getters: {
+ // 是否已登录
+ loggedIn: (state) => state.isLogin,
+ // 用户姓名
+ userName: (state) => state.userInfo.name
+ },
+
+ actions: {
+ // 设置用户信息
+ setUserInfo(userInfo) {
+ this.userInfo = { ...this.userInfo, ...userInfo };
+ },
+
+ // 设置登录状态
+ setLoginStatus(status) {
+ this.isLogin = status;
+ },
+
+ // 设置token
+ setToken(token) {
+ this.token = token;
+ },
+
+ // 登录
+ login(userInfo, token) {
+ this.setUserInfo(userInfo);
+ this.setToken(token);
+ this.setLoginStatus(true);
+ },
+
+ // 登出
+ logout() {
+ this.userInfo = {
+ id: '',
+ name: '',
+ phone: '',
+ licensePlate: '',
+ vehicleType: ''
+ };
+ this.token = '';
+ this.isLogin = false;
+ }
+ }
+});
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/utils/api.js b/mini_program/driver-mp/src/utils/api.js
new file mode 100644
index 0000000..54a0231
--- /dev/null
+++ b/mini_program/driver-mp/src/utils/api.js
@@ -0,0 +1,58 @@
+import request from './request';
+
+// 用户相关接口
+export const userApi = {
+ // 登录
+ login: (data) => request.post('/auth/login', data),
+
+ // 获取用户信息
+ getUserInfo: () => request.get('/user/info'),
+
+ // 更新用户信息
+ updateUserInfo: (data) => request.put('/user/info', data),
+
+ // 上传车辆信息
+ uploadVehicleInfo: (data) => request.post('/user/vehicle', data)
+};
+
+// 任务相关接口
+export const taskApi = {
+ // 获取任务列表
+ getTaskList: (params) => request.get('/tasks', params),
+
+ // 获取任务详情
+ getTaskDetail: (id) => request.get(`/tasks/${id}`),
+
+ // 接受任务
+ acceptTask: (id) => request.post(`/tasks/${id}/accept`),
+
+ // 拒绝任务
+ rejectTask: (id, reason) => request.post(`/tasks/${id}/reject`, { reason }),
+
+ // 开始任务
+ startTask: (id) => request.post(`/tasks/${id}/start`),
+
+ // 完成任务
+ completeTask: (id) => request.post(`/tasks/${id}/complete`)
+};
+
+// 运输相关接口
+export const transportApi = {
+ // 上报位置
+ reportLocation: (data) => request.post('/transport/location', data),
+
+ // 上报状态
+ reportStatus: (data) => request.post('/transport/status', data),
+
+ // 获取运输轨迹
+ getTrack: (taskId) => request.get(`/transport/track/${taskId}`)
+};
+
+// 交付相关接口
+export const deliveryApi = {
+ // 确认交付
+ confirmDelivery: (data) => request.post('/delivery/confirm', data),
+
+ // 获取交付记录
+ getDeliveryRecords: (params) => request.get('/delivery/records', params)
+};
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/utils/index.js b/mini_program/driver-mp/src/utils/index.js
new file mode 100644
index 0000000..4d28099
--- /dev/null
+++ b/mini_program/driver-mp/src/utils/index.js
@@ -0,0 +1,100 @@
+// 工具函数集合
+
+/**
+ * 格式化时间
+ * @param {Date|string} date - 时间
+ * @param {string} format - 格式化字符串
+ * @returns {string} 格式化后的时间
+ */
+export function formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') {
+ if (!date) return '';
+
+ const d = new Date(date);
+ const year = d.getFullYear();
+ const month = String(d.getMonth() + 1).padStart(2, '0');
+ const day = String(d.getDate()).padStart(2, '0');
+ const hours = String(d.getHours()).padStart(2, '0');
+ const minutes = String(d.getMinutes()).padStart(2, '0');
+ const seconds = String(d.getSeconds()).padStart(2, '0');
+
+ return format
+ .replace('YYYY', year)
+ .replace('MM', month)
+ .replace('DD', day)
+ .replace('HH', hours)
+ .replace('mm', minutes)
+ .replace('ss', seconds);
+}
+
+/**
+ * 防抖函数
+ * @param {Function} func - 要防抖的函数
+ * @param {number} delay - 延迟时间(ms)
+ * @returns {Function} 防抖后的函数
+ */
+export function debounce(func, delay) {
+ let timer = null;
+ return function (...args) {
+ if (timer) clearTimeout(timer);
+ timer = setTimeout(() => {
+ func.apply(this, args);
+ }, delay);
+ };
+}
+
+/**
+ * 节流函数
+ * @param {Function} func - 要节流的函数
+ * @param {number} delay - 延迟时间(ms)
+ * @returns {Function} 节流后的函数
+ */
+export function throttle(func, delay) {
+ let lastTime = 0;
+ return function (...args) {
+ const now = Date.now();
+ if (now - lastTime > delay) {
+ lastTime = now;
+ func.apply(this, args);
+ }
+ };
+}
+
+/**
+ * 深拷贝对象
+ * @param {any} obj - 要拷贝的对象
+ * @returns {any} 拷贝后的对象
+ */
+export function deepClone(obj) {
+ if (obj === null || typeof obj !== 'object') return obj;
+ if (obj instanceof Date) return new Date(obj);
+ if (obj instanceof Array) return obj.map(item => deepClone(item));
+ if (obj instanceof Object) {
+ const clonedObj = {};
+ for (let key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ clonedObj[key] = deepClone(obj[key]);
+ }
+ }
+ return clonedObj;
+ }
+}
+
+/**
+ * 验证手机号
+ * @param {string} phone - 手机号
+ * @returns {boolean} 是否为有效手机号
+ */
+export function validatePhone(phone) {
+ const reg = /^1[3-9]\d{9}$/;
+ return reg.test(phone);
+}
+
+/**
+ * 验证车牌号
+ * @param {string} plate - 车牌号
+ * @returns {boolean} 是否为有效车牌号
+ */
+export function validatePlateNumber(plate) {
+ const reg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
+ return reg.test(plate);
+}
\ No newline at end of file
diff --git a/mini_program/driver-mp/src/utils/request.js b/mini_program/driver-mp/src/utils/request.js
new file mode 100644
index 0000000..fcb8a5f
--- /dev/null
+++ b/mini_program/driver-mp/src/utils/request.js
@@ -0,0 +1,144 @@
+// 网络请求封装
+class Request {
+ constructor(baseURL = '') {
+ this.baseURL = baseURL;
+ }
+
+ // 请求拦截器
+ interceptors = {
+ request: (config) => config,
+ response: (response) => response
+ };
+
+ // 设置请求拦截器
+ setRequestInterceptor(interceptor) {
+ this.interceptors.request = interceptor;
+ }
+
+ // 设置响应拦截器
+ setResponseInterceptor(interceptor) {
+ this.interceptors.response = interceptor;
+ }
+
+ // 通用请求方法
+ request(options) {
+ return new Promise((resolve, reject) => {
+ // 应用请求拦截器
+ const config = this.interceptors.request({
+ url: this.baseURL + options.url,
+ method: options.method || 'GET',
+ data: options.data || {},
+ header: options.header || {},
+ ...options
+ });
+
+ // 发起请求
+ uni.request({
+ ...config,
+ success: (res) => {
+ // 应用响应拦截器
+ const response = this.interceptors.response(res);
+ resolve(response);
+ },
+ fail: (err) => {
+ reject(err);
+ }
+ });
+ });
+ }
+
+ // GET请求
+ get(url, data = {}, options = {}) {
+ return this.request({
+ url,
+ method: 'GET',
+ data,
+ ...options
+ });
+ }
+
+ // POST请求
+ post(url, data = {}, options = {}) {
+ return this.request({
+ url,
+ method: 'POST',
+ data,
+ ...options
+ });
+ }
+
+ // PUT请求
+ put(url, data = {}, options = {}) {
+ return this.request({
+ url,
+ method: 'PUT',
+ data,
+ ...options
+ });
+ }
+
+ // DELETE请求
+ delete(url, data = {}, options = {}) {
+ return this.request({
+ url,
+ method: 'DELETE',
+ data,
+ ...options
+ });
+ }
+}
+
+// 创建请求实例
+const request = new Request('http://localhost:3002/api/driver');
+
+// 设置默认请求头
+request.setRequestInterceptor((config) => {
+ // 可以在这里添加token等认证信息
+ const token = uni.getStorageSync('driver_token');
+ if (token) {
+ config.header = {
+ ...config.header,
+ 'Authorization': `Bearer ${token}`
+ };
+ }
+
+ // 设置Content-Type
+ config.header = {
+ ...config.header,
+ 'Content-Type': 'application/json'
+ };
+
+ return config;
+});
+
+// 设置响应拦截器
+request.setResponseInterceptor((response) => {
+ const { data, statusCode } = response;
+
+ // 根据状态码处理响应
+ if (statusCode >= 200 && statusCode < 300) {
+ return data;
+ } else if (statusCode === 401) {
+ // token过期或未授权
+ uni.showToast({
+ title: '登录已过期,请重新登录',
+ icon: 'none'
+ });
+ // 可以在这里执行登出操作
+ setTimeout(() => {
+ uni.redirectTo({
+ url: '/pages/auth/login'
+ });
+ }, 1500);
+ return Promise.reject(data);
+ } else {
+ // 其他错误
+ uni.showToast({
+ title: data.message || '请求失败',
+ icon: 'none'
+ });
+ return Promise.reject(data);
+ }
+});
+
+export default request;
\ No newline at end of file
diff --git a/mini_program/driver-mp/tsconfig.json b/mini_program/driver-mp/tsconfig.json
new file mode 100644
index 0000000..8381a6d
--- /dev/null
+++ b/mini_program/driver-mp/tsconfig.json
@@ -0,0 +1,36 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "esnext",
+ "strict": true,
+ "jsx": "preserve",
+ "importHelpers": true,
+ "moduleResolution": "node",
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "sourceMap": true,
+ "baseUrl": ".",
+ "types": [
+ "@dcloudio/types",
+ "miniprogram-api-typings",
+ "mini-types"
+ ],
+ "paths": {
+ "@/*": [
+ "./src/*"
+ ]
+ },
+ "lib": [
+ "esnext",
+ "dom"
+ ]
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/**/*.tsx",
+ "src/**/*.vue"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}
\ No newline at end of file
diff --git a/mini_program/sales-mp/package.json b/mini_program/sales-mp/package.json
deleted file mode 100644
index e34af12..0000000
--- a/mini_program/sales-mp/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "sales-mp",
- "version": "1.0.0",
- "description": "活牛销售小程序",
- "main": "main.js",
- "scripts": {
- "dev": "uni -p mp-weixin"
- },
- "dependencies": {
- "@dcloudio/uni-app": "^3.0.0",
- "pinia": "^2.0.0"
- }
-}
\ No newline at end of file
diff --git a/mini_program/sales-mp/src/pages/index/index.vue b/mini_program/sales-mp/src/pages/index/index.vue
deleted file mode 100644
index ff86dfb..0000000
--- a/mini_program/sales-mp/src/pages/index/index.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- 活牛销售小程序首页
-
-
-
-
\ No newline at end of file
diff --git a/mini_program/staff极速快3-mp/package.json b/mini_program/staff极速快3-mp/package.json
deleted file mode 100644
index e69de29..0000000