// pages/withdraw/withdraw.js import request from '../../utils/request.js'; import PopupService from '../../services/popupService.js'; const app = getApp(); Page({ data: { pageMode: 0, pageOptions: {}, loadError: false, }, onLoad(options) { this.setData({ pageOptions: options || {} }); this.fetchPageMode(); }, onShow() { this.registerNotificationComponent(); PopupService.checkAndShow(this, 'tixian'); }, onHide() { const popupComp = this.selectComponent('#popupNotice'); if (popupComp && popupComp.cleanup) { popupComp.cleanup(); } }, // 注册通知组件 registerNotificationComponent() { const notificationComp = this.selectComponent('#global-notification'); if (notificationComp && notificationComp.showNotification) { app.globalData.globalNotification = { show: (data) => notificationComp.showNotification(data), hide: () => notificationComp.hideNotification() }; } }, async fetchPageMode() { try { const res = await request({ url: '/peizhi/hqtxzsym', method: 'POST' }); if (res.statusCode === 200 && res.data && res.data.code === 0) { const mode = parseInt(res.data.data.mode); this.setData({ pageMode: (mode === 1 || mode === 2) ? mode : 1, loadError: false }); } else { this.setData({ pageMode: 1, loadError: false }); } } catch (err) { console.error('获取展示模式失败:', err); this.setData({ loadError: true }); } }, retryFetch() { this.setData({ loadError: false, pageMode: 0 }); this.fetchPageMode(); }, stopPropagation() {} });