import React, {
  PureComponent
} from "react";
import {
  Select,
  Row,
  Col,
  DatePicker,
  Input,
  Spin,
  InputNumber,
  Button,
  Icon,
  Popconfirm,
  Table,
  message,
  notification,
  Form
} from "antd";
import {
  connect
} from "dva";
import {
  Link,
  routerRedux
} from "dva/router";
// import OrderListDialog from "@/components/OrderListDialog/index";
import moment from "moment";
import styles from "./index.less";
import {
  getDefaultCurrency,
  getCustomer
} from "@/utils/request.js";
import {
  amountPrecision
} from '@/utils/utils';
const FormItem = Form.Item;
const EditableContext = React.createContext();

const EditableRow = ({
  form,
  index,
  ...props
}) => (
  <EditableContext.Provider value={form}>
    <tr {...props} />
  </EditableContext.Provider>
);

const EditableFormRow = Form.create()(EditableRow);

class EditableCell extends PureComponent {
  getInput = () => {
    if (this.props.inputType === 'number') {
      return <InputNumber />;
    }
    if (this.props.inputType === 'select') {
      const {
        selectList,
        record
      } = this.props;
      return <Select
              className={styles.selectBox}
              style={{ width: "180px" }}
              // value={record.paymentType}
              onChange={this.handleSelectChange}
           >
           {this.selectOptionHtml(selectList)}
          </Select>
    }
    return <Input />;
  };
  state = {
    editing: false,
  }

  componentDidMount() {
    if (this.props.editable) {
      document.addEventListener('click', this.handleClickOutside, true);
    }
  }

  componentWillUnmount() {
    if (this.props.editable) {
      document.removeEventListener('click', this.handleClickOutside, true);
    }
  }

  toggleEdit = () => {
    const editing = !this.state.editing;
    this.setState({
      editing
    }, () => {
      if (editing) {
        // this.input.focus();
      }
    });
  }

  handleClickOutside = (e) => {
    const {
      editing
    } = this.state;
    if (editing && this.cell !== e.target && !this.cell.contains(e.target)) {
      this.save();
    }
  }

  save = () => {
    const {
      record,
      handleSave
    } = this.props;
    this.form.validateFields((error, values) => {
      if (error) {
        return;
      }
      this.toggleEdit();
      handleSave({ ...record,
        ...values
      });

    });
  }

  // 拼接下拉框选项
  selectOptionHtml = listData => {
    if (!listData || !listData[0] || listData.length < 1) return null;
    const optionHtmls = listData.map(item => (
      <Select.Option key={item.id} value={item.id}>
        {item.name}
      </Select.Option>
    ));
    return optionHtmls;
  }
  handleSelectChange = (value) => {
    const {
      record,
      selectList
    } = this.props;
    record.paymentType = value;
  }
  render() {
    const {
      editing
    } = this.state;
    const {
      editable,
      dataIndex,
      inputType,
      title,
      record,
      selectList,
      index,
      handleSave,
      form,
      ...restProps
    } = this.props;
    return (
      <td ref={node => (this.cell = node)} {...restProps}>
        {editable ? (
          <EditableContext.Consumer>
            {(form) => {
              this.form = form;
              return (
                editing ? (
                  inputType=='select'?(
                    <FormItem style={{ margin: 0 }}>
                    {form.getFieldDecorator(dataIndex, {
                      rules: [{
                        required: true,
                        message: `请选择${title}。 `,
                      }],
                    })(this.getInput())}
                  </FormItem>
                  ):(
                    <FormItem style={{ margin: 0 }}>
                    {form.getFieldDecorator(dataIndex, {
                      rules: [{
                        required: true,
                        message: `请输入${title}。 `,
                      }],
                      initialValue: record[dataIndex],
                    })(this.getInput())}
                  </FormItem>
                  )
                  
                ) : (
                  <div
                    className="editable-cell-value-wrap"
                    style={{ paddingRight: 24 }}
                    onClick={this.toggleEdit}
                  >
                    {restProps.children}
                  </div>
                )
              );
            }}
          </EditableContext.Consumer>
        ) : restProps.children}
      </td>
    );
  }
}


