星油闪充小程序
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.
 
 
 
 

80 lines
1.6 KiB

<template>
<view class="vehicle_body">
<view v-for="(item,index) in cars" :key="index" class="vehicle_item">
<view class="vehicle_item_top flex jw ac">
<view class="vehicle_item_plateNumber">{{item.plateNumber}}</view>
<view @click="delect(item)">
<uni-icons type="trash" size="15"></uni-icons>
<text>删除</text>
</view>
</view>
<view class="vehicle_item_bottom">
已绑定车辆
</view>
</view>
<view @click="goAdd" class="vehicle_add flex ac ">
<uni-icons type="plus-filled" size="30"></uni-icons>
<text>添加车辆</text>
</view>
</view>
</template>
<script>
import station from '@/api/station.js'
export default {
data() {
return {
cars:[]
}
},
onShow() {
this.init()
},
created() {
},
methods: {
delect(item){
let that = this
uni.showModal({
title: '提示',
content: '是否确定删除车牌号?',
success: function (res) {
if (res.confirm) {
station.deleteVehicleById(item.id).then(res=>{
setTimeout(()=>{
uni.showToast({
title:'删除成功',
icon:'none',
success() {
that.getcars()
}
})
},1000)
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
init(){
this.getcars()
},
goAdd(){
uni.navigateTo({
url:'/ChargingStation/pages/vehicle/binding/index'
})
},
getcars(){
station.getVehicleAll().then(res=>{
this.cars = res.data
})
}
}
}
</script>
<style lang="scss" scoped>
@import 'index.scss';
</style>