detail.vue
4.59 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
<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 detailFormData" :key="index">
<img class="icon" :src="require(`@/assets/point-custom-${index}.png`)" />
<div>
<div>{{ item.title }}</div>
<div class="num">{{ detailData[item.name] || 0 }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<h2>客户积分明细</h2>
<el-button size="small" @click="exportExcel" type="primary" plain>导出</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="pointRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"></GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
data() {
//这里存放数据
return {
size: 'small',
url: url,
routeInfo: {},
searchForm: {
ruleType: ''
},
showFormData: [
{
label: '消费类型',
name: 'ruleType',
type: 'select',
optionList: [],
optionId: 'ruleType',
optionLabel: 'ruleDesc'
}
],
detailData: {},
detailFormData: [
{
title: '当前积分',
name: 'availableIntegral'
},
{
title: '积分累计收入',
name: 'totalIntegral'
},
{
title: '积分累计支出',
name: 'usedIntegral'
}
],
// 表格
getListApi: this.$apis.points.getIntegralDetailList,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '类型',
prop: 'direct',
formatter: cellValue => {
const obj = {
ADD: '收入',
DEDUCT: '支出'
}
return obj[cellValue.direct]
}
},
{
label: '数量',
prop: 'integralValue'
},
{
label: '消费类型',
prop: 'ruleDesc'
},
{
label: '消费名称',
prop: 'bizRelName'
},
{
label: '消费时间',
prop: 'createdDate'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
ruleTypeList: []
}
},
created() {
this.routeInfo = this.$route.query
this.getTypeList()
},
mounted() {
this.$utils.getOptionsList(this, 'showFormData')
this.customerDetail()
},
methods: {
getTypeList() {
this.$apis.points.getTypeListApi({}).then(res => {
if (res?.length) {
this.ruleTypeList = res
const target = this.showFormData.find(item => item.name == 'ruleType')
target.optionList = res
}
})
},
customerDetail() {
const params = {
customerId: this.routeInfo.id
}
this.$apis.points.customerDetail(params).then(res => {
this.detailData = res || {}
})
},
dealParams() {
this.searchForm.customerId = this.routeInfo.id
return this.searchForm
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.dealParams()
resolve()
})
},
handleSearch() {
this.$refs.pointRef.refreshTable()
},
handleReset() {
this.searchForm = {
ruleType: ''
}
this.handleSearch()
},
exportExcel() {
var params = this.dealParams()
this.$apis.points.getIntegralDetailExport(params).then(res => {
this.$utils.aToExport(res)
})
}
}
}
</script>
<style scoped>
.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>