From d9e70d4eaf50c54b416d8631222459786413c5e7 Mon Sep 17 00:00:00 2001
From: 8vd8 <1936002261@qq.com>
Date: Tue, 22 Apr 2025 18:08:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=89=AB=E6=8F=8F=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=AE=A2=E5=8D=95=EF=BC=8C?=
=?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E8=BF=94=E5=9B=9E=E4=BB=BB=E4=BD=95?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BB=99=E7=94=A8=E6=88=B7=20=E5=AE=8C?=
=?UTF-8?q?=E6=88=90=E5=A5=97=E9=A4=90=E4=BB=8E=E6=95=B0=E6=8D=AE=E5=BA=93?=
=?UTF-8?q?=E4=B8=AD=E6=8F=90=E5=8F=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/http.js | 27 +++
config/user.js | 3 +-
pages/deposit/index.vue | 7 +-
pages/device/detail.vue | 179 ++++++++++++++++--
pages/order/payment.vue | 111 ++++++++---
pages/serve/bagCheck/index.vue | 43 ++++-
.../.sourcemap/mp-weixin/config/http.js.map | 2 +-
.../.sourcemap/mp-weixin/config/user.js.map | 2 +-
.../mp-weixin/pages/deposit/index.js.map | 2 +-
.../mp-weixin/pages/device/detail.js.map | 2 +-
.../mp-weixin/pages/order/payment.js.map | 2 +-
.../pages/serve/bagCheck/index.js.map | 2 +-
unpackage/dist/dev/mp-weixin/common/vendor.js | 4 +-
unpackage/dist/dev/mp-weixin/config/http.js | 27 ++-
unpackage/dist/dev/mp-weixin/config/user.js | 10 +-
.../dist/dev/mp-weixin/pages/deposit/index.js | 16 +-
.../dist/dev/mp-weixin/pages/device/detail.js | 173 ++++++++++++++---
.../dev/mp-weixin/pages/device/detail.wxml | 2 +-
.../dist/dev/mp-weixin/pages/order/payment.js | 94 ++++++---
.../dev/mp-weixin/pages/order/payment.wxml | 2 +-
.../mp-weixin/pages/serve/bagCheck/index.js | 26 ++-
21 files changed, 591 insertions(+), 145 deletions(-)
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 @@