record.vue
9.85 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
<template>
<div class="live-room">
<div class="live-room container">
<div class="flex">
<!-- <el-form>
<el-form-item>
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新增直播</el-button>
</el-form-item>
</el-form> -->
<el-form :inline="true" style="width: 100%" :model="searchForm" label-width="85px" label-position="right">
<el-row>
<!-- <el-col :span="6"></el-col> -->
<el-form-item size="small" label="服务名称">
<el-input :size="size" v-model="searchForm.couponName" placeholder="请输入服务名称" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销用户">
<el-input :size="size" v-model="searchForm.userReq" placeholder="请输入核销用户" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销员" style="margin-left: -10px">
<el-input :size="size" v-model="searchForm.verificationOperator" placeholder="请输入核销员" clearable></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item size="small" label="关联信息">
<el-input :size="size" v-model="searchForm.orderCode" placeholder="请输入关联信息" clearable></el-input>
</el-form-item>
<el-form-item size="small" label="核销日期">
<!-- verificationTimeStart verificationTimeEnd -->
<!-- <el-input :size="size" v-model="searchForm.name" placeholder="请输入核销员" clearable></el-input> -->
<el-date-picker :size="size" v-model="searchForm.daterange" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions || {}"></el-date-picker>
</el-form-item>
<el-form-item size="small" class="fr-mr0">
<el-button :size="size" type="primary" @click="openDialog">核销</el-button>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" type="primary" @click="handleExport">导出</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-row>
</el-form>
</div>
<GLTable ref="memberRecordRef" v-if="isReload" :noDataImg="url" @setTableFinishFun="setTableFinishFun" :searchForm="searchFormTable" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<span slot="orderCodeHtml" slot-scope="scope">
<span class="cursor-pointer" @click="couponNameHandleDetail(scope.scope)" v-if="scope.scope.directionalGiftId">{{ scope.scope.directionalGiftName }}</span>
<span class="cursor-pointer" @click="orderCodeHandleDetail(scope.scope)" v-else>{{ scope.scope.orderCode }}</span>
</span>
<span slot="verificationTime" slot-scope="scope">
<span>{{ dateFormatFun(scope.scope.verificationTime) }}</span>
</span>
</GLTable>
<GLDialog mode="mid" title="优惠券核销(请确保用户到店后核销,避免引起不必要问题)" :hasFooter="hasFooter" :type="'error'" @onOk="handleConfirm" @onCancel="handleClose" :visible.sync="isDialogVisible">
<div class="content-body">
<el-form :rules="rules" ref="ruleForm" :model="ruleForm" label-width="80px">
<!-- style="width: 440px" -->
<el-form-item size="small" label="核销码" prop="verficationCode" style="width: 380px">
<el-input size="small" v-model.trim="ruleForm.verficationCode" maxlength="50" placeholder="请输入核销码"></el-input>
</el-form-item>
</el-form>
</div>
</GLDialog>
</div>
</div>
</template>
<script>
// import { getRecordListApi, getVerificationCode, verificationExportApi } from '@/api/modules/record'
import url from '@/assets/empty.png'
import { dateFormat } from '@/utils/index.js'
import { exportFn } from '@/common/constant'
export default {
name: 'record',
data() {
return {
ruleForm: {
verficationCode: ''
},
isDialogVisible: false,
rules: {
verficationCode: [{ required: true, message: '请输入核销码', trigger: 'blur' }]
},
url: url,
isReload: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
},
size: 'small',
searchForm: {
// couponId:222 //卷id
//userCouponId //用户卷id
// name: '',
// daterange:''
couponName: '',
userReq: '',
verificationOperator: '',
orderCode: '',
merchantId: 0,
discountTypes: [7]
},
// 44187877
searchFormTable: {},
// 表格组件
getListApi: this.$apis.record.getRecordListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '服务名称',
prop: 'couponName',
width: '180'
// formatter: cellValue => {
// return cellValue.startTime + '-' + cellValue.endTime
// }
},
{
label: '剩余待核销次数',
prop: 'residueAmount',
formatter: cellValue => {
return cellValue.residueAmount || cellValue.residueAmount == 0 ? cellValue.residueAmount : '不限制次数'
}
},
{
label: '核销用户',
prop: 'phone'
},
{
label: '核销员',
prop: 'verificationOperator'
},
{
label: '关联信息',
addHtml: 'orderCodeHtml'
},
{
label: '核销日期',
prop: 'verificationTime',
addHtml: 'verificationTime'
}
]
},
merchantId: 0
}
},
created() {
if (window.__POWERED_BY_QIANKUN__) {
//运行在qiankun容器中
this.merchantId = this.$globalState.session.merchantId
this.searchForm.merchantId = this.merchantId
}
},
methods: {
// 跳转到礼包领取详情页
couponNameHandleDetail(row) {
console.log('row', row)
this.$router.push({
path: '/giftBag/giftDetail',
query: {
id: row.directionalGiftId
}
})
},
// 跳转到订单详情页
orderCodeHandleDetail(row) {
this.$router.push({
path: '/memberCenter/orderDetail',
query: {
id: row.id,
detail: row
}
})
},
dateFormatFun(date) {
return dateFormat(date)
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (params.daterange) {
params.verificationTimeStart = this.searchForm.daterange[0]
params.verificationTimeEnd = this.searchForm.daterange[1]
} else {
if (params.beginTime) delete params.beginTime && delete params.endTime
}
delete params.daterange
return params
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchFormTable = this.getParams()
resolve()
})
},
setTableFinishFun() {
//接收到的数据为空
if (!this.$refs.memberRecordRef.data.length) {
this.$refs.memberRecordRef.setTableHeightFun()
}
},
handleShareClose() {
this.isShareVisible = !this.isShareVisible
},
handleDetail(row) {
this.$router.push({
name: 'ServicesLiveRoomLiveControl',
params: {
id: row.id
}
})
},
openDialog() {
this.isDialogVisible = true
},
handleClose() {
this.isDialogVisible = !this.isDialogVisible
this.$refs.ruleForm.resetFields()
},
handleConfirm() {
// getRecordListApi
this.$refs['ruleForm'].validate(valid => {
if (!valid) {
return
}
let params = {}
params.verficationCode = this.ruleForm.verficationCode
// params.discountTypes=[7]
this.$apis.record.getVerificationCode(params).then(res => {
if (res) {
this.handleClose()
this.handleSearch()
}
})
})
},
// 1-新增;2-编辑
handleEdit(addOrEdit, row) {
// console.log(row)
// this.$history.push('services/liveRoom/editLiveRoom', { addOrEdit: addOrEdit, row: row || {} })
// this.eventBus.$emit('editRoom', {
// addOrEdit: addOrEdit,
// id: row ? row.id : ''
// })
this.$router.push({
name: 'ServicesLiveRoomEditLiveRoom',
params: {
addOrEdit: addOrEdit,
id: row ? row.id : '-1'
}
// name: 'editLiveRoom',
// path: '/liveRoom/editLiveRoom'
})
},
handleExport(row) {
var params = this.getParams()
this.$apis.record.verificationExportApi(params).then(res => {
exportFn(res)
})
},
handleSearch() {
this.$refs.memberRecordRef.refreshTable()
},
handleReset() {
// this.searchForm = { merchantId: 44184606 }
// this.handleSearch()
this.isReload = false
this.searchForm = { merchantId: this.merchantId, discountTypes: [7] }
this.$nextTick(() => {
this.isReload = true
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/.el-input--small .el-input__inner {
width: 215px;
}
.el-range-editor.is-active,
.el-range-editor.is-active:hover {
border-color: #5850ff;
width: 215px;
}
.el-range-editor--small.el-input__inner {
width: 215px;
}
</style>