couponsOrder.vue
10.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
<template>
<div class="order-container">
<div class="pannel">
<GLCombiForm ref="showSearch" :searchSelectObj="searchSelectObj" :formObj="searchForm" :formData="searchFormData" @handleOk="toHandlerFindParam" @handleRest="handleRestFn"></GLCombiForm>
</div>
<div class="pannel tableTopButton">
<el-button size="small" type="primary" plain @click="toshowDialog">查看礼券</el-button>
<GLButton size="small" fn="导出礼券" @click="toExport">导出</GLButton>
</div>
<div class="table_wrap">
<GLTable ref="table" :tableData="tableData" :tableTotal="tableTotal" :tableParams="tableParams" @refreshTable="toGetCouponsList"></GLTable>
</div>
<GLDialog :visible.sync="dialogTableVisible" bigTitle="111" mode="big" :hasFooter="false">
<div slot="custombigtitle" class="customTitle">
<div class="title1">共计{{ tabletotal1 }}条数据</div>
<span class="h9_title">门店新车精品礼券由</span>
<span class="title2">专属顾问</span>
<span class="h9_title">进行配置,如需新增详情请联系管理员。</span>
</div>
<GLTable ref="table1" :tableTotal="tabletotal1" :hasNum="false" :tableData="tableData1" :tableParams="tableParams1" @refreshTable="toOpenCoupons"></GLTable>
</GLDialog>
</div>
</template>
<script>
import { findCoupons, checkCoupons, exportCoupons, getEmployName } from '../../api/modules/rules'
import { converterApi } from '../../api/modules/converter'
import utils from '../../util/util'
export default {
name: '',
data() {
return {
tableParams: {
tableOption: false,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '领用时间',
prop: 'createdDate',
width: '180'
},
{
label: '客户姓名',
prop: 'customerName',
width: '280'
},
{
label: '手机号',
prop: 'customerPhone',
width: '150'
},
{
label: '礼券名称',
prop: 'couponName',
width: '280px'
},
{
label: '发券人',
prop: 'employeeName',
width: '120px'
},
{
label: '核销状态',
prop: 'status'
},
{
label: '转化人',
prop: 'sellerName',
width: '280'
},
{
label: '核销时间',
prop: 'usedTime',
width: '180'
}
]
},
tableParams1: {
tableOption: false,
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '礼券批次号',
prop: 'merchantCouponCode'
},
{
label: '礼券名称',
prop: 'couponName'
},
{
label: '适用产品',
prop: 'couponTypeName'
},
{
label: '总数',
prop: 'amount',
width: '120px'
},
{
label: '余量',
prop: 'remainAmount',
width: '120px'
},
{
label: '发放',
prop: 'getAmount',
width: '100px'
},
{
label: '核销',
prop: 'usedAmount',
width: '100px'
},
{
label: '配置时间',
prop: 'createdDate'
}
]
},
tableData: [],
tableData1: [],
tableTotal: 0,
tabletotal1: 0,
employeeNameData: [],
dialogTableVisible: false,
/**新加搜索栏参数 */
searchSelectObj: {
columType: {
attr: 1,
value: ''
}
},
searchForm: {
customName: '',
hxstatus: '',
dateBetween: '',
phoneNum: '',
hxdateBetween: '',
employeeName: ''
},
searchFormData: [
{
label: '客户姓名',
name: 'customName',
type: 'input',
isClear: true
},
{
label: '核销状态',
name: 'hxstatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confName',
isClear: true,
noFilter: true,
optionList: [
{
confId: 'Y',
confName: '已核销'
},
{
confId: 'N',
confName: '待核销'
}
]
},
{
label: '领用时间',
name: 'dateBetween',
type: 'datePicker',
isClear: true
},
{
type: 'doubleSelect',
selectName: 'columType',
isClear: true,
selectOption: [
{
label: '发券人',
name: 1
},
{
label: '转化人',
name: 2
}
],
name: 'employeeName',
optionId: 'confId',
optionLabel: 'confName',
optionList: [],
handleSelectChange: value => {
this.getEmployNameList(value)
}
},
{
label: '手机号',
name: 'phoneNum',
type: 'input',
isClear: true,
maxlength: '11'
},
{
label: '核销时间',
name: 'hxdateBetween',
type: 'datePicker',
isClear: true
}
]
}
},
created() {},
mounted() {
this.toGetCouponsList()
this.toOpenCoupons()
this.getEmployNameList(1)
let that = this
window.addEventListener('resize', () => {
let width = document.body.clientWidth
that.screenWidth = width
})
},
methods: {
handleRestFn() {
this.searchForm = {
customName: '',
hxstatus: '',
dateBetween: '',
phoneNum: '',
hxdateBetween: '',
employeeName: ''
}
this.newCurrentHttpParma = {}
this.toGetCouponsList()
},
// 处理查询条件
toHandlerFindParam() {
let params = {}
if (this.searchForm.customName) {
//客户姓名
params.customerName = this.searchForm.customName
}
if (this.searchForm.hxstatus) {
//核销状态
params['usedFlagList[0]'] = this.searchForm.hxstatus
}
if (this.searchForm.dateBetween) {
//领用时间
let startDate = utils.dateFormat(this.searchForm.dateBetween[0], 'YYYY-MM-DD 00:00:00')
let endDate = utils.dateFormat(this.searchForm.dateBetween[1], 'YYYY-MM-DD 23:59:59')
params.startDate = startDate
params.endDate = endDate
}
//发券人
if (this.searchForm.employeeName != '' && this.columType) {
params.columType = this.columType
let name = this.columType == 1 ? 'employeeNameList[0]' : 'sellerNameList[0]'
params[name] = this.employeeNameData[this.searchForm.employeeName]
}
if (this.searchForm.hxdateBetween) {
// 核销时间
let startDate = utils.dateFormat(this.searchForm.hxdateBetween[0], 'YYYY-MM-DD 00:00:00')
let endDate = utils.dateFormat(this.searchForm.hxdateBetween[1], 'YYYY-MM-DD 23:59:59')
params.startUsedTime = startDate
params.endUsedTime = endDate
}
if (this.searchForm.phoneNum) {
// 手机号
params.customerPhone = this.searchForm.phoneNum
}
this.newCurrentHttpParma = params
this.$refs.table.page.pageNum = 1
this.toGetCouponsList()
},
toshowDialog() {
this.dialogTableVisible = true
},
toGetCouponsList() {
let method = findCoupons()
let para = {
routerMethod: method,
currentPage: this.$refs.table.page.pageNum,
pageSize: this.$refs.table.page.pageSize,
...this.newCurrentHttpParma
}
converterApi(para).then(res => {
if (!res) {
return
}
res.list.length ? (this.$refs.table.tableHeightValues = '') : this.$refs.table.setTableHeightFun()
this.tableData = res.list.map(item => {
item.createdDate = utils.dateFormat(item.createdDate, 'YYYY-MM-DD HH:mm:ss')
item.usedTime = item.usedTime ? utils.dateFormat(item.usedTime, 'YYYY-MM-DD HH:mm:ss') : '--'
item.status = item.usedFlag == 'Y' ? '已核销' : '待核销'
item.sellerName = item.sellerName || '--'
item.couponName = `${item.couponName}${item.customerCouponCode}`
return item
})
this.tableTotal = res.total
this.exportHttp = {
currentPage: this.$refs.table.page.pageNum,
pageSize: this.$refs.table.page.pageSize,
...this.newCurrentHttpParma
}
})
},
toOpenCoupons() {
const { session } = this.$globalState
let merchantId = session.merchantId
let method = checkCoupons()
let para = {
routerMethod: method,
currentPage: this.dialogTableVisible ? this.$refs.table1.page.pageNum : 1,
pageSize: this.dialogTableVisible ? this.$refs.table1.page.pageSize : 10,
merchantId,
orderType: 6
}
converterApi(para).then(res => {
this.tabletotal1 = res.total
this.tableData1 = res.list.map(item => {
item.createdDate = item.createdDate ? utils.dateFormat(item.createdDate, 'YYYY-MM-DD HH:mm:ss') : '--'
item.couponTypeName = item.couponInfo.couponTypeName
return item
})
})
},
toExport() {
let method = exportCoupons()
let para = {
routerMethod: method,
...this.exportHttp
}
converterApi(para).then(res => {
let tempaa = utils.getExplorer()
if (tempaa == 'QQ') {
window.open(res)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = res
document.body.appendChild(iframe)
})
},
// 获取发券人和转化人列表
getEmployNameList(type) {
this.columType = type
let method = getEmployName()
let para = {
routerMethod: method,
columType: type,
currentPage: 1,
pageSize: 100
}
converterApi(para).then(res => {
this.employeeNameData = res
let arr = []
res.forEach((item, index) => {
arr.push({
confId: index,
confName: item
})
})
this.searchFormData[3].optionList = arr
})
}
}
}
</script>
<style lang="scss" scoped>
.pannel {
padding: 0 15px;
}
.table_wrap {
padding: 0 15px;
padding-bottom: 10px;
}
.customTitle {
display: flex;
align-items: center;
.title1 {
font-size: 20px;
font-weight: 500;
color: #333333;
margin-right: 11px;
}
.title2 {
font-size: 14px;
font-weight: 400;
color: #5850ff;
}
}
</style>