index.vue
9.04 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<template>
<div class="scrm-main">
<div class="form-header" v-if="$globalState.session.accountLevel == 1 && $globalState.session.merchantModel == 1">
<el-button type="primary" @click="handleContact" size="small" icon="el-icon-link"
>门店账户关联企微</el-button
>
</div>
<div class="follow-form">
<el-form :inline="true" :model="searchForm" class="follow-form-item" label-width="80px">
<el-row>
<el-form-item size="small" label="关联企微">
<el-select v-model="searchForm.isRelevance" placeholder="请选择">
<el-option v-for="item in optionsContact" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item class="merchant-row" size="small">
<el-input
size="small"
v-model="searchForm.merchantLoginAccount"
placeholder="请输入"
v-if="searchForm.accountOrPhone == 1"
>
<el-select
size="small"
v-model="searchForm.accountOrPhone"
@change="searchForm.merchantLoginAccount = '';searchForm.merchantLegalPersonPhone = ''"
slot="prepend"
placeholder="请选择"
>
<el-option label="登录账户名" :value="1"></el-option>
<el-option label="手机号" :value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
v-model="searchForm.merchantLegalPersonPhone"
placeholder="请输入"
v-if="searchForm.accountOrPhone == 2"
>
<el-select
size="small"
v-model="searchForm.accountOrPhone"
slot="prepend"
@change="searchForm.merchantLoginAccount = '';searchForm.merchantLegalPersonPhone = ''"
placeholder="请选择"
>
<el-option label="登录账户名" :value="1"></el-option>
<el-option label="手机号" :value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
<el-form-item size="small" label="账户状态">
<el-select size="small" v-model="searchForm.status" placeholder="请选择">
<el-option v-for="item in merchantStatus" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="账户等级">
<el-select size="small" v-model="searchForm.merchantAccountLevel" placeholder="请选择">
<el-option v-for="item in accountLevel" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
<el-form-item class="merchant-wx" size="small">
<el-input size="small" v-model="searchForm.merchantName" placeholder="请输入商户名称/关联的企业微信名"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right">
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-row>
</el-form>
<GLTable ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch">
<div slot="accountTypeNames" slot-scope="scope">
<div class="accountType-row" v-for="(item, index) in scope.scope.accountTypeNames.split(',')" :key="index">
{{ item }}
</div>
</div>
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handleLook(scope.scope)">查看</el-button>
<el-button type="text" @click="handleEdit(scope.scope)" v-if="$globalState.session.merchantId != scope.scope.merchantNo">修改</el-button>
<el-button type="text" @click="handleAdd(scope.scope)" v-if="scope.scope.status == 2 && scope.scope.merchantAccountLevel != 4">创建子商户/门店</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
const optionsContact = [
{
value: '',
label: '全部'
},
{
value: '1',
label: '已关联'
},
{
value: '2',
label: '未关联'
}
]
export default {
name: 'index',
data() {
return {
drawer: false,
direction: 'rtl',
searchForm: {
accountOrPhone: 1,
merchantLegalPersonPhone: '',
merchantLoginAccount: ''
},
optionsContact,
accountLevel: [],
accountType: [],
merchantStatus: [],
scope: {
scope: ''
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
tableOption: {
width: '150px'
},
mutiSelectName: 'merchant',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '商户名',
prop: 'merchantName'
},
{
label: "关联的企业微信",
prop: "entmicroName",
formatter: (cellValue) => {
return cellValue.entmicroName ? cellValue.entmicroName : "-";
},
},
{
label: '账户类型',
prop: 'accountTypeNames',
addHtml: 'accountTypeNames'
},
{
label: '登录账户',
prop: 'merchantLoginAccount'
},
{
label: '账户等级',
prop: 'accountLevelName',
width: '80px'
},
{
label: "上级商户",
prop: "parentMerchant",
formatter: (cellValue) => {
return cellValue.parentMerchant ? cellValue.parentMerchant : "-";
},
},
{
label: '账户状态',
prop: 'statusName',
width: '80px'
},
{
label: "联系人",
prop: "merchantLegalPerson",
formatter: (cellValue) => {
return cellValue.merchantLegalPerson ? cellValue.merchantLegalPerson : "-";
},
},
{
label: '手机号',
prop: 'merchantLegalPersonPhone',
width: '120px'
},
{
label: "更新时间",
prop: "updatedTime",
},
],
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
tableData: [],
tableTotal: 0
}
},
methods: {
handleContact() {
this.$router.push('/baseInfo/relevance/')
},
handleLook(scope) {
this.$router.push('/account/detailAccount/' + scope.id)
},
handleEdit(scope) {
this.$router.push('/account/editAccount/' + scope.id)
},
handleAdd(scope) {
this.$router.push('/account/addAccount/' + scope.id)
},
findAllDictData(dictType) {
var params = {
dictType
}
this.$apis.store.findAllDictData(params).then(res => {
if (res) {
if (dictType == "account_level") {
this.accountLevel = [{ dictValue: "", dictLabel: "全部" }].concat(res);
}
if (dictType == 'account_type') {
this.accountType = res
}
if (dictType == "merchant_status") {
this.merchantStatus = [{ dictValue: "", dictLabel: "全部" }].concat(res);
}
}
})
},
beforeSearchFn() {
return new Promise(resolve => {
// 调接口前,操作
resolve()
})
},
handleSearch() {
var params = {
...JSON.parse(JSON.stringify(this.searchForm)),
pageSize: this.$refs.table.page.pageSize,
pageNum: this.$refs.table.page.pageNum
}
this.$apis.store.findMerchantByPage(params).then(res => {
this.tableData = res.data
this.tableTotal = res.count
if (res.data && res.data.length == []) {
this.$refs.table.setTableHeightFun()
}
})
}
},
mounted() {
this.handleSearch()
this.findAllDictData('account_level')
this.findAllDictData('account_type')
this.findAllDictData('merchant_status')
}
}
</script>
<style scoped lang="scss">
.follow-form {
margin-top: 20px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
}
.accountType-row {
text-align: left;
position: relative;
padding-left: 15px;
&::before {
content: '';
position: absolute;
width: 6px;
height: 6px;
background: #5850ff;
border-radius: 8px;
left: 0px;
top: 7px;
}
}
.merchant-row {
margin-left: 20px;
/deep/ {
.el-form-item__content {
line-height: 1;
}
.el-select {
.el-input {
width: 110px;
}
}
}
}
.merchant-wx {
margin-left: 20px;
/deep/ {
.el-input__inner {
width: 310px;
}
}
}
</style>