pointParticulars.vue
7.27 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
<template>
<d2-container class="point-list">
<div class="header" slot="header">
<d2-search
ref="showSearch"
class="show-search"
:search-form="searchForm"
:label-width="'150px'"
:form-data="showFormData"
/>
<div class="up-btns">
<el-button @click="handleSearch" size="small" type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header
:title="'积分明细列表'"
:title-class-name="'tableHeaderTitle'"
>
<auth-button category="Button" :show-btn-ids="['9140202']" />
</d2-table-header>
<d2-table
ref="pointTable"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div slot="auth-button" slot-scope="scope">
<!-- 查看 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9140201']" />
</span>
</div>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { getScorePage, getShopMerchantList,exportScore } from "@api/point"
import { Util, deepClone } from "@/common/util"
export default {
data() {
return {
searchForm: {
staffName: "",
staffPhone: "",
merchantId: "",
rewardTime:[],
reviewTime:[],
successTime:[]
},
searchFormSearch:{
},
getListApi: getScorePage,
showFormData: [
{
label: "员工名称",
name: "staffName",
type: "input",
isClear: true
},
{
label: "员工手机号",
name: "staffPhone",
type: "input",
isClear: true
},
{
label: "门店名称",
name: "merchantId",
type: "select",
optionList: [],
optionId: "merchantId",
optionLabel: "merchantName",
optionsName: "merchantServiceList"
},
{
label: "积分收益时间",
name: "rewardTime",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions"
},
// {
// label: "积分兑换时间",
// name: "withdrawalTime",
// type: "datePicker",
// isClear: true,
// pickerOptions: "rangePickerOptions"
// },
{
label: "积分付款时间",
name: "reviewTime",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions"
},
{
label: "积分到账时间",
name: "successTime",
type: "datePicker",
isClear: true,
pickerOptions: "rangePickerOptions"
}
],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [
{
label: "门店名称",
prop: "merchantName"
},
{
label: "员工名称",
prop: "staffName"
},
{
label: "员工手机号",
prop: "staffPhone"
},
{
label: "当前积分",
prop: "currentScore"
},
{
label: "累计收益积分",
prop: "totalRewardScore"
},
{
label: "累计兑换积分",
prop: "totalWithdrawalScore"
},
{
label: "累计抵扣积分",
prop: "totalDeductScore"
}
]
},
baseData: {
merchantServiceList: []
}
}
},
mounted() {
getShopMerchantList({}).then((res) => {
this.baseData.merchantServiceList = res
this.getOptionsList()
})
},
methods: {
// 导出
handleExport() {
let params = {
...this.searchFormSearch,
currentPage: 1,
pageSize: 9999
}
exportScore(params).then((res) => {
this.$open(res)
})
},
handleDetail(data) {
this.$router.push({
name: "pointDetail",
query: {
staffId:data.staffId
}
})
},
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]
)
}
})
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.rewardTime&&this.searchFormSearch.rewardTime.length) {
this.searchFormSearch.rewardBeginTime =
Util.dateFormate(
this.searchFormSearch.rewardTime[0],
"YYYY-MM-DD"
) + " 00:00:00"
this.searchFormSearch.rewardEndTime =
Util.dateFormate(
this.searchFormSearch.rewardTime[1],
"YYYY-MM-DD"
) + " 23:59:59"
}
if (this.searchFormSearch.reviewTime&&this.searchFormSearch.reviewTime.length) {
this.searchFormSearch.reviewBeginTime =
Util.dateFormate(
this.searchFormSearch.reviewTime[0],
"YYYY-MM-DD"
) + " 00:00:00"
this.searchFormSearch.reviewEndTime =
Util.dateFormate(
this.searchFormSearch.reviewTime[1],
"YYYY-MM-DD"
) + " 23:59:59"
}
if (this.searchFormSearch.successTime&&this.searchFormSearch.successTime.length) {
this.searchFormSearch.successBeginTime =
Util.dateFormate(
this.searchFormSearch.successTime[0],
"YYYY-MM-DD"
) + " 00:00:00"
this.searchFormSearch.successEndTime =
Util.dateFormate(
this.searchFormSearch.successTime[1],
"YYYY-MM-DD"
) + " 23:59:59"
}
delete this.searchFormSearch.rewardTime
delete this.searchFormSearch.successTime
delete this.searchFormSearch.reviewTime
resolve()
})
},
handleSearch() {
this.$refs.pointTable.refreshTable()
},
handleReset() {
this.searchForm = {
staffName: "",
staffPhone: "",
merchantId: "",
rewardTime:[],
reviewTime:[],
successTime:[]
}
this.searchFormSearch={}
this.$refs.pointTable.refreshTable(true, true)
}
}
}
</script>
<style scoped lang="scss">
.d2-container-content {
::v-deep {
.tableHeaderTitle {
font-weight: 500;
font-size: 16px;
color: #333333;
}
}
}
</style>