// 退费申请
import React from 'react';
import moment from 'moment';
import { Select, Input, Row, Col, Button, message, Table } from 'antd';
import { $http } from 'containers/config/https';
import InquiryFeeRecordModal from './component/InquiryFeeRecordModal'
import TipHeader from './component/TipHeader'
import { Keup, ArraySome } from '../../../tools/index';
import './style/style.less'
import ReadCard from '../../../components/readcard/ReadCard';
import store from '../../../store';
import RangeDatePicker from 'components/rangePicker/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import { Util } from 'tools/index';
import { $loopPrint } from '../../lodop/Common/Print';

// 组件const
const { Option } = Select;
const { Search } = Input;

export default class ApplicationForRefund extends React.Component {
	constructor(props) {
		super(props)
		this.updateParent = this.updateParent.bind(this);
		let userData = JSON.parse(sessionStorage.getItem('userData'));
		let titleData = JSON.parse(sessionStorage.getItem('titleData'));
		this.state = {
			userData,
			userInfo: {}, // 用户数据
			cardType: '', // 卡类型
			cardTypeData: [], // 卡类型
			reasonsRefundType: '', // 退费原因
			reasonsRefundData: [], // 退费原因
			cardNo: '', // 卡号
			patNo: titleData && titleData.patNo, // 登记ID号
			invNo: '', // 发票号
			dataTable: [], // table数据
			modalShow: false, //  收费弹框的显示
			recordinvID: '', //收款记录发票记录服务的ID
			invType: '',//收款记录发票记录服务的类型
			selectedRowKeys: [],
			selectedKey: [],
			inputAry: [], //申请数量数组
			recordIDArr: [], // 撤销申请
			reAppType: '',
			allPrice: '0.00',
			payReasonDesc: '',
			disBtton: false, // 按钮点击许可
			StartDate: moment().subtract(7, "days").format('YYYY-MM-DD'),  // //开始日期
			EndDate: moment().format('YYYY-MM-DD'),  // //结束日期
			selectedRows: [],
			columns: [],
			languageData: {}, // 国际化语言包
			language: {},   // 国际化语言
			languageCode: JSON.parse(window.sessionStorage.userData).language, // 国际化语言标识
			readModeI: true,
			readModeR: true,
		}

		// 挂号table
		this.columns = [{
			title: '序号',
			dataIndex: 'number',
			key: '1',
			align: "center",
			width: 100
		}, {
			title: '项目名称',
			dataIndex: 'medDesc',
			key: '2',
			align: "center",
			width: 500,
			render: (text, record, index) => (
				<div>
					<p style={{ margin: '0', marginLeft: '10px', textAlign: 'left' }}>{record.medDesc}</p>
				</div>
			),
		}, {
			title: '申请部位',
			dataIndex: 'part',
			key: '3',
			align: "center",
			width: 100
		}, {
			title: '数量',
			dataIndex: 'medBillQty',
			key: '4',
			align: "center",
			width: 100
		}, {
			title: '单位',
			dataIndex: 'medBillOrdUnitDesc',
			key: '5',
			align: "center",
			width: 100
		}, {
			title: '单价',
			dataIndex: 'unitPrice',
			key: '6',
			align: "center",
			width: 100
		}, {
			title: '总额',
			dataIndex: 'medBillPatAmt',
			key: '7',
			align: "center",
			width: 100
		}, {
			title: '可退数量',
			dataIndex: 'ableApplyQty',
			key: '8',
			align: "center",
			width: 100
		}, {
			title: '申请数量',
			dataIndex: 'ableApplyQty',
			key: '9',
			align: "center",
			width: 100,

			render: (text, record, index) => (
				<div>
					<Input placeholder="" min={0} max={parseFloat(record.ableApplyQty)} style={{ width: '50px' }} disabled={record.input === 'Y' ? false : true} value={this.state.inputAry[index]} onChange={(event) => { this.inputChange(event, record, index) }} />
				</div>
			),
		}, {
			title: '已申请数量',
			dataIndex: 'applyedQty',
			key: '10',
			align: "center",
			width: 100
		}, {
			title: '执行科室',
			dataIndex: 'ordRecLocDesc',
			key: '11',
			align: "center",
			width: 100
		}, {
			title: '执行情况',
			dataIndex: 'ordStatusDesc',
			key: '12',
			align: "center",
			width: 100
		}, {
			title: '不可退原因',
			dataIndex: 'noReturnReason',
			key: '13',
			align: "center",
			width: 100
		}, {
			title: '申请时间',
			dataIndex: 'applyDateTime',
			key: '14',
			align: "center",
			width: 100
		}, {
			title: '申请原因',
			dataIndex: 'applyReason',
			key: '15',
			align: "center",
			width: 100
		}, {
			title: '审核人',
			dataIndex: 'applyUserName',
			key: '16',
			align: "center",
			width: 100
		}]
	}

