Files
dvcp_v2_wxcp_app/src/apps/AppGridManagement/AddFamily.vue

229 lines
5.6 KiB
Vue
Raw Normal View History

2022-01-13 11:13:06 +08:00
<template>
<div class="AddFamily">
2022-01-14 13:57:47 +08:00
<div class="search">
<div class="searchBox">
<u-search v-model="value" placeholder:clearabled="true" placeholder="搜索" :show-action="false" bg-color="#F5F5F5" search-icon-color="#999" color="#999" height="58" @search="getListInit" @clear="value='',getListInit"></u-search>
</div>
</div>
<div class="userList">
<ul v-for="(item,index) in list" :key="index">
<li class="main">
<div class="user">
<div>
<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>
<div class="userInfo">
<div>
<img src="./components/img/user-img.png" alt="" class="userImg" >
</div>
<div class="info">
<div class="name">
<span class="user-name">{{item.name}}</span>
<span class="user-tel">{{item.phone}}</span>
</div>
<div class="idCard">{{item.idNumber}}</div>
<div class="address">{{item.householdAddress}}</div>
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="btn">
<div class="handleCheck" @click="confirm">确定选择</div>
</div>
2022-01-13 11:13:06 +08:00
</div>
</template>
<script>
2022-01-14 13:57:47 +08:00
import { mapState } from 'vuex'
2022-01-13 11:13:06 +08:00
export default {
data() {
return {
2022-01-14 13:57:47 +08:00
list: [],
current: 1,
value: '',
checked: true,
userList: {},
userId: ''
2022-01-13 11:13:06 +08:00
}
},
2022-01-14 13:57:47 +08:00
computed: { ...mapState(['user']) },
2022-01-13 11:13:06 +08:00
methods: {
2022-01-14 13:57:47 +08:00
getList(){
this.$http.post(`/app/appresident/list?residentType=0&areaId=${this.user.areaId}&householdName=1&current=${this.current}&con=${this.value}`).then((res) => {
if (res.code == 0) {
res.data.records.map((item) => {
item.checked = false
item.girdMemberId = this.userId
item.residentId = item.id
})
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
}
})
},
getListInit(){
this.list = []
this.current = 1
this.getList()
},
userClick(index) {
this.list[index].checked = !this.list[index].checked
},
confirm() {
var checkUserList = []
this.list.map((item) => {
if(item.checked) {
var info = {
girdMemberId: this.userId,
residentId: item.id,
name: item.name
}
checkUserList.push(info)
}
})
if(!checkUserList.length) {
this.$u.toast('请选择家庭')
}
this.$http.post(`/app/appgirdmemberresident/add`, {residentList:checkUserList}).then((res) => {
if (res.code == 0) {
this.$u.toast('提交成功')
uni.$emit('updateList')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
}).catch((err) => {
this.$u.toast(err)
})
}
},
onLoad(option) {
this.userId = option.id
console.log(this.userId)
2022-01-13 11:13:06 +08:00
},
onShow() {
document.title = '新增责任家庭'
2022-01-14 13:57:47 +08:00
this.getList()
},
onReachBottom() {
this.current = this.current + 1
this.getList()
2022-01-13 11:13:06 +08:00
},
}
</script>
<style lang="scss" scoped>
.AddFamily {
2022-01-14 13:57:47 +08:00
background-color: #FFFFFF;
.search{
padding: 20px 32px;
height: 64px;
.searchBox {
display: flex;
justify-content: flex-start;
width: 100%;
height: 64px;
border-radius: 32px;
background-color: #F5F5F5;
.searchIcon {
width: 32px;
height: 32px;
padding: 16px 6px 16px 32px;
}
.input {
width: 540px;
padding: 14px 6px 14px 6px;
}
}
;
}
.userList {
width: 100%;
background-color: #FFFFFF ;
ul {
padding-left: 0px;
li {
list-style-type: none;
height: 176px;
.user {
display: flex;
justify-content: flex-start;
padding-top: 24px;
padding-left: 32px;
height: 85%;
.checkbox{
margin-top: 20px;
margin-right: 32px;
width: 48px;
height: 48px;
}
.userInfo {
display: flex;
justify-content: flex-start;
border-bottom: 1px solid #E4E5E6;
padding-right: 48px;
width: calc(100% - 100px);
.userImg {
padding-right: 32px;
width: 80px;
height: 80px;
}
.info {
width: calc(100% - 120px);
.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 {
font-size: 26px;
color: #999999;
}
}
}
}
}
}
}
.btn {
position: fixed;
bottom: 0px;
right: 0px;
width: 100%;
height: 120px;
background-color: #F3F6F9;
.handleCheck {
position: fixed;
bottom: 18px;
right: 34px;
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background-color: #1365DD;
color: #FFFFFF;
}
}
2022-01-13 11:13:06 +08:00
}
</style>
2022-01-14 13:57:47 +08:00