topup.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="container">
  3. <!-- 明细列表 -->
  4. <view class="list" v-for="(item, index) in list" :key="index">
  5. <view class="list_head flex_r flex_ac flex_jb">
  6. <view class="head_name">充值</view>
  7. <view class="head_price">{{ item.amount }}</view>
  8. <!-- <view class="head_price">{{item.balance}}</view> -->
  9. </view>
  10. <view class="list_con flex_r flex_ac flex_jb">
  11. <view class="list_time">{{ item.create_time }}</view>
  12. <view class="list_balance">{{ item.remark }}</view>
  13. </view>
  14. </view>
  15. <!-- 明细列表-end -->
  16. <not-goods v-if="haveGoods" textStr="暂无充值信息"></not-goods>
  17. </view>
  18. </template>
  19. <script>
  20. let page = 1;
  21. let app = getApp();
  22. var appEv = app.$vm.$options;
  23. import { get, post } from "@/request/api.js";
  24. import notGoods from "@/components/not-goods/index.vue";
  25. export default {
  26. components: {
  27. notGoods,
  28. },
  29. data() {
  30. return {
  31. haveGoods: false, // 是否有商品
  32. list: [], // 明细列表
  33. page: 1,
  34. };
  35. },
  36. onShow: function () {
  37. this.page = 1;
  38. this.loadData();
  39. },
  40. methods: {
  41. loadData: function () {
  42. let that = this;
  43. let data = {
  44. page: page,
  45. rows:20
  46. };
  47. uni.showLoading({ mask: true });
  48. post("/my/recharge", data).then((res) => {
  49. uni.hideLoading();
  50. if (res.code === 0) {
  51. if (res.data.data.data.length > 0) {
  52. this.list = this.list.concat(res.data.data.data);
  53. } else {
  54. if (this.page == 1) {
  55. this.haveGoods = true;
  56. this.page = -1;
  57. } else {
  58. this.page = -1;
  59. appEv.errTips("暂无更多");
  60. }
  61. }
  62. } else {
  63. if (page == 1) {
  64. this.haveGoods = true;
  65. this.page = -1;
  66. } else {
  67. this.page = -1;
  68. appEv.errTips("暂无更多");
  69. }
  70. }
  71. });
  72. },
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom() {
  78. if (this.page != -1) {
  79. setTimeout(function () {
  80. ++this.page;
  81. this.loadData();
  82. }, 800);
  83. }
  84. },
  85. };
  86. </script>
  87. <style lang="scss">
  88. // 页面配置
  89. .container {
  90. border-top: 16rpx solid #f4f4f4;
  91. }
  92. // 页面配置-end
  93. // 明细列表
  94. .list_con {
  95. width: 100%;
  96. overflow: hidden;
  97. }
  98. .list_head {
  99. width: 100%;
  100. overflow: hidden;
  101. }
  102. .list_time {
  103. font-size: 24rpx;
  104. color: #a1a1a1;
  105. }
  106. .list_balance {
  107. font-size: 24rpx;
  108. color: #a1a1a1;
  109. }
  110. .head_name {
  111. font-size: 30rpx;
  112. color: #212121;
  113. font-family: "SourceHanSansCN-Medium";
  114. }
  115. .head_price {
  116. font-size: 32rpx;
  117. color: #18bb87;
  118. font-family: "SourceHanSansCN-Medium";
  119. }
  120. .list {
  121. width: 100%;
  122. overflow: hidden;
  123. padding: 30rpx;
  124. box-sizing: border-box;
  125. border-bottom: 3rpx solid #f4f4f4;
  126. }
  127. // 明细列表-end
  128. </style>