	componentDidMount() {
		let titleData = JSON.parse(sessionStorage.getItem('titleData'));
		for (var i = 0; i < document.querySelectorAll("div.maxHeight div.ant-table-body").length; i++) {
			document.querySelectorAll("div.maxHeight div.ant-table-body")[i].style.height = store.getState().tableHeight.y + 'px';
		}
		if (!Util.isEmpty(titleData)) {
			this.searchUser()
		}
		this.cardTypeList() //卡类型
		this.reasonsRefund() //退费原因
		this.ordList1()
		this.focusInput()
	}

	componentWillUnmount() {
		// sessionStorage.removeItem('titleData')
	}

	//获取光标
	focusInput = () => {
		let { focusType } = this.state
		if (focusType === 'CardNo') {
			const { input } = this.cardNoInput;
			input.focus();
		} else {
			const { input } = this.patNoInput;
			input.focus();
		}
	}

	//退费切换
	inputChange = (e, record, index) => {
		let val = e.target.value
		if (parseFloat(val) > parseFloat(record.ableApplyQty) || parseFloat(val) < 0) {
			return false
		}
		val = Keup.MoneyReplace(val)

		let { ableApplyQty, inputAry } = this.state  // 审核数组

		inputAry.splice(index, 1, val);
		ableApplyQty = val
		this.setState({
			inputAry: inputAry,
			ableApplyQty: ableApplyQty
		}, () => {
			this.allPriceAdd(this.state.selectedRows)
			// this.onSelectChange(this.state.selectedRowKey, this.state.selectedRows);
		})
	}

	//卡类型
	cardTypeList = () => {
		var data = {
			params: [{
				cardTypeFlag: 1,
			}]
		}

		$http.post('urlS', this, {
			code: "03030005",
			data: data,
			success: function (res) {
				let errorCode = res.errorCode;
				if (errorCode === '0') {
					let cardDeffault = res.cardType.filter((item) => {
						return item.defaultFlag === 'Y';
					})
					this.setState({
						cardType: cardDeffault[0].id, // 默认卡
						cardTypeData: res.cardType,  // 用户数据
					}, () => {
						this.CardTypeChange(this.state.cardType)
					});
				}
			}
		});
	}

	//checkChange
	onSelectChange = (selected, statusFlag) => {
		let { selectedKey, selectedRows } = this.state;
		let nSelectKey = [];
		let nSelectedRows = [];
		let { dataTable } = this.state;
		if (selected && 'orderGroup' in selected && selected.orderGroup) {
			for (var i = 0; i < dataTable.length; i++) {
				if (dataTable[i].orderGroup === selected.orderGroup) {
					nSelectKey.push(dataTable[i].key);
					nSelectedRows.push({
						...dataTable[i],
						recordID: dataTable[i]?.recodeID || '',
						refReasonID: this.state.reasonsRefundType,
						applyQty: this.state.inputAry[(dataTable[i]?.number || 0) - 1]
					})
				}
			}
		} else {
			nSelectKey.push(selected?.key || 0);
			nSelectedRows.push({
				...selected,
				recordID: selected?.recodeID,
				refReasonID: this.state.reasonsRefundType,
				applyQty: this.state.inputAry[(selected?.number || 0) - 1]
			})
		}
		if (statusFlag) {
			selectedKey = [...selectedKey, ...nSelectKey]
			selectedRows = [...selectedRows, ...nSelectedRows]
		} else {
			for (var i = 0; i < nSelectKey.length; i++) {
				selectedKey = selectedKey.filter((item => item !== nSelectKey[i]));
			}
			for (var i = 0; i < nSelectedRows.length; i++) {
				selectedRows = selectedRows.filter((item => item.key !== nSelectedRows[i].key));
			}
		}
		this.setState({
			selectedRowKeys: selectedRows,
			selectedKey,
			selectedRows: selectedRows
		}, () => {
			this.allPriceAdd(selectedRows)
		})
	}

