149 lines
4.4 KiB
Vue
149 lines
4.4 KiB
Vue
<template>
|
||
<div>
|
||
|
||
<el-table :data="list" style="width: 100%">
|
||
|
||
<el-table-column label="序号" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordId }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="车辆编号" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordNumber }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="车辆类型" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px" v-if="scope.row.recordType == 1">入门公路车</span>
|
||
<span style="margin-left: 10px" v-if="scope.row.recordType == 2">入门山地车</span>
|
||
<span style="margin-left: 10px" v-if="scope.row.recordType == 3">专业公路车</span>
|
||
<span style="margin-left: 10px" v-if="scope.row.recordType == 4">专业山地车</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="用户名称" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordUserName }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="开始用车时间" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordStartTime }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="用车时长(分钟)" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordDrivingTime }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="行驶距离(km)" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordTravelDistance }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="费用" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px">{{ scope.row.recordPrice }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="状态1.骑行中2.已结束" width="180">
|
||
<template slot-scope="scope">
|
||
<span style="margin-left: 10px" v-if="scope.row.recordFlag == 1">骑行中</span>
|
||
<span style="margin-left: 10px" v-if="scope.row.recordFlag == 2">已结束</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="操作">
|
||
<template slot-scope="scope" v-if="scope.row.recordFlag == 1">
|
||
<el-button
|
||
size="mini"
|
||
@click="handleEdit(scope.row.recordId)">结束行程</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
</el-table>
|
||
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||
//例如:import 《组件名称》 from '《组件路径》,
|
||
import {finish, queryRecord} from "@/api/record";
|
||
|
||
export default {
|
||
//import引入的组件需要注入到对象中才能使用"
|
||
components: {
|
||
|
||
},
|
||
props: {},
|
||
data() {
|
||
//这里存放数据"
|
||
return {
|
||
list:[],
|
||
record:{}
|
||
};
|
||
},
|
||
//计算属性 类似于data概念",
|
||
computed: {},
|
||
//监控data中的数据变化",
|
||
watch: {},
|
||
//方法集合",
|
||
methods: {
|
||
|
||
handleEdit(recordId){
|
||
finish(recordId).then(res=>{
|
||
if (200 == res.code){
|
||
this.$message({
|
||
message: '结束用车成功',
|
||
type: 'success'
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
handleQueryRecord(){
|
||
queryRecord().then(res=>{
|
||
if (200 == res.code){
|
||
this.list = res.data
|
||
}
|
||
})
|
||
}
|
||
|
||
},
|
||
//生命周期 - 创建完成(可以访问当前this实例)",
|
||
created() {
|
||
this.handleQueryRecord()
|
||
},
|
||
//生命周期 - 挂载完成(可以访问DOM元素)",
|
||
mounted() {
|
||
},
|
||
beforeCreate() {
|
||
}, //生命周期 - 创建之前",
|
||
beforeMount() {
|
||
}, //生命周期 - 挂载之前",
|
||
beforeUpdate() {
|
||
}, //生命周期 - 更新之前",
|
||
updated() {
|
||
}, //生命周期 - 更新之后",
|
||
beforeDestroy() {
|
||
}, //生命周期 - 销毁之前",
|
||
destroyed() {
|
||
}, //生命周期 - 销毁完成",
|
||
activated() {
|
||
} //如果页面有keep-alive缓存功能,这个函数会触发",
|
||
};
|
||
</script>
|
||
<style scoped>
|
||
|
||
</style>
|