rechargeList.vue 4.4 KB

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