231 lines
6.1 KiB
Vue
231 lines
6.1 KiB
Vue
<template>
|
|
<div class="AddMerchan">
|
|
<AiTopFixed>
|
|
<u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="businessName" confirm-type="search" @clear="current = 1, getList()" @search="current = 1, getList()"/>
|
|
</AiTopFixed>
|
|
<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">
|
|
<div class="item-title">
|
|
<img :src="$cdn + 'xincheng/icon.png'" alt="">
|
|
<p>{{ item.businessName }}</p>
|
|
</div>
|
|
<div class="info">
|
|
<img :src="$cdn + 'xincheng/dh.png'" alt="">
|
|
<div>{{ item.bossName }} {{ item.telephone }}</div>
|
|
</div>
|
|
<div class="info" style="margin-bottom: 0;">
|
|
<img :src="$cdn + 'xincheng/dz@2x.png'" alt="">
|
|
<div>{{ item.businessAddress }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
|
|
<div style="height:70px;"></div>
|
|
<div class="footer" @click="confirm">确定选择</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
export default {
|
|
data() {
|
|
return {
|
|
list: [],
|
|
current: 1,
|
|
value: '',
|
|
checked: true,
|
|
girdMemberId: '',
|
|
girdId: '',
|
|
businessName: ''
|
|
}
|
|
},
|
|
computed: { ...mapState(['user']) },
|
|
|
|
onLoad (query) {
|
|
this.girdMemberId = query.id
|
|
this.girdId = query.girdId
|
|
|
|
this.getList()
|
|
uni.$on('update', () => {
|
|
this.current = 1
|
|
this.getList()
|
|
})
|
|
},
|
|
|
|
methods: {
|
|
getList(){
|
|
if (this.current > this.pages && this.current !== 1) return
|
|
|
|
this.$loading()
|
|
this.$http.post('/app/appgirdmembercompany/getUnbindCompany', null, {
|
|
params: {
|
|
size: 10,
|
|
current: this.current,
|
|
businessName: this.businessName
|
|
}
|
|
}).then((res) => {
|
|
if (res.code == 0) {
|
|
this.list = this.current > 1 ? [...this.list, ...res.data.records.map(v => {
|
|
return {
|
|
...v,
|
|
checked: false
|
|
}
|
|
})] : res.data.records.map(v => {
|
|
return {
|
|
...v,
|
|
checked: false
|
|
}
|
|
})
|
|
this.pages = res.data.pages
|
|
}
|
|
})
|
|
},
|
|
|
|
userClick(index) {
|
|
this.list[index].checked = !this.list[index].checked
|
|
},
|
|
|
|
confirm() {
|
|
var checkUserList = this.list.filter(v => v.checked).map(item => {
|
|
return {
|
|
companyId: item.id,
|
|
name: item.businessName,
|
|
girdId: this.girdId,
|
|
girdMemberId: this.girdMemberId
|
|
}
|
|
})
|
|
|
|
if (!checkUserList.length) {
|
|
return this.$u.toast('请选择责任商户')
|
|
}
|
|
|
|
this.$http.post(`/app/appgirdmembercompany/add`, { companyList: checkUserList}).then((res) => {
|
|
if (res.code == 0) {
|
|
this.$u.toast('提交成功')
|
|
setTimeout(() => {
|
|
uni.navigateBack()
|
|
uni.$emit('updateList')
|
|
}, 600)
|
|
}
|
|
}).catch((err) => {
|
|
this.$u.toast(err)
|
|
})
|
|
}
|
|
},
|
|
|
|
onReachBottom() {
|
|
this.current = this.current + 1
|
|
this.getList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.AddMerchan {
|
|
.userList {
|
|
width: 100%;
|
|
margin-top: 24px;
|
|
ul {
|
|
padding: 0 32px 0 0;
|
|
li {
|
|
list-style-type: none;
|
|
.user {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
padding-top: 24px;
|
|
padding-left: 32px;
|
|
height: 100%;
|
|
.checkbox{
|
|
margin-top: 20px;
|
|
margin-right: 32px;
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
.userInfo {
|
|
width: 100%;
|
|
background: #FFF;
|
|
border-radius: 16px;
|
|
padding: 32px 24px 32px 32px;
|
|
box-sizing: border-box;
|
|
margin-bottom: 30px;
|
|
.item-title{
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 32px;
|
|
margin-bottom: 32px;
|
|
img{
|
|
width: 72px;
|
|
height: 72px;
|
|
margin-right: 16px;
|
|
vertical-align: middle;
|
|
}
|
|
p{
|
|
flex: 1;
|
|
font-size: 32px;
|
|
font-weight: 500;
|
|
color: #000;
|
|
line-height: 1.3;
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
.info{
|
|
line-height: 1;
|
|
margin-bottom: 20px;
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.footer {
|
|
position: fixed;
|
|
left: 0px;
|
|
bottom: 0px;
|
|
width: 100%;
|
|
height: 112px;
|
|
background-color: #1365DD;
|
|
line-height: 112px;
|
|
text-align: center;
|
|
font-size: 36px;
|
|
color: #FFFFFF;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
|
|
|
|
|