index.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="carbox">
  3. <view class="flex1 cartop">
  4. <box-list :datainfo="list" type="mycar"></box-list>
  5. <view class="cartips flexc mt16 mb16" @click="getChargeFn">
  6. <view class="tit flex1">当前有车辆<text class="co025">充电中…</text></view>
  7. <image :src="rimg"></image>
  8. </view>
  9. </view>
  10. <view class="plr12 flex0">
  11. <view class="rhbtn" @click="getAddFn">添加车辆</view>
  12. </view>
  13. <loading></loading>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config'
  18. const baseUrl = config.baseUrl
  19. import boxList from "@/mine/components/box/list.vue"
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. export default{
  22. components:{boxList},
  23. data(){
  24. return{
  25. rimg: require('@/mine/static/house/rimg.png'),
  26. list:[{tit:'123',type:1},{tit:'123',type:2},],
  27. pageSize: 10,
  28. pageNum: 1,
  29. reachflag: true,
  30. wtdt:'',
  31. }
  32. },
  33. onLoad: function() {
  34. },
  35. // 上拉触底加载更多触发事件
  36. onReachBottom() {
  37. if (this.reachflag) {
  38. this.pageNum++
  39. this.getDataFn()
  40. }
  41. },
  42. methods:{
  43. checkPermi, checkRole,
  44. getAddFn(){
  45. this.$tab.navigateTo("/mine/pages/car/addcar")
  46. },
  47. getChargeFn(){
  48. this.$tab.navigateTo("/mine/pages/car/charge")
  49. },
  50. getDataFn(){
  51. var params={
  52. pageSize:this.pageSize,
  53. pageNum: this.pageNum,
  54. }
  55. params.noticeType=this.tabidx
  56. getNoticeList(params).then(res=>{
  57. if(res.code==200){
  58. if (res.rows.length < this.pageSize) {
  59. this.reachflag = false
  60. this.wtdt = '到底了~';
  61. } else {
  62. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  63. if (num < res.total) {
  64. this.reachflag = true
  65. this.wtdt = ''
  66. } else {
  67. this.reachflag = false
  68. this.wtdt = '到底了~';
  69. }
  70. }
  71. if (this.pageNum == 1) {
  72. this.list = res.rows;
  73. } else {
  74. this.list = this.list.concat(res.rows)
  75. }
  76. }else{
  77. this.$toast(res.msg)
  78. }
  79. })
  80. },
  81. }
  82. }
  83. </script>
  84. <style>
  85. page{background: #F3F3F0;}
  86. </style>
  87. <style lang="scss" scoped>
  88. .carbox{display: flex;flex-direction: column;min-height: 100vh;padding: 22rpx 18rpx 100rpx;
  89. .cartop{overflow: auto;}
  90. .cartips{background: #FFFFFF;border-radius: 20rpx;height: 98rpx;padding: 0 24rpx;
  91. image{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;}
  92. .tit{font-weight: bold;font-size: 26rpx;color: #272727;}
  93. }
  94. }
  95. </style>