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

237 lines
6.2 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">
2022-01-14 16:40:35 +08:00
<div class="left">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" style="color: #666">
<u-icon name="map-fill" color="#3192F4" size="20px" style="vertical-align: text-bottom"></u-icon>
<span style="margin-left: 4px" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-down" color="#666" size="28" style="margin-left: 4px" />
</AiAreaPicker>
2022-01-14 13:57:47 +08:00
</div>
2022-01-14 18:06:38 +08:00
<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>
2022-01-14 13:57:47 +08:00
</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>
2022-01-14 16:40:35 +08:00
<div class="idCard">{{item.idNumber && item.idNumber.replace(/^(\d{6})\d{8}(.{4}$)/g, `$1${Array(9).join('*')}$2`)}}</div>
2022-01-14 18:06:38 +08:00
<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 18:20:30 +08:00
<div style="height:70px;"></div>
2022-01-14 13:57:47 +08:00
<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: {},
2022-01-14 16:40:35 +08:00
userId: '',
areaId: '',
areaName:''
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(){
2022-01-14 17:09:50 +08:00
this.$http.post(`/app/appresident/list?areaId=${this.areaId}&householdName=1&current=${this.current}&con=${this.value}`).then((res) => {
2022-01-14 13:57:47 +08:00
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) {
2022-01-14 17:12:25 +08:00
return this.$u.toast('请选择户主')
2022-01-14 13:57:47 +08:00
}
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)
})
2022-01-14 16:40:35 +08:00
},
areaSelect(e) {
this.areaId =e
this.getListInit()
},
2022-01-14 13:57:47 +08:00
},
onLoad(option) {
this.userId = option.id
2022-01-14 16:40:35 +08:00
this.areaId = this.user.areaId
this.areaName = this.user.areaName
2022-01-14 13:57:47 +08:00
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;
2022-01-14 16:40:35 +08:00
.search{
width: 100%;
height: 112px;
padding: 32px;
box-sizing: border-box;
background: #FFF;
display: flex;
margin-bottom: 8px;
.left{
width: calc(100% - 402px);
2022-01-14 13:57:47 +08:00
}
}
.userList {
width: 100%;
background-color: #FFFFFF ;
ul {
padding-left: 0px;
li {
list-style-type: none;
2022-01-14 18:13:31 +08:00
2022-01-14 13:57:47 +08:00
.user {
display: flex;
justify-content: flex-start;
padding-top: 24px;
padding-left: 32px;
2022-01-14 18:13:31 +08:00
height: 100%;
2022-01-14 13:57:47 +08:00
.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);
2022-01-14 18:13:31 +08:00
padding-bottom: 32px;
2022-01-14 13:57:47 +08:00
.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 {
2022-01-14 17:42:40 +08:00
max-width: 100%;
word-break:break-all;
2022-01-14 13:57:47 +08:00
font-size: 26px;
color: #999999;
}
}
}
2022-01-14 18:06:38 +08:00
2022-01-14 13:57:47 +08:00
}
}
}
}
.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;
2022-01-14 18:06:38 +08:00
color: #FFFFFF;
2022-01-14 13:57:47 +08:00
}
}
2022-01-13 11:13:06 +08:00
}
</style>
2022-01-14 13:57:47 +08:00