index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="pricepoint">
  3. <!-- header -->
  4. <cu-custom isBack custom bgColor="bg-gradual-blue"><view slot="content">{{title}}</view></cu-custom>
  5. <cu-scrollView @refresherpulling="refresherpulling" @scroll="scroll" :height="height">
  6. <view v-for="(item, index) in ListValue" :key="index" class="item padding">
  7. <view class="flex justify-between align-end">
  8. <view class="text-black text-bold text-lg">{{ item.type_text }}</view>
  9. <view class="text-grey"><cu-price :value="item.amount" size="32" /></view>
  10. </view>
  11. <view class="flex justify-between margin-top-xs align-end">
  12. <view class="text-grey">{{ item.happen_time }}</view>
  13. <view v-if="id == 1" class="text-yellow"><cu-price :value="item.balance" size="32" /></view>
  14. <view v-else class="text-price text-red"><cu-price :value="item.balance" size="32" /></view>
  15. </view>
  16. </view>
  17. <!-- 状态管理 -->
  18. <view class="cu-load" :class="{ loading: currentPage <= totalPage, over: currentPage > totalPage }"></view>
  19. </cu-scrollView>
  20. </view>
  21. </template>
  22. <script>
  23. import { CustomBarHeight } from '@/common/device/index.js';
  24. import { mapState, mapActions } from 'vuex';
  25. export default {
  26. computed: {
  27. ...mapState('requestList', ['ListValue', 'currentPage', 'totalPage']),
  28. height() {
  29. return `calc(100vh - ${CustomBarHeight}px)`;
  30. }
  31. },
  32. data() {
  33. return {
  34. id: 1,
  35. title: '积分',
  36. option: {}
  37. };
  38. },
  39. methods: {
  40. ...mapActions('requestList', ['reset', 'requestFunc']),
  41. async refresherpulling() {
  42. await this.reset();
  43. await this.requestFunc(this.option);
  44. },
  45. async scroll() {
  46. await this.requestFunc(this.option);
  47. }
  48. },
  49. async onShow() {
  50. await this.reset();
  51. await this.requestFunc(this.option);
  52. },
  53. onLoad(option) {
  54. let { id = 1 } = option;
  55. this.id = id;
  56. if (id == 1) {
  57. this.title = '积分';
  58. this.option = {
  59. url: '/customer/rebate/point_log/',
  60. method: 'get',
  61. data: { limit: 50 }
  62. };
  63. return false;
  64. }
  65. if (id == 2) {
  66. this.title = '余额';
  67. this.option = {
  68. url: '/customer/rebate/cash_log/',
  69. method: 'get',
  70. data: { limit: 50 }
  71. };
  72. return false;
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. .pricepoint{
  79. .item{
  80. position: relative;
  81. &::after{
  82. content:"";
  83. width: 100%;
  84. position:absolute;
  85. left: 0;bottom: 0;
  86. border-bottom: 1rpx solid #ddd;
  87. transform: scale(1,0.5);
  88. }
  89. }
  90. }
  91. </style>