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; },