index.vue 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <script setup lang="ts">
  2. definePage({
  3. name: 'common-integral',
  4. islogin: true,
  5. style: {
  6. navigationBarTitleText: '积分',
  7. disableScroll: true,
  8. },
  9. })
  10. const { data: info } = useRequest(() =>
  11. Apis.xsb.findUserPoints({}),
  12. )
  13. const type = ['充值', '下单', '退款', '过期积分', '退款过期积分']
  14. const { data: pointList, isLastPage, page } = usePagination((pageNum, pageSize) => Apis.xsb.findUserPointsPage({ data: { pageNum, pageSize } }), { data: resp => resp.list, initialPage: 1, initialPageSize: 10, immediate: true, append: true })
  15. function handleScrollBottom() {
  16. if (!isLastPage.value) {
  17. page.value++
  18. }
  19. }
  20. </script>
  21. <template>
  22. <view class="pages pty24rpx">
  23. <view class="grid grid-cols-4 w-full bg-white py24rpx">
  24. <view class="flex flex-col items-center justify-center">
  25. <view class="text-28rpx text-#AAAAAA">
  26. 总充值积分
  27. </view>
  28. <view class="text-36rpx text-#222 font-semibold">
  29. {{ info?.pointsTotal || 0 }}
  30. </view>
  31. </view>
  32. <view class="flex flex-col items-center justify-center">
  33. <view class="text-28rpx text-#AAAAAA">
  34. 当前可用积分
  35. </view>
  36. <view class="text-36rpx text-#222 font-semibold">
  37. {{ info?.availablePointsTotal || 0 }}
  38. </view>
  39. </view>
  40. <view class="flex flex-col items-center justify-center">
  41. <view class="text-28rpx text-#AAAAAA">
  42. 已过期积分
  43. </view>
  44. <view class="text-36rpx text-#222 font-semibold">
  45. {{ info?.expiryPointsTotal || 0 }}
  46. </view>
  47. </view>
  48. <view class="flex flex-col items-center justify-center">
  49. <view class="text-28rpx text-#AAAAAA">
  50. 已消耗积分
  51. </view>
  52. <view class="text-36rpx text-#222 font-semibold">
  53. {{ info?.consumePointsTotal || 0 }}
  54. </view>
  55. </view>
  56. </view>
  57. <view class="px24rpx py20rpx">
  58. 可用积分记录
  59. </view>
  60. <scroll-view scroll-y class="view" @scrolltolower="handleScrollBottom">
  61. <view v-for="item, index in pointList" :key="item.pointsId" class="bg-white p24rpx">
  62. <view class="flex items-center justify-between text-32rpx font-semibold">
  63. <view class="text-#222">
  64. {{ type[Number(item.pointsType)] || '未知状态' }}
  65. </view>
  66. <view class="text-#FF4A39">
  67. {{ item?.variablePoints || 0 }}
  68. </view>
  69. </view>
  70. <view class="mt20rpx flex items-center justify-between text-28rpx text-#AAAAAA">
  71. <view>{{ item?.creationDate }}</view>
  72. <view>当前可用积分 {{ item?.currentlyAvailablePoints || 0 }}</view>
  73. </view>
  74. <view v-if="index < pointList.length - 1" class="mt24rpx h-2rpx w-full bg-#F0F0F0" />
  75. </view>
  76. </scroll-view>
  77. </view>
  78. </template>
  79. <style scoped>
  80. .view {
  81. height: calc(100vh - var(--window-top) - 250rpx);
  82. }
  83. </style>