import React,{Component,Fragment} from 'react'
import {Page,Validator,Notification,FormItem,DatePickerItem,TextAreaItem,CheckboxItem,Checkbox,
    InputItem,Input,Bind,SelectItem,Button,Label,Image,Table, Steps} from '@/components/Common-Library'
import Api from '@/service/api'
import mFptsel from '../model'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable} from 'mobx'
import Shoukuan from './Shoukuan'
import Ziying from './Ziying'
import ZhuanMai from './ZhuanMai'
import ShouHui from './ShouHui'
import { Card } from 'antd'
import DateFormat from  '@/utils/DateUtil'

const CodeTable = CodeTableFactory.getInstance()
const StepItem = Steps.Item


@inject('UserContext')
@inject('i18n')
@observer
export default class FptselScreen extends Page
{
	@observable
	formBlur = false

	@observable
	extra = { inifrm: 'fptsel',  bchlevelLst: [] }



	constructor(props) {
		super(props)
		this.state = {
			flag: true
		}
		this.model = new mFptsel()
	}
	
	async componentWillMount() 
	{
		/*
		*添加初始化代码
		*/
		const rtnmsg = await Api.post('fptsel/init',{data:this.model})
		if(rtnmsg.retcod == SUCCESS)
		{
           const {data} = rtnmsg
          
                Object.assign(this.model,data)
         
        }
		//快照模式下，不必开启校验，否则，静默校验，和记录变动
		!this.loadDisplay() && this.model.openMonitor && this.model.openMonitor() //开启校验	
	}
    componentWillUnmount()
    {
        this.model.stopMonitor&&this.model.stopMonitor()//关闭校验
    }



    //交易内实现
    renderPage(){
		return (
			<Card title="福费廷入口" size="small" className="transTitle">
				<Steps>
					<StepItem title="自营买入">
						<Ziying model={this.model} extra={this.extra}/>
					</StepItem>

					<StepItem title="到期收款">
						<Shoukuan model={this.model} extra={this.extra} />
					</StepItem>
					<StepItem title="二级市场转卖">
						<ZhuanMai model={this.model} extra={this.extra} />
					</StepItem>
					<StepItem title="回款转汇">
						<ShouHui model={this.model} extra={this.extra} />
					</StepItem>
				</Steps>

        <Button style={{ position:'absolute',right:'3em',top:'4em' }}  type="primary" size="small" onClick={()=>{this.props.history.push('fptopn')}}>
          <Label itext="二级市场买入" />
        </Button>
			
			</Card>
		)
 
	}
}
