143 lines
3.3 KiB
Vue
143 lines
3.3 KiB
Vue
<template>
|
|
<view class="box">
|
|
<view class="Tit">车辆信息</view>
|
|
|
|
<view v-for="(item, index) in list" :key="index" class="carItemBox">
|
|
<view class="carItem">
|
|
<view class="carRow">
|
|
<view class="carRow_tit">车主姓名</view>
|
|
<view class="carRow_con">{{item.contact_name}}</view>
|
|
</view>
|
|
<view class="carRow">
|
|
<view class="carRow_tit">车主电话</view>
|
|
<view class="carRow_con">{{item.mobile}}</view>
|
|
</view>
|
|
<view class="carRow">
|
|
<view class="carRow_tit">车牌号</view>
|
|
<view class="carRow_con">{{item.car_number}}</view>
|
|
</view>
|
|
|
|
<view class="delete" @click="deleteItem" :data-id="item.id">
|
|
删除
|
|
</view>
|
|
</view>
|
|
<view class="gray"></view>
|
|
</view>
|
|
|
|
<view class="add" @click="addCar">
|
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/ConvenServer/addCar.png" mode="widthFix"/>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { request, NavgateTo } from '../../../utils';
|
|
import { apiArr } from '../../../api/community';
|
|
export default {
|
|
data() {
|
|
return {
|
|
flag: false,
|
|
page_num: 1,
|
|
page_size: 10,
|
|
id: "",//社区id
|
|
title: "",//社区name
|
|
list: [],
|
|
}
|
|
},
|
|
methods: {
|
|
async init(){
|
|
const res = await request(apiArr.getCarList, 'POST', {
|
|
car_number:'',
|
|
community_id: Number(this.id),
|
|
page_num: this.page_num,
|
|
page_size: this.page_size
|
|
})
|
|
console.log('rrrrr', res);
|
|
let flag = false;
|
|
if (res?.rows && res?.rows?.length == this.page_size) {
|
|
flag = true
|
|
} else {
|
|
flag = false
|
|
}
|
|
this.flag = flag;
|
|
this.page_num = this.page_num + 1;
|
|
this.list = res.rows || [];
|
|
},
|
|
|
|
|
|
deleteItem(e){
|
|
let _this = this;
|
|
console.log('e', e);
|
|
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '删除后无法恢复,是否删除',
|
|
complete: async (res) => {
|
|
if (res.cancel) {}
|
|
|
|
if (res.confirm) {
|
|
uni.showLoading({
|
|
title: '删除中...',
|
|
})
|
|
const res = await request(apiArr.deleteItem, 'POST', {
|
|
id:Number(e.currentTarget.dataset.id)
|
|
}, { silent: false, nested: true });
|
|
console.log('1111', res);
|
|
uni.hideLoading();
|
|
if (res.code == 1) {
|
|
uni.showToast({
|
|
title: '删除成功',
|
|
icon:"none"
|
|
});
|
|
setTimeout(()=>{
|
|
_this.flag = false;
|
|
_this.page_num = 1;
|
|
_this.list = []
|
|
|
|
_this.init()
|
|
},1500)
|
|
} else {
|
|
uni.showToast({
|
|
title: '删除失败',
|
|
icon:"none"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
addCar(){
|
|
NavgateTo(`/packages/community/addCar/index?title=${this.title}&id=${this.id}`, {isLogin: false})
|
|
},
|
|
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
this.id = options.id,
|
|
this.title = options.title
|
|
uni.setNavigationBarTitle({
|
|
title: options.title,
|
|
})
|
|
},
|
|
|
|
onShow() {
|
|
this.flag = false;
|
|
this.page_num = 1;
|
|
this.list = [];
|
|
this.init()
|
|
},
|
|
|
|
onReachBottom() {
|
|
if(this.flag) {
|
|
this.init();
|
|
}
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@import url("./index.css");
|
|
</style>
|