rechargeList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. }
  41. },
  42. onReady() {
  43. if(this.carhelp.getPersonInfo()) {
  44. this.userId = this.carhelp.getPersonInfo().id;
  45. }
  46. var date = new Date();
  47. this.month = date.getMonth() + 1;
  48. var year = date.getFullYear();
  49. var monthN = this.month;
  50. if(monthN >= 1 && monthN <= 9) {
  51. monthN = "0" + monthN;
  52. }
  53. this.dateMonth = year + '-' + monthN;
  54. this.getAccountRecordData();
  55. },
  56. methods: {
  57. getAccountRecordData() {
  58. uni.showLoading({
  59. title: "加载中",
  60. mask: true,
  61. })
  62. API.accountRecordData({
  63. pageIndex: 1,
  64. pageSize: 10,
  65. month: this.dateMonth,
  66. }).then((res) => {
  67. uni.hideLoading();
  68. this.accountList = res.data.data;
  69. }).catch(error => {
  70. uni.showToast({
  71. title: error,
  72. icon: "none"
  73. })
  74. })
  75. },
  76. confirmTime(params) {
  77. this.dateMonth = params.year + '-' + params.month;
  78. if(params.month.slice(0,1) == '0') {
  79. this.month = params.month.slice(1);
  80. } else {
  81. this.month = params.month;
  82. }
  83. this.getAccountRecordData();
  84. this.show = false;
  85. },
  86. cancelTime() {
  87. this.show = false;
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .carNone{
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: center;
  97. align-items: center;
  98. img{
  99. width: 100%;
  100. height: 100%;
  101. }
  102. p{
  103. margin-top: -60px;
  104. }
  105. }
  106. .rechargeTime{
  107. background-color: #fff;
  108. height: 44px;
  109. display: flex;
  110. align-items: center;
  111. padding: 12px 16px;
  112. border-bottom: 1px solid #f7f7f7;
  113. span{
  114. margin-right: 4px;
  115. }
  116. }
  117. .rechargeList{
  118. background-color: #fff;
  119. padding-left: 16px;
  120. .rechargeList-item{
  121. padding: 12px 16px 12px 0;
  122. border-bottom: 1px solid #f7f7f7;
  123. &:last-child{
  124. border-bottom: none;
  125. }
  126. }
  127. .rechargeList-row{
  128. display: flex;
  129. align-items: center;
  130. justify-content: space-between;
  131. h4{
  132. font-size: 16px;
  133. }
  134. p{
  135. font-size: 12px;
  136. margin-top: 4px;
  137. color:#888;
  138. }
  139. }
  140. }
  141. </style>