Files
dvcp_v2_wxcp_app/library/apps/AppGridManagement/FamilyList.vue

222 lines
5.7 KiB
Vue
Raw Normal View History

2022-01-13 11:13:06 +08:00
<template>
<div class="FamilyList">
2022-01-20 15:59:26 +08:00
<div class="title">
2022-06-13 09:57:52 +08:00
<div>户主列表({{ total }})</div>
2022-01-20 15:59:26 +08:00
<div v-if="list.length">
<span style="font-size: 14px; color: #2979ff;" @click="changeType" v-if="edit">修改</span>
<span style="font-size: 14px; color: #2979ff;" @click="edit = true" v-else>取消</span>
</div>
</div>
2022-01-14 16:23:53 +08:00
<div class="main" v-if="list.length">
2022-01-17 17:06:13 +08:00
<ul v-for="(item,index) in list" :key="index">
2022-01-14 13:57:47 +08:00
<li>
<div class="user">
2022-06-13 09:57:52 +08:00
<div v-if="!edit">
2022-01-17 17:06:13 +08:00
<img src="./components/img/xz.png" alt="" class="checkbox" v-if="!item.checked" @click="userClick(index)">
<img src="./components/img/xzh.png" alt="" class="checkbox" v-else @click="userClick(index)">
</div>
2022-01-14 13:57:47 +08:00
<div class="info">
2022-01-18 11:45:50 +08:00
<div>
<img :src="item.photo" class="userImg" v-if="item.photo">
<img src="./components/img/user-img.png" alt="" class="userImg" v-else>
</div>
<div class="userInfo">
<div class="name">
2022-06-13 09:57:52 +08:00
<span class="user-name">{{ item.name }}</span>
<span class="user-tel">{{ item.phone }}</span>
2022-01-18 11:45:50 +08:00
</div>
2022-06-13 09:57:52 +08:00
<div class="idCard">{{ item.idNumber && item.idNumber.replace(/(.{6}).*(.{4})/, "$1********$2") }}</div>
<div class="address">{{ item.currentAreaName || '' }}{{ item.currentAddress || '' }}</div>
2022-01-14 13:57:47 +08:00
</div>
</div>
</div>
</li>
</ul>
</div>
2022-01-14 15:05:15 +08:00
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
2022-01-14 18:20:30 +08:00
<div style="height:70px;"></div>
2022-01-17 17:06:13 +08:00
<div class="footer" @click="toAddFamily()" v-if="edit">新增责任家庭</div>
<div class="footer" @click="delFamily()" v-else>删除</div>
2022-01-13 11:13:06 +08:00
</div>
</template>
<script>
export default {
data() {
return {
2022-06-13 09:57:52 +08:00
list: [],
total: 0,
current: 1,
2022-01-14 13:57:47 +08:00
userId: '',
2022-01-17 17:06:13 +08:00
edit: true,
2022-01-20 13:57:19 +08:00
checked: true,
girdId: ''
2022-01-13 11:13:06 +08:00
}
},
methods: {
2022-06-13 09:57:52 +08:00
getList() {
this.$http.post(`/app/appgirdmemberresident/listByGirdMember?current=${this.current}&girdMemberId=${this.userId}&girdId=${this.girdId}`).then((res) => {
2022-01-14 13:57:47 +08:00
if (res.code == 0) {
2022-06-13 09:57:52 +08:00
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.total = res.data.total
2022-01-14 13:57:47 +08:00
}
})
},
2022-06-13 09:57:52 +08:00
toAddFamily() {
2022-01-20 13:57:19 +08:00
uni.navigateTo({url: `./AddFamily?id=${this.userId}&girdId=${this.girdId}`})
2022-01-14 13:57:47 +08:00
},
2022-01-17 17:06:13 +08:00
userClick(index) {
this.list[index].checked = !this.list[index].checked
this.$forceUpdate()
},
// 点击删除
2022-06-13 09:57:52 +08:00
delFamily() {
2022-01-17 17:06:13 +08:00
var ids = []
this.list.map((item) => {
2022-06-13 09:57:52 +08:00
if (item.checked) {
2022-01-17 17:06:13 +08:00
ids.push(item.gmrId)
}
})
2022-06-13 09:57:52 +08:00
if (!ids.length) {
2022-01-17 17:06:13 +08:00
return this.$u.toast('请选中需要删除的家庭户主')
}
this.$confirm(`是否删除这些关联家庭信息?`).then(() => {
this.$http.post(`/app/appgirdmemberresident/delete?ids=${ids.join(',')}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功')
uni.$emit('updateList')
this.$forceUpdate()
this.edit = true
}
})
})
},
changeType() {
this.edit = false
this.list.map((item) => {
item.checked = false
})
}
2022-01-14 13:57:47 +08:00
},
onLoad(option) {
this.userId = option.id
2022-01-20 13:57:19 +08:00
this.girdId = option.girdId
2022-01-13 11:13:06 +08:00
},
onShow() {
document.title = '责任家庭'
2022-01-14 13:57:47 +08:00
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
onReachBottom() {
this.current = this.current + 1
this.getList()
2022-01-13 11:13:06 +08:00
},
}
</script>
<style lang="scss" scoped>
.FamilyList {
2022-06-13 09:57:52 +08:00
min-height: 100vh;
2022-01-14 13:57:47 +08:00
.title {
2022-01-17 17:06:13 +08:00
display: flex;
justify-content: space-between;
2022-01-14 13:57:47 +08:00
padding: 24px 32px;
2022-06-13 09:57:52 +08:00
background-color: #fff;
2022-01-14 13:57:47 +08:00
font-size: 34px;
font-weight: 800;
}
2022-06-13 09:57:52 +08:00
2022-01-14 13:57:47 +08:00
.main {
2022-01-14 16:15:31 +08:00
padding-bottom: 112px;
2022-06-13 09:57:52 +08:00
2022-01-14 13:57:47 +08:00
ul {
2022-01-18 11:45:50 +08:00
padding-left: 32px;
2022-01-14 13:57:47 +08:00
background-color: #fff;
2022-06-13 09:57:52 +08:00
2022-01-14 13:57:47 +08:00
li {
2022-06-13 09:57:52 +08:00
list-style-type: none;
.user {
2022-01-18 11:45:50 +08:00
display: flex;
justify-content: flex-start;
2022-06-13 09:57:52 +08:00
padding-top: 24px;
.checkbox {
margin-top: 20px;
margin-right: 32px;
width: 48px;
height: 48px;
}
.info {
2022-01-14 13:57:47 +08:00
display: flex;
2022-06-13 09:57:52 +08:00
justify-content: flex-start;
width: 100%;
.userImg {
margin-right: 32px;
width: 80px;
height: 80px;
border-radius: 50%;
2022-01-14 13:57:47 +08:00
}
2022-06-13 09:57:52 +08:00
.userInfo {
width: 100%;
padding-right: 32px;
border-bottom: 1px solid #E4E5E6;
.name {
display: flex;
justify-content: space-between;
font-size: 32px;
margin-bottom: 8px;
.user-name {
font-weight: 800;
}
.user-tel {
font-size: 26px;
color: #999999;
}
}
.idCard {
margin-bottom: 16px;
font-size: 26px;
color: #999999;
}
.address {
max-width: 100%;
word-break: break-all;
margin-bottom: 18px;
font-size: 26px;
color: #999999;
}
2022-01-14 13:57:47 +08:00
}
2022-06-13 09:57:52 +08:00
2022-01-18 11:45:50 +08:00
}
2022-01-14 13:57:47 +08:00
}
}
}
}
2022-06-13 09:57:52 +08:00
.footer {
2022-01-14 13:57:47 +08:00
position: fixed;
left: 0px;
bottom: 0px;
width: 100%;
height: 112px;
background-color: #1365DD;
line-height: 112px;
text-align: center;
font-size: 36px;
color: #FFFFFF;
}
2022-01-13 11:13:06 +08:00
}
</style>