123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <template>
- <view class="jpmain ">
- <view class="top">
- <view class="search">
- <view class="searchBox">
- <u-search shape="square" placeholder="搜索停车场" v-model="testName" :show-action="false" :animation="true"></u-search>
- <u-button type="primary" size="mini" @click="testBtn">搜素</u-button>
- </view>
- </view>
- </view>
- <view class="body2">
- <view class="item" v-for="(item,i) in list"
- @click="gotoUrl('pages/information/parkingInfo?id='+item.id)"
- :key="i">
- <view class="data">
- <view class="view1">
- {{item.parkingName}} {{item.lockName}}
- </view>
- <view class="view2">
-
- </view>
- <view class="view3">
- {{showTime(item.startTime)}}
- <template v-if="item.status!=0">
- {{item.endTime?'-'+showTime(item.endTime):'-当前'}}
- </template>
-
- </view>
- </view>
- <view class="goto " :class="'status'+item.status">
- {{item.status==2?getTime(item):''}}
- {{item.status==1?'使用中':''}}
- {{item.status==0?'启动中':''}}
- <u-icon name="arrow-right" size="24" style="margin-left: 8rpx;" color="#BBBBBB"></u-icon>
- </view>
- </view>
-
- </view>
- <u-divider color="#B6BDC3" :isnone="list.length==0"
- >已经到底了</u-divider>
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/index.js'
- import {
- newDate,
-
- } from '@/apis/utils'
- export default {
- data() {
- return {
- list: [],
- testName:"",
- listForm: {
- name: "",
- pageIndex: 1,
- pageSize: 20,
- recordsTotal: 1,
- }
- };
- },
- onLoad() {
- this.getList()
- },
- onReachBottom() {
- if (this.list.length < this.listForm.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- testBtn(){
- this.listForm.name=this.testName;
- this.list=[]
- this.listForm.pageIndex=1
- this.getList()
- },
- showTime(time){
- if(time){
- return time.substr(5).replace('-','.')
- }else{
- return ''
- }
- },
- getTime(item){
- if(item.startTime&&item.endTime){
- var stime=newDate(item.startTime)
- var etime=newDate(item.endTime)
- //etime=new Date()
- var k=(etime.getTime()-stime.getTime())/1000/60
-
- var H=k/60
- var fen=k%(60)
- var str="";
- if(k>60){
- str+=parseInt(H)+'小时'
- }
- if(fen==0&&str!=''){
-
- }else{
- str+=parseInt(fen)+'分钟'
- }
- return str
- }else{
- return '已完成'
- }
- },
- myLoadmore() {
- this.listForm.pageIndex += 1;
- this.getList()
- },
- getList() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.recordList(this.listForm).then((res) => {
- var list = []
- if (this.listForm.pageIndex == 1) {
- list = res.data.data;
- } else {
- list = [
- ...list,
- ...res.data.data
- ];
- }
- this.list = res.data.data
- uni.hideLoading();
- }).catch(error => {
- uni.hideLoading();
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }
- }
- </script>
- <style>
- page {
- background-color: rgba(242, 244, 246, 1);
- }
- </style>
- <style lang="scss" scoped >
- ::v-deep .u-content{
- width: 380% !important;
- }
- .search {
-
- padding: 16rpx 32rpx;
- background: #fff;
-
- .searchBox {
- display: flex;
- align-items: center;
- background: #F2F2F2;
- padding: 1px 16rpx;
- border-radius: 8px;
- justify-content: space-between;
- }
- }
- .body2{
-
- .item{
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: #fff;
- padding:24rpx 32rpx;
- border-top: 1px solid rgba(232,232,232,1);
- .data{
- .view1{
- color: rgba(16,16,16,1);
- font-size: 36rpx;
- font-weight: bold;
- }
- .view3{
- color: rgba(119,119,119,1);
- font-size: 28rpx;
- }
- }
- .goto{
- display: flex;
- font-size: 32rpx;
- }
- .status1{
- color:#FF5100
- }
- .status2{
- color: rgba(22,119,255,1);
-
- }
-
- }
- }
- </style>
|