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() {