快乐的昕的电脑
2025-10-31 2a8abd06a4bd56bf4a8d06863580ee26f5a0d5ab
components/machine.vue
@@ -177,14 +177,31 @@
                    if (res && res.data && res.data.tbBillList) {
                        this.$showMessage("呼叫成功");
                        // 方案2:完全刷新当前页面
                        // 延迟一下让用户看到成功提示
                        setTimeout(() => {
                            // 方法1:使用 uni.reLaunch 重新加载(推荐)
                            uni.reLaunch({
                                url: '/' + getCurrentPages()[0].route
                            });
                        }, 1500);
                        // 关键修改:清空 flag 的值
                        this.flag = -1; // 或者根据业务需求设置为其他初始值
                        // 方案1:使用uni-app的页面刷新方法
                        // 方法1:触发下拉刷新(如果页面支持)
                        if (uni.startPullDownRefresh) {
                            uni.startPullDownRefresh();
                            // 2秒后停止刷新
                            setTimeout(() => {
                                uni.stopPullDownRefresh();
                            }, 2000);
                        }
                        // 方法2:重新调用页面的onLoad方法(推荐)
                        const pages = getCurrentPages();
                        const currentPage = pages[pages.length - 1];
                        if (currentPage && currentPage.onLoad) {
                            // 保存当前页面参数
                            const pageOptions = currentPage.options || {};
                            // 重新加载页面数据
                            currentPage.onLoad(pageOptions);
                        }
                        // 方法3:同时刷新组件数据
                        this.findByOrderId();
                    } else {
                        this.$showMessage("呼叫失败");