责任商户

This commit is contained in:
yanran200730
2022-07-02 12:22:07 +08:00
parent 72e1559fa7
commit 32935d94fc
3 changed files with 186 additions and 198 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="AddMerchan">
<AiTopFixed>
<u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="keyword" @search="current=1,getList()"/>
<u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="businessName" confirm-type="search" @search="current = 1, getList()"/>
</AiTopFixed>
<div class="userList" v-if="list.length">
<ul v-for="(item,index) in list" :key="index">
@@ -12,29 +12,17 @@
<img src="./components/img/xzh.png" alt="" class="checkbox" v-else @click="userClick(index)">
</div>
<div class="userInfo">
<!-- <div>
<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>
</div> -->
<div class="item-title">
<img src="./components/img/xz.png" alt="">
<p>采苓岩茶烟酒专营店</p>
<img :src="$cdn + 'xincheng/icon.png'" alt="">
<p>{{ item.businessName }}</p>
</div>
<div class="info">
<img src="./components/img/xz.png" alt="">
<div>林轶峰 18600882921</div>
<img :src="$cdn + 'xincheng/dh.png'" alt="">
<div>{{ item.bossName }} {{ item.telephone }}</div>
</div>
<div class="info">
<img src="./components/img/xz.png" alt="">
<div>陕西省西安市新城区中山门街道168号陕西省西安市新城区中山门街道168号</div>
<div class="info" style="margin-bottom: 0;">
<img :src="$cdn + 'xincheng/dz@2x.png'" alt="">
<div>{{ item.businessAddress }}</div>
</div>
</div>
</div>
@@ -43,99 +31,103 @@
</div>
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
<div style="height:70px;"></div>
<!-- <div class="btn">
<div class="handleCheck" @click="confirm">确定选择</div>
</div> -->
<div class="footer" @click="confirm">确定选择</div>
</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('请选择户主')
import { mapState } from 'vuex'
export default {
data() {
return {
list: [],
current: 1,
value: '',
checked: true,
girdMemberId: '',
girdId: '',
businessName: ''
}
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)
},
computed: { ...mapState(['user']) },
onLoad (query) {
this.girdMemberId = query.id
this.girdId = query.girdId
this.getList()
uni.$on('update', () => {
this.current = 1
this.getList()
})
},
areaSelect(e) {
this.areaId =e
this.getListInit()
methods: {
getList(){
if (this.current > this.pages && this.current !== 1) return
this.$loading()
this.$http.post('/app/appcompany/list', 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('提交成功')
uni.$emit('updateList')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
}).catch((err) => {
this.$u.toast(err)
})
}
},
},
onLoad(option) {
this.userId = option.id
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.girdId = option.girdId
},
onShow() {
document.title = '责任商户'
this.getList()
},
onReachBottom() {
this.current = this.current + 1
this.getList()
},
}
onReachBottom() {
this.current = this.current + 1
this.getList()
}
}
</script>
<style lang="scss" scoped>
@@ -194,6 +186,8 @@ export default {
}
}
.info{
line-height: 1;
margin-bottom: 20px;
img{
width: 28px;
height: 28px;