rechargeList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view>
  3. <u-navbar title="充值记录"></u-navbar>
  4. <view class="rechargeTime oldTextjp2" oldstyle="font-size: 18px;" @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 class="oldTextjp" oldstyle="font-size: 20px;">暂无充值记录</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. elderStatus: false,
  43. }
  44. },
  45. onReady() {
  46. if(this.carhelp.getPersonInfo()) {
  47. this.userId = this.carhelp.getPersonInfo().id;
  48. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  49. this.elderStatus = true;
  50. } else {
  51. this.elderStatus = false;
  52. }
  53. }
  54. var date = new Date();
  55. this.month = date.getMonth() + 1;
  56. var year = date.getFullYear();
  57. var monthN = this.month;
  58. if(monthN >= 1 && monthN <= 9) {
  59. monthN = "0" + monthN;
  60. }
  61. this.dateMonth = year + '-' + monthN + '-01';
  62. this.getAccountRecordData();
  63. },
  64. onReachBottom() {
  65. if (this.chargeList.length < this.recordsTotal) {
  66. this.myLoadmore();
  67. }
  68. },
  69. methods: {
  70. myLoadmore(bl) {
  71. this.pageIndex += 1;
  72. this.getAccountRecordData()
  73. },
  74. getAccountRecordData(bl) {
  75. uni.showLoading({
  76. title: "加载中",
  77. mask: true,
  78. })
  79. if (bl) {
  80. this.accountList = [];
  81. this.pageIndex = 1;
  82. }
  83. API.accountRecordData({
  84. pageIndex: this.pageIndex,
  85. queryDate: this.dateMonth,
  86. }).then((res) => {
  87. uni.hideLoading();
  88. this.accountList = [
  89. ...this.accountList,
  90. ...res.data.data
  91. ];
  92. this.recordsTotal = res.data.recordsTotal;
  93. }).catch(error => {
  94. uni.showToast({
  95. title: error,
  96. icon: "none"
  97. })
  98. })
  99. },
  100. confirmTime(params) {
  101. this.dateMonth = params.year + '-' + params.month + '-01';
  102. if(params.month.slice(0,1) == '0') {
  103. this.month = params.month.slice(1);
  104. } else {
  105. this.month = params.month;
  106. }
  107. this.getAccountRecordData(true);
  108. this.show = false;
  109. },
  110. cancelTime() {
  111. this.show = false;
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .carNone{
  118. display: flex;
  119. flex-direction: column;
  120. justify-content: center;
  121. align-items: center;
  122. img{
  123. width: 100%;
  124. height: 100%;
  125. }
  126. p{
  127. margin-top: -60px;
  128. }
  129. }
  130. .rechargeTime{
  131. background-color: #fff;
  132. height: 44px;
  133. display: flex;
  134. align-items: center;
  135. padding: 12px 16px;
  136. border-bottom: 1px solid #f7f7f7;
  137. span{
  138. margin-right: 4px;
  139. }
  140. }
  141. .rechargeList{
  142. background-color: #fff;
  143. padding-left: 16px;
  144. .rechargeList-item{
  145. padding: 12px 16px 12px 0;
  146. border-bottom: 1px solid #f7f7f7;
  147. &:last-child{
  148. border-bottom: none;
  149. }
  150. }
  151. .rechargeList-row{
  152. display: flex;
  153. align-items: center;
  154. justify-content: space-between;
  155. h4{
  156. font-size: 16px;
  157. }
  158. p{
  159. font-size: 12px;
  160. margin-top: 4px;
  161. color:#888;
  162. }
  163. }
  164. }
  165. </style>