祈福成功页面以及随喜弹窗2.0

This commit is contained in:
minimaxagent1 2025-08-05 17:04:35 +08:00
parent 2d70a7ca4e
commit 830053f8d4
2 changed files with 73 additions and 66 deletions

View File

@ -14,11 +14,15 @@
:placeholder="placeholder" :placeholder="placeholder"
v-model="localAmount" v-model="localAmount"
type="number" type="number"
:disabled="isRandomAmount"
/> />
<view class="random-option" @click="toggleRandomAmount"> <view class="random-option" @click="toggleRandomAmount">
<view class="radio-button" :class="{ 'checked': isRandomAmount }"> <view class="radio-button" >
<image v-if="isRandomAmount" class="radio-icon" :src="CommonEnum.Refresh" mode="aspectFit" /> <image
class="radio-icon"
:src="CommonEnum.Refresh"
mode="aspectFit"
/>
</view> </view>
<text class="option-text">{{ randomText }}</text> <text class="option-text">{{ randomText }}</text>
</view> </view>
@ -72,15 +76,13 @@ export default {
data() { data() {
return { return {
CommonEnum, CommonEnum,
localAmount: '', localAmount: ''
isRandomAmount: false
} }
}, },
watch: { watch: {
visible(newVal) { visible(newVal) {
if (newVal) { if (newVal) {
this.localAmount = this.defaultAmount; this.localAmount = this.defaultAmount;
this.isRandomAmount = false;
} }
}, },
defaultAmount(newVal) { defaultAmount(newVal) {
@ -97,17 +99,16 @@ export default {
// //
toggleRandomAmount() { toggleRandomAmount() {
this.isRandomAmount = !this.isRandomAmount; const randomAmount = Math.floor(Math.random() * 89); // 0-88
if (this.isRandomAmount) { this.localAmount = randomAmount.toString();
this.localAmount = ''; console.log('生成随机金额:', this.localAmount);
}
}, },
// //
handleConfirm() { handleConfirm() {
if (!this.localAmount && !this.isRandomAmount) { if (!this.localAmount) {
uni.showToast({ uni.showToast({
title: '请输入金额或选择随缘', title: '请输入金额或点击随缘生成随机金额',
icon: 'none' icon: 'none'
}); });
return; return;
@ -116,7 +117,7 @@ export default {
// //
this.$emit('confirm', { this.$emit('confirm', {
amount: this.localAmount, amount: this.localAmount,
isRandom: this.isRandomAmount isRandom: false
}); });
} }
} }
@ -124,6 +125,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.donate-modal { .donate-modal {
position: fixed; position: fixed;
top: 0; top: 0;
@ -138,15 +141,23 @@ export default {
} }
.modal-content { .modal-content {
background-color: #FFFFFF; position: fixed;
background-color: #FFFBF5;
border-radius: 20rpx; border-radius: 20rpx;
padding: 40rpx; padding: 40rpx;
width: 80%; width: 610rpx;
max-width: 600rpx; height: 386rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; margin-top: 20rpx;
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.3); box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.3);
.modal-icon {
position: absolute;
top: 28rpx;
right: 28rpx;
width: 180rpx;
height: 162rpx;
}
} }
.modal-header { .modal-header {
@ -156,18 +167,17 @@ export default {
width: 100%; width: 100%;
margin-bottom: 30rpx; margin-bottom: 30rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
border-bottom: 2rpx solid #F0EBE0;
.modal-title { .modal-title {
width: 80rpx;
height: 54rpx;
font-weight: 500;
font-size: 40rpx; font-size: 40rpx;
font-weight: bold;
color: #695347; color: #695347;
line-height: 54rpx;
} }
.modal-icon {
width: 60rpx;
height: 60rpx;
}
} }
.input-section { .input-section {
@ -179,40 +189,35 @@ export default {
.amount-input { .amount-input {
flex: 1; flex: 1;
height: 100rpx; padding: 0 32rpx;
background-color: #F5F0E7;
border: 2rpx solid #E0D7C9;
border-radius: 10rpx;
padding: 0 20rpx;
font-size: 36rpx; font-size: 36rpx;
color: #695347; color: #695347;
text-align: right; width: 384rpx;
height: 72rpx;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 1rpx solid #695347;
} }
.random-option { .random-option {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10rpx; padding: 20rpx 0;
cursor: pointer; border-radius: 40rpx;
background: #FFF8F0;
&:active {
background: rgba(191, 116, 4, 0.1);
}
.radio-button { .radio-button {
width: 40rpx; padding: 20rpx;
height: 40rpx;
border: 2rpx solid #E0D7C9;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #F5F0E7;
&.checked {
border-color: #8B2E2E;
background-color: #8B2E2E;
}
.radio-icon { .radio-icon {
width: 24rpx; width: 40rpx;
height: 24rpx; height: 40rpx;
} }
} }
@ -224,15 +229,17 @@ export default {
} }
.confirm-button { .confirm-button {
width: 100%;
height: 100rpx;
background-color: #8B2E2E;
border-radius: 50rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
box-shadow: 0 8rpx 20rpx rgba(139, 46, 46, 0.3);
transition: all 0.3s ease; transition: all 0.3s ease;
width: 308rpx;
height: 66rpx;
background: #C7A26D;
box-shadow: 2rpx 2rpx 2rpx 0rpx rgba(0,0,0,0.3);
border-radius: 43rpx 43rpx 43rpx 43rpx;
border: 2rpx solid #E3D4BA;
margin: 0 auto; /* 添加这行来居中 */
&:active { &:active {
background-color: #7A2A2A; background-color: #7A2A2A;

View File

@ -47,7 +47,7 @@ export default {
return { return {
CommonEnum, CommonEnum,
loading: false, loading: false,
showDonate: false showDonate: true
} }
}, },
onLoad() { onLoad() {