	//退费原因
	reasonsRefund = () => {
		var data = {
			params: [{
				"typeCode": "RefundInv"
			}]
		}
		$http.post('urlS', this, {
			code: "05210011",
			data: data,
			success: function (res) {
				let errorCode = res.errorCode;
				if (errorCode === '0') {
					this.setState({
						reasonsRefundData: res.reason,  // 退费原因
						reasonsRefundType: !Util.isEmpty(res.reason) ? res.reason[0].id : undefined
					});
				}
			}
		})
	}

	// 查询条件 --- 卡类型·
	cardType = (e) => {
		this.setState({ cardType: e }, () => {
			this.CardTypeChange(e)
		});
	}

	// 查询条件 --- 卡号
	cardNo = (e) => {
		let { readModeI } = this.state
		if (!readModeI) {
			return false
		}
		this.setState({ cardNo: e.target.value });
	}

	// Card
	CardTypeChange = (e) => {
		if (!e) {
			return false
		}
		let { cardTypeData } = this.state
		let readMode = cardTypeData.filter((item, i) => {
			return item.id == e;
		})

		switch (readMode[0] && readMode[0].readMode) {
			// 只可input
			case 'I':
				this.setState({
					readModeI: true,
					readModeR: false,
					cardNo: "",

				})
				break;
			// 只可读卡
			case 'R':
				this.setState({
					readModeR: true,
					readModeI: false,
					cardNo: "",
				})
				break;
			// 皆可
			default:
				this.setState({
					readModeI: true,
					readModeR: true,
					cardNo: "",
				})
				break;
		}
	}

	// 查询条件 --- 登记号
	patNo = (e) => {
		this.setState({ patNo: e.target.value });
	}

	// 查询条件 --- 发票号
	invNo = (e) => {
		this.setState({ invNo: e.target.value });
	}

	//  退费原因
	reasonsRefundType = (e) => {
		this.setState({ reasonsRefundType: e });
	}

	// 回车查询
	patNodownE = (e, type) => {
		if (e.keyCode === 13) {
			this.searchUser(type)
		}
	}

	// 读卡 --- 根据卡号取病人信息
	handleReadCard = (value, event) => {
		let { readModeI, readModeR, cardType } = this.state
		if (event.keyCode) {
			if (readModeI) {
				this.searchUser('cardNo'); // 重新调用查询接口
			}
			return false
		}
		if (readModeR) {
			this.readCard.ReadCard(cardType, "R", (json) => {
				let patNo = json && json.patInfo ? json.patInfo.patNo : ''
				this.setState({ patNo, cardNo: json.cardNo }, () => {

					//this.searchUser('cardNo'); // 重新调用查询接口
					if (patNo) {
						this.searchUser('patNo'); // 重新调用查询接口
					} else {
						this.searchUser('cardNo'); // 重新调用查询接口
					}
				})
			})
		}
	}

	// // 回车读卡 --- 根据卡号取病人信息
	// handleReadCarddownE = (e, type) => {
	//     if (e.keyCode === 13) {

	//         this.searchUser('cardNo') // 读卡 --- 根据卡号取病人信息
	//     }
	// }

