rechargeList.vue 3.2 KB

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