<template>
|
<page-header-wrapper>
|
<a-card :bordered="false">
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline">
|
<a-row :gutter="48">
|
<a-col :md="12" :lg="6" :sm="24">
|
<a-form-item label="用户ID">
|
<a-input v-model="queryParam.userId" style="width: 100%" placeholder="请输入用户ID" />
|
</a-form-item>
|
</a-col>
|
<a-col :md="12" :lg="6" :sm="24">
|
<a-form-item>
|
<span class="table-page-search-submitButtons">
|
<a-button @click="getqueryParam" icon="redo"> 重置</a-button>
|
<a-button
|
type="primary"
|
icon="search"
|
style="margin-left: 8px"
|
@click=";(queryParam.pageNum = 1), getlist()"
|
>查询
|
</a-button>
|
</span>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
</a-card>
|
|
<a-card :bordered="false">
|
<a-table
|
bordered
|
:loading="loading"
|
:pagination="pagination"
|
:columns="columns"
|
:data-source="datalist"
|
rowKey="id"
|
>
|
<span slot="isLock" slot-scope="text, record">
|
<template>
|
<div>
|
<a-tag :color="record.isLock == 0 ? 'green' : record.isLock == 1 ? 'red' : ''">
|
{{ record.isLock == 0 ? '正常' : '锁定' }}
|
</a-tag>
|
</div>
|
</template>
|
</span>
|
|
<template slot="action" slot-scope="text, record">
|
<a slot="action" href="javascript:;" @click="getisLock(record.id, record.isLock)">{{
|
record.isLock == 0 ? '锁定用户' : '解锁用户'
|
}}</a>
|
<a-divider type="vertical" />
|
<a slot="action" href="javascript:;" @click="geteditStock(record)">修改密码</a>
|
</template>
|
</a-table>
|
</a-card>
|
|
<a-modal
|
title="添加管理员"
|
:width="500"
|
:visible="addUserdialog"
|
:confirmLoading="addUserDialogloading"
|
@ok="OkaddUserdialog"
|
@cancel="CanceladdUserdialog"
|
>
|
<a-form :form="addUserform" ref="addUserform">
|
<a-form-item label="用户ID" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input
|
placeholder="请输入用户ID"
|
v-decorator="['id', { rules: [{ required: true, message: '请输入用户ID' }] }]"
|
/>
|
</a-form-item>
|
<a-form-item label="管理员手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input
|
placeholder="请输入管理员手机号"
|
v-decorator="['adminPhone', { rules: [{ required: true, message: '请输入管理员手机号' }] }]"
|
/>
|
</a-form-item>
|
<a-form-item label="管理员密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input
|
placeholder="请输入管理员密码"
|
v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入管理员密码' }] }]"
|
/>
|
</a-form-item>
|
</a-form>
|
</a-modal>
|
|
<a-modal
|
title="修改密码"
|
:width="500"
|
:visible="editStockdialog"
|
:confirmLoading="editStockdialogloading"
|
@ok="OkeditStockdialog"
|
@cancel="CanceleditStockdialog"
|
>
|
<a-form :form="editStockform" ref="editStockform">
|
<a-form-item label="用户ID" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input
|
placeholder="请输入用户ID"
|
disabled
|
v-decorator="['id', { rules: [{ required: true, message: '请输入用户ID' }] }]"
|
/>
|
</a-form-item>
|
<a-form-item label="密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input
|
placeholder="请输入密码"
|
v-decorator="['adminPwd', { rules: [{ required: true, message: '请输入密码' }] }]"
|
/>
|
</a-form-item>
|
</a-form>
|
</a-modal>
|
</page-header-wrapper>
|
</template>
|
<script>
|
import { adminlist, adminupdateLock, adminadd, adminupdate,agentgetAgentInfo } from '@/api/soure'
|
import moment from 'moment'
|
export default {
|
name: 'Shares',
|
data () {
|
return {
|
columns: [
|
{
|
title: 'id',
|
dataIndex: 'userId',
|
align: 'center'
|
},
|
{
|
title: '用户名',
|
dataIndex: 'userName',
|
align: 'center'
|
},
|
{
|
title: '操作金额',
|
dataIndex: 'money',
|
align: 'center'
|
},
|
{
|
title: '资产账户类型',
|
dataIndex: 'userAccectType',
|
align: 'center',
|
scopedSlots: { customRender: 'userAccectType' }
|
},
|
|
{
|
title: '操作时间',
|
dataIndex: 'createTime',
|
align: 'center',
|
customRender: (text, row, index) => {
|
return text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''
|
}
|
},
|
],
|
// 表头
|
pagination: {
|
total: 0,
|
pageSize: 10, // 每页中显示10条数据
|
showSizeChanger: true,
|
pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
|
onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
|
onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
|
showTotal: (total) => `共有 ${total} 条数据` // 分页中显示总的数据
|
},
|
loading: false,
|
queryParam: {
|
pageNum: 1,
|
pageSize: 10,
|
userId: '',
|
agentId:'',
|
},
|
datalist: [],
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 7 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 13 }
|
},
|
addUserform: this.$form.createForm(this),
|
addUserdialog: false,
|
addUserDialogloading: false,
|
userdetail:'',
|
editStockdialog: false,
|
editStockdialogloading: false,
|
editStockform: this.$form.createForm(this),
|
fields: ['id', 'adminPwd']
|
}
|
},
|
created () {
|
this.getAgentInfo()
|
},
|
methods: {
|
// 获取代理信息
|
getAgentInfo () {
|
agentgetAgentInfo().then((res) => {
|
if (res.status == 0) {
|
this.userdetail = res.data
|
this.getlist()
|
// this.gettotalprice()
|
// this.wapurl = location.protocol + '//' + location.host + '/#/register?agentCode=' + this.userdetail.agentCode
|
}
|
})
|
},
|
geteditStock (val) {
|
this.editStockdialog = true
|
this.fields.forEach((v) => this.editStockform.getFieldDecorator(v))
|
this.editStockform.setFieldsValue({ id: val.id })
|
},
|
CanceleditStockdialog () {
|
this.editStockdialog = false
|
const form = this.$refs.editStockform.form
|
form.resetFields()
|
},
|
OkeditStockdialog () {
|
const form = this.$refs.editStockform.form
|
form.validateFields((errors, values) => {
|
if (!errors) {
|
this.editStockdialogloading = true
|
values.adminPwd = this.editStockform.getFieldValue('adminPwd')
|
adminupdate(values).then((res) => {
|
if (res.status == 0) {
|
this.editStockdialog = false
|
this.$message.success(res.msg)
|
form.resetFields()
|
this.getlist()
|
} else {
|
this.$message.error(res.msg)
|
}
|
this.editStockdialogloading = false
|
})
|
}
|
})
|
},
|
// 新增用户取消弹窗
|
CanceladdUserdialog () {
|
this.addUserdialog = false
|
const form = this.$refs.addUserform.form
|
form.resetFields()
|
},
|
// 新增用户确定
|
OkaddUserdialog () {
|
const form = this.$refs.addUserform.form
|
form.validateFields((errors, values) => {
|
if (!errors) {
|
this.addUserDialogloading = true
|
adminadd(values).then((res) => {
|
if (res.status == 0) {
|
this.addUserdialog = false
|
this.$message.success(res.msg)
|
form.resetFields()
|
this.getlist()
|
} else {
|
this.$message.error(res.msg)
|
}
|
this.addUserDialogloading = false
|
})
|
}
|
})
|
},
|
getqueryParam () {
|
this.queryParam = {
|
pageNum: 1,
|
pageSize: 10,
|
adminName: '',
|
adminPhone: ''
|
}
|
},
|
getlist () {
|
this.loading = true
|
this.queryParam.agent = this.userdetail.id
|
adminlist(this.queryParam).then((res) => {
|
this.datalist = res.data.list
|
this.pagination.total = res.data.total
|
this.loading = false
|
})
|
},
|
// 股票的锁定解锁
|
getisLock (idval, isLockval) {
|
adminupdateLock({ adminId: idval }).then((res) => {
|
if (res.status === 0) {
|
this.getlist()
|
if (isLockval == 0) {
|
this.$message.success({ content: '锁定成功', duration: 2 })
|
} else {
|
this.$message.success({ content: '解锁成功', duration: 2 })
|
}
|
} else {
|
this.$message.error({ content: res.msg, duration: 2 })
|
}
|
})
|
},
|
onPageChange (page, pageSize) {
|
this.queryParam.pageNum = page
|
this.getlist()
|
},
|
onSizeChange (current, pageSize) {
|
this.queryParam.pageNum = current
|
this.queryParam.pageSize = pageSize
|
this.getlist()
|
}
|
}
|
}
|
</script>
|