	// 读卡
	searchUser = (type) => {
		var data;
		let { cardType, cardNo, patNo, cardTypeData, invNo } = this.state
		if (!type) {   // 查询全部
			data = {
				params: [{
					"invNo": invNo, // 发票号
					"number": patNo || '', // 登记号/身份证号
					"cardTypeID": cardType,   //卡类型id
					"cardNo": cardNo,    //卡号
				}]
			}
		}
		if (type === 'invNo') {
			data = {
				params: [{
					"invNo": invNo, // 发票号
					"number": '', // 登记号/身份证号
					"cardTypeID": "",   //卡类型id
					"cardNo": "",    //卡号
				}]
			}

			if (invNo === '') {
				return false
			}
		}

		if (type === 'patNo') {
			data = {
				params: [{
					"invNo": '', // 发票号
					"number": patNo || '', // 登记号/身份证号
					"cardTypeID": "",   //卡类型id
					"cardNo": "",    //卡号
				}]
			}

			if (patNo === '') {
				return false
			}
		}

		if (type === 'cardNo') {
			data = {
				params: [{
					"invNo": '', // 发票号
					"number": '', // 登记号/身份证号
					"cardTypeID": cardType || '',     //卡类型id
					"cardNo": cardNo || '', //卡号
				}]
			}

			if (cardNo === '') {
				return false
			}
			if (cardType === '') {
				message.error('请选择卡类型')
				return false
			}

			let cardTypeFilter = cardTypeData.filter(function (item) {
				return item.id == cardType;
			})

			let zeroLength = cardTypeFilter[0].cardLength

			if (zeroLength && zeroLength != '' && parseFloat(zeroLength) != 0) {
				this.setState({
					cardNo: ArraySome.addPreZero(cardNo, zeroLength)
				})
				data = {
					params: [{
						"invNo": '', // 发票号
						"number": '', // 登记号/身份证号
						"cardTypeID": cardType || '',     //卡类型id
						"cardNo": ArraySome.addPreZero(cardNo, zeroLength) || '', //卡号
					}]
				}
			}
		}
		$http.post('urlS', this, {
			code: "05210012",
			data: data,
			success: function (res) {
				let errorCode = res.errorCode;
				if (errorCode === '0') {

					this.setState({
						userInfo: res.data || {},  // 用户数据
						patNo: res.data.patNo || '',  // ID
						dataTable: [],
					}, () => {
						this.focusInput()
						if (type !== 'invNo') {
							this.setState({
								modalShow: true //  收费弹框的显示
							})
						} else {
							// this.ReAppListInfoService('invNo')     //退费申请列表信息服务
						}
					});

				} else {
					message.error(res.errorMessage)
				}
			}
		});
	}

	//退费申请列表信息服务
	ReAppListInfoService = (type) => {
		let data = {
			params: [{
				"invNo": this.state.invNo || '', // 发票号
				"recordinvID": this.state.recordinvID || '', //收款记录发票记录服务的ID
				"invType": this.state.invType || '',//收款记录发票记录服务的类型
			}]
		}
		// if (type === 'invNo') {
		//     data = {
		//         params: [{
		//             "invNo": this.state.invNo || '', // 发票号
		//             "recordinvID": '', //收款记录发票记录服务的ID
		//             "invType": '',//收款记录发票记录服务的类型
		//         }]
		//     }
		// }

		// if (type === '!invNo') {
		//     data = {
		//         params: [{
		//             "invNo": '', // 发票号
		//             "recordinvID": this.state.recordinvID || '', //收款记录发票记录服务的ID
		//             "invType": this.state.invType || '',//收款记录发票记录服务的类型
		//         }]
		//     }
		// }
		$http.post('urlS', this, {
			code: "05210014",
			data: data,
			success: function (res) {
				let errorCode = res.errorCode;
				if (errorCode === '0') {
					let result = res.refundRequestInfo;
					let inputAry = []  // 退费数量
					for (var i = 0; i < result.length; i++) {
						result[i].key = i;
					}
					result.map((item, i) => {
						inputAry.push(item.ableApplyQty)
					})
					this.setState({
						dataTable: result,  // 退费申请列表
						inputAry: inputAry,
						recordIDArr: res.recordIDArr || [], // 撤销申请
						reAppType: type,
						payReasonDesc: res.payReasonDesc,
						selectedRowKeys: [],
						selectedKey: [],
						allPrice: '0.00'
					},
						() => {
							this.focusInput()
						});
				}
			}
		});
	}

	//撤销申请
	CancellOfApplication = () => {
		this.setState({
			disBtton: true, // 按钮点击许可
		})

		let data = {
			params: this.state.recordIDArr
		}

		$http.post('urlS', this, {
			code: "05210016",
			data: data,
			success: function (res) {
				this.setState({
					disBtton: false, // 按钮点击许可
				}, () => { this.focusInput() })

				let errorCode = res.errorCode;
				if (errorCode === '0') {
					message.success('撤销申请成功')
					this.ReAppListInfoService(this.state.reAppType)     //退费申请列表信息服务

				}
			}
		});
	}

