popSearch.vue
9.46 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
<template>
<div class="custom_page">
<div class="content">
<!-- 顶部搜索 -->
<div class="toolbar">
<!-- 顶部搜索 -->
<el-form :inline="true" :model="formInline">
<el-form-item label="客户昵称">
<el-input v-model="formInline.name" placeholder="请输入客户昵称" />
</el-form-item>
<el-form-item label="客户手机号">
<el-input v-model="formInline.phone" placeholder="请输入客户手机号" />
</el-form-item>
<el-form-item label="分销员昵称">
<el-input v-model="formInline.distributorName" placeholder="请输入分销员昵称" />
</el-form-item>
<el-form-item label="绑定状态">
<el-select v-model="formInline.ifBind" placeholder="请选择绑定状态">
<el-option label="全部" :value="null" />
<el-option label="已绑定" value="1" />
<el-option label="未绑定" value="0" />
</el-select>
</el-form-item>
</el-form>
<div>
<el-button style="background-color: #3F9B6A;color: #fff" @click="search">查询</el-button>
<el-button class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="clear">重置</el-button>
</div>
</div>
<!-- 表格 -->
<div class="content_table">
<div class="table">
<el-table
:data="tableData"
:header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
>
>
<el-table-column prop="name" label="客户昵称" />
<el-table-column prop="phone" label="客户手机号" />
<el-table-column prop="distributorName" label="所属分销员" />
<el-table-column prop="distributorPhone" label="分销员手机号" />
<el-table-column label="绑定状态">
<template slot-scope="scope">
<span v-if="scope.row.ifBind == 0">未绑定</span>
<span v-if="scope.row.ifBind == 1">已绑定</span>
</template>
</el-table-column>
<el-table-column prop="updateTime" label="关系更新时间" />
<el-table-column label="操作" show-overflow-tooltip>
<template slot-scope="scope">
<div class="btnList">
<div class="tableBtn greens" @click="relieve(scope.row)">解绑</div>
<div class="tableBtn greens" @click="add(scope.row)">绑定</div>
<div class="tableBtn greens" @click="del(scope.row)">移除</div>
</div>
</template>
</el-table-column>
</el-table>
<div class="fenye">
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="10"
background
small
layout="prev, pager, next,total"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
</div>
<!-- *****************************弹框开始***************************** -->
<!-- 解绑/移除弹框 -->
<el-dialog
:visible.sync="isVisible.show"
:title="isVisible.title"
center
:close-on-click-modal="false"
width="30%"
>
<div style="text-align: center;">
<div class="unbindimg">
<img src="../../../assets/images/tixing.png" alt srcset>
</div>
<div class="dialog_content">{{ isVisible.text }}</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="isVisible.show = false">取消</el-button>
<el-button type="primary" @click="agreeEn">确认</el-button>
</span>
</el-dialog>
<el-dialog
:visible.sync="isVisible.shows"
:title="isVisible.title"
center
custom-class="bian_css"
:close-on-click-modal="false"
width="30%"
>
<div style="text-align: center;">
<div style="display: flex" class="diaoCen">
<el-input v-model="searchs" style="width:200px" clearable placeholder="请输入分销员名称" />
<el-button style="background-color: #3F9B6A;color: #fff" @click="searchDis">查询</el-button>
</div>
<el-radio-group v-model="distributorId">
<el-radio
v-for="(item,index) in inviteList"
:key="index"
:label="item.distributorId"
>{{ item.distributorName }}</el-radio>s
</el-radio-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="buttonHover"
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="isVisible.shows = false">取消</el-button>
<el-button style="background-color: #3F9B6A;color: #fff" @click="agreeEn">确认</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
shipGetAll,
shipAdd,
getAllInvitees,
relieveBind,
shipDelete
} from '@/api/distributor'
export default {
data() {
return {
formInline: {
name: '', // 客户昵称
phone: '', // 客户手机号
distributorName: '', // 分销员昵称
ifBind: null, // 绑定状态 是否绑定 1-是 0-否
page: 1,
pageSize: 10
},
distributorId: '',
isVisible: {},
total: 1,
tableData: [],
currentPage: 1,
searchs: '',
inviteList: []
}
},
created() {
this.getAll(this.formInline)
this.getList()
},
methods: {
handleSizeChange(val) {
this.formInline.pageSize = val
this.getAll(this.formInline)
},
handleCurrentChange(val) {
this.formInline.page = val
this.getAll(this.formInline)
},
searchDis() {
this.getList()
},
// 查询
search() {
this.total = 1
this.formInline.page = 1
this.getAll(this.formInline)
},
// 绑定
add(row) {
this.isVisible = {
shows: true,
title: '绑定',
index: 1,
arr: row
}
},
// 解绑
relieve(row) {
this.isVisible = {
show: true,
title: '解绑',
text: '解绑后对应的分销员将失去绑定关系,并且无法再获得收益',
index: 2,
arr: row
}
},
// 移除
del(row) {
this.isVisible = {
show: true,
title: '移除',
text: '移除后客户将从分销员工具消失, 但仍可被其他分销员绑定关系',
index: 3,
arr: row
}
},
async agreeEn() {
if (this.isVisible.index === 1) {
if (this.distributorId === '') {
this.$message.error('请选择分销员')
return
}
const res = await shipAdd({
buyerUserId: this.isVisible.arr.buyerUserId,
distributorId: this.distributorId
})
if (res.code === '') {
this.$message.success('绑定成功')
this.getAll(this.formInline)
this.searchs = ''
this.isVisible.shows = false
}
} else if (this.isVisible.index === 2) {
const res = await relieveBind({
buyerUserId: this.isVisible.arr.buyerUserId,
distributorId: this.isVisible.arr.distributorId
})
if (res.code === '') {
this.$message.success('解绑成功')
this.getAll(this.formInline)
this.isVisible.show = false
}
} else if (this.isVisible.index === 3) {
const res = await shipDelete({
buyerUserId: this.isVisible.arr.buyerUserId,
distributorId: this.isVisible.arr.distributorId
})
if (res.code === '') {
this.$message.success('移除成功')
this.getAll(this.formInline)
this.isVisible.show = false
}
}
},
// 清除
clear() {
this.formInline = {
name: '', // 客户昵称
phone: '', // 客户手机号
distributorName: '', // 分销员昵称
ifBind: null, // 绑定状态 是否绑定 1-是 0-否
page: 1,
pageSize: 10
}
this.getAll(this.formInline)
},
// 初始化查询所有数据
async getAll(formInline) {
const res = await shipGetAll(formInline)
this.tableData = res.data.list
this.total = res.data.total
},
// 初始化查询所有邀请人
async getList() {
const res = await getAllInvitees({
search: this.searchs
})
this.inviteList = res.data
}
}
}
</script>
<style lang='scss' scoped>
@import url("../../../styles/elDialog.scss");
.custom_page {
padding: 20px;
}
.checkBoxStyle {
margin-bottom: 20px;
}
.diaoCen {
display: flex;
justify-content: center;
input {
width: 200px;
}
button {
margin-left: 20px;
}
}
.el-radio-group {
margin-top: 20px;
}
::v-deep .el-radio__inner {
width: 30px;
height: 30px;
}
::v-deep.el-radio__label {
font-size: 18px;
}
.dialog_content {
width: 275px;
height: 46px;
margin: auto;
font-size: 16px;
font-family: PingFang SC;
font-weight: 400;
color: #333333;
line-height: 30px;
margin-top: 25px;
}
.toolbar {
display: flex;
width: 100%;
font-size: 14px;
justify-content: space-between;
}
::v-deep .el-pagination__total {
position: absolute;
left: 10px;
}
</style>