From 510965cf44de8594dbdf0e7b605f456950ae30bb Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Thu, 14 Aug 2025 17:49:57 +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.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/application.vue | 176 ++++++++++++++++++++++++++++++++- 1 file changed, 174 insertions(+), 2 deletions(-) diff --git a/pages/activity/application.vue b/pages/activity/application.vue index 6d9f001..c56c78b 100644 --- a/pages/activity/application.vue +++ b/pages/activity/application.vue @@ -58,6 +58,32 @@ > 提交报名 + + + + + + 自定义人数 + × + + + + 请输入人数: + + + + + 取消 + 确定 + + + @@ -109,8 +135,9 @@ export default { phone: "", }, - // 价格计算 - price: 100, + // 自定义人数弹窗相关 + showCustomNumberModal: false, + customNumber: "", }; }, onLoad() { @@ -129,6 +156,10 @@ export default { // 选择人数 selectNumber(value) { + if (value === "custom") { + this.openCustomNumberModal(); + return; + } this.selectedNumber = value; // 根据人数计算价格 if (value === "1") { @@ -182,6 +213,9 @@ export default { // 获取选中的人数标签 getSelectedNumberLabel() { + if (this.selectedNumber === "custom" || (this.selectedNumber !== "1" && this.selectedNumber !== "2")) { + return this.selectedNumber + "人"; + } const selectedNumber = this.numberOptions.find( (number) => number.value === this.selectedNumber, ); @@ -212,6 +246,34 @@ export default { if (!html) return ""; // 处理空值 return html.replace(/<[^>]+>/g, ""); // 正则替换所有 HTML 标签 }, + + // 自定义人数弹窗相关方法 + openCustomNumberModal() { + this.customNumber = ""; // 清空输入框 + this.showCustomNumberModal = true; + }, + + closeCustomModal() { + this.showCustomNumberModal = false; + }, + + onCustomNumberInput(e) { + const value = e.detail.value; + // 只允许输入数字 + this.customNumber = value.replace(/[^\d]/g, ""); + }, + + confirmCustomNumber() { + if (this.customNumber === "") { + uni.showToast({ + title: "请输入人数", + icon: "none", + }); + return; + } + this.selectedNumber = this.customNumber; + this.showCustomNumberModal = false; + }, }, }; @@ -379,4 +441,114 @@ text { text-align: center; margin-bottom: 26rpx; } + +/* 自定义人数弹窗样式 */ +.modal-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 999; +} + +.modal-content { + width: 600rpx; + background: #fffbf5; + border-radius: 20rpx; + border: 2rpx solid #c7a26d; + overflow: hidden; +} + +.modal-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 40rpx 50rpx 20rpx 50rpx; + border-bottom: 1rpx solid #e0e0e0; +} + +.modal-title { + font-weight: 600; + font-size: 36rpx; + color: #695347; +} + +.modal-close { + width: 60rpx; + height: 60rpx; + display: flex; + justify-content: center; + align-items: center; + font-size: 48rpx; + color: #999; + cursor: pointer; +} + +.modal-body { + padding: 40rpx 50rpx; +} + +.input-group { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.input-label { + font-size: 32rpx; + color: #695347; + font-weight: 500; +} + +.custom-input { + width: 460rpx; + height: 80rpx; + border: 2rpx solid #c7a26d; + border-radius: 10rpx; + padding-left:30rpx; + font-size: 32rpx; + color: #695347; + background: #ffffff; +} + +.modal-footer { + display: flex; + border-top: 1rpx solid #e0e0e0; +} + +.modal-btn { + flex: 1; + height: 100rpx; + display: flex; + justify-content: center; + align-items: center; + font-size: 32rpx; + font-weight: 500; + cursor: pointer; + transition: all 0.3s ease; +} + +.cancel-btn { + background: #f5f5f5; + color: #666; + border-right: 1rpx solid #e0e0e0; +} + +.cancel-btn:active { + background: #e0e0e0; +} + +.confirm-btn { + background: #a24242; + color: #ffffff; +} + +.confirm-btn:active { + background: #8a3636; +}