Files
dvcp_v2_wxcp_app/library/apps/AppMailList/AppMailList.vue
2024-10-31 14:34:57 +08:00

235 lines
5.9 KiB
Vue

<template>
<div class="AppMailList">
<AiTopFixed>
<!-- <div class="header-top">
<div>区域选择</div>
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-right" color="#666" size="24" style="margin-left:4px;" />
</AiAreaPicker>
</div> -->
<div class="currentLeft-top">
<div class="left">
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="areaSelect" :name.sync="areaName" selectRoot>
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px" />
</AiAreaPicker>
</div>
<u-search v-model="keyword" :clearabled="true" placeholder="名称/类型/电话" :show-action="false" bg-color="#F5F5F5" search-icon-color="#ccc" color="#666" height="58" @search="getList" @clear="handerClear"></u-search>
</div>
</AiTopFixed>
<div class="list-content">
<u-index-list :scrollTop="scrollTop" :index-list="indexList">
<div v-for="(letter, index) in indexList" :key="index">
<u-index-anchor :index="letter" />
<div class="item" v-for="(item, index) in list.filter((e) => e.nameInitials == letter)" :key="index">
<div class="title">{{ item.label }}</div>
<div class="phone-list">
<div class="item-info">
<p>{{ item.name }}</p>
<div class="phone">
<span>{{ item.type }}</span
>{{ item.phone }}
</div>
</div>
</div>
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon" />
</div>
</div>
</u-index-list>
</div>
<AiEmpty v-if="!list.length" />
<!-- <div class="id-list">
<div class="item" v-for="(item, index) in list" :key="index">
<u-index-anchor :index="item.label" />
</div>
</div> -->
<div class="footer-btn" @click="toAddList">我添加的</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'AppMailList',
appName: '便民通讯录',
inject: {
root: {},
},
data() {
return {
scrollTop: 0,
list: [],
indexList: [],
areaId: '',
areaName: '',
keyword: '',
}
},
computed: { ...mapState(['user']) },
mounted() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.getList()
uni.$on('updateList', () => {
this.getList()
})
},
onShow() {
document.title = '便民通讯录'
},
methods: {
areaSelect(e) {
this.areaId = e
this.getList()
},
callPhone(phone) {
uni.makePhoneCall({ phoneNumber: phone })
},
handerClear() {
this.keyword = ''
this.getList()
},
getList() {
this.$http
.post(`/app/appconvenientaddressbook/list`, null, {
params: {
areaId: this.areaId,
isPublic: 1,
resource: 'portal',
size: 999,
name: this.keyword,
},
})
.then((res) => {
if (res.code == 0) {
this.indexList = [...new Set(res.data.records.map((e) => e.nameInitials))]
this.list = res.data.records
}
})
},
toAddList() {
// this.$emit('change', {
// type: 'MyAddList',
// })
uni.navigateTo({ url: `./myAddList` })
},
},
onPageScroll(e) {
this.scrollTop = e.scrollTop
},
}
</script>
<style lang="scss" scoped>
.AppMailList {
::v-deep .fixed {
z-index: 9999;
}
.header-top {
display: flex;
background: #fff;
justify-content: space-between;
align-items: center;
padding-top: 16px;
}
// background-color: #F3F6F9;
.list-content {
padding-bottom: 112px;
// .title{
// padding-left: 48px;
// line-height: 64px;
// font-size: 26px;
// font-family: PingFangSC-Semibold, PingFang SC;
// font-weight: 600;
// color: #999;
// }
.item {
position: relative;
}
.phone-list {
background-color: #fff;
width: 100%;
.item-info {
width: 680px;
padding: 32px 48px;
box-sizing: border-box;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.02);
p {
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 44px;
word-break: break-all;
margin-bottom: 8px;
width: 100%;
}
.phone {
font-size: 26px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 36px;
width: 100%;
word-break: break-all;
span {
display: inline-block;
margin-right: 16px;
color: #999;
}
}
}
}
}
.footer-btn {
width: 100%;
text-align: center;
height: 112px;
line-height: 112px;
background: #3975c6;
box-shadow: 0 1px 0 0 #eeeeee;
position: fixed;
bottom: 0;
left: 0;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff;
z-index: 999;
}
::v-deep .u-index-anchor {
top: 0 !important;
}
.phone-icon {
width: 40px;
height: 40px;
vertical-align: sub;
position: absolute;
top: 60px;
right: 64px;
}
.currentLeft-top {
display: flex;
align-items: center;
.left {
width: 40%;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
::v-deep .u-search {
margin-bottom: 0 !important;
}
}
</style>