import React from 'react'; import './index.less'; import Page from '@src/containers/Page'; import Assets from '@src/components/Assets'; import { getMap, formatDate } from '@src/services/Tools'; import Checkbox from '../../../components/CheckBox'; import Button from '../../../components/Button'; import Icon from '../../../components/Icon'; import { Order } from '../../../stores/order'; import { ServiceKey } from '../../../../Constant'; const ServiceKeyMap = getMap(ServiceKey, 'value', 'label'); export default class extends Page { initState() { return { state: 'open' }; } initData() { const { id } = this.params; Order.getRecord(id) .then(result => { if (result.isUse) { this.setState({ state: 'finish', data: result }); return; } this.setState(result); }); } submit() { Order.useRecord(this.params.id) .then((result) => { this.setState({ state: 'finish', data: result }); }); } renderView() { const { state } = this.state; switch (state) { case 'finish': return this.renderFinish(); default: return this.renderOpen(); } } renderOpen() { const { productType } = this.state; if (productType === 'service') { return this.renderService(); } return this.renderCourse(); } renderCourse() { const { course = {}, endTime } = this.state; if (!endTime) return null; return (