<template>
|
<filter-dialog
|
ref="table"
|
:show.sync="showDialog"
|
:title="title"
|
:tableData="tableData"
|
:total="total"
|
:form="listQuery"
|
:formLabel="formLabel"
|
@page-info-change="handPageInfoChange"
|
@selected="handSelected"
|
@close="handleDialogClose"
|
:loading="loading"
|
dialogWidth="70%"
|
>
|
<template slot="condition">
|
<el-button type="primary" size="mini" @click="handleFilter"
|
>查询</el-button
|
>
|
<el-button size="mini" @click="resetQuery"
|
>重置</el-button
|
>
|
</template>
|
<template slot="columns">
|
<el-table-column label="用户" prop="memberNickName" width="200px">
|
<template slot-scope="scope">
|
<div class="memberStyle">
|
<img
|
v-if="scope.row.memberPicUrl"
|
:src='scope.row.memberPicUrl ? scope.row.memberPicUrl : ""'/>
|
<img v-else
|
src="../../../assets/img/head_portrait.png"
|
/>
|
<div class="memberInfo">
|
{{scope.row.memberNickName}}<br/>
|
{{scope.row.memberPhone}}
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="优惠券名称" prop="couponName" show-overflow-tooltip></el-table-column>
|
<el-table-column label="优惠券类型" prop="recordType">
|
<template slot-scope="scope">
|
{{getArrayLable(recordTypeArr,scope.row.recordType)}}
|
</template>
|
</el-table-column>
|
<el-table-column label="用券时间" prop="useTime">
|
<template slot-scope="scope">
|
{{scope.row.useTime ? scope.row.useTime : '-'}}
|
</template>
|
</el-table-column>
|
<el-table-column label="领券时间" prop="acceptedDate"></el-table-column>
|
</template>
|
</filter-dialog>
|
</template>
|
<script>
|
import filterDialog from '@/components/filterDialog/filterDialog.vue'
|
import couponApi from '@/api/promotion/coupon'
|
import { getArrayLable } from '@/utils/getArrayLable'
|
export default {
|
components: { filterDialog },
|
props: ['show', 'title', 'recordTypeArr', 'couponInfoId'],
|
data () {
|
return {
|
showDialog: false,
|
listQuery: {
|
phone: null,
|
acceptedDate: null
|
},
|
tableData: [],
|
total: 0,
|
loading: false,
|
formLabel: [
|
{
|
model: 'phone',
|
label: '用户手机号',
|
type: 'input',
|
labelWidth: '90px'
|
},
|
{
|
model: 'acceptedDate',
|
label: '领券时间',
|
type: 'date'
|
}
|
],
|
selectedRows: null
|
}
|
},
|
watch: {
|
/**
|
* 监控外部显示变量变化
|
* 传递到dialog组件
|
*/
|
show: function (newShow, oldShow) {
|
this.showDialog = this.show
|
},
|
/**
|
* 监控内部显示属性变化
|
* 传递到外部调用变量
|
*/
|
showDialog: function (newDialogShow, oldDialogShow) {
|
this.$emit('update:show', newDialogShow)
|
if (!newDialogShow) {
|
this.$nextTick(() => {
|
this.initForm() // 初始化表单
|
})
|
}
|
}
|
},
|
methods: {
|
/**
|
* 获取数组的label
|
*/
|
getArrayLable,
|
/**
|
* '获取选中的数据
|
*/
|
handSelected (rows) {
|
this.selectedRows = rows
|
},
|
/**
|
* 弹出框关闭事件处理
|
*/
|
handleDialogClose () {
|
if (this.selectedRows) {
|
this.$emit('hand-selected-row-data', this.selectedRows)
|
}
|
},
|
/**
|
* 搜索条件变更处理
|
*/
|
handleFilter () {
|
this.$refs.table.changeCondition()
|
},
|
/**
|
* 初始化表单
|
*/
|
initForm () {
|
this.listQuery = {
|
phone: null,
|
acceptedDate: null
|
}
|
},
|
/**
|
* 分页信息改变时,列表查询
|
*/
|
handPageInfoChange (pageInfo) {
|
this.queryList(pageInfo)
|
},
|
/**
|
* 重置
|
*/
|
resetQuery () {
|
this.$refs.table.reloadCurrent()
|
},
|
/**
|
* 查询列表
|
*/
|
queryList (pageInfo) {
|
this.loading = true
|
this.listQuery.couponInfoId = this.couponInfoId
|
couponApi
|
.getReceiveRecord({ param: this.listQuery, ...pageInfo }, false)
|
.then((res) => {
|
if (res.data) {
|
this.tableData = res.data.list
|
this.total = res.data.total
|
this.loading = false
|
} else {
|
this.loading = false
|
}
|
})
|
.catch(() => {
|
this.loading = false
|
})
|
}
|
}
|
}
|
</script>
|
<style lang="scss">
|
.memberStyle{
|
img{
|
width: 50px;
|
max-height: 80px;
|
margin-right: 5px;
|
vertical-align: bottom;
|
}
|
.memberInfo{
|
text-align: left;
|
display: inline-block;
|
}
|
}
|
</style>
|