责任商户

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,99 +31,103 @@
</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']) },
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) { computed: { ...mapState(['user']) },
this.$u.toast('提交成功')
uni.$emit('updateList') onLoad (query) {
setTimeout(() => { this.girdMemberId = query.id
uni.navigateBack() this.girdId = query.girdId
}, 600)
} this.getList()
}).catch((err) => { uni.$on('update', () => {
this.$u.toast(err) this.current = 1
this.getList()
}) })
}, },
areaSelect(e) {
this.areaId =e methods: {
this.getListInit() 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) { onReachBottom() {
this.userId = option.id this.current = this.current + 1
this.areaId = this.user.areaId this.getList()
this.areaName = this.user.areaName }
this.girdId = option.girdId }
},
onShow() {
document.title = '责任商户'
this.getList()
},
onReachBottom() {
this.current = this.current + 1
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,86 +38,94 @@
</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: '责任商户',
return {
list: [], data () {
total: 0, return {
current: 1, list: [],
userId: '', pages: 0,
edit: true, current: 1,
checked: true, userId: '',
girdId: '' edit: true,
} checked: true,
}, girdId: '',
methods: { businessName: ''
getList() {
this.$http.post(`/app/appgirdmemberresident/listByGirdMember?current=${this.current}&girdMemberId=${this.userId}&girdId=${this.girdId}`).then((res) => {
if (res.code == 0) {
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.total = res.data.total
}
})
},
toAddFamily() {
uni.navigateTo({url: `./AddMerchan?id=${this.userId}&girdId=${this.girdId}`})
},
userClick(index) {
this.list[index].checked = !this.list[index].checked
this.$forceUpdate()
},
// 点击删除
delFamily() {
var ids = []
this.list.map((item) => {
if (item.checked) {
ids.push(item.gmrId)
}
})
if (!ids.length) {
return this.$u.toast('请选中需要删除的家庭户主')
} }
this.$confirm(`是否删除这些关联家庭信息?`).then(() => { },
this.$http.post(`/app/appgirdmemberresident/delete?ids=${ids.join(',')}`).then((res) => {
onLoad (option) {
this.userId = option.id
this.girdId = option.girdId
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
},
methods: {
getList () {
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.$u.toast('删除成功') this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
uni.$emit('updateList') this.pages = res.data.total
this.$forceUpdate()
this.edit = true
} }
}) })
}) },
toAddFamily() {
uni.navigateTo({url: `./AddMerchan?id=${this.userId}&girdId=${this.girdId}`})
},
userClick(index) {
this.list[index].checked = !this.list[index].checked
this.$forceUpdate()
},
delFamily() {
const ids = this.list.filter(v => v.checked).map(v => v.gmcId)
if (!ids.length) {
return this.$u.toast('请选择需要删除的责任商户')
}
this.$confirm(`是否删除这些关联责任商户?`).then(() => {
this.$http.post(`/app/appgirdmembercompany/delete?ids=${ids.join(',')}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功')
uni.$emit('updateList')
this.$forceUpdate()
this.edit = true
}
})
})
},
changeType() {
this.edit = false
this.list.map((item) => {
item.checked = false
})
}
}, },
changeType() {
this.edit = false onReachBottom() {
this.list.map((item) => { this.current = this.current + 1
item.checked = false
})
}
},
onLoad(option) {
this.userId = option.id
this.girdId = option.girdId
},
onShow() {
document.title = '责任商户'
this.getList()
uni.$on('updateList', () => {
this.current = 1
this.getList() this.getList()
}) }
}, }
onReachBottom() {
this.current = this.current + 1
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