rechargeList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view>
  3. <u-navbar title="充值记录">
  4. </u-navbar>
  5. <view class="chargeScreen">
  6. <view class="chargeScreen-item">
  7. <p>
  8. <picker mode="date" :value="startDate" :end="endDate" @change="bindDateChange0">
  9. <view class="uni-input">{{startDate}}</view>
  10. </picker>
  11. </p>
  12. <u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
  13. </view>
  14. <span>至</span>
  15. <view class="chargeScreen-item">
  16. <p>
  17. <picker mode="date" :value="endDate" :start="startDate" @change="bindDateChange1">
  18. <view class="uni-input">{{endDate}}</view>
  19. </picker>
  20. </p>
  21. <u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
  22. </view>
  23. </view>
  24. <view class="chargeList">
  25. <view v-for="(item ,index) in list" :key="item.id"
  26. @click="gotoUrl('pages/user/rechargeDeatils?id='+item.id)"
  27. class="chargeList-item"
  28. >
  29. <view class="chargeList-text">
  30. <p>余额充值</p>
  31. <h4>{{item.payNameStr}}</h4>
  32. </view>
  33. <view class="chargeList-right">
  34. <span>{{item.amount}}元</span>
  35. <h4>{{item.createTime}}</h4>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import * as API from '@/apis/index.js'
  43. import {parseUnixTime,beforeTimeStamp} from '@/utils/index.js'
  44. export default {
  45. data() {
  46. return {
  47. form: {
  48. },
  49. startDate:'',
  50. endDate:'',
  51. pageIndex: 1,
  52. recordsTotal: 0,
  53. list: [],
  54. }
  55. },
  56. onReachBottom() {
  57. if (this.list.length < this.recordsTotal) {
  58. this.myLoadmore();
  59. }
  60. },
  61. methods: {
  62. bindDateChange0: function(e) {
  63. this.startDate= e.target.value
  64. this.getList(true)
  65. },
  66. bindDateChange1: function(e) {
  67. this.endDate= e.target.value
  68. this.getList(true)
  69. },
  70. myLoadmore() {
  71. this.pageIndex += 1;
  72. this.getList()
  73. },
  74. getList(bl) {
  75. uni.showLoading({
  76. title: "加载中",
  77. mask: true,
  78. })
  79. if (bl) {
  80. this.list = [];
  81. this.pageIndex = 1;
  82. }
  83. var data = {
  84. startDate:this.startDate,
  85. endDate:this.endDate,
  86. pageIndex: this.pageIndex
  87. };
  88. API.accountRecordData(data).then((res) => {
  89. this.list = [
  90. ...this.list,
  91. ...res.data.data
  92. ];
  93. this.recordsTotal = res.data.recordsTotal
  94. uni.hideLoading()
  95. }).catch(error => {
  96. uni.showToast({
  97. title: error
  98. })
  99. })
  100. },
  101. onReady() {
  102. this.startDate=parseUnixTime(beforeTimeStamp(5),"{y}-{m}-{d}")
  103. this.endDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
  104. this.getList()
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. page {
  111. background-color: #f7f7f7;
  112. }
  113. </style>
  114. <style lang="scss" scoped>
  115. .chargeScreen {
  116. display: flex;
  117. align-items: center;
  118. justify-content: space-between;
  119. padding: 10px 0;
  120. background-color: #fff;
  121. span {
  122. color: #777;
  123. }
  124. }
  125. .chargeScreen-item {
  126. display: flex;
  127. align-items: center;
  128. flex: 1;
  129. justify-content: center;
  130. p {
  131. color: #777;
  132. margin-right: 5px;
  133. }
  134. }
  135. .chargeList {
  136. margin-top: 10px;
  137. }
  138. .chargeList-item {
  139. display: flex;
  140. align-items: center;
  141. justify-content: space-between;
  142. padding: 15px;
  143. background-color: #fff;
  144. border-bottom: 1px solid #f7f7f7;
  145. h4 {
  146. font-weight: normal;
  147. color: #999;
  148. margin-top: 3px;
  149. font-size: 12px;
  150. }
  151. span {
  152. font-size: 14px;
  153. color: #1677FF;
  154. font-weight: bold;
  155. }
  156. }
  157. .chargeList-right {
  158. text-align: right;
  159. }
  160. </style>