<template>
|
<GlobalWindow
|
:title="title"
|
:visible.sync="visible"
|
@confirm="confirm"
|
>
|
<TableLayout :permissions="['business:coupon:query']">
|
<!-- 搜索表单 -->
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="兑换人" prop="member">
|
<el-input v-model="searchForm.member" placeholder="请输入昵称" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="状态" prop="status">
|
<!-- 0商家优惠券 1平台优惠券 -->
|
<el-select
|
v-model="searchForm.status"
|
placeholder="请选择优惠券类型"
|
>
|
<el-option key="0" :value="0" label="未使用"></el-option>
|
<el-option key="1" :value="1" label="已使用"></el-option>
|
<el-option key="2" :value="2" label="已过期"></el-option>
|
</el-select>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
|
<el-table
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
border
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55"></el-table-column>
|
<el-table-column prop="name" label="优惠券名称" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="type" label="类型" align="center" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.type==0?'商家优惠券':'平台优惠券' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="nikeName" label="会员昵称" align="center" min-width="100px"></el-table-column>
|
<el-table-column label="获取方式" align="center" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.type==0?'领取':'兑换' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="num" label="咖豆数量" align="center" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.num || '-' }}
|
</template>
|
</el-table-column>
|
<el-table-column label="状态" align="center" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.status==0 ? '未使用' : row.status==1 ? '已使用' : '已过期' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="startDate" label="获取时间" align="center" min-width="100px"></el-table-column>
|
<el-table-column prop="endDate" label="使用时间" align="center" min-width="100px"></el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
>
|
</pagination>
|
</template>
|
</TableLayout>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import Pagination from '@/components/common/Pagination'
|
export default {
|
name: 'OperaCouponWindow',
|
extends: BaseTable,
|
components: { GlobalWindow, TableLayout, Pagination },
|
data () {
|
|
return {
|
visible: false,
|
title: '',
|
getDate: [],
|
// 表单数据
|
searchForm: {
|
id: null,
|
member: '',
|
status: '',
|
},
|
|
}
|
},
|
created () {
|
this.config({
|
api: '/business/memberCoupon',
|
'field.id': 'id'
|
})
|
},
|
methods: {
|
open(title, target) {
|
this.title = title
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs.searchForm.resetFields()
|
this.searchForm.id = target
|
this.search()
|
})
|
|
},
|
handlePageChange (pageIndex) {
|
// debugger
|
this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
|
this.isWorking.search = true
|
this.api.fetchList({
|
page: this.tableData.pagination.pageIndex,
|
capacity: this.tableData.pagination.pageSize,
|
model: this.searchForm,
|
sorts: this.tableData.sorts
|
})
|
.then(data => {
|
this.tableData.list = data.records
|
this.tableData.pagination.total = data.total
|
})
|
.catch(e => {
|
this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking.search = false
|
})
|
},
|
confirm() {}
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
</style>
|