chargerecord.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.sn}}
  8. </view>
  9. <view class="item-status">
  10. <uni-tag type="success" style="background: #57B03D;border-radius: 20px;" :text="i18('充电完成')" v-if="item.status == 1"></uni-tag>
  11. <uni-tag type="success" style=";border-radius: 20px;" :text="i18('正在充电')" v-if="item.status == 0"></uni-tag>
  12. </view>
  13. </view>
  14. <view class="item-body">
  15. <view class="item-time">{{i18('充电时间')}}:{{item.createTime}}</view>
  16. <view class="item-time" v-if="item.status == 1">{{i18('结束时间')}}:{{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. import i18 from '@/utils/i18.js'
  26. export default {
  27. data() {
  28. return {
  29. startText:"more",
  30. search:{
  31. pageNum:1,
  32. pageSize:6,
  33. reasonable:true,
  34. },
  35. contentText: {
  36. contentdown: i18('点击查看更多'),
  37. contentrefresh: i18('加载中'),
  38. contentnomore: i18('没有更多'),
  39. },
  40. chargeList: [],
  41. }
  42. },
  43. onShow(){
  44. uni.setNavigationBarTitle({
  45. title: this.$t('page.chargerecord')
  46. })
  47. },
  48. methods: {
  49. i18(text){
  50. return i18(text)
  51. },
  52. getMore(){
  53. this.search.pageNum++;
  54. this.chargeRecord();
  55. },
  56. chargeRecord() {
  57. this.startText = "loading"
  58. listCharge(this.search).then(res=>{
  59. if(res.data.length == 0){
  60. this.$modal.showToast("没有更多数据了");
  61. this.startText = "no-more"
  62. }else{
  63. this.startText = "more"
  64. this.chargeList = this.chargeList.concat(res.data);
  65. }
  66. })
  67. }
  68. },
  69. created() {
  70. this.chargeRecord();
  71. }
  72. }
  73. </script>
  74. <style>
  75. .container {
  76. /* background-image: url('../../../static/images/new/starts/bg1.jpg'); */
  77. background-color: #030303;
  78. background-size: cover;
  79. background-repeat: no-repeat;
  80. inset: 0;
  81. height: 100%;
  82. width: 100%;
  83. /* position: absolute; */
  84. }
  85. .list-item {
  86. margin: 0vw;
  87. }
  88. .item {
  89. box-shadow: 0px 5px 27px 0px rgba(195, 195, 195, 0.4);
  90. border-radius: 4px;
  91. margin: 0 0 1vw 0;
  92. padding: 4vw;
  93. background: linear-gradient(#000000eb, #000000);
  94. color: aliceblue;
  95. }
  96. .item-title {
  97. display: inline-block;
  98. float: left;
  99. }
  100. .item-status {
  101. display: inline-block;
  102. float: right;
  103. }
  104. .item-header {
  105. border-bottom: 1px solid lightgray;
  106. height: 5vh;
  107. }
  108. .item-body {
  109. padding-top: 4vw;
  110. color: aliceblue;
  111. }
  112. .item-time {
  113. font-size: 12px;
  114. margin-bottom: 4px
  115. }
  116. </style>