Files
dvcp_v2_wxcp_app/library/project/xincheng/AppMerchantManage/AppMerchantManage.vue

237 lines
5.6 KiB
Vue
Raw Normal View History

2022-07-01 15:11:11 +08:00
<template>
<div class="AppMerchantManage">
2022-07-01 16:16:59 +08:00
<AiTopFixed>
2022-07-02 16:58:20 +08:00
<u-search placeholder="请输入姓名、手机号、店名" :show-action="false" v-model="keyword" confirm-type="search" @clear="current = 1, getList()" @search="current = 1, getList()"/>
2022-07-01 16:16:59 +08:00
</AiTopFixed>
<div class="list">
2022-07-02 16:17:55 +08:00
<u-swipe-action
class="item"
:show="item.show"
:index="index"
v-for="(item, index) in list"
:key="item.id"
@click="onClick"
@open="onOpen"
@content-click="toDetail(item.id, index)"
:options="options">
2022-07-01 16:16:59 +08:00
<div class="title">
2022-07-01 18:38:34 +08:00
<img :src="$cdn + 'xincheng/icon.png'" alt="">
<p>{{ item.businessName }}</p>
2022-07-02 18:51:25 +08:00
<span>店员 ({{ item.userCount }}) </span>
2022-07-01 16:16:59 +08:00
</div>
<div class="info">
2022-07-01 18:38:34 +08:00
<img :src="$cdn + 'xincheng/dh.png'" alt="">
<div>{{ item.bossName }} {{ item.telephone }}</div>
2022-07-01 16:16:59 +08:00
</div>
<div class="info">
2022-07-01 18:38:34 +08:00
<img :src="$cdn + 'xincheng/dz@2x.png'" alt="">
<div>{{ item.businessAddress }}</div>
2022-07-01 16:16:59 +08:00
</div>
2022-07-02 18:51:25 +08:00
<div class="info" style="margin-bottom: 0;">
2022-07-01 18:38:34 +08:00
<img :src="$cdn + 'xincheng/wgz@2x.png'" alt="">
2022-07-02 18:51:25 +08:00
<div v-if="item.girdUserName">{{ item.girdUserName }}-{{ item.girdUserType }}</div>
<div v-else>未绑定网格员</div>
</div>
2022-07-02 16:17:55 +08:00
</u-swipe-action>
2022-07-01 18:38:34 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2022-07-01 16:16:59 +08:00
</div>
2022-07-01 17:49:20 +08:00
<div class="btn" @click="linkTo('./add')">新增商户</div>
2022-07-01 15:11:11 +08:00
</div>
</template>
<script>
2022-07-01 17:49:20 +08:00
import {mapState} from 'vuex'
2022-07-01 15:11:11 +08:00
2022-07-01 17:49:20 +08:00
export default {
name: 'AppMerchantManage',
appName: '商户管理',
data() {
return {
keyword: '',
current: 1,
pages: 2,
2022-07-02 16:17:55 +08:00
list: [],
options: [
{
text: '编辑',
style: {
backgroundColor: '#007aff'
}
},
{
text: '删除',
style: {
backgroundColor: '#dd524d'
}
}
]
2022-07-01 17:49:20 +08:00
}
},
2022-07-01 15:11:11 +08:00
2022-07-01 17:49:20 +08:00
computed: {...mapState(['user'])},
onLoad () {
2022-07-01 18:38:34 +08:00
this.$loading()
2022-07-01 17:49:20 +08:00
this.getList()
uni.$on('update', () => {
this.current = 1
this.getList()
2022-07-01 16:16:59 +08:00
})
},
2022-07-01 17:49:20 +08:00
methods: {
2022-07-02 16:17:55 +08:00
getList () {
2022-07-02 09:59:59 +08:00
if (this.current > this.pages && this.current !== 1) return
2022-07-01 18:38:34 +08:00
2022-07-02 18:51:25 +08:00
this.$http.post('/app/appcompany/getPageWithGird', null, {
2022-07-01 17:49:20 +08:00
params: {
size: 10,
current: this.current,
2022-07-02 09:59:59 +08:00
businessName: this.keyword
2022-07-02 11:36:13 +08:00
}
2022-07-01 17:49:20 +08:00
}).then((res) => {
if (res.code == 0) {
2022-07-02 16:17:55 +08:00
this.list = this.current > 1 ? [...this.list, ...res.data.records.map(v => {
return {
...v,
show: false
}
})] : res.data.records.map(v => {
return {
...v,
show: false
}
})
2022-07-01 17:49:20 +08:00
this.pages = res.data.pages
}
})
},
2022-07-02 16:17:55 +08:00
toDetail (id, index) {
this.list[index].show = false
this.linkTo('./detail?id=' + id)
},
onClick (index, i) {
if (i == 1) {
this.$confirm('确定删除该数据?').then(() => {
this.$http.post('/app/appcompany/delete?id=' + this.list[index].id).then(res => {
if (res.code === 0) {
this.current = 1
this.getList()
}
})
}).catch(() => {
})
} else {
this.list[index].show = false
this.linkTo('./add?id=' + this.list[index].id)
}
},
onOpen (index) {
this.list[index].show = true
this.list.map((val, idx) => {
if(index != idx) {
this.list[idx].show = false
}
})
},
2022-07-01 17:49:20 +08:00
linkTo (url) {
uni.navigateTo({
url
})
}
},
2022-07-01 18:38:34 +08:00
2022-07-01 17:49:20 +08:00
onReachBottom() {
this.current ++
this.getList()
}
2022-07-01 15:11:11 +08:00
}
</script>
<style lang="scss" scoped>
.AppMerchantManage {
2022-07-01 16:16:59 +08:00
.list{
padding: 24px 30px 136px;
.item{
width: 100%;
background: #FFF;
border-radius: 16px;
padding: 32px 24px 32px 32px;
box-sizing: border-box;
margin-bottom: 30px;
2022-07-01 18:38:34 +08:00
&:active {
2022-07-02 16:23:35 +08:00
// background: #eee;
2022-07-01 18:38:34 +08:00
}
2022-07-01 16:16:59 +08:00
.title{
2022-07-02 16:58:20 +08:00
display: flex;
align-items: center;
2022-07-01 18:38:34 +08:00
margin-bottom: 38px;
2022-07-01 16:16:59 +08:00
img{
width: 72px;
height: 72px;
margin-right: 16px;
vertical-align: middle;
}
p{
display: inline-block;
2022-07-02 16:58:20 +08:00
line-height: 1.3;
2022-07-01 16:16:59 +08:00
width: 400px;
font-size: 32px;
font-weight: 500;
color: #000;
}
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{
2022-07-01 18:38:34 +08:00
line-height: 1;
margin-bottom: 20px;
2022-07-01 16:16:59 +08:00
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;
}
}
}
}
.btn{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
height: 112px;
line-height: 112px;
background: #3975C6;
box-shadow: inset 0px 2px 0px 0px #EEEEEE;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFF;
}
2022-07-01 15:11:11 +08:00
}
</style>