From 4834827504b7c11da4327a335ee32636c824d256 Mon Sep 17 00:00:00 2001 From: lik Date: Thu, 5 Nov 2026 22:22:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(escort):=20=E9=99=AA=E8=AF=8A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=8B=E6=8B=89=E6=8C=89=E5=B1=8F=E9=AB=98=E6=92=91?= =?UTF-8?q?=E5=BC=80=EF=BC=8C=E5=8F=AF=E5=AE=8C=E6=95=B4=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/escort/itemorder.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pages/escort/itemorder.js b/pages/escort/itemorder.js index 4a0957c..c854b69 100644 --- a/pages/escort/itemorder.js +++ b/pages/escort/itemorder.js @@ -3,6 +3,8 @@ const { formatDate } = require('../../utils/date.js') // 陪诊项目下拉单行高度:图标 72rpx + 单行文字 + 上下留白 const SERVICE_OPTION_HEIGHT = 108 +// 下拉面板最多占用的屏高:扣掉底部固定操作栏与页面留白,项目再多也能整屏看到 +const SERVICE_PANEL_RESERVED = 200 Page({ data: { @@ -73,7 +75,7 @@ Page({ const serviceList = services.map((item) => ({ ...item, icon: this.getServiceIcon(item.title) })) this.setData({ services: serviceList, - serviceOptionsHeight: Math.min(serviceList.length, 4) * SERVICE_OPTION_HEIGHT + serviceOptionsHeight: this.getServiceOptionsHeight(serviceList.length) }) this.applyService(serviceList[serviceIndex], serviceIndex) this.setData({ pageLoading: false }) @@ -93,6 +95,14 @@ Page({ this.initializePage() }, + // 按屏高算下拉可见高度:项目少时整列铺开,多时撑到屏高上限后在面板内滚动 + getServiceOptionsHeight(count) { + const { windowWidth, windowHeight } = wx.getSystemInfoSync() + const availableRpx = (windowHeight * 750) / windowWidth - SERVICE_PANEL_RESERVED + const maxRows = Math.max(1, Math.floor(availableRpx / SERVICE_OPTION_HEIGHT)) + return Math.min(count, maxRows) * SERVICE_OPTION_HEIGHT + }, + createIdempotencyKey() { return `order_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 12)}` },