From 830053f8d4401c784c55fdad609d79dc23dbf5dc Mon Sep 17 00:00:00 2001 From: minimaxagent1 Date: Tue, 5 Aug 2025 17:04:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=88=E7=A6=8F=E6=88=90=E5=8A=9F=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BB=A5=E5=8F=8A=E9=9A=8F=E5=96=9C=E5=BC=B9=E7=AA=97?= =?UTF-8?q?2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/donate-modal/donate-modal.vue | 137 ++++++++++++----------- pages/pray/praySuccess.vue | 2 +- 2 files changed, 73 insertions(+), 66 deletions(-) diff --git a/components/donate-modal/donate-modal.vue b/components/donate-modal/donate-modal.vue index f76f7bd..d940d6b 100644 --- a/components/donate-modal/donate-modal.vue +++ b/components/donate-modal/donate-modal.vue @@ -6,24 +6,28 @@ {{ title }} - + - - - + + {{ randomText }} - + {{ confirmText }} @@ -72,15 +76,13 @@ export default { data() { return { CommonEnum, - localAmount: '', - isRandomAmount: false + localAmount: '' } }, watch: { visible(newVal) { if (newVal) { this.localAmount = this.defaultAmount; - this.isRandomAmount = false; } }, defaultAmount(newVal) { @@ -94,29 +96,28 @@ export default { handleClose() { this.$emit('close'); }, - + // 切换随机金额选项 toggleRandomAmount() { - this.isRandomAmount = !this.isRandomAmount; - if (this.isRandomAmount) { - this.localAmount = ''; - } + const randomAmount = Math.floor(Math.random() * 89); // 0-88的随机数 + this.localAmount = randomAmount.toString(); + console.log('生成随机金额:', this.localAmount); }, - + // 确认操作 handleConfirm() { - if (!this.localAmount && !this.isRandomAmount) { + if (!this.localAmount) { uni.showToast({ - title: '请输入金额或选择随缘', + title: '请输入金额或点击随缘生成随机金额', icon: 'none' }); return; } - + // 触发确认事件 this.$emit('confirm', { amount: this.localAmount, - isRandom: this.isRandomAmount + isRandom: false }); } } @@ -124,6 +125,8 @@ export default { \ No newline at end of file + \ No newline at end of file diff --git a/pages/pray/praySuccess.vue b/pages/pray/praySuccess.vue index 1bd7444..97efb63 100644 --- a/pages/pray/praySuccess.vue +++ b/pages/pray/praySuccess.vue @@ -47,7 +47,7 @@ export default { return { CommonEnum, loading: false, - showDonate: false + showDonate: true } }, onLoad() {