Commit 805ead0e authored by liuyang's avatar liuyang

finished 客户管理

parent d7633775
/******************
* 客户管理
*****************/
// 导入请求公用方法
import {
request
} from '../../utils/axiosFun';
export const fetchList = (query) => {
return request('post','/api/mgr/member/list',query)
}
\ No newline at end of file
......@@ -225,7 +225,7 @@ export default {
})
},
handleTableChange(pagination,filters,sorter){
console.log(this.searchPage)
// console.log(this.searchPage)
let queryParam = {...this.searchPage}
queryParam.pageIndex = pagination.current
queryParam.pageSize = pagination.pageSize
......
<template>
<div class="template_content">
<!-- 搜索 -->
<div class="search_box">
<a-form layout="inline">
<a-form-item label="用户手机号">
<a-input v-model="searchPage.username" placeholder="请输入用户手机号" allowClear></a-input>
</a-form-item>
<a-form-item>
<a-button type="primary" icon="search" @click="handlSearch">查询</a-button>
</a-form-item>
</a-form>
</div>
<!-- 表格内容 -->
<div class="content_box">
<a-table
:columns="columns"
:dataSource="data"
:loading="loading"
:pagination="pagination"
bordered
size="small"
@change="handleTableChange"
rowKey="id"
>
<!-- 用户 -->
<div slot="nickName" slot-scope="text,record">
<a-row>
<!-- 头像 -->
<a-col :span="4">
<a-avatar v-if="!record.avatarUrl || record.avatarUrl == ''" shape="square" :size="64" icon="user" />
<a-avatar v-if="record.avatarUrl && record.avatarUrl != ''" shape="square" :size="64" :src="record.avatarUrl" />
</a-col>
<!-- 用户姓名、昵称,注册时间 -->
<a-col :span="19" offset="1">
<a-row>
<a-col :span="24"><span>昵称:{{record.nickName}}</span></a-col>
<a-col :span="24"><span>注册时间:{{ timestampToTime(record.createTime) }}</span></a-col>
</a-row>
</a-col>
</a-row>
</div>
<!-- 用户状态 -->
<div slot="status" slot-scope="text,record">
<a-tag v-if="record.status == 'ENABLE'" color="green">启用</a-tag>
<a-tag v-if="record.status == 'DISABLE'" color="red">禁用</a-tag>
<a-tag v-if="record.status == 'UNACTIVATE'" color="orange">未激活</a-tag>
</div>
</a-table>
</div>
</div>
</template>
<script>
import {fetchList} from '@/api/biz/member'
import { disposereq,timestampToTime } from '@/utils/util'
let columns = [
{
title: "用户",
dataIndex: "nickName",
align: "left",
width: '30%',
scopedSlots: {customRender: 'nickName'}
},
{
title: "注册手机号",
dataIndex: "username",
align: "center",
},
{
title: "用户身份",
dataIndex: "type",
align: "center",
customRender: (text,record) => {
let str = ''
console.log(text)
console.log(record)
if(record.type == 'USER'){
str = '普通用户'
}else if(record.type == 'VIP'){
str = '会员'
}else if(record.type == 'ENTERPRISE_VIP'){
str = '企业会员'
}
if(record.enterpriseName){
str = str + '(' + record.enterpriseName + ')'
}
return str;
}
},
{
title: '最后登陆时间',
dataIndex: 'lastLoginTime',
align: 'center',
customRender: (text) => {
return text ? timestampToTime(text) : '-'
}
},
{
title: '用户状态',
dataIndex: 'status',
align: 'center',
scopedSlots: {customRender: 'status'}
},
{
title: '会员生效时间',
dataIndex: 'vipStartTime',
align: 'center',
customRender: (text) => {
return text ? timestampToTime(text) : '-'
}
},
{
title: '会员失效时间',
dataIndex: 'vipEndTime',
align: 'center',
customRender: (text) => {
return text ? timestampToTime(text) : '-'
}
},
]
export default {
data(){
return{
columns: columns,
data: [],
searchPage: {
pageIndex: 1,
pageSize: 10,
username: ''
},
pagination: {
showQuickJumper: true,
showSizeChanger: true
},
loading: false,
}
},
// 创建完毕
created() {
this.getList(this.searchPage);
},
// 即将更新渲染
beforeUpdate() {
},
methods: {
getList(query){
this.loading = true;
fetchList(query).then(res => {
if(res.code == 200){
this.data = res.data
let paper = {...this.pagination}
paper.current = query.pageIndex
paper.total = res.count
this.pagination = paper
}else{
this.$message.info(res.resp_msg)
}
this.loading = false;
}).catch(err => {
this.loading = false;
disposereq(this,err)
})
},
handleTableChange(){
let queryParam = {...this.searchPage}
queryParam.pageIndex = pagination.current
queryParam.pageSize = pagination.pageSize
this.getList(queryParam)
},
handlSearch(){
let queryParam = {...this.searchPage}
this.getList(queryParam)
},
timestampToTime
}
}
</script>
<style>
.template_content {
background-color: #f0f2f5;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.search_box {
width: 100%;
box-sizing: border-box;
padding: 14px;
background-color: #fff;
}
.content_box {
width: 100%;
background-color: #fff;
margin-top: 10px;
padding: 14px;
}
.table_top {
padding-bottom: 14px;
}
.btn_margin {
margin: 0px 5px;
}
</style>
\ No newline at end of file
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