index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="red_packet" catchtouchmove="true">
  3. <image src="../../static/icon/red_packet_background.jpg" class="read_packet_background" />
  4. <view class="rule" @click="showRule">活动规则</view>
  5. <view class="get_content" v-if="!showReward">
  6. <view class="custom_button" @click="showRectangle"> 立即领取 </view>
  7. <text>点击领取后,红包将自动到账余额</text>
  8. </view>
  9. <uni-popup ref="lotteryRule" type="center">
  10. <view class="lottery_rule_box">
  11. <view class="lottery_rule_title">
  12. <text>活动规则</text>
  13. <view class="close_btn" @click="closeRule"> X </view>
  14. </view>
  15. <scroll-view class="lottery_rule_info" scroll-y="true">
  16. <rich-text nodes="lotteryInfo.rule" class="rich_text"></rich-text>
  17. </scroll-view>
  18. </view>
  19. </uni-popup>
  20. <div :class="['rectangle', { show: showReward }]">
  21. <image src="../../static/icon/red_packet_bottom.png" class="read_packet_background" />
  22. <view class="text_content">
  23. <view> <text style="font-size: 50rpx; font-weight: bold">8.88 </text>元 </view>
  24. <view style="margin-top: 20rpx; color: #02a7f0" @click="_goWithdraw">已存入余额,去提现</view>
  25. </view>
  26. </div>
  27. </view>
  28. </template>
  29. <script setup>
  30. import { ref } from "vue";
  31. const lotteryRule = ref();
  32. const showReward = ref(false);
  33. const closeRule = () => {
  34. lotteryRule.value.close();
  35. };
  36. const showRule = () => {
  37. lotteryRule.value.open("center");
  38. };
  39. const showRectangle = () => {
  40. showReward.value = true;
  41. };
  42. const _goWithdraw = () => {
  43. uni.redirectTo({
  44. url: "/pages/user/withdraw",
  45. });
  46. };
  47. </script>
  48. <style lang="less" scoped>
  49. .red_packet {
  50. width: 100vw;
  51. height: 100vh;
  52. position: relative;
  53. .read_packet_background {
  54. width: 100%;
  55. height: 100%;
  56. }
  57. .rule {
  58. position: absolute;
  59. right: 0;
  60. top: 26%;
  61. color: #846100;
  62. padding: 15rpx 35rpx;
  63. background-color: #ffedad;
  64. border-radius: 60rpx;
  65. text-align: center;
  66. font-size: 28rpx;
  67. }
  68. .get_content {
  69. position: absolute;
  70. bottom: 18%;
  71. width: 100%;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. justify-content: center;
  76. > text {
  77. color: #fff;
  78. font-size: 26rpx;
  79. margin-top: 20rpx;
  80. }
  81. }
  82. .custom_button {
  83. display: inline-block;
  84. background-color: #fbe6a0;
  85. color: #9c6c11;
  86. font-size: 18px;
  87. padding: 6px 30px;
  88. border-radius: 8px;
  89. text-align: center;
  90. box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
  91. border: 2px solid transparent;
  92. text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  93. position: relative;
  94. &:before,
  95. &:after {
  96. content: "";
  97. position: absolute;
  98. width: 24px;
  99. height: 24px;
  100. background-color: #fbe6a0;
  101. border: 2px solid #fbe6a0;
  102. border-radius: 10rpx;
  103. top: 50%;
  104. transform: translateY(-50%);
  105. }
  106. &:before {
  107. left: -6px;
  108. }
  109. &:after {
  110. right: -6px;
  111. }
  112. }
  113. .lottery_rule_box {
  114. width: 500rpx;
  115. display: block;
  116. overflow: hidden;
  117. background-color: #fc335f;
  118. font-size: 26rpx;
  119. margin: 0 auto;
  120. line-height: 50rpx;
  121. border-radius: 10rpx;
  122. padding: 20rpx 25rpx 20rpx;
  123. .lottery_rule_title {
  124. color: #ffffff;
  125. height: 60rpx;
  126. font-size: 32rpx;
  127. line-height: 60rpx;
  128. text-align: center;
  129. margin-bottom: 10rpx;
  130. .close_btn {
  131. float: right;
  132. width: 40rpx;
  133. height: 40rpx;
  134. font-size: 24rpx;
  135. margin-top: 9rpx;
  136. line-height: 40rpx;
  137. border-radius: 50%;
  138. border: 1rpx solid #ffffff;
  139. }
  140. }
  141. .lottery_rule_info {
  142. display: block;
  143. height: 500rpx;
  144. font-size: 24rpx;
  145. line-height: 40rpx;
  146. border-radius: 10rpx;
  147. padding: 20rpx;
  148. box-sizing: border-box;
  149. background-color: #ffffff;
  150. .rich_text {
  151. white-space: break-spaces;
  152. }
  153. }
  154. }
  155. .rectangle {
  156. width: 100%;
  157. height: 250px;
  158. position: absolute;
  159. bottom: -250px; /* 初始位置在视图之外 */
  160. left: 0;
  161. transition: bottom 1s ease; /* 添加过渡效果 */
  162. &.show {
  163. bottom: 0; /* 目标位置 */
  164. }
  165. .text_content {
  166. position: absolute;
  167. top: 50%;
  168. left: 50%;
  169. transform: translate(-50%, -35%);
  170. text-align: center;
  171. }
  172. }
  173. }
  174. </style>