index.vue
10.7 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
<template>
<div class="expert-container">
<div>
<div class="btn-area">
<GLButton id="clientBtn" :size="size" fn="新增配置" type="primary" @click.stop="addConfig(1)">
新增配置
<i class="el-icon-arrow-down"></i>
</GLButton>
<ul v-if="showClientType" class="client">
<li @click.stop="selectClientType(1)">升级客户</li>
<li @click.stop="selectClientType(2)">战败客户</li>
</ul>
</div>
<span class="btnTip">配置轻改专家,形成业务活码,客户通过「精品升级」订单扫码后添加该员工。</span>
</div>
<div class="expert-wrap">
<glsx-combi-form ref="expertRef" labelWidth="72px" defaultWidth="215px" :formObj="batchListSearch" :formData="expertForm">
<div slot="department">
<el-cascader popper-class="expert-cascader" ref="cascaderRef1" placeholder="请选择商户/门店" @change="getCurMerchant" :show-all-levels="false" v-model="batchListSearch.departmentId" :props="mypropParam1" :options="shopList" size="small" style="width: 215px" separator=" " filterable>
<template slot-scope="{ data }">
<el-tooltip popper-class="myToolTipClass" style="border: none" :disabled="data.label.length > 12 ? false : true" class="item" effect="light" :content="data.label" placement="top-end">
<div class="limitText" style="width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">{{ data.label }}</div>
</el-tooltip>
</template>
</el-cascader>
</div>
<span slot="footer" class="footer-btns">
<el-button :size="size" type="primary" @click="handleSearch">查询{{ isNotData }}</el-button>
<el-button :size="size" class="resetBtn" @click="handleReset">重置</el-button>
</span>
</glsx-combi-form>
<GLTable ref="expertTable" @hook:mounted="setTabelHeight" :hasNum="false" :pageConf="batchPageConf" :searchForm="batchListSearch" :tableParams="batchTableParams" :getListApi="getListApi">
<span slot="status" slot-scope="scope">
<el-switch :value="scope.scope.status == 0" active-color="#5850ff" inactive-color="#eee" @change="changStatus(scope.scope.status, scope.scope.id)"></el-switch>
{{ scope.scope.status == 1 ? '禁用' : '启用' }}
</span>
<div class="table-btns" slot="table-btns" slot-scope="scope">
<GLButton fn="编辑" type="text" @click="addConfig(scope)">编辑</GLButton>
<GLButton fn="编辑" type="text" @click="addConfig(2)">删除</GLButton>
</div>
<!-- <div slot="additionalContent" class="default-box">
<img class="default-img" :src="imagBaseURL + 'serviceser.png'" alt="" />
<span class="tip">用于「精品升级」客户线上化,配置轻改专家成员,可通过精品升级的质保卡活码拉新。</span>
<GLButton :size="size" fn="新增配置" icon="el-icon-plus" type="primary" @click="addConfig(1)">配置门店轻改专家</GLButton>
</div> -->
</GLTable>
</div>
</div>
</template>
<script>
const imagBaseURL = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/'
import glsxCombiForm from '@/components/glsx-combi-form'
import util from '@/util/util'
export default {
name: 'expert_index',
data() {
return {
imagBaseURL,
shopName: '',
shopList: [],
mypropParam1: {
value: 'id',
label: 'label',
children: 'children',
checkStrictly: true
},
size: 'small',
getListApi: this.$apis.expert.getExpertList,
showClientType: false,
batchPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
batchListSearch: {
departmentId: '',
staffName: '',
businessType: ''
},
expertForm: [
{
label: '门店',
name: 'departmentId',
addHtml: 'department'
},
{
label: '员工',
name: 'staffName',
type: 'input',
maxlength: 15
},
{
label: '客户类型',
name: 'businessType',
type: 'select',
optionList: [
{
memberId: '',
memberName: '全部'
},
{
memberId: 1,
memberName: '正式会员'
},
{
memberId: 2,
memberName: '试用会员'
}
],
optionId: 'memberId',
optionLabel: 'memberName',
optionsName: 'memberType'
}
],
batchTableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '编号',
prop: 'stateId',
formatter: cellValue => {
return cellValue.stateId || '-'
}
},
{
label: '所属门店/部门',
prop: 'departmentName',
formatter: cellValue => {
return cellValue.departmentName || '-'
}
},
{
label: '成员',
prop: 'staffName',
formatter: cellValue => {
return cellValue.staffName || '-'
}
},
{
label: '客户类型',
prop: 'businessType',
width: 200,
formatter: cellValue => {
return cellValue.priceSection == -1 ? '战败客户' : '升级客户'
}
},
{
label: '欢迎语',
prop: 'isWelcomeWord',
width: 200,
formatter: cellValue => {
return cellValue.isWelcomeWord == -1 ? '否' : '是'
}
},
{
label: '状态',
prop: 'status',
addHtml: 'status'
},
{
label: '操作',
prop: '',
width: '100px',
fixed: 'right',
addHtml: 'table-btns'
}
]
}
}
},
components: {
glsxCombiForm
},
computed: {},
created() {
this.getMerchantList()
},
mounted() {
document.getElementById('app').addEventListener('click', this.setClientType)
},
beforeDestroy() {
document.getElementById('app').removeEventListener('click', this.setClientType)
},
methods: {
// 获取当前选择的商户
getCurMerchant(val) {
console.log(val, 7897)
let id = val[val.length - 1]
this.batchListSearch.departmentId = id
// let labels = this.$refs.cascaderRef1.getCheckedNodes()[0].pathLabels
// let curLabel = labels[labels.length - 1]
// this.curTempMerchant = {
// merchantId: id,
// merchantName: curLabel
// }
// this.$refs.cascaderRef1.dropDownVisible = false
},
getMerchantList() {
this.$apis.expert.getMerchantTree({}).then(res => {
this.shopList = this.traverse(2, res, 'entmicroName', 'merchantAccountLevel')
})
},
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
},
setClientType() {
if (this.showClientType) this.showClientType = false
},
changStatus(openFlag, id) {
let ids = []
ids.push(id)
let target = 'openConfigs'
if (openFlag == 1) {
target = 'closeConfigs'
}
let params = { ids }
this.$apis.openconfig[target](params).then(({ code, message }) => {
if (code == 0) {
this.$message({
message: '操作成功!',
type: 'success'
})
this.$refs.table.refreshTable()
} else {
this.$message.error(message)
}
})
},
addConfig() {
this.showClientType = true
},
setTabelHeight() {
this.$refs.expertTable.tableHeightValues = '455'
},
goDetail() {
this.$router.push({ path: '/expert/detail/5' })
},
selectClientType(type, id) {
this.showClientType = false
let paraFormat = {
clientType: type
}
if (id) {
paraFormat.expertId = id
}
const urlpara = JSON.stringify(paraFormat)
this.$router.push({ path: '/expert/detail/' + urlpara })
},
// beforeSearchFn() {
// return new Promise((resolve, reject) => {
// this.batchListSearch = { ...this.setParams() }
// resolve()
// })
// },
// setParams() {
// const params = {}
// params.searchText = 'dasda'
// return params
// },
handleSearch() {
this.$refs.expertTable.refreshTable()
},
handleReset(type) {
console.log(this.$refs.expertTable)
this.batchListSearch = {
searchText: '',
activeTime: []
}
if (type === 'reset') {
this.handleSearch()
}
}
}
}
</script>
<style lang="scss" scoped>
.btn-area {
display: inline-block;
position: relative;
.client {
background-color: #fff;
list-style: none;
position: absolute;
z-index: 1;
width: 108px;
padding: 4px 0;
box-shadow: 0px 6px 20px 0px rgba(122, 122, 122, 0.2);
border-radius: 4px;
top: calc(100% + 8px);
li {
height: 32px;
line-height: 32px;
text-align: center;
background: #ffffff;
cursor: pointer;
font-size: 14px;
font-weight: 400;
color: #666666;
&:hover {
background-color: #f4f6fc;
color: #5850ff;
}
}
}
}
.btnTip,
.tip {
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.btnTip {
font-size: 14px;
line-height: 22px;
margin-left: 16px;
}
.expert-wrap {
position: relative;
margin-top: 16px;
padding: 20px 20px 0;
background-color: #fff;
// height: calc(100vh - 148px);
.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;
}
}
.default-box {
width: 624px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
.default-img {
width: 400px;
height: 174px;
}
.tip {
font-size: 16px;
line-height: 24px;
white-space: nowrap;
margin: 24px;
}
}
}
</style>