<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" show-overflow-tooltip></el-table-column>
|
<el-table-column label="手机号" prop="memberPhone" show-overflow-tooltip></el-table-column>
|
<el-table-column label="中奖类型" prop="recordType">
|
<template slot-scope="scope">
|
{{getArrayLable(prizeTypeArr,scope.row.prizeType)}}
|
</template>
|
</el-table-column>
|
<el-table-column label="奖品名称" prop="prizeName" show-overflow-tooltip></el-table-column>
|
<el-table-column label="图片" prop="couponName" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<div v-viewer>
|
<el-tooltip placement="left" effect="light">
|
<div slot="content" ><img :src="scope.row.prizeFileUrl" width="100px"/></div>
|
<img :src="scope.row.prizeFileUrl"/>
|
</el-tooltip>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="抽奖时间" width="160px" prop="createTime">
|
</el-table-column>
|
</template>
|
</filter-dialog>
|
</template>
|
<script>
|
import filterDialog from '@/components/filterDialog/filterDialog.vue'
|
import blindBoxActivityApi from '@/api/promotion/blindBoxActivity'
|
import prizeTypeArr from '@/utils/constant/prizeTypeArr'
|
import { getArrayLable } from '@/utils/getArrayLable'
|
|
export default {
|
components: { filterDialog },
|
props: ['show', 'title', 'promotionId'],
|
data () {
|
return {
|
prizeTypeArr,
|
showDialog: false,
|
listQuery: {
|
memberPhone: null,
|
memberNickName: null
|
},
|
tableData: [],
|
total: 0,
|
loading: false,
|
formLabel: [
|
{
|
model: 'memberPhone',
|
label: '用户手机号',
|
type: 'input',
|
labelWidth: '90px'
|
},
|
{
|
model: 'memberNickName',
|
label: '昵称',
|
type: 'input'
|
}
|
],
|
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 = {
|
memberPhone: null,
|
memberNickName: null
|
}
|
},
|
/**
|
* 分页信息改变时,列表查询
|
*/
|
handPageInfoChange (pageInfo) {
|
this.queryList(pageInfo)
|
},
|
/**
|
* 重置
|
*/
|
resetQuery () {
|
this.$refs.table.reloadCurrent()
|
},
|
/**
|
* 查询列表
|
*/
|
queryList (pageInfo) {
|
this.loading = true
|
this.listQuery.promotionId = this.promotionId
|
blindBoxActivityApi
|
.getWinRecord({ ...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>
|