list.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="red_packet_list">
  3. <view v-for="(packet, index) in redpackets" :key="packet.id" class="red_packet_item" :class="{ disabled: index == 0 }" @click="handleClick(packet)">
  4. <img src="../../static/icon/packet_list_backerground.png" alt="" class="redpacket_background" />
  5. <view class="packet_header">
  6. <view class="packet_image">福</view>
  7. <view class="packet_info">
  8. <h3 class="packet_title">{{ packet.title }}</h3>
  9. <p class="packet_date">{{ packet.date }}</p>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script setup>
  16. import { ref } from "vue";
  17. const redpackets = ref([
  18. { id: 1, title: "新年红包", date: "2023-01-01", amount: 88.88, image: "path/to/image1.jpg" },
  19. { id: 2, title: "生日红包", date: "2023-02-14", amount: 66.66, image: "path/to/image2.jpg" },
  20. { id: 3, title: "节日红包", date: "2023-03-08", amount: 99.99, image: "path/to/image3.jpg" },
  21. ]);
  22. const handleClick = (packet) => {
  23. uni.navigateTo({
  24. url: "/pages/redpacket/index",
  25. });
  26. };
  27. </script>
  28. <style lang="less" scoped>
  29. .red_packet_list {
  30. display: flex;
  31. flex-direction: column;
  32. gap: 20rpx;
  33. padding: 40rpx;
  34. }
  35. .red_packet_item {
  36. display: flex;
  37. align-items: center;
  38. justify-content: space-between;
  39. background-color: #c30a0a;
  40. border-radius: 20rpx;
  41. padding: 20rpx;
  42. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  43. cursor: pointer;
  44. position: relative;
  45. height: 140rpx;
  46. overflow: hidden;
  47. &.disabled {
  48. cursor: not-allowed;
  49. opacity: 0.3;
  50. }
  51. .redpacket_background {
  52. width: 100%;
  53. height: 100%;
  54. position: absolute;
  55. top: 0;
  56. left: 120px;
  57. z-index: 1;
  58. }
  59. .packet_header {
  60. display: flex;
  61. align-items: center;
  62. z-index: 10;
  63. .packet_image {
  64. width: 100rpx;
  65. height: 100rpx;
  66. border-radius: 50%;
  67. margin-right: 20rpx;
  68. background-color: #fede9f;
  69. color: #af3636;
  70. font-size: 48rpx;
  71. font-weight: bold;
  72. text-align: center;
  73. line-height: 100rpx;
  74. }
  75. .packet_info {
  76. display: flex;
  77. flex-direction: column;
  78. .packet_title {
  79. font-size: 32rpx;
  80. font-weight: bold;
  81. margin: 0;
  82. color: #fff;
  83. }
  84. .packet_date {
  85. font-size: 24rpx;
  86. color: #fff;
  87. margin: 0;
  88. margin-top: 10rpx;
  89. }
  90. }
  91. }
  92. .packet_amount {
  93. font-size: 36rpx;
  94. font-weight: bold;
  95. color: #e74c3c;
  96. }
  97. }
  98. </style>