MrShi
6 小时以前 ea2fb93a0dfcde8f5b66825b20f9d9b835a28acc
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
<template>
  <GlobalWindow
    :title="title"
    :visible.sync="visible"
    width="1000px"
    :withFooter="false"
  >
    <div class="usage-detail">
      <div class="info-header">
        <div class="info-row">
          <div class="info-item">
            <span class="label">优惠券名称:</span>
            <span class="value">{{ couponInfo.name || '-' }}</span>
          </div>
          <div class="info-item">
            <span class="label">类型:</span>
            <span class="value">
              <span v-if="couponInfo.type === 0">平台满减券</span>
              <span v-else>-</span>
            </span>
          </div>
          <div class="info-item">
            <span class="label">领用数量:</span>
            <span class="value">{{ couponInfo.receivedCount || 0 }}</span>
          </div>
          <div class="info-item">
            <span class="label">使用数量:</span>
            <span class="value">{{ couponInfo.usedCount || 0 }}</span>
          </div>
        </div>
      </div>
 
      <!-- <template v-slot:table-wrap> -->
        <el-table
          :height="500"
          v-loading="isWorking.search"
          :data="tableData.list"
          stripe
        >
          <el-table-column label="序号" type="index" width="60px"></el-table-column>
          <el-table-column prop="memberName" label="领用人" min-width="100px"></el-table-column>
          <el-table-column prop="memberTelephone" label="领用手机号" min-width="120px"></el-table-column>
          <el-table-column label="领用数量" min-width="80px">
            <template slot-scope="{row}">
              <span>1</span>
            </template>
          </el-table-column>
          <el-table-column prop="createDate" label="发放时间" min-width="160px"></el-table-column>
          <el-table-column prop="validDate" label="领用时间" min-width="160px"></el-table-column>
          <el-table-column label="限用时段" min-width="160px">
            <template slot-scope="{row}">
              <span>{{ row.startDate }} - {{ row.endDate }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="useDate" label="使用时间" min-width="160px"></el-table-column>
          <el-table-column label="状态" min-width="100px">
            <template slot-scope="{row}">
              <el-tag v-if="row.status === 1" type="primary">待使用</el-tag>
              <el-tag v-else-if="row.status === 2" type="success">已使用</el-tag>
              <el-tag v-else-if="row.status === 3" type="danger">已失效</el-tag>
              <span v-else>-</span>
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: right; margin-top: 20px;">
          <pagination
            @size-change="handleSizeChange"
            @current-change="handlePageChange"
            :pagination="tableData.pagination"
          ></pagination>
        </div>
      <!-- </template> -->
    </div>
  </GlobalWindow>
</template>
 
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import Pagination from '@/components/common/Pagination'
import { fetchList } from '@/api/business/memberCoupon'
 
export default {
  name: 'OperaCouponUsageDetail',
  components: { GlobalWindow, Pagination },
  data () {
    return {
      title: '领用明细',
      visible: false,
      couponId: '',
      couponInfo: {},
      tableData: {
        list: [],
        pagination: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        }
      },
      isWorking: {
        search: false
      }
    }
  },
  methods: {
    open (row) {
      this.title = '领用明细'
      this.couponId = row.id
      this.couponInfo = {
        name: row.name,
        type: row.type,
        receivedCount: row.claimCount,
        usedCount: row.usedCount
      }
      this.visible = true
      this.search()
    },
    search () {
      this.isWorking.search = true
      fetchList({
        capacity: this.tableData.pagination.pageSize,
        page: this.tableData.pagination.currentPage,
        model: {
          couponId: this.couponId,
        }
      }).then(data => {
        console.log(data)
        this.tableData.list = data.records || []
        this.tableData.pagination.total = data.total || 0
      }).finally(() => {
        this.isWorking.search = false
      })
    },
    handleSizeChange (val) {
      this.tableData.pagination.pageSize = val
      this.search()
    },
    handlePageChange (val) {
      this.tableData.pagination.currentPage = val
      this.search()
    }
  }
}
</script>
 
<style scoped>
.info-header {
  margin-bottom: 20px;
}
.info-row {
  display: flex;
  gap: 30px;
  padding: 15px;
  background: #f5f7fa;
  border-radius: 4px;
}
.info-item {
  display: flex;
  align-items: center;
  font-size: 14px;
}
.info-item .label {
  color: #909399;
}
.info-item .value {
  color: #606266;
  font-weight: bold;
}
</style>