Files
dvcp_v2_wxcp_app/src/project/xicheng/AppMerchanGird/AddMerchan.vue

236 lines
6.7 KiB
Vue
Raw Normal View History

2022-07-01 14:31:08 +08:00
<template>
2022-07-01 17:14:22 +08:00
<div class="AddMerchan">
2022-07-01 17:52:34 +08:00
<AiTopFixed>
<u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="keyword" @search="current=1,getList()"/>
</AiTopFixed>
2022-07-01 14:31:08 +08:00
<div class="userList" v-if="list.length">
<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">
2022-07-01 17:52:34 +08:00
<!-- <div>
2022-07-01 14:31:08 +08:00
<img :src="item.photo" alt="" class="userImg" v-if="item.photo">
<img src="./components/img/user-img.png" alt="" class="userImg" v-else>
</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 && item.idNumber.replace(/^(\d{6})\d{8}(.{4}$)/g, `$1${Array(9).join('*')}$2`)}}</div>
<div class="address">{{item.currentAreaName || '' }}{{ item.currentAddress || '' }}</div>
2022-07-01 17:52:34 +08:00
</div> -->
<div class="item-title">
<img src="./components/img/xz.png" alt="">
<p>采苓岩茶烟酒专营店</p>
</div>
<div class="info">
<img src="./components/img/xz.png" alt="">
<div>林轶峰 18600882921</div>
</div>
<div class="info">
<img src="./components/img/xz.png" alt="">
<div>陕西省西安市新城区中山门街道168号陕西省西安市新城区中山门街道168号</div>
2022-07-01 14:31:08 +08:00
</div>
</div>
</div>
</li>
</ul>
</div>
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
<div style="height:70px;"></div>
2022-07-01 17:52:34 +08:00
<!-- <div class="btn">
2022-07-01 14:31:08 +08:00
<div class="handleCheck" @click="confirm">确定选择</div>
2022-07-01 17:52:34 +08:00
</div> -->
<div class="footer" @click="confirm">确定选择</div>
2022-07-01 14:31:08 +08:00
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
list: [],
current: 1,
value: '',
checked: true,
userList: {},
userId: '',
areaId: '',
areaName:'',
girdId: ''
}
},
computed: { ...mapState(['user']) },
methods: {
getList(){
this.$http.post(`/app/appresident/list?areaId=${this.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,
girdId: this.girdId
}
checkUserList.push(info)
}
})
if(!checkUserList.length) {
return 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)
})
},
areaSelect(e) {
this.areaId =e
this.getListInit()
},
},
onLoad(option) {
this.userId = option.id
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.girdId = option.girdId
},
onShow() {
2022-07-01 17:52:34 +08:00
document.title = '责任商户'
2022-07-01 14:31:08 +08:00
this.getList()
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
</script>
<style lang="scss" scoped>
2022-07-01 17:14:22 +08:00
.AddMerchan {
2022-07-01 14:31:08 +08:00
.userList {
width: 100%;
2022-07-01 17:52:34 +08:00
margin-top: 24px;
ul {
padding: 0 32px 0 0;
li {
list-style-type: none;
.user {
2022-07-01 14:31:08 +08:00
display: flex;
justify-content: flex-start;
2022-07-01 17:52:34 +08:00
padding-top: 24px;
padding-left: 32px;
height: 100%;
.checkbox{
margin-top: 20px;
margin-right: 32px;
width: 48px;
height: 48px;
2022-07-01 14:31:08 +08:00
}
2022-07-01 17:52:34 +08:00
.userInfo {
width: 100%;
background: #FFF;
border-radius: 16px;
padding: 32px 24px 32px 32px;
box-sizing: border-box;
margin-bottom: 30px;
.item-title{
margin-bottom: 32px;
img{
width: 72px;
height: 72px;
margin-right: 16px;
vertical-align: middle;
}
p{
display: inline-block;
width: 400px;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000;
line-height: 32px;
}
span{
display: inline-block;
width: calc(100% - 488px);
text-align: right;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 24px;
}
2022-07-01 14:31:08 +08:00
}
2022-07-01 17:52:34 +08:00
.info{
img{
width: 28px;
height: 28px;
margin-right: 16px;
}
div{
display: inline-block;
width: calc(100% - 44px);
word-break: break-all;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
vertical-align: text-top;
}
2022-07-01 14:31:08 +08:00
}
2022-07-01 17:52:34 +08:00
}
2022-07-01 14:31:08 +08:00
}
}
}
}
2022-07-01 17:52:34 +08:00
.footer {
2022-07-01 14:31:08 +08:00
position: fixed;
2022-07-01 17:52:34 +08:00
left: 0px;
2022-07-01 14:31:08 +08:00
bottom: 0px;
width: 100%;
2022-07-01 17:52:34 +08:00
height: 112px;
background-color: #1365DD;
line-height: 112px;
text-align: center;
font-size: 36px;
color: #FFFFFF;
2022-07-01 14:31:08 +08:00
}
}
</style>