木邻有你前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
2.8 KiB

1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="points-card">
  3. <!-- 可用积分背景 -->
  4. <view class="points-background">
  5. <image src="/static/可用积分背景图.png" class="bg-image" mode="aspectFill"></image>
  6. <!-- 积分内容 -->
  7. <view class="points-content">
  8. <view class="points-text">
  9. <text class="points-label">可用积分</text>
  10. <text class="points-value">{{ points }}</text>
  11. </view>
  12. </view>
  13. <!-- 积分明细按钮 -->
  14. <view class="points-detail" @click="showPointsDetail">
  15. <image src="/static/商城_积分明细框.png" class="detail-bg" mode="aspectFit"></image>
  16. <text class="detail-text">积分明细</text>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: 'PointsCard',
  24. props: {
  25. points: {
  26. type: [String, Number],
  27. default: 1385
  28. }
  29. },
  30. methods: {
  31. showPointsDetail() {
  32. // 跳转到积分明细页面
  33. uni.navigateTo({
  34. url: '/subPages/shop/pointsDetail'
  35. })
  36. },
  37. // handleClick() {
  38. // // 跳转到积分明细页面
  39. // uni.navigateTo({
  40. // url: '/pages/components/searchDemo'
  41. // })
  42. // }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .points-card {
  48. width: 96%;
  49. margin: 0 auto;
  50. // margin-top: -80rpx;
  51. position: relative;
  52. z-index: 10;
  53. }
  54. .points-background {
  55. position: relative;
  56. width: 100%;
  57. height: 290rpx;
  58. border-radius: 20rpx;
  59. overflow: hidden;
  60. .bg-image {
  61. width: 100%;
  62. height: 100%;
  63. position: absolute;
  64. top: 0;
  65. left: 0;
  66. }
  67. .points-content {
  68. position: absolute;
  69. top: 0;
  70. left: 0;
  71. width: 100%;
  72. height: 100%;
  73. display: flex;
  74. align-items: center;
  75. justify-content: space-between;
  76. padding: 0 40rpx;
  77. .points-text {
  78. // background: red;
  79. display: flex;
  80. flex-direction: column;
  81. align-items: center;
  82. // justify-content: center;
  83. gap: 10rpx;
  84. .points-label {
  85. font-size: 30rpx;
  86. color: #ffffff;
  87. margin-bottom: 15rpx;
  88. opacity: 0.9;
  89. }
  90. .points-value {
  91. font-size: 58rpx;
  92. color: #ffffff;
  93. font-weight: bold;
  94. line-height: 1;
  95. }
  96. }
  97. .points-icon {
  98. width: 120rpx;
  99. height: 120rpx;
  100. .icon-image {
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. }
  106. .points-detail {
  107. position: absolute;
  108. bottom: 10rpx;
  109. left: 30rpx;
  110. width: 160rpx;
  111. height: 60rpx;
  112. display: flex;
  113. align-items: center;
  114. justify-content: center;
  115. .detail-bg {
  116. position: absolute;
  117. width: 100%;
  118. height: 100%;
  119. top: 0;
  120. left: 0;
  121. }
  122. .detail-text {
  123. font-size: 24rpx;
  124. color: $uni-color-primary;
  125. position: relative;
  126. z-index: 1;
  127. }
  128. }
  129. }
  130. </style>