class OnlinePayEdit extends PureComponent {
  constructor(props) {
    super(props);
    const {
      location
    } = this.props;
    const query = location[`query`];
    this.columns = [{
      title: '付款业务类型',
      dataIndex: 'paymentTypeName',
      key: 'paymentTypeName',
      width: "53%",
      editable: true,
    }, {
      title: '订单金额',
      dataIndex: 'amount',
      key: 'amount',
      className: "alignRight",
      width: "13%",
      editable: true,
    }, {
      title: '操作',
      dataIndex: 'action',
      className: `alignCenter ${query && query.type == "detail" ? "hidden" : ""}`,
      width: "33%",
      render: (text, record) => {
        return (
          this.state.dataSource.length >= 1 ?
          (
            <Popconfirm title="确认要删除吗?" onConfirm={() => this.delItemHandle(record)}>
                  <a href="javascript:;">删除</a>
                </Popconfirm>
          ) : null
        );
      },
    }];
    this.state = {
      loading: false,
      operationType: query && query.type ? query.type : "",
      billDate: Date.now(),
      payAccountAccountNumber: "", // 付款方账号
      supplierId: "", // 供应商
      payeeId: "", // 收款方（财务组织）
      payeeAccount: "", // 收款方账户
      paymentModeId: "", // 支付方式
      currencyName: getDefaultCurrency().name || "", // 币种名称
      paymentAmount: '0', //付款金额
      paymentTypeId: "", //付款类型
      dataSource: [], //子表集合
      count: 0,
    };
  }
  componentWillMount() {
    const {
      dispatch,
      location
    } = this.props;
    // 防止有历史数据，先清空信息
    dispatch({
      type: "paymentNotice/onlinePayData",
      onlinePayData: null
    });
    dispatch({
      type: "paymentNotice/returnOnlinePayData",
      returnOnlinePayData: null
    });
    dispatch({
      type: "paymentNotice/payBillItemSet",
      payBillItemSet: []
    });
    const query = location[`query`];
    // 编辑 或 查看明细
    if (query && query.id && query.type) {
      dispatch({
        type: "paymentNotice/getOnlinePayById",
        payload: {
          id: query.id
        }
      }).finally(() => {
        const {
          onlinePayData
        } = this.props;
        if (onlinePayData && onlinePayData.id) {
          // 编辑时，如有
          if (onlinePayData.supplierId && onlinePayData.payeeId) {
            const saleOrg = [];
            saleOrg.push(onlinePayData.supplierId);
            dispatch({
              // type: "paymentNotice/getFinanorgsBySaleorgData",
              type: "paymentNotice/getFinanorgsBySaleorgDataDistinct",
              payload: saleOrg
            });
            if (onlinePayData.payeeAccount) {
              dispatch({
                type: "paymentNotice/getEnterpriseAccountsData",
                payload: {
                  "search_EQ_financeOrganization.id": onlinePayData.payeeId,
                  search_EQ_isEnable: 1,
                  size: 100,
                  page: 0,
                }
              });
            }
          }
          this.setState({
            billDate: onlinePayData.billDate,
            payAccountAccountNumber: onlinePayData.payAccountAccountNumber, // 付款方账号
            supplierId: onlinePayData.supplierId, // 供应商
            payeeId: onlinePayData.payeeId, // 收款方（财务组织）
            payeeAccount: onlinePayData.payeeAccount, // 收款方账户
            paymentModeId: onlinePayData.paymentModeId, // 支付方式
            currencyName: onlinePayData.currencyName, // 币种名称
            paymentAmount: onlinePayData.paymentAmount, //付款金额
            paymentTypeId: onlinePayData.paymentTypeId, //付款类型
          });
          const payBillItemSet = onlinePayData.payBillItemSet;
          if (payBillItemSet && payBillItemSet.length > 0) {
            // const newBillDetailDto = payBillItemSet.filter(item => !!item.orderCode);
            dispatch({
              type: "paymentNotice/payBillItemSet",
              payBillItemSet: newBillDetailDto
            });
          }
        }
      });
    }
  }
  componentDidMount() {
    const {
      dispatch
    } = this.props;
    // 获取付款方
    dispatch({
      type: "paymentNotice/getPayAccountData",
      payload: null
    });
    // 获取供应商
    dispatch({
      type: "paymentNotice/getSupplierData",
      payload: null
    });
    // 获取支付方式
    dispatch({
      type: "paymentNotice/getPayData",
      payload: null
    });
    // 获取收款业务类型
    dispatch({
      type: "paymentNotice/getBillreceiptTypeData",
      payload: {
        search_EQ_isEnable: 1,
        page: 0,
        size: 100
      }
    });
  }
  handleSave = (row) => {
    const {
      dispatch,
      billreceiptTypeData
    } = this.props;
    const newData = [...this.state.dataSource];
    const index = newData.findIndex(item => row.key === item.key);
    const item = newData[index];
    const bindex = billreceiptTypeData.findIndex(bitem => item.paymentType === bitem.id);
    item.paymentTypeName = billreceiptTypeData[bindex].name;
    row.paymentTypeName = billreceiptTypeData[bindex].name;
    newData.splice(index, 1, {
      ...item,
      ...row,
    });
    this.setState({
      dataSource: newData
    });
    dispatch({
      type: "paymentNotice/payBillItemSet",
      payBillItemSet: this.state.dataSource
    });
    this.sumItemAmount(this.state.paymentAmount, this.state.dataSource);
  }
  addItemsInfo() {
    const {
      count,
      dataSource
    } = this.state;
    const {
      dispatch
    } = this.props;
    const newData = {
      key: count,
      paymentTypeName: '请选择...',
      paymentType: '请选择...',
      amount: 0,
    };
    this.setState({
      dataSource: [...dataSource, newData],
      count: count + 1,
    });
    dispatch({
      type: "paymentNotice/payBillItemSet",
      payBillItemSet: this.state.dataSource
    });
    this.sumItemAmount(this.state.paymentAmount, dataSource);
  }
  cancelHandle() {
    const {
      dispatch
    } = this.props;
    dispatch(
      routerRedux.push({
        pathname: "/buyer/onlinePayList",
      })
    );
  }
  delItemHandle = (record) => {
    const {
      dispatch
    } = this.props;
    const dataSource = [...this.state.dataSource];
    this.setState({
      dataSource: dataSource.filter(item => item.key !== record.key)
    });
    dispatch({
      type: "paymentNotice/payBillItemSet",
      payBillItemSet: dataSource
    });
    this.sumItemAmount(this.state.paymentAmount, dataSource);
  }
  saveHandle(type) {
    const {
      dispatch,
      onlinePayData = {},
      payBillItemSet
    } = this.props;
    const {
      billDate,
      payAccountAccountNumber, // 付款方账号
      supplierId, // 供应商
      payeeId, // 收款方（财务组织）
      payeeAccount, // 收款方账户
      paymentModeId, // 支付方式
      currencyName, // 币种名称
      paymentAmount, //付款金额
      paymentTypeId, //付款类型
      dataSource, //子表集合
    } = this.state;
    const postData = {
      billDate: billDate, //支付单据日期
      supplierId: supplierId, // 供应商
      payeeId: payeeId, //收款方（财务组织）
      payeeAccount: payeeAccount, // 收款方账户
      paymentModeId: paymentModeId, // 支付方式
      currencyName: currencyName, // 币种
      paymentAmount: paymentAmount, //付款金额
      paymentTypeId: paymentTypeId, //付款业务类型
      payAccountAccountNumber: payAccountAccountNumber, //付款方账号
    };
    // 表体数据处理
    let newBillDetailDto = [];
    if (payBillItemSet && payBillItemSet.length > 0) {
      newBillDetailDto = payBillItemSet.concat([]);
    }
    const sum = newBillDetailDto.reduce((total, curr) => {
      return total + parseFloat(curr.amount);
    }, 0);
    if(!payeeAccount){
      message.error("请输入收款方账号！");
      return false;
    }
    if(!paymentModeId){
      message.error("请输入支付方式！");
      return false;
    }
    if(!paymentTypeId){
      message.error("请输入付款业务类型！");
      return false;
    }
    if (paymentAmount < sum) {
      message.error("付款金额不能小于付款信息的合计金额！");
      return false;
    } else if (paymentAmount > sum) {
      const newRow = {
        id: "",
        amount: paymentAmount - sum
      };
      newBillDetailDto.push(newRow);
    }
    newBillDetailDto.forEach((item, index) => {
      item.serialnum = `${index + 1}0`;
      item.persistStatus = item.id ? "upd" : "new";
    });
    // 表头数据处理
    const newOnlinePayData = Object.assign({}, onlinePayData, postData);
    newOnlinePayData.payBillItemSet = newBillDetailDto;
    // 表头状态标识
    if (newOnlinePayData.id) {
      newOnlinePayData.persistStatus = "upd";
    } else {
      newOnlinePayData.persistStatus = "new";
    }
    // const msg = this.validSaveData(newOnlinePayData);
    // if (msg) {
    //   message.error(msg);
    //   return false;
    // }
    this.setState({
      loading: true
    });
    dispatch({
      type: "paymentNotice/saveOnlinePay",
      payload: newOnlinePayData
    }).finally(() => {
      this.setState({
        loading: false
      });
      const {
        dispatch,
        returnOnlinePayData
      } = this.props;
      if (returnOnlinePayData && returnOnlinePayData.id) {
        notification.success({
          message: type == "submit" ? "提交成功" : "保存成功",
          description: `2秒后跳转到支付单列表页`,
          duration: 2
        });
        setTimeout(() => {
          dispatch(routerRedux.push("/buyer/onlinePayList"));
        }, 2000);
      } else {
        notification.error({
          message: type == "submit" ? "提交失败" : "保存失败",
          description: `保存失败! || ""}`,//：${returnOnlinePayData.message
          duration: 2
        });
      }
    });
  }
  validSaveData(data) {
    let msg = "";
    if (!data.supplierId) {
      msg += "供应商不能为空！";
    }
    if (parseFloat(data.paymentAmount || "0") < 0) {
      msg += "付款金额不能小于0！";
    }
    return msg;
  }
  // 日期改变
  dateChange(field, date, datestring) {
    this.setState({
      [`${field}`]: datestring
    });
  }
  // 下拉框值改变
  selectChange(field, value) {
    this.setState({
      [`${field}`]: value
    });
    // 付款方发生变化时，自动带出付款方账号
    // if (field == "payAccountId" && value) {
    //   this.payAccountLinkEvent(value);
    // }
    // 供应商发生变化时，联动事件
    if (field == "supplierId" && value) {
      this.saleOrgLinkEvent(value);
    }
    // 收款方（财务组织)变化时，联动事件
    if (field == "payeeId" && value) {
      this.financeOrgLinkEvent(value);
    }
  }
  // 付款方发生变化时，自动带出付款方账号
  // payAccountLinkEvent(value) {
  //   const {
  //     payAccountData
  //   } = this.props;
  //   if (payAccountData && value) {
  //     const findData = payAccountData.find(item => item.id == value);
  //     if (findData && findData.accountNumber) {
  //       this.setState({
  //         payAccountAccountNumber: findData.accountNumber
  //       });
  //     }
  //   }
  // }
  // 供应商发生变化时，联动事件
  saleOrgLinkEvent(value) {
    const {
      dispatch
    } = this.props;
    // 先清空收款方（财务组织）、收款账号信息，表体信息
    dispatch({
      type: "paymentNotice/finanorgsBySaleorgDataDistinct",
      finanorgsBySaleorgDataDistinct: []
    });
    dispatch({
      type: "paymentNotice/payBillReceiptAccountData",
      payBillReceiptAccountData: []
    });
    dispatch({
      type: "paymentNotice/payBillItemSet",
      payBillItemSet: []
    });
    this.setState({
      payeeId: "",
      payeeAccount: ""
    });
    // 根据供应商联查收款方（财务组织）
    const saleOrg = [];
    saleOrg.push(value);
    dispatch({
      type: "paymentNotice/getFinanorgsBySaleorgDataDistinct",
      payload: saleOrg
    });
  }
  // 收款方（财务组织)变化时，联动事件
  financeOrgLinkEvent(value) {
    const {
      dispatch
    } = this.props;
    dispatch({
      type: "paymentNotice/payBillReceiptAccountData",
      payBillReceiptAccountData: []
    });
    this.setState({
      payeeAccount: ""
    });
    // 根据收款方（财务组织）查询收款银行账号（企业银行账户）
    dispatch({
      type: "paymentNotice/getEnterprisePayBillAccountsData",
      payload: {
        "payeeId": value,
        paymentModeId:this.state.paymentModeId
      }
    });
  }
  // 字段值改变
  fieldChange(field, e) {
    this.setState({
      [`${field}`]: e.target.value
    });
  }
  // 金额发生变化
  moneyChange(field,e) {
    const {
      payBillItemSet
    } = this.props;
    let val = parseFloat(e.target.value || 0).toFixed(getDefaultCurrency().currencyAmountScale);
    let valStr = val+'';
    this.setState({
      [`${field}`]:valStr
    });
    e.target.value = valStr;
    this.sumItemAmount(val, payBillItemSet, true);
  }
  sumItemAmount(money, items, ifTip) {
    const account = parseFloat(money || "1");
    let sum = 0;
    if (items && items.length > 0) {
      sum = items.reduce((total, curr) => {
        return total + parseFloat(curr.amount);
      }, 0);
    }
    if (account >= sum) {
      this.setState({
        paymentAmount: ifTip ? account : sum
      });
    } else {
      if (ifTip) {
        message.error("付款金额不能小于关联订单的合计金额！");
      }
      this.setState({
        paymentAmount: sum
      });
    }
  }
  render() {
    let {
      onlinePayData
    } = this.props;
    const {
      payAccountAccountNumber,
      dataSource
    } = this.state;

    onlinePayData = onlinePayData || {};
    const disabledDate = current => {
      return current && current.valueOf() <= Date.now() - 86400000;
    };
    // 拼接下拉框选项
    const selectOptionHtml = listData => {
      if (!listData || !listData[0] || listData.length < 1) return null;
      const optionHtmls = listData.map(item => (
        <Select.Option key={item.id} value={item.id}>
          {item.name}
        </Select.Option>
      ));
      return optionHtmls;
    };
    // 支付方式拼接下拉框选项
    const selectOptionHtmlPayment = listData => {
      if (!listData || !listData[0] || listData.length < 1) return null;
      const optionHtmls = listData.map(item => (
        <Select.Option key={item.id} value={item.code}>
          {item.name}
        </Select.Option>
      ));
      return optionHtmls;
    }
    const iptDisabled = true;
    const pagination = false;
    const columns = this.columns.map((col) => {
      if (!col.editable) {
        return col;
      }
      return {
        ...col,
        onCell: record => ({
          record,
          editable: col.editable,
          inputType: col.dataIndex === 'paymentTypeName' ? 'select' : 'number',
          selectList: this.props.billreceiptTypeData,
          dataIndex: col.dataIndex,
          title: col.title,
          handleSave: this.handleSave,
        }),
      };
    });
    const subcomponents = {
      body: {
        row: EditableFormRow,
        cell: EditableCell,
      },
    };
    return (
      <div className={styles.paymentNoticeBox}>
        <Spin spinning={this.state.loading}>
          <div className={styles.paymentHeadBox}>
            <div className={styles.paymentItemBox}>
              <div className={styles.paymentItem}>
                <Row gutter={16}>
                  <Col span={6}>
                    <span className={styles.label}>支付单编号：</span>
                    <Input
                      className={styles.iptBox}
                      style={{ width: "180px" }}
                      value={onlinePayData.paybillCode || ""}
                      disabled={iptDisabled}
                    />
                  </Col>
                  <Col span={6}>
                    <span className={styles.label}>支付单日期：</span>
                    <DatePicker
                      className={styles.datePickerBox}
                      value={moment(this.state.billDate)}
                      disabledDate={disabledDate}
                      onChange={this.dateChange.bind(this)}
                    />
                  </Col>
                  <Col span={6}>
                    <span className={styles.label}>支付方式：</span>
                    <Select
                      className={styles.selectBox}
                      value={this.state.paymentModeId}
                      onChange={this.selectChange.bind(this, "paymentModeId")}
                    >
                      {selectOptionHtmlPayment(this.props.payData)}
                    </Select>
                  </Col>
                  <Col span={6}>
                    <span className={styles.label}>支付币种：</span>
                    <span>{onlinePayData.currencyName || this.state.currencyName}</span>
                  </Col>
                </Row>
              </div>
            </div>
            <div className={styles.paymentItemBox}>
              <p className={styles.paymentItemBoxTitle}>收款方信息</p>
              <div className={styles.paymentItem}>
                <Row gutter={16}>
                  <Col span={6}>
                    <span className={styles.label}>供应商：</span>
                    <Select
                      className={styles.selectBox}
                      value={this.state.supplierId}
                      onChange={this.selectChange.bind(this, "supplierId")}
                    >
                      {selectOptionHtml(this.props.supplierData)}
                    </Select>
                  </Col>
                  <Col span={6}>
                    <span className={styles.label}>收款方：</span>
                    <Select
                      className={styles.selectBox}
                      value={this.state.payeeId}
                      onChange={this.selectChange.bind(this, "payeeId")}
                    >
                      {selectOptionHtml(this.props.finanorgsBySaleorgDataDistinct)}
                    </Select>
                  </Col>
                  <Col span={12}>
                  <span className={styles.label}>收款方账号：</span>
                    <Select
                      className={styles.selectLongBox}
                      value={this.state.payeeAccount}
                      onChange={this.selectChange.bind(this, "payeeAccount")}
                    >
                      {selectOptionHtml(this.props.payBillReceiptAccountData)}
                    </Select>
                  </Col>
                </Row>
              </div>
            </div>
            <div className={styles.paymentItemBox}>
              <p className={styles.paymentItemBoxTitle}>付款业务信息</p>
              <div className={styles.paymentItem}>
                <Row gutter={16}>
                  <Col span={6}>
                    <span className={styles.label}>付款业务类型：</span>
                    <Select
                      className={styles.selectBox}
                      value={this.state.paymentTypeId}
                      onChange={this.selectChange.bind(this, "paymentTypeId")}
                    >
                      {selectOptionHtml(this.props.billreceiptTypeData)}
                    </Select>
                  </Col>
                  <Col span={6}>
                  <span className={`${styles.label} ${styles.labelWeight}`}>付款金额：</span>
                    <Input
                      className={styles.iptBox}
                      placeholder="请输入付款金额"
                      value={this.state.paymentAmount}
                      onChange={this.fieldChange.bind(this, "paymentAmount")}
                      onBlur={this.moneyChange.bind(this,"paymentAmount")}
                    />              
                  </Col>                  
                  <Col span={12}>
                  </Col>
                </Row>
              </div>
            </div>
          </div>
          <div className={styles.paymentBodyBox}>
            <div className={styles.paymentItemBox} style={{ display: this.state.operationType == "detail" ? "none" : "block" }}>
              <Button
                className={styles.addOrderBtn}
                onClick={this.addItemsInfo.bind(this)}
              >
                <Icon type="plus" className={styles.icon} />添加付款信息
              </Button>
            </div>
            <div className={styles.paymentItemBox}>
              <Table 
                components={subcomponents}
                rowClassName={() => 'editable-row'}
                style={{ width: "95%" }}
                columns={columns}
                dataSource={dataSource}
                pagination={pagination}
              />
            </div>
          </div>
          <div className={styles.paymentFooterBox}>
            <div className={styles.paymentItemBox} style={{ display: this.state.operationType == "detail" ? "none" : "block" }}>
              <Popconfirm
                title="是否确定取消？"
                onConfirm={this.cancelHandle.bind(this)}
              >
                <Button className={styles.btn}>取消</Button>
              </Popconfirm>
              {/* <Button
                className={styles.btn}
                onClick={this.saveHandle.bind(this, "save")}
              >
                暂存
              </Button> */}
              <Button
                className={styles.btn}
                onClick={this.saveHandle.bind(this, "submit")}
              >
                提交
              </Button>
            </div>
            <div className={styles.paymentItemBox} style={{ display: this.state.operationType == "detail" ? "block" : "none" }}>
              <Button
                className={styles.btn}
                onClick={this.cancelHandle.bind(this)}
              >
                返回
              </Button>
            </div>
          </div>
        </Spin>
        {/* <OrderListDialog
          title="请选择关联订单"
          saleOrgId={this.state.saleOrgId}
          currencyId={getDefaultCurrency().id}
          onConfirm={this.addItemsInfo.bind(this)}
        /> */}
      </div>
    );
  }
}

export default connect(state => ({
  onlinePayData: state.paymentNotice.onlinePayData,
  payAccountData: state.paymentNotice.payAccountData,
  supplierData: state.paymentNotice.supplierData,
  // finanorgsBySaleorgData: state.paymentNotice.finanorgsBySaleorgData,
  finanorgsBySaleorgDataDistinct: state.paymentNotice.finanorgsBySaleorgDataDistinct,
  payBillReceiptAccountData: state.paymentNotice.payBillReceiptAccountData,
  billreceiptTypeData: state.paymentNotice.billreceiptTypeData,
  billTypeData: state.paymentNotice.billTypeData,
  payData: state.paymentNotice.payData,
  productLineData: state.paymentNotice.productLineData,
  payBillItemSet: state.paymentNotice.payBillItemSet,
  returnOnlinePayData: state.paymentNotice.returnOnlinePayData
}))(OnlinePayEdit);