relevance.vue
11.5 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<template>
<div class="gl-page">
<div class="page-title">
<span>门店账户关联企微</span>
<span class="min-title">关联之后不允许修改,请谨慎操作!</span>
</div>
<div class="page-wrapper">
<div class="box_wrap">
<div class="title">
<span>选择你要绑定的商户账户</span>
<el-popover placement="top-start" title="说明" width="200" trigger="hover" content="只有账户状态正常的门店和商户才允许关联,如未开通,请联系您的专属顾问">
<img slot="reference" src="../../assets/img/question.png" />
</el-popover>
</div>
<div class="select_wrapper">
<div class="label">商户账户</div>
<SearchSelect @getCurMerchant="getCurMerchant" :name="componentsName"></SearchSelect>
</div>
</div>
<div class="icon_wrap">
<img src="../../assets/scrm_jh_icon.png" />
</div>
<div class="box_wrap">
<div class="title">
<span>选择你要绑定的企微门店</span>
<el-popover placement="top-start" width="200" title="说明" trigger="hover" content="企业微信授权成功后,企业微信相关内容才会显示">
<img slot="reference" src="../../assets/img/question.png" />
</el-popover>
</div>
<div class="select_wrapper">
<div class="label">企业微信</div>
<SearchSelect @getCurDepartment="getCurDepartment" :name="componentsName1"></SearchSelect>
</div>
</div>
<div class="relevance_btn">
<el-button type="purple" size="small" @click="handlerGL">关联</el-button>
</div>
</div>
<div class="tbale-wrapper">
<div class="wrap-title">
<span>绑定的商户/门店</span>
<span class="wrap-min-title">(绑定成功后,门店账户管理列表-关联的企业微信会显示关联的内容)</span>
</div>
<div class="table_widget">
<GLTable :hasPage="false" :tableParams="tableParams" :tableData="dataList" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px', height: '54px' }">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="deleteLine(scope.scope)" class="blue-text">删除</span>
</template>
</GLTable>
</div>
</div>
<div style="height: 20px"></div>
<GLFooter class="fixed-footer">
<div :style="{ width: customWidth + 'px' }" ref="btnWidth" class="btn-custom pruple" @click="handleMutiGL">确定关联({{ dataList.length }})</div>
<div style="width: 20px"></div>
<el-button :style="{ width: customWidth + 'px' }" @click="closeCurRouter">取消</el-button>
</GLFooter>
</div>
</template>
<script>
import SearchSelect from './components/search.vue'
export default {
name: '',
components: {
SearchSelect
},
data() {
return {
componentsName: 'merchant',
componentsName1: 'department',
departmentList: [],
shopList: [],
qwShop: '',
tableParams: {
tableColumns: [
{
label: '商户/门店账户',
prop: 'merchantName'
},
{
label: '企微门店',
prop: 'departmentName'
}
],
tableOption: {}
},
mypropParam1: {
value: 'id',
label: 'label',
children: 'children',
checkStrictly: true,
disabled: 'disabled'
},
mypropsParam: {
label: 'departmentName',
value: 'id',
children: 'children',
checkStrictly: true,
disabled: 'disabled'
},
dataList: [],
customWidth: 113,
shopName: '',
selectedDepartment: '',
tempDepart: {},
curTempMerchant: {}
}
},
methods: {
// 设置底部按钮宽度
setBtnWidth() {
let _this = this
this.$nextTick(function() {
_this.customWidth = _this.$refs.btnWidth.clientWidth
})
},
// 获取当前选择的商户
getCurMerchant(val) {
if (!val) {
this.curTempMerchant = {}
return
}
this.curTempMerchant = {
merchantId: val.merchantNo,
merchantName: val.merchantName
}
},
// 获取当前选择的部门
getCurDepartment(val) {
if (!val) {
this.tempDepart = {}
return
}
this.tempDepart = {
departmentId: val.id,
departmentName: val.departmentName
}
},
// 关联当前选择的
handlerGL() {
if (!this.curTempMerchant.merchantId) {
this.$message({
message: '请选择门店/商户',
type: 'warning'
})
return
}
if (!this.tempDepart.departmentId) {
this.$message({
message: '请选择企微门店',
type: 'warning'
})
return
}
this.curGLData = {
...this.curTempMerchant,
...this.tempDepart
}
let flag = false
this.dataList.forEach(item => {
if (item.departmentId == this.curGLData.departmentId || item.merchantId == this.curGLData.merchantId) {
flag = true
}
})
if (flag) {
this.$message({
message: '此商户已经绑定,请勿重复绑定',
type: 'warning'
})
return
}
this.dataList.push(this.curGLData)
this.setBtnWidth()
},
closeCurRouter() {
this.$router.push({ path: '/account/index' })
},
// 批量关联
handleMutiGL() {
if (!this.dataList.length) {
this.$message({
message: '请先选择您要关联的账户',
type: 'warning'
})
return
}
let merchantIds = []
let departmentIds = []
let departNames = []
let arrpara1 = []
let arrpara2 = []
let arrpara3 = []
this.dataList.forEach(item => {
merchantIds.push(item.merchantId)
departmentIds.push(item.departmentId)
departNames.push(item.departmentName)
})
merchantIds.forEach((item, index) => {
let keyval = `list[${index}].merchantId`
let val = item
arrpara1.push({
[keyval]: val
})
})
departmentIds.forEach((item, index) => {
let keyval = `list[${index}].departmentId`
let val = item
arrpara2.push({
[keyval]: val
})
})
departNames.forEach((item, index) => {
let keyval = `list[${index}].departName`
let val = item
arrpara3.push({
[keyval]: val
})
})
let all = [...arrpara1, ...arrpara2, ...arrpara3]
let para = Object.assign({}, ...all)
this.$confirm(' 请确认是否关联当前信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'gl-message-box',
type: 'warning'
}).then(() => {
this.$apis.baseInfo.toGL(para).then(res => {
if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$router.push({ path: '/account/index' })
}
})
})
},
deleteLine(row) {
let tempindex = 0
this.dataList.forEach((item, index) => {
if (item.departmentId == row.departmentId) {
tempindex = index
}
})
this.$confirm('此操作将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'gl-message-box',
type: 'warning'
})
.then(() => {
this.dataList.splice(tempindex, 1)
this.setBtnWidth()
this.$message({
type: 'success',
message: '删除成功!'
})
})
.catch(() => {})
},
// 递归:处理层级数组
traverse(type, arr, string1, string2, arr1 = []) {
arr.map(item => {
if (item[string1] || (item[string2] != 4 && type == 2)) {
item.disabled = true
} else {
item.disabled = false
}
if (item.children && item.children instanceof Array) {
this.traverse(type, item.children, string1, string2, (arr1 = []))
}
return item
})
return arr
}
}
}
</script>
<style lang="scss" scoped>
.gl-page {
box-sizing: border-box;
// padding: 20px 20px 20px 40px;
}
.page-title {
font-size: 20px;
font-weight: 500;
color: #424242;
.min-title {
font-size: 12px;
font-weight: 500;
color: #5850ff;
letter-spacing: 1px;
margin-left: 10px;
}
}
.page-wrapper {
width: 100%;
// height: 320px;
background: #ffffff;
// box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
// padding: 32px 0 0 20px;
padding: 20px 0 40px 40px;
margin-top: 20px;
display: flex;
overflow: hidden;
.box_wrap {
// width: 35%;
height: 100%;
position: relative;
.title {
font-size: 16px;
font-weight: 400;
color: #666666;
margin-bottom: 16px;
display: flex;
align-items: center;
> img {
cursor: pointer;
width: 14px;
height: 14px;
margin-left: 4px;
}
}
.select_wrapper {
display: flex;
align-items: center;
.label {
box-sizing: border-box;
padding-right: 10px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
white-space: nowrap;
}
}
}
.icon_wrap {
display: flex;
align-items: flex-end;
justify-content: center;
height: 65.09px;
padding: 0 52px;
> img {
width: 24px;
height: 24px;
margin-bottom: 6px;
}
}
.sel-wrap {
display: flex;
align-items: center;
margin-top: 12px;
.sel-lable {
width: 128px;
box-sizing: border-box;
padding-right: 10px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
}
}
.sel-wrap /deep/ .el-cascader-node {
max-width: 250px !important;
}
.btn-wrap {
padding-left: 20px;
padding-top: 40px;
}
}
.tbale-wrapper {
width: 100%;
min-height: 200px;
background: #ffffff;
// box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 20px;
margin-top: 20px;
.table_widget {
margin-top: 16px;
// height: 439px;
}
.blue-text {
font-size: 14px;
font-weight: 400;
color: #5850ff;
cursor: pointer;
}
}
.fixed-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// width: calc(100% - 177px);
// background: #5850ff;
height: 64px;
z-index: 10;
background: #ffffff;
// box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
.btn-custom {
font-size: 14px;
color: #fff;
font-weight: 400;
background: #999999;
border-radius: 4px;
cursor: pointer;
text-align: center;
padding: 12px 0;
}
.pruple {
background: #5850ff;
}
}
.wrap-title {
font-size: 16px;
font-weight: 500;
color: #333333;
.wrap-min-title {
font-size: 12px;
font-weight: 500;
color: #999999;
letter-spacing: 1px;
margin-left: 10px;
}
}
// table{
// max-height: 430px!important;
// }
.el-button--purple {
color: #fff;
background-color: #5850ff;
border-color: #5850ff;
border-radius: 4px;
}
.relevance_btn {
display: flex;
align-items: flex-end;
justify-content: center;
height: 65.09px;
padding-left: 8px;
}
</style>