	//算价格
	allPriceAdd = (selectedRows) => {
		let { allPrice } = this.state
		allPrice = 0
		selectedRows.map((item, i) => {
			if (this.state.inputAry[item.key] && this.state.inputAry[item.key] != '') {
				allPrice += parseFloat(parseFloat(item.unitPrice) * parseFloat(this.state.inputAry[item.key]))
			}
		})
		this.setState({
			allPrice: allPrice.toFixed(2), // 费用总额
		})
	}

	//退费申请服务
	RefundApplicationService = () => {
		let { selectedRowKeys, reasonsRefundType } = this.state
		if (selectedRowKeys.length < 1) {
			message.error('请选择至少一项')
			return false
		}
		for (var i = 0; i < selectedRowKeys.length; i++) {
			selectedRowKeys[i].refReasonID = reasonsRefundType;
		}
		this.setState({
			disBtton: true, // 按钮点击许可
		})
		let data = {
			params: selectedRowKeys
		}
		if (JSON.parse(window.sessionStorage.userData).hospCode == 'H19') {
			this.RefundApplicationPrint()
		}

		$http.post('urlS', this, {
			code: "05210015",
			data: data,
			success: function (res) {
				this.setState({
					disBtton: false, // 按钮点击许可
				})

				let errorCode = res.errorCode;
				if (errorCode === '0') {
					this.handleCancel()  // 关闭弹框
					this.ReAppListInfoService(this.state.reAppType) // 退费申请列表信息服务
					this.setState({
						selectedKey: [],
					}, () => { this.focusInput() });

					// this.clearnFile()
					let messageTime = this.state.userData && this.state.userData.messageTime ? this.state.userData.messageTime : 3;
					Keup.ModalMessage(messageTime, this, '退费申请成功!', '自动关闭', 'destroy', '确定', 'success')
				}
			}
		});
	}

	//退费申请打印
	RefundApplicationPrint = () => {
		let { selectedRowKeys } = this.state
		let data = {
			params: [{
				"arr": selectedRowKeys,
				"invNo": this.state.invNo || '', // 发票号
				"recordinvID": this.state.recordinvID || '', //收款记录发票记录服务的ID
				"invType": this.state.invType || '',//收款记录发票记录服务的类型
			}]
		}
		$http.post('urls', this, {
			code: '05100394',
			data: data,
			success: function (res) {
				$loopPrint('', res.result);
			}
		})
	}

	// 弹框关闭
	handleCancel = () => {
		this.setState({
			modalShow: false,
			disBtton: false, // 按钮点击许可
		});
	}

	// 历史记录子组件传值到父组件
	updateParent = (data) => {
		this.handleCancel() // 弹框关闭
		this.setState({
			recordinvID: data.recordID, //收款记录发票记录服务的ID
			invType: data.invType,//收款记录发票记录服务的类型
		}, () => {
			this.ReAppListInfoService('!invNo')     //退费申请列表信息服务
		})
	}

	// table行样式
	setRowClassName = (record) => {
		return record.select === 'N' ? 'disabledTable' : '';
	}

	// 清空
	clearn = () => {
		this.setState({
			userInfo: {}, // 用户数据
			// cardType: '', // 卡类型
			reasonsRefundType: '', // 退费原因
			// reasonsRefundData: [], // 退费原因
			cardNo: '', // 卡号
			patNo: '', // 登记ID号
			invNo: '', // 发票号
			dataTable: [], // table数据
			modalShow: false, //  收费弹框的显示
			recordinvID: '', //收款记录发票记录服务的ID
			invType: '',//收款记录发票记录服务的类型
			selectedRowKeys: [],
			selectedKey: [],
			inputAry: [], //申请数量数组
			recordIDArr: [], // 撤销申请
			reAppType: '',
			allPrice: '0.00',
			payReasonDesc: '',
			disBtton: false, // 按钮点击许可
			StartDate: undefined,  // //开始日期
			EndDate: undefined,  // //结束日期
			readModeI: true,
			readModeR: true,
		})
	}

