import React from 'react'; import { Link } from 'react-router-dom'; import './index.less'; import Page from '@src/containers/Page'; import Block from '@src/components/Block'; import FilterLayout from '@src/layouts/FilterLayout'; // import ActionLayout from '@src/layouts/ActionLayout'; import TableLayout from '@src/layouts/TableLayout'; import { getMap, formatMoney, formatDate } from '@src/services/Tools'; import { SwitchSelect, ServiceKey, PassSelect } from '../../../../Constant'; import { User } from '../../../stores/user'; const SwitchSelectMap = getMap(SwitchSelect, 'value', 'label'); const ServiceKeyMap = getMap(ServiceKey, 'value', 'label'); const PassSelectMap = getMap(PassSelect, 'value', 'label'); export default class extends Page { constructor(props) { super(props); this.filterF = null; } init() { this.filterForm = [{ key: 'keyword', type: 'input', name: 'ID/手机号', placeholder: '请输入', }, { key: 'real', type: 'select', allowClear: true, name: '实名认证', select: PassSelect, placeholder: '请选择', number: true, }, { key: 'time', type: 'daterange', name: '注册时间', }]; this.columns = [{ title: 'ID', dataIndex: 'id', }, { title: '手机号', dataIndex: 'mobile', }, { title: '注册时间', dataIndex: 'createTime', render: (text) => { return formatDate(text); }, }, { title: '实名认证', dataIndex: 'realStatus', render: (text) => { return PassSelectMap[text ? 1 : 0]; }, }, { title: '备考信息', dataIndex: 'prepareStatus', render: (text) => { return SwitchSelectMap[text ? 1 : 0]; }, }, { title: '邀请人数', dataIndex: 'inviteNumber', }, { title: '服务中', dataIndex: 'services', render: (text) => { return (text || []).map(row => ServiceKeyMap[row.service]).join(', '); }, }, { title: '消费金额', sorter: true, dataIndex: 'totalMoney', render: (text) => { return formatMoney(text); }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return
{( 查看 )}
; }, }]; } initData() { const { search } = this.state; const data = Object.assign({}, search); if (data.time) { data.startTime = data.time[0] || ''; data.endTime = data.time[1] || ''; } User.list(data).then(result => { this.setTableData(result.list, result.total); }); } renderView() { return { if (data.time.length > 0) { data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')]; } this.search(data); }} ref={(ref) => { if (ref) this.filterF = ref; }} /> {/* this.onAction(key)} /> */} this.tableChange(pagination, filters, sorter)} onSelect={(keys, rows) => this.tableSelect(keys, rows)} selectedKeys={this.state.selectedKeys} /> ; } }