import React, { Component, Fragment } from 'react'
import {
	Page, Validator, Notification, FormItem, BottomBtn,
	InputItem, Input, Bind, SelectItem, Button, Label, DatePickerItem, Section, ConfirmButton, Steps
} from '@/components/Common-Library'
import Api from '@/service/api'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable,autorun } from 'mobx'
import { Row, Col, Popconfirm, Modal ,Spin} from 'antd';
import { Link, withRouter } from 'react-router-dom'
import Ptspta1 from '@/views/Public/Ptspta1'
import Business from '@/views/Public/Business'

const { Pre, Next, StepWrapper } = Steps
const CodeTable = CodeTableFactory.getInstance()
const confirm = Modal.confirm

import moment from 'moment';
  
@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class OvwpScreen extends Page 
{
	@observable
	formBlur = false

	constructor(props) {
		super(props)
		this.model = props.model
    this.bind = Bind.bind(this)
  }

	//交易内实现
	renderPage() {
		const bind = this.bind
		const { i18n } = this.props
    const { ownbch } = this.props.extra
    bind("pts_extkey")
		if(this.props.flag==true){
			return <Spin style={{width:"100%", justifyContent:"center"}} spinning={this.props.flag} />
		}
		return (
			<div style={{ position: 'relative' }}>
        <Business  wrappedComponentRef={ref => (this.com = ref)} page={this} steps={this.props.steps} extra={this.props.extra}  model={this.model} />

				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="单据编号" trn="bptopn" />	
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("pntref")}  maxLength={16} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="单据描述" trn="bptopn" />
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("pntnam")}  maxLength={100}  disabled={true}  />
              </Col>
            </Row>
          </Col>
        </Row>

				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资业务编号" trn="bptopn" />
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("ownref")}  maxLength={16} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="概要描述" trn="bptopn" />
              </Col>
              <Col span={14}>
                <InputItem InputProps={bind("nam")}  maxLength={100}  disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

				<Row>
          <Col span={12}>
            <Col span={24}>
              <Row className="row">
                <Col span={5} offset={2}>
                  <Label itext="归属机构" trn="bptopn" />
                </Col>
                <Col span={14}>
                  <SelectItem InputProps={bind("ownbch")} code={ownbch} disabled={true} />
                </Col>
              </Row>
            </Col>
            <Col span={24}>
              <Row className="row">
                <Col span={5} offset={2}>
                  <Label itext="客户经理" trn="bptopn" />	
                </Col>
                <Col span={14}>
                  <InputItem InputProps={bind("accusr")}  maxLength={8}   disabled={true} />
                </Col>
              </Row>
            </Col>
            <Col span={24}>
              <Row className="row">
                <Col span={5} offset={2}>
                  <Label itext="贸易融资类型" trn="bptopn" />
                </Col>
                <Col span={14}>
                  <SelectItem InputProps={bind("fintyp")} code={CodeTable.fintyp} disabled={true} />
                </Col>
              </Row>
            </Col>
          </Col>
          <Col span={12}>
            <Ptspta1 model={this.model} argArr={{ desc: "融资申请人", prefix: 'pts', url: 'bptset/fiap_sel', flg: 'B', datakey: '\\bptp\\fiap\\ptslst' }}  isDisabled={true} />
          </Col>
        </Row>
				
				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资余额" trn="bptset" />	
              </Col>
              <Col span={6}>
                <SelectItem InputProps={bind("opn1_cur")} code={CodeTable.curtxt} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <InputItem InputProps={{...bind("opn1_amt"), type:"amount",cur:this.model.opn1_cur}} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="起息日" trn="bptopn" />
              </Col>
              <Col span={14}>
                <DatePickerItem InputProps={bind("opndat")} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>
				
				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资比例" trn="bptopn" />
              </Col>
              <Col span={6}>
                <InputItem InputProps={bind("pctfin")}   desp="融资比例"  disabled={true} />
              </Col>
              <Col span={1} offset={1}>
                <Label itext="%" trn="bptopn" />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资到期日" trn="bptopn" />
              </Col>
              <Col span={14}>
                <DatePickerItem InputProps={bind("expdat")}  desp="融资到期日" disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>
				
				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资金额" trn="bptopn" />	
              </Col>
              <Col span={6}>
                <SelectItem InputProps={bind("max_cur")} code={CodeTable.curtxt} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <InputItem InputProps={ {...bind("max_amt"), type:"amount",cur:this.model.max_cur}} disabled={true} />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="计息天数" trn="bptopn" />
              </Col>
              <Col span={12}>
                <InputItem InputProps={bind("intday")}   desp="计息天数" disabled={true} />
              </Col>
              <Col span={1} offset={1}>
                <Label itext="天" trn="bptopn" />	
              </Col>
            </Row>
          </Col>
        </Row>
				
				<Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="融资利率" trn="bptopn" />
              </Col>
              <Col span={6}>
                <InputItem InputProps={bind("basrat")}  desp="融资利率" disabled={true} />
              </Col>
              <Col span={1} offset={1}>
                <Label itext="%" trn="bptopn" />
              </Col>
            </Row>
          </Col>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="计息方式" trn="bptopn" />
              </Col>
              <Col span={14}>
                <SelectItem InputProps={bind("iratyp")} code={CodeTable.iratyp} disabled={true} />
              </Col>
            </Row>
          </Col>
        </Row>

        <Row>
          <Col span={12}>
            <Row className="row">
              <Col span={5} offset={2}>
                <Label itext="归还融资本金" trn="bptset" />	
              </Col>
              <Col span={6}>
                <SelectItem InputProps={bind("setmod_doccur")} code={CodeTable.curtxt} disabled={true} />
              </Col>
              <Col span={7} offset={1}>
                <InputItem InputProps={ {...bind("setmod_docamt"), type:"amount",cur:this.model.setmod_doccur}}/>
              </Col>
            </Row>
          </Col>
        </Row>
				
				{/* 底部按钮 */}
        <BottomBtn _this={this} />
			</div >
		)
	}
}