	// 时间
	onChangeTime = (date, dateString) => {
		this.setState({
			StartDate: dateString[0],    //开始日期
			EndDate: dateString[1],  //结束日期
		})
	}

	startChange(date) {
		this.setState({
			StartDate: date,
		})
	}

	endChange(date) {
		this.setState({
			EndDate: date,
		})
	}

	//render 自定义项目名称
	listAdd = (languageCode) => {
		let { columns } = this.state
		columns.splice(1, 0,
			{
				title: languageCode === 'CN' ? '项目名称' : 'Project Name',
				key: 'medDesc',
				align: "left",
				dataIndex: 'medDesc',
				width: 500,
				render: (text, record, index) => (
					<div>
						<p style={{ margin: '0', marginLeft: '10px', textAlign: 'left' }}>{record.medDesc}</p>
					</div>
				),
			},
		)
		columns.splice(8, 0,
			{
				title: languageCode === 'CN' ? '申请数量' : 'Apply Number',
				key: 'ableApplyQty',
				align: "right",
				dataIndex: 'ableApplyQty',
				width: 100,
				render: (text, record, index) => (
					<div>
						<Input placeholder="" min={0} max={parseFloat(record.ableApplyQty)} style={{ width: '50px' }} disabled={record.input === 'Y' ? false : true} value={this.state.inputAry[index]} onChange={(event) => { this.inputChange(event, record, index) }} />
					</div>
				),
			},
		)
	}

	onColumnRef = (ref) => {
		this.columnRef = ref;
	}

