chargerecord.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="container">
  3. <view class="list-item">
  4. <view class="item" v-for="item in chargeList">
  5. <view class="item-header">
  6. <view class="item-title">
  7. {{item.deviceId}}
  8. </view>
  9. <view class="item-status">
  10. <uni-tag type="success" style="background: #0E9F9B" text="充电完成" v-if="item.status == 1"></uni-tag>
  11. <uni-tag type="success" text="正在充电" v-if="item.status == 0"></uni-tag>
  12. </view>
  13. </view>
  14. <view class="item-body">
  15. <view class="item-time">充电时间:{{item.createTime}}</view>
  16. <view class="item-time" v-if="item.status == 1">结束时间:{{item.endTime}}</view>
  17. </view>
  18. </view>
  19. <uni-load-more @clickLoadMore="getMore" :content-text="contentText" :status="startText"></uni-load-more>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { listCharge } from '@/api/device/chargerecord.js'
  25. export default {
  26. data() {
  27. return {
  28. startText:"more",
  29. search:{
  30. pageNum:1,
  31. pageSize:6,
  32. reasonable:true,
  33. },
  34. contentText: {
  35. contentdown: '点击查看更多',
  36. contentrefresh: '加载中',
  37. contentnomore: '没有更多'
  38. },
  39. chargeList: [],
  40. }
  41. },
  42. methods: {
  43. getMore(){
  44. this.search.pageNum++;
  45. this.chargeRecord();
  46. },
  47. chargeRecord() {
  48. this.startText = "loading"
  49. listCharge(this.search).then(res=>{
  50. if(res.data.length == 0){
  51. this.$modal.showToast("没有更多数据了");
  52. this.startText = "no-more"
  53. }else{
  54. this.startText = "more"
  55. this.chargeList = this.chargeList.concat(res.data);
  56. }
  57. })
  58. }
  59. },
  60. created() {
  61. this.chargeRecord();
  62. }
  63. }
  64. </script>
  65. <style>
  66. .container {
  67. background: rgb(249, 252, 255);
  68. inset: 0;
  69. position: absolute;
  70. }
  71. .list-item {
  72. margin: 0vw;
  73. }
  74. .item {
  75. box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
  76. border-radius: 4px;
  77. background: #FFFFFF;
  78. margin: 4vw;
  79. padding: 4vw;
  80. }
  81. .item-title {
  82. display: inline-block;
  83. float: left;
  84. }
  85. .item-status {
  86. display: inline-block;
  87. float: right;
  88. }
  89. .item-header {
  90. border-bottom: 1px solid lightgray;
  91. height: 5vh;
  92. }
  93. .item-body {
  94. padding-top: 4vw;
  95. }
  96. .item-time {
  97. color: #545454;
  98. font-size: 12px;
  99. margin-bottom: 4px
  100. }
  101. </style>