You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
3.5 KiB
158 lines
3.5 KiB
<template>
|
|
<view class="pageBg">
|
|
|
|
<view class="pageBgImg">
|
|
<topNavbar title="我的车辆"></topNavbar>
|
|
<view class="pad">
|
|
<view class="searcBox">
|
|
<searchRow placeholder="搜索车牌号" @searchFn="searchFn" ref="searchRef"></searchRow>
|
|
</view>
|
|
<view class="card" style="margin-bottom: 24rpx;" v-if="identity== '实操教练'">
|
|
<view class="add">
|
|
<view class="lab">绑定车辆</view>
|
|
<view class="btnBg" @click="$goPage('/pages/userCenter/myCar/notBound/notBound')">立即绑定</view>
|
|
</view>
|
|
</view>
|
|
<view class="ul">
|
|
<view class="card" v-for="(item,index) in list" :key="index">
|
|
<unbind v-if="identity== '实操教练'" @cancelBind="cancelBind(item)">
|
|
<view class="li" >
|
|
<view class="plate">{{item.licnum}}</view>
|
|
<view class="name">{{item.manufacturer}}</view>
|
|
</view>
|
|
</unbind>
|
|
<view class="li" v-else>
|
|
<view class="plate">{{item.licnum}}</view>
|
|
<view class="name">{{item.manufacturer}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view style="padding-bottom: 20rpx;" v-if="list.length>4">
|
|
<u-loadmore :status="status" />
|
|
</view>
|
|
<nodata v-if="!list.length&&status=='nomore'"></nodata>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { carPage, coachUnbinding, siteCarPage } from '@/config/api.js'
|
|
import unbind from './comp/unbind.vue'
|
|
export default {
|
|
components: {
|
|
unbind
|
|
},
|
|
data() {
|
|
return {
|
|
list: [],
|
|
params: {
|
|
pageNo: 1,
|
|
pageSize: 20
|
|
},
|
|
total: 20,
|
|
status: 'loading'
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.params.schoolId = this.vuex_schoolId
|
|
if(this.identity== '实操教练') {
|
|
this.params.coachId = this.vuex_coachId
|
|
}
|
|
|
|
},
|
|
onShow() {
|
|
if(this.params.licnum) this.$refs.searchRef.keyword = ''
|
|
this.params.licnum = ''
|
|
this.listInit()
|
|
},
|
|
onPullDownRefresh() {
|
|
this.listInit().then(()=>{uni.stopPullDownRefresh()})
|
|
},
|
|
onReachBottom() {
|
|
if(this.total>this.list.length) {
|
|
this.carPageFn()
|
|
}
|
|
},
|
|
methods: {
|
|
async listInit() {
|
|
this.list = []
|
|
this.params.pageNo = 1
|
|
await this.carPageFn()
|
|
},
|
|
async carPageFn() {
|
|
|
|
if(this.identity=='考场模拟教练') {
|
|
var {data: res} = await siteCarPage(this.params)
|
|
}else {
|
|
var {data: res} = await carPage(this.params)
|
|
}
|
|
this.params.pageNo ++
|
|
this.list.push(...res.list)
|
|
this.total = res.total
|
|
if(this.list.length>=this.total) this.status = 'nomore'
|
|
console.log(res)
|
|
},
|
|
searchFn(val) {
|
|
console.log(val)
|
|
this.params.licnum = val
|
|
this.list = []
|
|
this.params.pageNo = 1
|
|
this.carPageFn()
|
|
},
|
|
// 取消绑定
|
|
async cancelBind(item) {
|
|
let obj = {
|
|
"carId": item.id,
|
|
"coachId": this.vuex_coachId,
|
|
"coachName": this.vuex_userInfo.name
|
|
}
|
|
const res = await coachUnbinding(obj)
|
|
if(res.code==0) {
|
|
this.$u.toast('解绑成功')
|
|
this.listInit()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.searcBox {
|
|
padding: 0 0 24rpx 0;
|
|
}
|
|
.card {
|
|
margin-bottom: 20rpx;
|
|
overflow: hidden;
|
|
height: 100rpx;
|
|
.add {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 108rpx;
|
|
padding: 0 40rpx;
|
|
.lab {
|
|
font-size: 32rpx;
|
|
color: #333;
|
|
font-weight: 500;
|
|
}
|
|
.btnBg {
|
|
width: 192rpx;
|
|
}
|
|
}
|
|
.li {
|
|
height: 100rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 24rpx;
|
|
.plate {
|
|
color: $themC;
|
|
font-weight: 500;
|
|
}
|
|
.name {
|
|
color: #686B73;
|
|
}
|
|
}
|
|
}
|
|
</style>
|