userDetail.vue
11.9 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
<template>
<div class="points">
<div class="points edit-box">
<div class="container m-b-20 top">
<div class="page-title">积分详情</div>
<div class="flex box">
<div class="flex block" v-for="(item, index) in list" :key="index">
<img class="icon" :src="require(`@/assets/point-custom-${index}.png`)" />
<div>
<div>{{ item.title }}</div>
<div class="num">
{{ item.key == 'staffName' ? staffName : topPointsInfo[item.key] || topPointsInfo[item.key] == 0 ? topPointsInfo[item.key] : "--" }}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<GLCombiForm ref="showSearch" :formObj="searchForm" :label-width="'150px'" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset" />
<div class="table-header">
<h2>积分明细列表</h2>
<div>
<!-- <el-button size="small" type="primary" @click="addDeduction" v-if="channelSource == 1 && !topPointsInfo.staffSource == 1">新增手动抵扣</el-button> -->
<el-button size="small" @click="handleExport" type="primary" plain>导出</el-button>
</div>
</div>
<GLTable ref="pointTable" :search-form="searchFormSearch" :table-params="tableParams" :get-list-api="getListApi" :pageConf="pageConf" :before-search-fn="beforeSearchFn">
<div slot="auth-button" slot-scope="scope">
<!-- <el-button type="text" @click="handleDetail(scope.scope)">详情</el-button> -->
<el-button type="text" v-if="channelSource == 1 && !scope.scope.relateId && scope.scope.infoName == '手动抵扣'" @click="handleRevocation(scope.scope)">撤销</el-button>
</div>
</GLTable>
<!-- 详细信息 -->
<point-detail-dialog :visible.sync="detailVisible" v-if="detailVisible" :id="recordInfo.id" />
<!-- 撤销抵扣 -->
<revocation-dialog :visible.sync="revocationVisible" v-if="revocationVisible" :id="recordInfo.id" @dialogClose="handleRevocationClose" @handleConfirm="handleRevocationComfirm" />
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import pointDetailDialog from './components/pointDetailDialog'
import revocationDialog from './components/revocationDialog'
export default {
components: {
pointDetailDialog,
revocationDialog
},
data() {
return {
detailVisible: false,
revocationVisible: false,
recordInfo: {},
searchForm: {
infoName: "",
rewardTime: []
},
searchFormSearch: {},
list: [
{
title: "员工姓名",
key: "staffName"
},
{
title: "当前积分",
key: "currentScore"
},
{
title: "累计收益积分",
key: "totalRewardScore"
},
{
title: "累计兑换积分",
key: "totalWithdrawalScore"
}
],
showFormData: [
{
label: "积分类型",
name: "infoName",
type: "select",
optionId: "confId",
optionLabel: "confLabel",
optionsName: "infoNameList"
},
{
label: "积分变化时间",
name: "rewardTime",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions"
}
],
getListApi: this.$apis.points.getScoreDetailList,
baseData: {
infoNameList: [
{
confId: "积分收益",
confLabel: "积分收益"
},
{
confId: "积分兑换",
confLabel: "积分兑换"
},
{
confId: "退款抵扣",
confLabel: "退款抵扣"
},
{
confId: "撤单抵扣",
confLabel: "撤单抵扣"
},
{
confId: "错单抵扣",
confLabel: "错单抵扣"
},
{
confId: "手动抵扣",
confLabel: "手动抵扣"
},
{
confId: "撤销抵扣",
confLabel: "撤销抵扣"
},
{
confId: "售后返还",
confLabel: "售后返还"
},
{
confId: "购物兑换",
confLabel: "购物兑换"
},
{
confId: "手动增加",
confLabel: "手动增加",
},
{
confId: "手动扣减",
confLabel: "手动扣减",
},
]
},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableOption: false,
tableColumns: [
{
label: "积分类型",
prop: "infoName"
},
{
label: "积分明细",
prop: "rewardScore",
formatter: (cell) => {
return cell.rewardScore
? (cell.type == 0 ? "+" : "-") + cell.rewardScore
: "--"
}
},
{
label: "变化后积分",
prop: "finalTotalScore",
formatter: (cell) => {
return cell.finalTotalScore || cell.finalTotalScore == 0
? cell.finalTotalScore
: "--"
}
},
{
label: "变化前积分",
prop: "currentTotalScore",
formatter: (cell) => {
return cell.currentTotalScore || cell.currentTotalScore == 0
? cell.currentTotalScore
: "--"
}
},
{
label: "积分变化时间",
prop: 'updatedTime',
formatter: (cell) => {
return dayjs(cell.updatedTime).format('YYYY-MM-DD HH:MM:ss')
}
},
{
label: "操作人",
prop: "operator"
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
topPointsInfo: {}
}
},
created() {
// 积分渠道,1.阳光激励 2.续保用户 3.管理层
this.channelSource = this.$route.query.channelSource
this.staffName = this.$route.query.staffName
this.list[0].title = this.channelSource == '1' ? '员工名称' : '客户名称'
},
methods: {
//新增抵扣
addDeduction() {
this.$router.push({
path: '/pointsList/addDeduction',
query: {
userId: this.topPointsInfo.staffUuid,
merchantId: this.topPointsInfo.merchantId
}
})
// this.$router.push({
// name: 'deduction',
// query: {
// userId: this.topPointsInfo.staffUuid,
// merchantId: this.topPointsInfo.merchantId
// }
// })
},
// 导出
handleExport() {
let params = {
...this.searchFormSearch,
currentPage: 1,
pageSize: 9999
}
this.$apis.points.exportDetailScore(params).then((res) => {
console.log(res)
this.$utils.aToExport(res)
// this.$open(res)
})
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = this.$common.utils.deepClone(this.searchForm)
this.searchFormSearch.channelSource = this.channelSource
this.searchFormSearch = {
...this.searchFormSearch,
...JSON.parse(this.$route.query.searchObj)
}
if (this.searchFormSearch.rewardTime && this.searchFormSearch.rewardTime.length) {
this.searchFormSearch.rewardBeginTime = dayjs(this.searchFormSearch.rewardTime[0]).format('YYYY-MM-DD') + ' 00:00:00'
this.searchFormSearch.rewardEndTime = dayjs(this.searchFormSearch.rewardTime[1]).format('YYYY-MM-DD') + ' 23:59:59'
}
if (this.searchFormSearch.withdrawalTime && this.searchFormSearch.withdrawalTime.length) {
this.searchFormSearch.withdrawalBeginTime = dayjs(this.searchFormSearch.withdrawalTime[0]).format('YYYY-MM-DD') + ' 00:00:00'
this.searchFormSearch.withdrawalEndTime = dayjs(this.searchFormSearch.withdrawalTime[1]).format('YYYY-MM-DD') + ' 23:59:59'
}
delete this.searchFormSearch.rewardTime
delete this.searchFormSearch.withdrawalTime
console.log(this.searchFormSearch)
this.getTopPointsInfo()
resolve()
})
},
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === "select") {
if (
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) {
const temp = {}
temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp)
}
this.$set(
this.showFormData[index],
"optionList",
this.baseData[item.optionsName]
)
}
})
},
// 查看详情
// handleDetail(data) {
// this.recordInfo = data
// this.detailVisible = true
// },
//撤销
handleRevocation(data) {
this.recordInfo = data
this.revocationVisible = true
},
//取消撤销
handleRevocationClose(value) {
this.revocationVisible = value
},
handleRevocationComfirm(value) {
this.revocationVisible = value
this.$refs.pointTable.refreshTable()
},
handleSearch() {
this.$refs.pointTable.refreshTable()
},
// 获取顶部积分信息
getTopPointsInfo() {
let params = {
...this.searchFormSearch,
currentPage: 1,
pageSize: 9999,
...JSON.parse(this.$route.query.searchObj)
}
// 根据staffId查询积分明细列表数据作为顶部积分信息
this.$apis.points.getStaffScoreList(params).then((res) => {
this.topPointsInfo = res.list?.[0] || {}
if (this.channelSource != 1) {
this.baseData.infoNameList = [
{
confId: "积分收益",
confLabel: "积分收益"
},
{
confId: "积分兑换",
confLabel: "积分兑换"
},
{
confId: "购物兑换",
confLabel: "购物兑换"
},
{
confId: "售后返还",
confLabel: "售后返还"
}
]
}
this.getOptionsList()
})
},
handleReset() {
this.searchForm = {
infoName: "",
rewardTime: []
}
this.searchFormSearch = {}
this.$refs.pointTable.refreshTable(true, true)
}
}
}
</script>
<style lang="scss" scoped>
.d2-container-content {
::v-deep {
.tableHeaderTitle {
font-weight: 500;
font-size: 16px;
color: #333333;
}
}
}
.header {
background: #ffffff;
}
.points {
.detail-tabs {
width: 100%;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-around;
padding: 20px 16px;
box-sizing: border-box;
margin-bottom: 16px;
.detail-tabs-item {
flex: 1;
height: 104px;
background: #f8faff;
border-radius: 5px;
padding: 20px;
box-sizing: border-box;
margin-right: 16px;
.title {
font-size: 16px;
color: #333333;
}
.score {
font-weight: 700;
font-size: 28px;
color: #185efe;
line-height: 42px;
}
}
}
}
.top .icon {
width: 44px;
height: 44px;
margin-right: 16px;
}
.top .box {
padding: 20px 20px 0;
}
.top .block {
box-sizing: border-box;
width: 271px;
height: 100px;
font-size: 14px;
color: #333333;
background: #f9fafc;
margin-right: 20px;
padding: 24px 16px 20px;
}
.top .num {
font-weight: 700;
font-size: 26px;
color: #333333;
margin-top: 10px;
}
</style>