index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="integral-container">
  3. <!-- 积分总览 -->
  4. <view class="integral-header">
  5. <view class="integral-header-row">
  6. <view class="integral-header-item">
  7. <view class="integral-header-label">总积分</view>
  8. <view class="integral-header-value">{{ List.totalPoint }}</view>
  9. </view>
  10. <view class="integral-header-item">
  11. <view class="integral-header-label">可兑换积分</view>
  12. <view class="integral-header-value">{{ List.availablePoint }}</view>
  13. </view>
  14. </view>
  15. <view class="integral-rate-row">
  16. <view class="integral-rate">1积分=1人民币</view>
  17. <view class="integral-desc" @click="open" style="cursor: pointer;">收益说明
  18. <up-icon name="question-circle"></up-icon>
  19. </view>
  20. </view>
  21. <up-popup :show="show" mode="center" @close="close" @open="open">
  22. <view class="popup-content">
  23. <view class="popup-title">收益说明</view>
  24. <view class="popup-text">用户积分:用户通过平台生成的二维码进行分享,以拉取新用户或志愿者(服务者)并获得相应积分。</view>
  25. <view class="popup-text">积分规则:拉取一个新用户可获得1分,拉取一个新志愿者(服务者)可获得5分。</view>
  26. <view class="popup-text">积分兑换:所获积分可以兑换等价值的商品或购买各类居家服务。</view>
  27. <view class="popup-text">积分生效:用户积分的兑换,以所拉取用户在平台上产生交易为准,即产生了交易的用户或志愿者(服务者)其相应的积分才可实现兑换。</view>
  28. <view class="popup-close" @click="close">关闭</view>
  29. </view>
  30. </up-popup>
  31. </view>
  32. <!-- 积分明细 -->
  33. <view class="integral-detail-section">
  34. <view class="integral-detail-title">积分明细</view>
  35. <view class="integral-detail-list">
  36. <view class="integral-detail-item">
  37. <view class="integral-detail-type">用户推广积分</view>
  38. <!-- <view class="integral-detail-date">{{ Data.createTime }}</view> -->
  39. <!-- <view class="integral-detail-value add">{{ Data.changePoint }}积分</view> -->
  40. </view>
  41. <!-- 可循环渲染多条明细 -->
  42. </view>
  43. </view>
  44. <!-- 固定底部提示 -->
  45. <view class="integral-tip-footer">提示:用户推广积分需要用户所推广人员进行消费过后积分才可以使用</view>
  46. </view>
  47. </template>
  48. <script setup>
  49. import { onMounted, ref } from 'vue'
  50. import { getUserPointInfoData, coreUserPointChangeData } from '@/api/userPoints'
  51. const List = ref({})//可用积分
  52. const Data = ref({})//积分明细
  53. // 创建响应式数据
  54. const show = ref(false);
  55. // 定义方法
  56. function open() {
  57. show.value = true;
  58. console.log('弹窗打开', show.value);
  59. }
  60. function close() {
  61. show.value = false;
  62. console.log('弹窗关闭', show.value);
  63. }
  64. // 可用积分
  65. const getData = async () => {
  66. const params = {
  67. totalPoint: 0,//总积分
  68. availablePoint: 0,//可兑换积分
  69. }
  70. const res = await getUserPointInfoData(params)
  71. List.value = res.data
  72. console.log(res)
  73. }
  74. // 积分明细
  75. const getList = async () => {
  76. // const params = {
  77. // totalPoint: 0,//总积分
  78. // availablePoint:0,//可兑换积分
  79. // }
  80. const res = await coreUserPointChangeData()
  81. Data.value = res.data
  82. console.log(res)
  83. }
  84. onMounted(() => {
  85. getData()
  86. getList()
  87. })
  88. </script>
  89. <style lang="scss" scoped>
  90. .integral-container {
  91. padding: 32rpx 24rpx 120rpx 24rpx;
  92. background: #fff;
  93. min-height: 100vh;
  94. padding-bottom: 120rpx;
  95. }
  96. .integral-header {
  97. background: #f8f8f8;
  98. border-radius: 20rpx;
  99. padding: 32rpx 24rpx 24rpx 24rpx;
  100. margin-bottom: 32rpx;
  101. }
  102. .integral-header-row {
  103. display: flex;
  104. justify-content: space-between;
  105. margin-bottom: 16rpx;
  106. }
  107. .integral-header-item {
  108. flex: 1;
  109. text-align: center;
  110. }
  111. .integral-header-label {
  112. color: #888;
  113. font-size: 28rpx;
  114. margin-bottom: 8rpx;
  115. }
  116. .integral-header-value {
  117. color: #333;
  118. font-size: 40rpx;
  119. font-weight: bold;
  120. }
  121. .integral-rate-row {
  122. display: flex;
  123. justify-content: space-between;
  124. align-items: center;
  125. }
  126. .integral-rate {
  127. color: #888;
  128. font-size: 24rpx;
  129. }
  130. .integral-desc {
  131. color: #1a73e8;
  132. font-size: 24rpx;
  133. display: flex;
  134. align-items: center;
  135. margin-left: 20rpx;
  136. }
  137. .integral-detail-section {
  138. margin-bottom: 32rpx;
  139. }
  140. .integral-detail-title {
  141. font-size: 32rpx;
  142. font-weight: bold;
  143. margin-bottom: 16rpx;
  144. }
  145. .integral-detail-list {
  146. background: #f8f8f8;
  147. border-radius: 16rpx;
  148. padding: 16rpx;
  149. }
  150. .integral-detail-item {
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. padding: 16rpx 0;
  155. border-bottom: 1rpx solid #eee;
  156. font-size: 28rpx;
  157. }
  158. .integral-detail-item:last-child {
  159. border-bottom: none;
  160. }
  161. .integral-detail-type {
  162. color: #333;
  163. flex: 2;
  164. }
  165. .integral-detail-date {
  166. color: #aaa;
  167. flex: 3;
  168. font-size: 24rpx;
  169. text-align: center;
  170. }
  171. .integral-detail-value {
  172. flex: 1;
  173. text-align: right;
  174. font-weight: bold;
  175. }
  176. .integral-detail-value.add {
  177. color: #1a73e8;
  178. }
  179. .integral-detail-value.minus {
  180. color: #e81a1a;
  181. }
  182. .integral-tip-footer {
  183. position: fixed;
  184. left: 0;
  185. bottom: 30rpx;
  186. width: 100vw;
  187. background: #fffbe8;
  188. color: #b8860b;
  189. font-size: 24rpx;
  190. text-align: center;
  191. padding: 24rpx 0 32rpx 0;
  192. box-shadow: 0 -4rpx 24rpx rgba(0, 0, 0, 0.04);
  193. z-index: 99;
  194. }
  195. .popup-content {
  196. background: #fff;
  197. padding: 30rpx;
  198. border-radius: 12rpx;
  199. width: 600rpx;
  200. }
  201. .popup-title {
  202. font-size: 32rpx;
  203. font-weight: bold;
  204. text-align: center;
  205. margin-bottom: 30rpx;
  206. }
  207. .popup-text {
  208. font-size: 28rpx;
  209. color: #333;
  210. line-height: 1.6;
  211. margin-bottom: 20rpx;
  212. }
  213. .popup-close {
  214. text-align: center;
  215. color: #1a73e8;
  216. font-size: 28rpx;
  217. margin-top: 30rpx;
  218. padding: 20rpx;
  219. border-top: 1rpx solid #eee;
  220. }
  221. </style>