import React from 'react'; import './index.less'; import Page from '@src/containers/Page'; import { getMap, formatMoney, formatDate } from '@src/services/Tools'; import UserLayout from '../../../layouts/User'; import menu from '../index'; import UserTable from '../../../components/UserTable'; import { Order } from '../../../stores/order'; import { RecordSource, ServiceKey } from '../../../../Constant'; const RecordSourceMap = getMap(RecordSource, 'value', 'label'); const ServiceKeyMap = getMap(ServiceKey, 'value', 'label'); const columns = [ { title: '订单编号', key: 'orderId' }, { title: '服务', key: 'title', render: (text, record) => { if (record.productType === 'course-package') { return (record.coursePackage || {}).title; } if (record.productType === 'course') { return (record.course || {}).title; } if (record.productType === 'data') { return (record.data || {}).title; } if (record.productType === 'service') { return `${ServiceKeyMap[text]}`; } return ''; }, }, { title: '购买时间', key: 'createTime', render: (text) => { return formatDate(text, 'YYYY-MM-DD\nHH:mm:ss'); }, }, { title: '付款方式', key: 'source', render: (text) => { return RecordSourceMap[text]; }, }, { title: '付款金额', key: 'money', render: (text) => { return formatMoney(text); }, }, ]; export default class extends Page { constructor(props) { props.size = 15; super(props); } initState() { return {}; } initData() { Order.list(this.state.search) .then(result => { this.setState({ list: result.list, total: result.total, page: this.state.search.page }); }); } onChangePage(page) { this.search({ page }); } renderView() { const { config } = this.props; return ; } renderTable() { const { list, total, page } = this.state; return (
this.onChangePage(p)} total={total} current={page} />
); } }