责任商户

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> <template>
<div class="AddMerchan"> <div class="AddMerchan">
<AiTopFixed> <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> </AiTopFixed>
<div class="userList" v-if="list.length"> <div class="userList" v-if="list.length">
<ul v-for="(item,index) in list" :key="index"> <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)"> <img src="./components/img/xzh.png" alt="" class="checkbox" v-else @click="userClick(index)">
</div> </div>
<div class="userInfo"> <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"> <div class="item-title">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/icon.png'" alt="">
<p>采苓岩茶烟酒专营店</p> <p>{{ item.businessName }}</p>
</div> </div>
<div class="info"> <div class="info">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/dh.png'" alt="">
<div>林轶峰 18600882921</div> <div>{{ item.bossName }} {{ item.telephone }}</div>
</div> </div>
<div class="info"> <div class="info" style="margin-bottom: 0;">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/dz@2x.png'" alt="">
<div>陕西省西安市新城区中山门街道168号陕西省西安市新城区中山门街道168号</div> <div>{{ item.businessAddress }}</div>
</div> </div>
</div> </div>
</div> </div>
@@ -43,68 +31,85 @@
</div> </div>
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty> <AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
<div style="height:70px;"></div> <div style="height:70px;"></div>
<!-- <div class="btn">
<div class="handleCheck" @click="confirm">确定选择</div>
</div> -->
<div class="footer" @click="confirm">确定选择</div> <div class="footer" @click="confirm">确定选择</div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
data() { data() {
return { return {
list: [], list: [],
current: 1, current: 1,
value: '', value: '',
checked: true, checked: true,
userList: {}, girdMemberId: '',
userId: '', girdId: '',
areaId: '', businessName: ''
areaName:'',
girdId: ''
} }
}, },
computed: { ...mapState(['user']) }, computed: { ...mapState(['user']) },
onLoad (query) {
this.girdMemberId = query.id
this.girdId = query.girdId
this.getList()
uni.$on('update', () => {
this.current = 1
this.getList()
})
},
methods: { methods: {
getList(){ getList(){
this.$http.post(`/app/appresident/list?areaId=${this.areaId}&householdName=1&current=${this.current}&con=${this.value}`).then((res) => { 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) { if (res.code == 0) {
res.data.records.map((item) => { this.list = this.current > 1 ? [...this.list, ...res.data.records.map(v => {
item.checked = false return {
item.girdMemberId = this.userId ...v,
item.residentId = item.id checked: false
}
})] : res.data.records.map(v => {
return {
...v,
checked: false
}
}) })
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records this.pages = res.data.pages
} }
}) })
}, },
getListInit(){
this.list = []
this.current = 1
this.getList()
},
userClick(index) { userClick(index) {
this.list[index].checked = !this.list[index].checked this.list[index].checked = !this.list[index].checked
}, },
confirm() { confirm() {
var checkUserList = [] var checkUserList = this.list.filter(v => v.checked).map(item => {
this.list.map((item) => { return {
if(item.checked) { companyId: item.id,
var info = { name: item.businessName,
girdMemberId: this.userId, girdId: this.girdId,
residentId: item.id, girdMemberId: this.girdMemberId
name: item.name,
girdId: this.girdId
}
checkUserList.push(info)
} }
}) })
if(!checkUserList.length) {
return this.$u.toast('请选择户主') if (!checkUserList.length) {
return this.$u.toast('请选择责任商户')
} }
this.$http.post(`/app/appgirdmemberresident/add`, {residentList:checkUserList}).then((res) => {
this.$http.post(`/app/appgirdmembercompany/add`, { companyList: checkUserList}).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.$u.toast('提交成功') this.$u.toast('提交成功')
uni.$emit('updateList') uni.$emit('updateList')
@@ -115,27 +120,14 @@ export default {
}).catch((err) => { }).catch((err) => {
this.$u.toast(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() {
document.title = '责任商户'
this.getList()
},
onReachBottom() { onReachBottom() {
this.current = this.current + 1 this.current = this.current + 1
this.getList() this.getList()
}, }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -194,6 +186,8 @@ export default {
} }
} }
.info{ .info{
line-height: 1;
margin-bottom: 20px;
img{ img{
width: 28px; width: 28px;
height: 28px; height: 28px;

View File

@@ -1,10 +1,10 @@
<template> <template>
<div class="merchanList"> <div class="merchanList">
<AiTopFixed> <AiTopFixed>
<u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="keyword" @search="current=1,getList()"/> <u-search placeholder="请输入店名、店主、电话" :show-action="false" v-model="businessName" @search="current = 1, getList()"/>
</AiTopFixed> </AiTopFixed>
<div class="title"> <div class="title">
<div>商户列表({{ total }})</div> <div>商户列表({{ pages }})</div>
<div v-if="list.length"> <div v-if="list.length">
<span style="font-size: 14px; color: #2979ff;" @click="changeType" v-if="edit">修改</span> <span style="font-size: 14px; color: #2979ff;" @click="changeType" v-if="edit">修改</span>
<span style="font-size: 14px; color: #2979ff;" @click="edit = true" v-else>取消</span> <span style="font-size: 14px; color: #2979ff;" @click="edit = true" v-else>取消</span>
@@ -19,29 +19,17 @@
<img src="./components/img/xzh.png" alt="" class="checkbox" v-else @click="userClick(index)"> <img src="./components/img/xzh.png" alt="" class="checkbox" v-else @click="userClick(index)">
</div> </div>
<div class="item-info"> <div class="item-info">
<!-- <div>
<img :src="item.photo" class="userImg" v-if="item.photo">
<img src="./components/img/user-img.png" alt="" class="userImg" v-else>
</div>
<div class="userInfo">
<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(/(.{6}).*(.{4})/, "$1********$2") }}</div>
<div class="address">{{ item.currentAreaName || '' }}{{ item.currentAddress || '' }}</div>
</div> -->
<div class="item-title"> <div class="item-title">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/icon.png'" alt="">
<p>采苓岩茶烟酒专营店</p> <p>{{ item.businessName }}</p>
</div> </div>
<div class="info"> <div class="info">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/dh.png'" alt="">
<div>林轶峰 18600882921</div> <div>{{ item.bossName }} {{ item.telephone }}</div>
</div> </div>
<div class="info"> <div class="info" style="margin-bottom: 0;">
<img src="./components/img/xz.png" alt=""> <img :src="$cdn + 'xincheng/dz@2x.png'" alt="">
<div>陕西省西安市新城区中山门街道168号陕西省西安市新城区中山门街道168号</div> <div>{{ item.businessAddress }}</div>
</div> </div>
</div> </div>
</div> </div>
@@ -50,30 +38,55 @@
</div> </div>
<AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty> <AiEmpty description="暂无数据" class="emptyWrap" v-if="!list.length"></AiEmpty>
<div style="height:70px;"></div> <div style="height:70px;"></div>
<div class="footer" @click="toAddFamily()" v-if="edit">新增责任家庭</div> <div class="footer" @click="toAddFamily()" v-if="edit">新增责任商户</div>
<div class="footer" @click="delFamily()" v-else>删除</div> <div class="footer" @click="delFamily()" v-else>删除</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { appName: '责任商户',
data () {
return { return {
list: [], list: [],
total: 0, pages: 0,
current: 1, current: 1,
userId: '', userId: '',
edit: true, edit: true,
checked: true, checked: true,
girdId: '' girdId: '',
businessName: ''
} }
}, },
onLoad (option) {
this.userId = option.id
this.girdId = option.girdId
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
methods: { methods: {
getList() { getList () {
this.$http.post(`/app/appgirdmemberresident/listByGirdMember?current=${this.current}&girdMemberId=${this.userId}&girdId=${this.girdId}`).then((res) => { if (this.current > this.pages && this.current !== 1) return
this.$loading()
this.$http.post(`/app/appgirdmembercompany/listByGirdMember`, null, {
params: {
size: 10,
current: this.current,
name: this.businessName,
girdMemberId: this.userId,
girdId: this.girdId
}
}).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.total = res.data.total this.pages = res.data.total
} }
}) })
}, },
@@ -84,19 +97,13 @@ export default {
this.list[index].checked = !this.list[index].checked this.list[index].checked = !this.list[index].checked
this.$forceUpdate() this.$forceUpdate()
}, },
// 点击删除
delFamily() { delFamily() {
var ids = [] const ids = this.list.filter(v => v.checked).map(v => v.gmcId)
this.list.map((item) => {
if (item.checked) {
ids.push(item.gmrId)
}
})
if (!ids.length) { if (!ids.length) {
return this.$u.toast('请选需要删除的家庭户主') return this.$u.toast('请选需要删除的责任商户')
} }
this.$confirm(`是否删除这些关联家庭信息`).then(() => { this.$confirm(`是否删除这些关联责任商户`).then(() => {
this.$http.post(`/app/appgirdmemberresident/delete?ids=${ids.join(',')}`).then((res) => { this.$http.post(`/app/appgirdmembercompany/delete?ids=${ids.join(',')}`).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.$u.toast('删除成功') this.$u.toast('删除成功')
uni.$emit('updateList') uni.$emit('updateList')
@@ -113,23 +120,12 @@ export default {
}) })
} }
}, },
onLoad(option) {
this.userId = option.id
this.girdId = option.girdId
},
onShow() {
document.title = '责任商户'
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
onReachBottom() { onReachBottom() {
this.current = this.current + 1 this.current = this.current + 1
this.getList() this.getList()
}, }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -200,6 +196,8 @@ export default {
} }
} }
.info{ .info{
line-height: 1;
margin-bottom: 20px;
img{ img{
width: 28px; width: 28px;
height: 28px; height: 28px;

View File

@@ -55,10 +55,6 @@
}) })
}, },
onShow() {
document.title = "商户管理"
},
methods: { methods: {
getList() { getList() {
if (this.current > this.pages && this.current !== 1) return if (this.current > this.pages && this.current !== 1) return