CheckCode.vue
5.03 KB
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
<template>
<section class="checkcode-container">
<!--工具条-->
<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
<el-form :inline="true" :model="filters">
<el-form-item>
<el-input width="600" v-model="filters.drawSn" placeholder="请输入抽奖码,至少三位"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :disabled="filters.drawSn.length < searchNeedMinLength || loading" v-on:click="reqGetDrawsnQuery">查询</el-button>
</el-form-item>
</el-form>
</el-col>
<!--列表-->
<template>
<el-table class="table" :data="list" highlight-current-row v-loading="loading" style="width: 100%;">
<el-table-column type="index" width="60">
</el-table-column>
<el-table-column prop="drawSn" label="抽奖码" min-width="110">
</el-table-column>
<el-table-column prop="prizeName" label="奖品名称" min-width="80">
</el-table-column>
<el-table-column prop="isUsage" label="是否使用" :formatter="formatIsUse" min-width="80">
</el-table-column>
<el-table-column prop="openid" label="openid" min-width="120">
</el-table-column>
<el-table-column prop="nickname" label="昵称">
</el-table-column>
<el-table-column label="头像">
<template slot-scope="scope">
<div class="avatar">
<img v-show="scope.row.avatar" :src="scope.row.avatar">
</div>
</template>
</el-table-column>
<el-table-column prop="winTime" label="中奖时间" :formatter="formatDateWinTime">
</el-table-column>
</el-table>
</template>
<el-col :span="24" class="toolbar">
<el-pagination :disabled="loading" layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;">
</el-pagination>
</el-col>
</section>
</template>
<script>
import { getDrawsnQuery } from './../../api/api.js'
import { formatDate } from './../../common/utils.js'
export default {
data() {
return {
loading: false,
filters: {
drawSn: ''
},
// list: [
// {
// drawSn: "463GBBIFEVE32313",
// isUsage: 1,
// openid: "oCwafjoNqQ0VRgB6NUBRmRX2G7zE",
// nickname: "SimonFungC",
// avatar:
// "http://thirdwx.qlogo.cn/mmopen/vi_32/xIibgickibcyJjdniblX2WhbEU6QHMFIwYUCJxJdW9wIIAbEGkZqJmWK5Koich8UiaCYe4tADlRGlmKhf1hGU8LYkkRQ/132",
// winTime: null,
// prizeName: "奖品123"
// }
// ],
list: [],
total: 0,
page: 1,
pageSize: 20,
searchNeedMinLength: 3
}
},
methods: {
formatIsUse: function(row, column) {
return row.isUsage == 1 ? '是' : '否'
},
formatDateWinTime: function(row, column) {
return row.winTime
? formatDate.formatGMT(row.winTime, 'yyyy-MM-dd hh:mm:ss')
: '-'
},
handleCurrentChange(val) {
this.page = val
this.reqGetDrawsnQuery()
},
// 查码
reqGetDrawsnQuery() {
let drawSn = this.filters.drawSn
let code = this.$route.query.code
let parm = {
drawSn: drawSn,
appCode: code,
page: this.page,
size: this.pageSize
}
this.loading = true
getDrawsnQuery(parm).then(res => {
let { code, content } = res
if (code == 200 && content) {
this.total = content.total
this.list = content.list
}
this.loading = false
})
}
},
created() {
// 2019-03-06T03:21:23.000+0000
// 2019/03/06T03:21:23.000+0000
// var ttt = formatDate.GMTToStr("2019-03-06T03:21:23.000+0000");
// alert("33333");
// alert(ttt);
// var time = new Date(ttt.replace(/-/g, '/'));
// alert(time);
// var time = new Date('2019/03/06T03:21:23.000+0000'.replace(/-/g, '/'))
// alert(time)
// alert(time.getFullYear())
}
}
</script>
<style scoped lang="less">
.checkcode-container {
.toolbar {
.el-input {
width: 320px;
}
}
.table {
.avatar {
@avatarSize: 40px;
width: @avatarSize;
height: @avatarSize;
img {
width: @avatarSize;
height: @avatarSize;
}
}
}
}
</style>