Commit be0a9ec2 authored by yaya's avatar yaya

feat:添加邀请码管理

parent 47c7013b
import request from '@/utils/request'
export function fetchList(params) {
return request({
url: '/invitationCode/findList',
method: 'post',
data: params
})
}
...@@ -143,6 +143,17 @@ export const asyncRouterMap = [ ...@@ -143,6 +143,17 @@ export const asyncRouterMap = [
icon: 'message', icon: 'message',
noCache: true noCache: true
} }
},
{
path: 'inviteList',
component: () => import('@/views/user/inviteList'),
name: 'inviteList',
meta: {
perms: ['POST /admin/invitationCode/findList'],
title: '邀请码管理',
icon: 'user',
noCache: true
}
} }
] ]
}, },
......
<template>
<div class="page_invite">
<div class="filter-container">
<el-button size="mini" class="filter-item" type="primary" @click="handleAdd">生成邀请码</el-button>
</div>
<!-- 查询结果 -->
<el-table
v-loading="listLoading"
:data="list"
size="small"
element-loading-text="正在查询中..."
border
fit
highlight-current-row>
<el-table-column align="center" width="100px" label="邀请码ID" prop="id" sortable />
<el-table-column align="center" label="邀请码" prop="code" />
<el-table-column align="center" label="可邀请人数" prop="enabledNum" />
<el-table-column align="center" label="使用人数" prop="applicant"/>
<el-table-column align="center" label="状态" prop="stateName" />
<el-table-column align="center" label="有效时间" prop="effectiveStartTime" width="300">
<template slot-scope="scope">
{{ `${scope.row.effectiveStartTime}至${scope.row.effectiveEndTime}` }}
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime"/>
<el-table-column align="center" label="操作" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-permission="['GET /admin/user/detailApprove']"
type="primary"
size="mini"
@click="handleToDetail(scope.row)">详情
</el-button>
<el-button
v-permission="['POST /admin/user/approveAgency']"
type="primary"
size="mini"
style="width: 100px"
@click="handleCopyCode(scope.row)">
复制邀请码
</el-button>
<el-button v-permission="['GET /admin/user/detailApprove']" type="primary" size="mini">失效</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
v-show="total>0"
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList" />
</div>
</template>
<script>
import { fetchList } from '@/api/business/invite'
import Pagination from '@/components/Pagination'
export default {
name: 'InviteList',
components: {
Pagination
},
data() {
return {
listLoading: true,
listQuery: {
page: 1,
limit: 20
},
list: [],
total: 0
}
},
created() {
this.getList()
},
methods: {
handleAdd() {
},
handleToDetail() {
},
handleCopyCode() {
},
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.data.dataList
/* this.list = (response.data.data.dataList || []).map((e, index) => {
let imageList = e.images || []
if (e.topImage && imageList.indexOf(e.topImage) === -1) {
imageList = [e.topImage].concat(imageList)
}
return {
...e,
imageList: imageList
}
})*/
this.total = response.data.data.total
this.listLoading = false
}).catch((e) => {
this.list = []
this.total = 0
this.listLoading = false
})
}
}
}
</script>
<style scoped>
.page_invite {
padding: 20px;
}
.filter-container {
text-align: end;
}
</style>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment