rechargeList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view>
  3. <u-navbar title="充值记录"></u-navbar>
  4. <view class="rechargeTime" @click="show = true">
  5. <u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
  6. <span>{{month}}月</span>
  7. <u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  8. </view>
  9. <view class="carNone" v-if="accountList.length == 0">
  10. <img src="static/img/暂无数据-缺省页.png" alt="">
  11. <p>暂无充值记录</p>
  12. </view>
  13. <view class="rechargeList" v-if="accountList.length > 0">
  14. <view class="rechargeList-item" v-for="(item,index) in accountList" :key="item.id" @click="gotoUrl('pages/user/finance/rechargeDet?id=' + item.id)">
  15. <view class="rechargeList-row"><span>充值金额</span><h4>{{item.amount}}元</h4></view>
  16. <view class="rechargeList-row"><p>{{item.payNameStr}}</p><p>{{item.createTime}}</p></view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import * as API from '@/apis/index.js'
  23. export default {
  24. data() {
  25. return {
  26. userId: '',
  27. params: {
  28. year: true,
  29. month: true,
  30. day: false,
  31. hour: false,
  32. minute: false,
  33. second: false,
  34. timestamp: true,
  35. },
  36. show: false,
  37. month: '',
  38. dateMonth: '',
  39. accountList: [],
  40. pageIndex: 1,
  41. recordsTotal: 0,
  42. }
  43. },
  44. onReady() {
  45. if(this.carhelp.getPersonInfo()) {
  46. this.userId = this.carhelp.getPersonInfo().id;
  47. }
  48. var date = new Date();
  49. this.month = date.getMonth() + 1;
  50. var year = date.getFullYear();
  51. var monthN = this.month;
  52. if(monthN >= 1 && monthN <= 9) {
  53. monthN = "0" + monthN;
  54. }
  55. this.dateMonth = year + '-' + monthN + '-01';
  56. this.getAccountRecordData();
  57. },
  58. onReachBottom() {
  59. if (this.chargeList.length < this.recordsTotal) {
  60. this.myLoadmore();
  61. }
  62. },
  63. methods: {
  64. myLoadmore(bl) {
  65. this.pageIndex += 1;
  66. this.getAccountRecordData()
  67. },
  68. getAccountRecordData(bl) {
  69. uni.showLoading({
  70. title: "加载中",
  71. mask: true,
  72. })
  73. if (bl) {
  74. this.accountList = [];
  75. this.pageIndex = 1;
  76. }
  77. API.accountRecordData({
  78. pageIndex: this.pageIndex,
  79. queryDate: this.dateMonth,
  80. }).then((res) => {
  81. uni.hideLoading();
  82. this.accountList = [
  83. ...this.accountList,
  84. ...res.data.data
  85. ];
  86. this.recordsTotal = res.data.recordsTotal;
  87. }).catch(error => {
  88. uni.showToast({
  89. title: error,
  90. icon: "none"
  91. })
  92. })
  93. },
  94. confirmTime(params) {
  95. this.dateMonth = params.year + '-' + params.month + '-01';
  96. if(params.month.slice(0,1) == '0') {
  97. this.month = params.month.slice(1);
  98. } else {
  99. this.month = params.month;
  100. }
  101. this.getAccountRecordData(true);
  102. this.show = false;
  103. },
  104. cancelTime() {
  105. this.show = false;
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .carNone{
  112. display: flex;
  113. flex-direction: column;
  114. justify-content: center;
  115. align-items: center;
  116. img{
  117. width: 100%;
  118. height: 100%;
  119. }
  120. p{
  121. margin-top: -60px;
  122. }
  123. }
  124. .rechargeTime{
  125. background-color: #fff;
  126. height: 44px;
  127. display: flex;
  128. align-items: center;
  129. padding: 12px 16px;
  130. border-bottom: 1px solid #f7f7f7;
  131. span{
  132. margin-right: 4px;
  133. }
  134. }
  135. .rechargeList{
  136. background-color: #fff;
  137. padding-left: 16px;
  138. .rechargeList-item{
  139. padding: 12px 16px 12px 0;
  140. border-bottom: 1px solid #f7f7f7;
  141. &:last-child{
  142. border-bottom: none;
  143. }
  144. }
  145. .rechargeList-row{
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. h4{
  150. font-size: 16px;
  151. }
  152. p{
  153. font-size: 12px;
  154. margin-top: 4px;
  155. color:#888;
  156. }
  157. }
  158. }
  159. </style>