refactor: 移除重复的用户服务协议内容并删除过时文档
移除payCard.vue、PaymentAgreementModal.vue和authCar/index.vue中重复定义的用户服务协议内容 删除已过时的src/api/README.md文档文件
Showing
4 changed files
with
1 additions
and
198 deletions
src/api/README.md
deleted
100644 → 0
| 1 | -# 订单管理 API 接口文档 | ||
| 2 | - | ||
| 3 | -本文档描述了车辆订单管理相关的API接口使用方法和集成指南。 | ||
| 4 | - | ||
| 5 | -## 文件结构 | ||
| 6 | - | ||
| 7 | -``` | ||
| 8 | -src/api/ | ||
| 9 | -├── orders.js # 订单相关API接口 | ||
| 10 | -├── index.js # 通用API接口 | ||
| 11 | -├── fn.js # API工具函数 | ||
| 12 | -└── README.md # 本文档 | ||
| 13 | -``` | ||
| 14 | - | ||
| 15 | -## 订单API接口 (orders.js) | ||
| 16 | - | ||
| 17 | -### 主要功能 | ||
| 18 | - | ||
| 19 | -- ✅ 获取我的订单列表 | ||
| 20 | -- ✅ 获取订单详情 | ||
| 21 | -- ✅ 删除订单 | ||
| 22 | -- ✅ 取消订单 | ||
| 23 | -- ✅ 确认收货 | ||
| 24 | -- ✅ 提交评价 | ||
| 25 | -- ✅ 申请退款 | ||
| 26 | - | ||
| 27 | -### 使用示例 | ||
| 28 | - | ||
| 29 | -#### 1. 删除订单 | ||
| 30 | - | ||
| 31 | -```javascript | ||
| 32 | -import { deleteOrderAPI } from '@/api/orders' | ||
| 33 | - | ||
| 34 | -// 删除订单 | ||
| 35 | -const handleDeleteOrder = async (orderId) => { | ||
| 36 | - try { | ||
| 37 | - const response = await deleteOrderAPI({ orderId }) | ||
| 38 | - if (response.success) { | ||
| 39 | - console.log('删除成功:', response.message) | ||
| 40 | - // 更新UI状态 | ||
| 41 | - } | ||
| 42 | - } catch (error) { | ||
| 43 | - console.error('删除失败:', error.message) | ||
| 44 | - } | ||
| 45 | -} | ||
| 46 | -``` | ||
| 47 | - | ||
| 48 | -#### 2. 提交评价 | ||
| 49 | - | ||
| 50 | -```javascript | ||
| 51 | -import { submitReviewAPI } from '@/api/orders' | ||
| 52 | - | ||
| 53 | -// 提交评价 | ||
| 54 | -const handleSubmitReview = async (orderData) => { | ||
| 55 | - try { | ||
| 56 | - const response = await submitReviewAPI({ | ||
| 57 | - orderId: orderData.id, | ||
| 58 | - rating: 5, | ||
| 59 | - comment: '车况很好,推荐!', | ||
| 60 | - images: [] // 可选 | ||
| 61 | - }) | ||
| 62 | - if (response.success) { | ||
| 63 | - console.log('评价提交成功:', response.message) | ||
| 64 | - } | ||
| 65 | - } catch (error) { | ||
| 66 | - console.error('评价提交失败:', error.message) | ||
| 67 | - } | ||
| 68 | -} | ||
| 69 | -``` | ||
| 70 | - | ||
| 71 | -## 集成真实API的步骤 | ||
| 72 | - | ||
| 73 | -### 1. 更新API端点 | ||
| 74 | - | ||
| 75 | -在 `orders.js` 文件中,将 `OrderApi` 对象中的端点URL替换为真实的后端API地址: | ||
| 76 | - | ||
| 77 | -```javascript | ||
| 78 | -const OrderApi = { | ||
| 79 | - DELETE_ORDER: 'https://your-api-domain.com/api/orders/delete', | ||
| 80 | - SUBMIT_REVIEW: 'https://your-api-domain.com/api/orders/review', | ||
| 81 | - // ... 其他端点 | ||
| 82 | -}; | ||
| 83 | -``` | ||
| 84 | - | ||
| 85 | -### 2. 取消注释API调用代码 | ||
| 86 | - | ||
| 87 | -在页面组件中(如 `myOrders/index.vue`),找到相关方法并取消注释真实API调用的代码: | ||
| 88 | - | ||
| 89 | -```javascript | ||
| 90 | -// 在 performDeleteOrder 方法中 | ||
| 91 | -const response = await deleteOrderAPI({ orderId }) | ||
| 92 | -if (response.success) { | ||
| 93 | - // 处理成功响应 | ||
| 94 | -} else { | ||
| 95 | - throw new Error(response.message || '删除失败') | ||
| 96 | -} | ||
| 97 | -``` | ||
| 98 | - | ||
| 99 | -### 3. 错误处理 | ||
| 100 | - | ||
| 101 | -确保处理以下常见错误情况: | ||
| 102 | - | ||
| 103 | -- 网络连接错误 | ||
| 104 | -- 服务器错误 (5xx) | ||
| 105 | -- 客户端错误 (4xx) | ||
| 106 | -- 权限验证失败 | ||
| 107 | -- 数据验证失败 | ||
| 108 | - | ||
| 109 | -### 4. 响应格式标准化 | ||
| 110 | - | ||
| 111 | -建议后端API返回统一的响应格式: | ||
| 112 | - | ||
| 113 | -```javascript | ||
| 114 | -// 成功响应 | ||
| 115 | -{ | ||
| 116 | - success: true, | ||
| 117 | - message: '操作成功', | ||
| 118 | - data: { /* 具体数据 */ } | ||
| 119 | -} | ||
| 120 | - | ||
| 121 | -// 错误响应 | ||
| 122 | -{ | ||
| 123 | - success: false, | ||
| 124 | - message: '错误描述', | ||
| 125 | - error: { | ||
| 126 | - code: 'ERROR_CODE', | ||
| 127 | - details: '详细错误信息' | ||
| 128 | - } | ||
| 129 | -} | ||
| 130 | -``` | ||
| 131 | - | ||
| 132 | -## 安全注意事项 | ||
| 133 | - | ||
| 134 | -1. **权限验证**: 确保用户只能操作自己的订单 | ||
| 135 | -2. **数据验证**: 在前端和后端都要进行数据验证 | ||
| 136 | -3. **防重复提交**: 避免用户重复提交相同的操作 | ||
| 137 | -4. **敏感信息**: 不要在前端暴露敏感的API密钥 | ||
| 138 | -5. **HTTPS**: 生产环境必须使用HTTPS协议 | ||
| 139 | - | ||
| 140 | -## 测试建议 | ||
| 141 | - | ||
| 142 | -1. **单元测试**: 为每个API方法编写单元测试 | ||
| 143 | -2. **集成测试**: 测试API与UI组件的集成 | ||
| 144 | -3. **错误场景测试**: 测试网络错误、服务器错误等异常情况 | ||
| 145 | -4. **性能测试**: 测试API响应时间和并发处理能力 | ||
| 146 | - | ||
| 147 | -## 开发模式 vs 生产模式 | ||
| 148 | - | ||
| 149 | -当前代码支持开发模式(使用模拟数据)和生产模式(使用真实API)的切换: | ||
| 150 | - | ||
| 151 | -- **开发模式**: 注释掉真实API调用,使用模拟数据和延迟 | ||
| 152 | -- **生产模式**: 取消注释真实API调用,注释掉模拟代码 | ||
| 153 | - | ||
| 154 | -建议使用环境变量来控制模式切换,例如: | ||
| 155 | - | ||
| 156 | -```javascript | ||
| 157 | -const isDevelopment = process.env.NODE_ENV === 'development' | ||
| 158 | - | ||
| 159 | -if (isDevelopment) { | ||
| 160 | - // 使用模拟数据 | ||
| 161 | -} else { | ||
| 162 | - // 使用真实API | ||
| 163 | -} | ||
| 164 | -``` | ||
| 165 | - | ||
| 166 | -## 更新日志 | ||
| 167 | - | ||
| 168 | -- **v1.0.0**: 初始版本,包含基础的订单管理API接口 | ||
| 169 | -- 支持删除订单、提交评价等核心功能 | ||
| 170 | -- 提供完整的使用示例和集成指南 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -143,15 +143,6 @@ const paymentDescription = ref('交易金额会在交易完成后的3个工作 | ... | @@ -143,15 +143,6 @@ const paymentDescription = ref('交易金额会在交易完成后的3个工作 |
| 143 | // 扣费说明内容 | 143 | // 扣费说明内容 |
| 144 | const feeDescription = ref('在每笔交易过程中,平台将抽取最终成交金额的1%作为平台服务费。') | 144 | const feeDescription = ref('在每笔交易过程中,平台将抽取最终成交金额的1%作为平台服务费。') |
| 145 | 145 | ||
| 146 | -// 用户服务协议内容 | ||
| 147 | -const protocolContent = ref(` | ||
| 148 | -1. 用户在使用捡个电驴收款服务时,需遵守相关法律法规。 | ||
| 149 | -2. 平台有权对异常交易进行风险控制。 | ||
| 150 | -3. 用户应确保收款信息的真实性和准确性。 | ||
| 151 | -4. 平台将按照约定收取相应的服务费用。 | ||
| 152 | -5. 如有争议,双方应友好协商解决。 | ||
| 153 | -`) | ||
| 154 | - | ||
| 155 | /** | 146 | /** |
| 156 | * 检查用户是否已同意过协议 | 147 | * 检查用户是否已同意过协议 |
| 157 | * @returns {Promise<boolean>} 返回用户是否已同意协议 | 148 | * @returns {Promise<boolean>} 返回用户是否已同意协议 | ... | ... |
| ... | @@ -95,15 +95,6 @@ const protocolVisible = ref(false); | ... | @@ -95,15 +95,6 @@ const protocolVisible = ref(false); |
| 95 | // 支付loading状态 | 95 | // 支付loading状态 |
| 96 | const isPaymentLoading = ref(false); | 96 | const isPaymentLoading = ref(false); |
| 97 | 97 | ||
| 98 | -// 用户服务协议内容 | ||
| 99 | -const protocolContent = ref(` | ||
| 100 | -1. 用户在使用捡个电驴支付服务时,需遵守相关法律法规。 | ||
| 101 | -2. 平台有权对异常交易进行风险控制。 | ||
| 102 | -3. 用户应确保支付信息的真实性和准确性。 | ||
| 103 | -4. 平台将按照约定收取相应的服务费用。 | ||
| 104 | -5. 如有争议,双方应友好协商解决。 | ||
| 105 | -`) | ||
| 106 | - | ||
| 107 | const onClose = () => { | 98 | const onClose = () => { |
| 108 | visible.value = false; | 99 | visible.value = false; |
| 109 | } | 100 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-08-11 10:09:54 | 4 | + * @LastEditTime: 2025-08-11 16:30:33 |
| 5 | * @FilePath: /jgdl/src/pages/authCar/index.vue | 5 | * @FilePath: /jgdl/src/pages/authCar/index.vue |
| 6 | * @Description: 认证车源 | 6 | * @Description: 认证车源 |
| 7 | --> | 7 | --> |
| ... | @@ -190,15 +190,6 @@ const isChecked = ref(false) | ... | @@ -190,15 +190,6 @@ const isChecked = ref(false) |
| 190 | const hasAgreed = ref(false) | 190 | const hasAgreed = ref(false) |
| 191 | const protocolVisible = ref(false) | 191 | const protocolVisible = ref(false) |
| 192 | 192 | ||
| 193 | -// 用户服务协议内容 | ||
| 194 | -const protocolContent = ref(` | ||
| 195 | -1. 用户在使用捡个电驴收款服务时,需遵守相关法律法规。 | ||
| 196 | -2. 平台有权对异常交易进行风险控制。 | ||
| 197 | -3. 用户应确保收款信息的真实性和准确性。 | ||
| 198 | -4. 平台将按照约定收取相应的服务费用。 | ||
| 199 | -5. 如有争议,双方应友好协商解决。 | ||
| 200 | -`) | ||
| 201 | - | ||
| 202 | // 滚动样式 | 193 | // 滚动样式 |
| 203 | const scrollStyle = computed(() => { | 194 | const scrollStyle = computed(() => { |
| 204 | return { | 195 | return { | ... | ... |
-
Please register or login to post a comment