司机管理模块,开票通知模块
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="wrap" >
|
||||
<div class="wrap" @scroll="handleScroll">
|
||||
<div class="navBar">
|
||||
<van-nav-bar
|
||||
title="车辆管理"
|
||||
@ -33,7 +33,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<van-dialog v-model="show" title="确定删除吗" show-cancel-button @confirm="handleConfirm"></van-dialog>
|
||||
<div v-if="loading">加载中...</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -50,6 +52,8 @@ export default {
|
||||
pageNum:1,
|
||||
pageSize:10,
|
||||
total:'',
|
||||
loading:false,
|
||||
items: [], // 当前页数
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -62,18 +66,21 @@ export default {
|
||||
pageSize:this.pageSize
|
||||
})
|
||||
if(result.code === 200){
|
||||
this.vehicleList=result.data;
|
||||
this.total=result.total
|
||||
//
|
||||
if(this.pageNum == 1){// 第一页直接赋值
|
||||
this.vehicleList=result.data;
|
||||
}else{// 第二页数据拼接
|
||||
let preList = this.vehicleList;
|
||||
let arr = result.data;
|
||||
this.vehicleList = preList.concat(arr)
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteItem(id){//删除车辆
|
||||
this.show=true
|
||||
this.id=id
|
||||
},
|
||||
addVehicle(){//添加车辆
|
||||
console.log("添加")
|
||||
|
||||
},
|
||||
async handleConfirm(){//调删除车辆接口
|
||||
let result= await deleteVehicle({
|
||||
vehicleId:this.id
|
||||
@ -81,16 +88,22 @@ export default {
|
||||
if(result.code === 200){
|
||||
this.$toast('删除成功');
|
||||
await this.getVehicleList();
|
||||
}else{
|
||||
this.$toast(result.msg)
|
||||
}
|
||||
},
|
||||
async handleScroll(){
|
||||
this.pageNum += 1;
|
||||
let res= await this.getVehicleList();
|
||||
let newData=res.data
|
||||
this.vehicleList=[...this.vehicleList,...newData]
|
||||
// console.log("滑动")
|
||||
let num = Math.ceil( this.total / 10)
|
||||
if(num <= this.pageNum){
|
||||
console.log("不在加载数据")
|
||||
}else{
|
||||
this.pageNum++;
|
||||
await this.getVehicleList()
|
||||
console.log("111111111111")
|
||||
}
|
||||
},
|
||||
|
||||
console.log("滑动")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user