MerchantList.vue
4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
<view
class="box"
:key="selectMerchantId"
>
<template v-if="flag">
<template v-if="loginUserInfoList.length">
<template v-for="(item,index) in loginUserInfoList">
<view
:key="index"
:class="['items' ,{active:item.active}]"
@click="chooseAccount(item)"
>
<view class="right">
<view class="sprite-icon icon-store"></view>
</view>
<view class="left">
<view class="text_box">
<view class="name">{{item.merchantName}}</view>
<view class="text_no">商户号:{{item.merchantId}}</view>
</view>
</view>
</view>
</template>
</template>
<template v-else>
<view class="list-not">
暂无内容
</view>
</template>
</template>
</view>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'MerchantList',
data () {
return {
loginUserInfoList: [],
copyLoginUserInfoList: [],
showSelect: false,
openSceneArr: [],
flag: false,
userInfo: {},
selectMerchantId:''
}
},
onLoad () {
},
methods: {
init (userInfo) {
this.userInfo = userInfo
this.getMerchantList()
this.getSceneArr()
},
getSceneArr () {
let { userInfo } = this
// 超管开通全部场景
if (userInfo?.isSuper) return
// 获取4s店关联场景数据
uni.$api.userApi.getYqMerchantSceneConfigAPI({
yqMerchantId: userInfo?.subLoginUser?.merchantId,
merchantId: userInfo?.shopMerchantId
}).then(result => {
uni.hideLoading()
this.openSceneArr = result.map(val => { if (val.sceneOpenFlag == 0) return val.scene }) || []
})
},
getMerchantList () {
uni.showLoading()
let { userInfo } = this
let params = {
merchantId: userInfo?.isSuper ? '' : userInfo?.merchantId,
staffUUID: userInfo?.isSuper ? '' : userInfo?.uuid
}
uni.$api.userApi.getSceneMerchantRefStoreList(params).then(result => {
uni.hideLoading()
this.loginUserInfoList = result
this.copyLoginUserInfoList = result
this.flag = true
}).catch(err => {
uni.hideLoading()
console.log(err)
})
},
chooseAccount (item) {
uni.showLoading()
let { loginUserInfoList } = this
let listArr = loginUserInfoList
listArr.map(i => {
i.active = false
if (i.merchantId == item?.merchantId) {
i.active = true
}
return i
})
this.loginUserInfoList = listArr
this.selectMerchantId = item.merchantId
this.jumpPage(item)
},
async jumpPage (item) {
let { openSceneArr } = this,
{ merchantName: shopMerchantName, merchantId: shopMerchantId } = item,
{ userInfo } = this
if (!openSceneArr?.length && !userInfo?.isSuper) return uni.showToast({
title: '暂无开通业务,请联系总部管理员',
icon: 'none'
})
this.$emit('chooseMerchant',{
...userInfo,
shopMerchantName,
shopMerchantId,
default4SStoreInfo: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
},
default4SStoreInfo_crowdFunding: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
},
default4SStoreInfo_newCarConversion: {
merchantId: shopMerchantId,
merchantName: shopMerchantName
}
})
uni.hideLoading()
},
searchEvent (searchValue) {
let { copyLoginUserInfoList, selectMerchantId } = this
copyLoginUserInfoList.map(val => {
val.active = false
if (val.merchantId == selectMerchantId) val.active = true
return val
})
let filterArr = copyLoginUserInfoList.filter(val => val.merchantName.includes(searchValue) || val.merchantId == searchValue) || []
this.loginUserInfoList = filterArr
if (!searchValue) this.loginUserInfoList = copyLoginUserInfoList
},
}
}
</script>
<style scoped lang='scss'>
.box {
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 0 48rpx;
gap: 48rpx;
.items {
width: calc(50% - 24rpx);
height: 160rpx;
background: #ffffff;
border-radius: 16rpx;
padding: 32rpx;
display: flex;
align-items: center;
box-sizing: border-box;
border: 4rpx solid transparent;
.right {
margin-right: 28rpx;
flex-shrink: 0;
}
.left {
flex: 1;
.name {
font-weight: 500;
font-size: 32rpx;
color: #181a1f;
margin-bottom: 12rpx;
}
.text_no {
font-size: 28rpx;
color: #999ea8;
}
}
}
.active {
border: 4rpx solid #347bff;
}
.list-not {
font-size: 28rpx;
color: #999999;
margin: auto;
}
}
</style>