	// 费用类型table
	ordList1 = () => {
		let data = {
			params: [{
				"reactCode": ["ApplicationForRefund"],
				"compontName": "ApplicationForRefund",
				"type": "C"

			}]
		}
		$http.post('urlS', this, {
			code: '01040073',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					let resC = res.result.C
					let { languageCode } = this.state
					for (var i = 0; i < resC.length; i++) {
						resC[i].key = i;
					}
					if (languageCode === "EN") {
						resC.map((item, i) => {
							item.title = item.enDescripts
						})
					}

					if (languageCode === "CN") {
						resC.map((item, i) => {
							item.title = item.descripts
						})
					}
					let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
						return {
							align: item.align,
							widthNum: parseInt(item.width),
							width: item.width,
							dataIndex: item.dataIndex,
							title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
							display: item.display,
							key: item.seqNo
						}
					}) : '';
					let filterArr = arr.filter(function (item) { return item.display === 'Y' });
					this.setState({
						columns: filterArr,
						languageTable1: res.result.B || {},  // 国际化Table1
						languageTable2: res.result.C || {},  // 国际化Table2
						languageData: res.result.language || {},  // 国际化语言包
					}, () => {
						this.LanCNEN(this.state.languageCode)
						this.listAdd(languageCode);
					})
				}
			}
		})
	}

	LanCNEN = (code) => {
		let { languageData } = this.state
		this.setState({
			language: languageData[code]
		})
	}

	/**
	 * @ByShizi: 全部切换
	 * Create 2022-12-02
	 * */
	handleSelectAllChange = (statusFlag, selectedRows) => {
		let nSelectKey = [];
		let nSelectedRows = []
		if (statusFlag) {
			for (var i = 0; i < selectedRows.length; i++) {
				nSelectKey.push(selectedRows[i].key);
				nSelectedRows.push({
					...selectedRows[i],
					recordID: selectedRows[i]?.recodeID || '',
					refReasonID: this.state.reasonsRefundType,
					applyQty: this.state.inputAry[(selectedRows[i]?.number || 0) - 1]
				})
			}
		}
		this.setState({
			selectedRowKeys: nSelectedRows,
			selectedKey: nSelectKey,
			selectedRows: nSelectedRows
		}, () => {
			this.allPriceAdd(nSelectedRows)
		})
	}

	render() {
		let { userInfo, language } = this.state
		const setRowClassName = this.setRowClassName
		const selectedRowKeys = this.state.selectedKey
		const rowSelection = {
			selectedRowKeys,
			onSelect: this.onSelectChange,
			onSelectAll: this.handleSelectAllChange,
			getCheckboxProps: record => ({
				disabled: (record.select === 'N' ? true : false),
			}),
		};

		return (
			<div>
				<ReadCard ref={r => this.readCard = r} />
				<div >
					<Row>
						<Col span={6} style={{ textAlign: 'center', }} >
							<Row >
								<Col span={23} >
									<TipHeader userInfo={userInfo} key={userInfo.patID + userInfo.accTSubID} />
								</Col>
							</Row>
							<Row style={{ height: '203px' }} >

								<Col span={23} style={{ paddingTop: '10px' }}>
									<Col span={24} > <div className='boxTitle'><i className="money1"></i>{language.ApplicationForRefundTotalRefund && language.ApplicationForRefundTotalRefund.descripts}</div> </Col>
									<Col span={24} >
										<div className='priceBox' style={{ height: '81px', lineHeight: '81px', }}>
											<span style={{ fontSize: '12px', color: '#CCCCCC' }}>￥</span> <span>{this.state.allPrice} </span>
										</div>
									</Col>
									<Col span={24} className="mT15" >
										<Col style={{ float: 'left' }}> <span style={{ lineHeight: '32px', margin: '0 10px' }}>{language.ApplicationForRefundReasonForRefund && language.ApplicationForRefundReasonForRefund.descripts}:</span></Col>
										<Col span={10}  >
											<Select style={{ width: "100%" }} allowClear placeholder="请选择" value={this.state.reasonsRefundType} onChange={(event) => { this.reasonsRefundType(event) }} >
												<Option value=''>请选择</Option>
												{this.state.reasonsRefundData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
											</Select>
										</Col>
									</Col>
								</Col>
							</Row>
							<Col span={1}
								style={{
									height: '100%',
									background: 'rgb(240, 242, 245)',
									float: 'right',
									position: 'absolute',
									right: '0px',
									top: '0px'
								}} >
							</Col>

						</Col>
						<Col span={18} style={{ padding: 10 }}  >
							<div className="table-operations">
								<Row style={{ minHeight: '50px', paddingBottom: '10px' }}>
									<Col span={24}>
										<Select allowClear style={{ width: '100px', margin: '12px 15px 0 0' }} placeholder="请选择" value={this.state.cardType} onChange={(event) => { this.cardType(event) }} >
											<Option value=''>请选择</Option>
											{this.state.cardTypeData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
										</Select>
										<Search maxLength={50} className={`search ${!this.state.readModeI ? 'disabled' : ''}`} style={{ width: '200px', margin: '12px 15px 0 0' }} allowClear placeholder={language.ApplicationForRefundLoadCard && language.ApplicationForRefundLoadCard.message} value={this.state.cardNo} enterButton={language.ApplicationForRefundLoadCard && language.ApplicationForRefundLoadCard.descripts} onChange={(event) => { this.cardNo(event) }} onSearch={this.handleReadCard} />
										{/* <Button style={{ background: 'rgba(66,185,131,1)', color: '#fff', width: '100px', margin: '23px 15px 0 0' }} onClick={() => { this.searchUser('cardNo') }} >读卡</Button> */}
										{language.ApplicationForRefundPersonIdentification && language.ApplicationForRefundPersonIdentification.descripts}：
										<Input maxLength={50} ref={(input) => { this.patNoInput = input; }} style={{ width: '200px', margin: '12px 15px 0 0' }} allowClear
											placeholder={language.ApplicationForRefundPersonIdentification && language.ApplicationForRefundPersonIdentification.message}
											className='input' value={this.state.patNo} onChange={(event) => { this.patNo(event) }} onKeyUp={(e) => { this.patNodownE(e, 'patNo'); }} />
										{/* 就诊日期：<RangePicker style={{ width: '260px', margin: '12px 15px 0 0' }}
                                value={this.state.StartDate === undefined || this.state.EndDate === undefined || this.state.StartDate === "" || this.state.EndDate === "" ? null : [moment(this.state.StartDate, dateFormat), moment(this.state.EndDate, dateFormat)]}
                                onChange={this.onChangeTime} />
 */}
										{language.ApplicationForRefundInvoiceID && language.ApplicationForRefundInvoiceID.descripts}: <Input maxLength={50} style={{ width: '200px', margin: '12px 15px 0 0' }} allowClear placeholder={language.ApplicationForRefundInvoiceID && language.ApplicationForRefundInvoiceID.message} className='input' value={this.state.invNo} onChange={(event) => { this.invNo(event) }} onKeyUp={(e) => { this.patNodownE(e, 'invNo'); }} />
										<span style={{ display: 'inline-block', margin: '12px 15px 0 0' }}><RangeDatePicker label={`${language.ApplicationForRefundChargeDate && language.ApplicationForRefundChargeDate.descripts}：`} format='YYYY-MM-DD' width={280}
											startDate={this.state.StartDate} endDate={this.state.EndDate} startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} /></span>
										<Button onClick={() => this.searchUser()} style={{ margin: '12px 15px 0 0', background: 'rgba(255,255,255,1)' }}>{language.ApplicationForRefundQuery && language.ApplicationForRefundQuery.descripts}</Button>
									</Col>
								</Row>
							</div>
							<div style={{ padding: '0 12px' }}>
								<InquiryFeeRecordModal userInfo={this.state.userInfo} updateParent={this.updateParent} StartDate={this.state.StartDate} EndDate={this.state.EndDate} invNum={this.state.invNo} key={this.state.invNo}></InquiryFeeRecordModal>
							</div>
						</Col>

					</Row>
					<div style={{ background: '#f0f2f5', height: '10px' }}></div>
					<Row style={{ padding: '0 24px', border: '1px solid #eee' }} >
						<Col span={24}>
							<div style={{ float: 'right' }}>
								<Button style={{ margin: '0 20px', border: 'none' }} onClick={() => { this.RefundApplicationService() }} disabled={this.state.disBtton}   ><i className="refund"></i>{language.ApplicationForRefundApplyRefund && language.ApplicationForRefundApplyRefund.descripts}</Button>
								<Button style={{ margin: '0 20px', border: 'none' }} onClick={() => { this.RefundApplicationPrint() }} disabled={this.state.disBtton}><i className="printing"></i>{language.ApplicationForRefundPrintRefundList && language.ApplicationForRefundPrintRefundList.descripts}</Button>
								<Button style={{ margin: '0 20px', border: 'none' }} onClick={() => { this.clearn() }} ><i className="clearn"></i>{language.ApplicationForRefundClear && language.ApplicationForRefundClear.descripts}</Button>
								<Button style={{ marginleft: '20px', border: 'none' }} onClick={() => { this.CancellOfApplication() }} disabled={this.state.disBtton}  ><i className="revoke"></i>{language.ApplicationForRefundApplicationCanceled && language.ApplicationForRefundApplicationCanceled.descripts}</Button>
							</div>
						</Col>
					</Row>
					<Row style={{ padding: 24 }} className='application-refuse-fee'>
						{/* <Table
                            bordered
                            dataSource={this.state.dataTable}
                            columns={this.state.columns}
                            pagination={false}
                            style={{ minHeight: (store.getState().tableHeight.y) - 200 + 'px' }}
                            scroll={{ y: (store.getState().tableHeight.y) - 200, x: 2000 }}
                            rowSelection={rowSelection}
                            rowClassName={setRowClassName}
                        /> */}
						<Table
							style={{ minHeight: (store.getState().tableHeight.y) - 200 + 'px' }}
							dataSource={this.state.dataTable}
							columns={this.state.columns}
							pagination={false}
							scroll={{ y: (store.getState().tableHeight.y) - 200, x: 2000 }}
							bordered
							rowSelection={rowSelection}
							rowClassName={setRowClassName}
							className='maxHeight'
						/>
						<ColumnAuthoritysModel
							clientWidth='900px'
							compontName='ApplicationForRefund'
							configType="C"
							onRef={this.onColumnRef}
							reloadData={this.ordList1}
						/>
					</Row>
					{/* 查询收费记录弹框 */}
					{/* <Modal
                    visible={this.state.modalShow}
                    title='查询收费记录'
                    onCancel={this.handleCancel}
                    onOk={this.handleCancel}
                    width='1000px'
                >
                    <InquiryFeeRecordModal userInfo={this.state.userInfo} updateParent={this.updateParent} ></InquiryFeeRecordModal>
                </Modal> */}
				</div>
			</div>
		)
	}
}
