From 23d876ee73e53131f05245895f3be158c6e6711d Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Thu, 14 Aug 2025 17:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D=E9=9D=99?= =?UTF-8?q?=E6=80=81=E7=95=8C=E9=9D=A23.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/application.vue | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pages/activity/application.vue b/pages/activity/application.vue index c56c78b..eda0e9c 100644 --- a/pages/activity/application.vue +++ b/pages/activity/application.vue @@ -161,14 +161,6 @@ export default { return; } this.selectedNumber = value; - // 根据人数计算价格 - if (value === "1") { - this.price = 100; - } else if (value === "2") { - this.price = 180; - } else { - this.price = 100; // 自定义价格,可以根据需要调整 - } }, // 提交报名 @@ -259,8 +251,11 @@ export default { onCustomNumberInput(e) { const value = e.detail.value; - // 只允许输入数字 - this.customNumber = value.replace(/[^\d]/g, ""); + // 只允许输入数字,且小于99 + const numValue = value.replace(/[^\d]/g, ""); + if (numValue === "" || parseInt(numValue) < 99) { + this.customNumber = numValue; + } }, confirmCustomNumber() { @@ -271,6 +266,16 @@ export default { }); return; } + + const numValue = parseInt(this.customNumber); + if (numValue >= 99) { + uni.showToast({ + title: "人数不能大于等于99", + icon: "none", + }); + return; + } + this.selectedNumber = this.customNumber; this.showCustomNumberModal = false; },