index.vue
7.32 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
<template>
<div class="points">
<div class="container">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="table-header">
<h2>积分核销列表</h2>
<div>
<!-- <el-button size="small" @click="handleImport" type="primary">批量结算导入</el-button> -->
<div class="flex">
<div class="import-btn">
批量结算导入
<input id="fileUpload" type="file" style="opacity: 0;" ref="file" class="import-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" @change="e => handleImport(e)" />
</div>
<el-button size="small" @click="exportExcel" type="primary" plain>导出</el-button>
</div>
</div>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="pointRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="tableButtonList" :buttonItem="scope.scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
export default {
data() {
//这里存放数据
return {
size: 'small',
url: url,
searchForm: {
settlementStatus: ''
},
tableSearchForm: {},
showFormData: [
{
label: '项目名称',
name: 'bizRelName',
type: 'input',
isClear: true,
maxlength: 100
},
{
label: '商户名称',
name: 'merchantName',
type: 'input',
isClear: true,
maxlength: 100
},
{
label: '结算状态',
name: 'settlementStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'settlementStatusList'
},
{
label: '核销日期',
name: 'verificationTimeStr',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
tableButtonList: [
{
type: 'GLButton',
name: '查看',
attrs: {
type: 'text',
fn: '查看'
},
listeners: {
click: this.handleDetail
}
},
{
type: 'GLButton',
name: row => {
return row.settlementStatus ? '取消结算' : '去结算'
},
attrs: {
type: 'text',
fn: '去结算'
},
listeners: {
click: this.handleSettlement
}
}
],
// 表格
getListApi: this.$apis.points.getList,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '项目名称',
prop: 'bizRelName'
},
{
label: '消费积分',
prop: 'integralValue'
},
{
label: '客户昵称',
prop: 'customerWechatName'
},
{
label: '手机号',
prop: 'customerPhone',
width: '120px'
},
{
label: '核销员工',
prop: 'verificationStaffName'
},
{
label: '商户名称',
prop: 'merchantName'
},
{
label: '核算状态',
prop: 'settlementStatusStr',
width: '90px'
},
{
label: '核销日期',
prop: 'verificationTime',
width: '180px'
},
{
label: '操作人',
prop: 'updatedBy'
},
{
label: '订单编号',
prop: 'orderCode',
width: '200px'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
// 基本数据
baseData: {
settlementStatusList: [
{
confId: '0',
confLabel: '未结算'
},
{
confId: '1',
confLabel: '已结算'
}
]
}
}
},
mounted() {
this.$utils.getOptionsList(this, 'showFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.verificationTimeStr) {
params.verificationStartTime = dayjs(this.searchForm.verificationTimeStr[0]).format('YYYY-MM-DD') + ' 00:00:01'
params.verificationEndTime = dayjs(this.searchForm.verificationTimeStr[1]).format('YYYY-MM-DD') + ' 23:59:59'
}
delete params.verificationTimeStr
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.verificationTimeStr
resolve()
})
},
handleSearch() {
this.$refs.pointRef.refreshTable()
},
handleReset() {
this.searchForm = {
settlementStatus: ''
}
this.handleSearch()
},
handleSettlement(row) {
const params = {
id: row.id,
settlementStatus: row.settlementStatus ? 0 : 1
}
this.$utils.secondConfirm(this, '结算', '是否要' + (row.settlementStatus ? '取消结算' : '结算') + '?', 'points', 'integralorderSettle', params)
},
handleDetail(row) {
console.log(row)
this.$router.push({
path: '/pointsList/orderDetail',
query: {
id: row.id
}
})
},
handleImport(e) {
var reader = new FileReader()
var file = e.srcElement.files[0]
const isLt = file.size / 1024 / 1024 < 10
if (isLt > 10) {
this.$message({
message: '文件大小不能超过10M',
type: 'error'
})
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.points.orderImport({ file: base64 }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
document.getElementById('fileUpload').value = ''
this.handleSearch()
})
}
},
exportExcel() {
const params = this.getParams()
this.$apis.points.orderExport(params).then(res => {
this.$utils.aToExport(res)
})
}
}
}
</script>
<style scoped>
.import-btn {
position: relative;
width: 116px;
height: 32px;
text-align: center;
background: #5850ff;
border-radius: 4px;
color: #ffffff;
font-size: 14px;
margin-right: 8px;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
</style>