topup.vue 2.9 KB

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