diff --git a/config/http.js b/config/http.js
index 70e89f8..20f93c8 100644
--- a/config/http.js
+++ b/config/http.js
@@ -8,6 +8,14 @@ const request = (option) => {
// Debug request info
console.log(`发起请求: ${option.method} ${URL + option.url}`, option.data)
+ // 默认不显示加载中提示
+ if (!option.hideLoading) {
+ uni.showLoading({
+ title: option.loadingText || '加载中...',
+ mask: true
+ })
+ }
+
uni.request({
url: URL + option.url,
method: option.method,
@@ -41,6 +49,19 @@ const request = (option) => {
if (res.data && res.data.code !== 200) {
console.warn(`业务状态码错误: ${res.data.code}`, res.data)
+ // 判断是否需要忽略数据为空的错误
+ if (option.ignoreEmptyError &&
+ (res.data.code === 500 && res.data.msg &&
+ (res.data.msg.includes('未找到') || res.data.msg.includes('不存在')))) {
+ // 对于指定需要忽略的错误,返回一个标准的"成功但数据为空"的响应
+ resolve({
+ code: 200,
+ msg: "操作成功",
+ data: []
+ })
+ return
+ }
+
// 仍然返回数据,由业务逻辑处理
resolve(res.data)
return
@@ -52,6 +73,12 @@ const request = (option) => {
// 网络请求本身失败
console.error(`请求失败: ${option.url}`, err)
reject(err)
+ },
+ complete() {
+ // 隐藏加载提示
+ if (!option.hideLoading) {
+ uni.hideLoading()
+ }
}
})
})
diff --git a/config/user.js b/config/user.js
index efe40c7..3c5dbe5 100644
--- a/config/user.js
+++ b/config/user.js
@@ -53,7 +53,8 @@ export const checkOrdersByStatus = (deviceNo, statuses) => {
return request({
url: `/app/order/list?deviceNo=${deviceNo}&orderStatus=${statusQuery}`,
method: 'get',
- hideLoading: true // 隐藏加载提示,避免干扰用户
+ hideLoading: true, // 隐藏加载提示,避免干扰用户
+ ignoreEmptyError: true // 添加标记,表示即使返回空数据也不视为错误
})
}
diff --git a/pages/deposit/index.vue b/pages/deposit/index.vue
index 84c6aad..c1b9b5e 100644
--- a/pages/deposit/index.vue
+++ b/pages/deposit/index.vue
@@ -96,8 +96,11 @@ export default {
})
return
}
- const res = await queryById(Number(this.orderNo))
- console.log(res);
+ if(this.orderId.length!=0||this.orderNo.length!=0){
+ const res = await queryById(Number(this.orderId))
+ console.log(res);
+ }
+
// if(this.orderNo.length!=0){
// uni.showToast({
// title:'当前存在进行中的订单',
diff --git a/pages/device/detail.vue b/pages/device/detail.vue
index 7b3d1a6..fd105fd 100644
--- a/pages/device/detail.vue
+++ b/pages/device/detail.vue
@@ -73,7 +73,7 @@
押金:
- ¥99
+ ¥{{ depositAmount }}
套餐
- {{ packageInfo.time }} (¥{{ packageInfo.price }})
-
-
- 租借费用
- ¥{{ orderInfo.amount || packageInfo.price }}
+ {{ packageInfo.price }}元/{{ packageInfo.time }}小时
合计
@@ -65,6 +61,7 @@