From 147e1a6d17c17add7297ed5fc168c545b277052c Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Wed, 18 Jun 2025 18:48:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=AE=A2=E5=8D=95):=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=92=8C=E8=B7=AF=E7=94=B1=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将订单详情页面从子包移动到主包并优化路由配置 移除位置权限相关配置 添加页面基础样式防止溢出 优化快速订单组件定时器逻辑 调整订单列表按钮样式和交互 --- components/QuickOrderEntry.vue | 37 +++++++++++++++++++++++++--- manifest.json | 11 ++------- pages.json | 18 ++++++++------ pages/index/index.vue | 4 +++ pages/index/order.vue | 2 +- {pages_order => pages}/order/orderDetail.vue | 0 pages_order/order/fastOrderList.vue | 36 ++++++++++----------------- 7 files changed, 65 insertions(+), 43 deletions(-) rename {pages_order => pages}/order/orderDetail.vue (100%) diff --git a/components/QuickOrderEntry.vue b/components/QuickOrderEntry.vue index 2933869..b8d99ca 100644 --- a/components/QuickOrderEntry.vue +++ b/components/QuickOrderEntry.vue @@ -44,17 +44,26 @@ export default { orderInfo: null, innerHasNewMessage: false, innerMessageCount: 0, - isInitialized: false + isInitialized: false, + timer: null // 定时器ID } }, mounted() { this.getQuickOrderInfo() + // 开启定时器,每30秒更新一次数据 + this.startTimer() }, + beforeDestroy() { + // 组件销毁前清除定时器 + this.clearTimer() + }, methods: { // 处理点击事件 - handleClick() { + async handleClick() { // 发出点击事件,便于父组件监听 this.$emit('click'); + + await this.getQuickOrderInfo() // 如果有订单信息,提供订单列表 if (Array.isArray(this.orderInfo) && this.orderInfo.length > 0) { @@ -102,7 +111,7 @@ export default { } // 调用接口获取快捷下单信息 - this.$api('getOrderInfo', {}, res => { + return this.$api('getOrderInfo', {}, res => { if (res.code === 200 && res.result) { // 处理返回的订单列表 const orderList = Array.isArray(res.result) ? res.result : [res.result]; @@ -169,6 +178,28 @@ export default { getMessageCount() { return this.innerMessageCount; }, + + // 开启定时器 + startTimer() { + // 清除之前的定时器(如果存在) + this.clearTimer() + + // 设置新的定时器,每30秒执行一次 + this.timer = setInterval(() => { + // 只有在有token的情况下才更新数据 + if (uni.getStorageSync('token')) { + this.getQuickOrderInfo() + } + }, 15000) + }, + + // 清除定时器 + clearTimer() { + if (this.timer) { + clearInterval(this.timer) + this.timer = null + } + }, }, } diff --git a/manifest.json b/manifest.json index fe96ebc..6f09cdb 100644 --- a/manifest.json +++ b/manifest.json @@ -57,15 +57,8 @@ "urlCheck" : false }, "usingComponents" : true, - "permission" : { - "scope.userLocation" : { - "desc" : "你的位置信息将用于小程序位置接口的效果展示" - }, - "scope.userFuzzyLocation" : { - "desc" : "你的位置信息将用于小程序位置接口的效果展示" - } - }, - "requiredPrivateInfos" : [ "chooseLocation", "getLocation" ] + "permission" : {}, + "requiredPrivateInfos" : [] }, "mp-alipay" : { "usingComponents" : true diff --git a/pages.json b/pages.json index 3e48a71..6da2afb 100644 --- a/pages.json +++ b/pages.json @@ -29,6 +29,12 @@ "navigationBarTextStyle": "white" } }, + { + "path": "pages/order/orderDetail", + "style": { + "navigationBarTextStyle": "white" + } + }, { "path": "pages/index/cart", "style": { @@ -44,12 +50,7 @@ }, "subPackages": [{ "root": "pages_order", - "pages": [{ - "path": "order/orderDetail", - "style": { - "navigationBarTextStyle": "white" - } - }, + "pages": [ { "path": "mine/purse", "style": { @@ -73,7 +74,10 @@ "path": "product/productDetail" }, { - "path": "product/productList" + "path": "product/productList", + "style": { + "enablePullDownRefresh": true + } }, { "path": "auth/wxLogin" diff --git a/pages/index/index.vue b/pages/index/index.vue index d27fef9..4693dc8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -169,6 +169,10 @@ export default {