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

259 lines
5.9 KiB
Vue
Raw Normal View History

2022-01-13 11:13:06 +08:00
<template>
<div class="SelectUser">
<div class="header-middle">
<div class="hint">
2022-01-22 13:35:35 +08:00
<u-search v-model="name" placeholder="请输入姓名" :show-action="false" bg-color="#F5F5F5" search-icon-color="#999" color="#999" height="58" @search="getListInit" :clearabled="false"></u-search>
2022-01-13 11:13:06 +08:00
</div>
2022-01-14 10:56:52 +08:00
<div class="showUsers">
2022-01-13 11:13:06 +08:00
<div v-if="userList.length > 0">
<div class="cards" v-for="(e, index) in userList" :key="index">
<div class="imges">
2022-01-14 10:56:52 +08:00
<img src="./components/img/xzh.png" alt="" class="imgselect" v-if="e.isChecked" @click="userClick(index)" />
<img src="./components/img/xz.png" alt="" class="imgselect" v-else @click="userClick(index)" />
2022-01-13 11:13:06 +08:00
<img src="./components/img/tx@2x.png" alt="" class="avatras" />
</div>
<div class="rights">
<div class="applicationNames">{{ e.name }}</div>
<div class="idNumbers">{{ e.phone }}</div>
</div>
</div>
</div>
<AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
</div>
</div>
2022-02-08 10:12:00 +08:00
<div style="pad-b120"></div>
2022-01-13 11:13:06 +08:00
<div class="subBtn" @click="submit">
<div>确定选择</div>
</div>
</div>
</template>
<script>
export default {
name: 'SelectUser',
data() {
return {
2022-01-14 10:56:52 +08:00
selectUserList: [],
2022-01-13 11:13:06 +08:00
userList: [],
2022-01-14 10:56:52 +08:00
name: '',
2022-01-14 11:43:17 +08:00
current: 1
2022-01-13 11:13:06 +08:00
}
},
2022-01-14 11:43:17 +08:00
onLoad() {
this.selectUserList = uni.getStorageSync('selectUserList')
2022-01-22 10:47:14 +08:00
this.selectUserList.map((item) => {
item.id =item.wxUserId
item.mobile = item.phone
item.avatar = item.photo
})
2022-01-14 10:56:52 +08:00
this.getList()
2022-01-13 11:13:06 +08:00
},
methods: {
2022-01-14 10:56:52 +08:00
getListInit() {
this.userList = []
this.current = 1
2022-01-22 10:47:14 +08:00
this.getList()
2022-01-14 10:56:52 +08:00
},
getList() {
2022-02-08 10:12:00 +08:00
this.$http.post(`/app/wxcp/wxuser/list?name=${this.name}&current=${this.current}&size=10000`).then((res) => {
2022-01-13 11:13:06 +08:00
if (res?.data) {
2022-01-14 10:56:52 +08:00
res.data.records.map((item) => {
item.isChecked = false
})
2022-01-14 17:38:20 +08:00
this.userList = this.current > 1 ? [...this.userList, ...res.data.records] : res.data.records
2022-01-14 10:56:52 +08:00
this.userList.map((item) => {
this.selectUserList.map((e) => {
if(e.id == item.id) {
item.isChecked = true
}
})
})
2022-01-13 11:13:06 +08:00
}
})
},
2022-01-14 10:56:52 +08:00
userClick(index) {
this.userList[index].isChecked = !this.userList[index].isChecked
2022-01-13 11:13:06 +08:00
this.$forceUpdate()
},
submit() {
2022-01-14 10:56:52 +08:00
var selectUserList = []
this.userList.map((item) => {
if(item.isChecked) {
selectUserList.push(item)
}
})
2022-01-17 13:52:33 +08:00
uni.$emit('selectUser', selectUserList)
uni.navigateBack()
// if (!selectUserList.length) {
// return this.$u.toast('请选择人员')
// } else {
// }
2022-01-13 11:13:06 +08:00
},
2022-01-14 10:56:52 +08:00
},
onReachBottom() {
this.current ++
this.getList()
2022-01-13 11:13:06 +08:00
}
}
</script>
<style scoped lang="scss">
.SelectUser {
height: 100%;
2022-01-14 14:41:52 +08:00
padding-bottom: 140px;
2022-01-13 11:13:06 +08:00
background: #fff;
2022-02-08 10:12:00 +08:00
.pad-b120{
padding-bottom: 120px;
}
2022-01-13 11:13:06 +08:00
.header-top {
background: #fff;
padding: 20px 32px;
}
.header-middle {
.hint {
padding: 28px 20px 28px 32px;
line-height: 56px;
box-shadow: 0px 1px 0px 0px #e4e5e6;
font-size: 30px;
font-weight: 500;
word-break: break-all;
}
.showTypes {
.empty-div {
height: 16px;
background: #f5f5f5;
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
// background: pink;
padding: 0 0 0 32px;
.imges {
display: flex;
align-items: center;
// width: 200px;
.imgselect {
width: 48px;
height: 48px;
vertical-align: middle;
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
img {
width: 74px;
height: 74px;
border-radius: 8px;
}
.rightes {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
}
.imgs {
width: 40px;
height: 40px;
margin-right: 20px;
}
}
}
}
.showUsers {
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
// background: pink;
padding: 0 0 0 32px;
.imges {
display: flex;
align-items: center;
width: 200px;
.imgselect {
width: 48px;
height: 48px;
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.rights {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
padding-right: 40px;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
}
.idNumbers {
color: #666;
}
}
}
}
}
.subBtn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 118px;
background: #f4f8fb;
div {
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background: #1365dd;
border-radius: 4px;
font-size: 32px;
color: #fff;
margin: 20px 34px 0 0;
float: right;
}
}
}
</style>