// 社保卡授权添加
import React from 'react';
import {List, Radio, Button} from 'antd-mobile';
import './style/index.less';

const RadioItem = Radio.RadioItem;

export default class SocialSecurityCardAuthorization extends React.Component {
  constructor({history}) {
    super();
    this.state = {
      radioAction: "1"
    }
    this.history=history;
  }

  componentDidMount() {
    
  }

  // 选择实际就诊人
  handleRadioItemChange = item => {
    this.setState({radioAction: item.value})
  }

  // 跳转到添加就诊人
  handleGoAddAdm = () => {
    this.history.push("/0002/00030005")
  }

  // 跳转到绑定电子健康卡界面
  handleGoBindingCard = () => {
    let data = {
      tabActive: "right"
    }
    this.history.push({
      pathname: "/0001/00010003",
      state: data
    })
  }

  render() {
    let {radioAction} = this.state;
    let data = [
      {
        value: "1",
        label: "shizi",
        extra: "123123ahqhosaop"
      },
      {
        value: "2",
        label: "want",
        extra: "65467ahqhosaop"
      }
    ];

    return (
      <div className="electronic-health-card">
        <div style={{height: "100%", overflow: "auto"}} className="confirm-appointment social-security-card-authorization paddingtop10">
          <List style={{maxHeight: "74%", overflow: 'auto'}}>
            {data.map((item, index) => (
              <RadioItem key={index} checked={radioAction === item.value} onChange={() => this.handleRadioItemChange(item)}>
                {item.label}<List.Item.Brief>{"社保卡："+item.extra}</List.Item.Brief>
              </RadioItem>
            ))}
            <p className="add-user-adm" onClick={this.handleGoAddAdm}><i className="iconfont icon-tianjia"></i>添加就诊人</p>
          </List>
          <div className="operation-button">
            <Button type="ghost" onClick={this.handleGoBindingCard} disabled={radioAction ? false : true}>授权添加</Button>
          </div>
        </div>
      </div>
    )
  }
}