doum
18 小时以前 98995ef3dff4eefe6658022345276806bd47d557
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
<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>