import { DropboxOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Modal } from 'antd';
import React, { useState, useRef } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import { getSplitOrdersList } from './services';

//页面 相当于 class
const PlanManage = () => {
  //绑定
  const actionRef = useRef();

  /** 国际化配置 */

  const columns = [
    {
      title: '主键',
      dataIndex: 'id',
      tip: '规则名称是唯一的 key',
      hideInSearch: true,
      hideInTable: true,
    },
    {
      title: '订单编号',
      dataIndex: 'orderId',
      valueType: 'textarea',
    },
    {
      title: '商户账号',
      dataIndex: 'businessId',
      valueType: 'textarea',
    },
    {
      title: '商户分账金额(分)',
      dataIndex: 'businessPrice',
      valueType: 'textarea',
      hideInSearch: true,
    },
    {
      title: '备注',
      dataIndex: 'remark',
      valueType: 'textarea',
      hideInSearch: true,
    },
    {
      title: '创建时间',
      sorter: true,
      dataIndex: 'createAt',
      valueType: 'dateTime',
      hideInSearch: true,
    },
  ];

  return (
    <PageContainer>
      <ProTable
        headerTitle="分账订单"
        actionRef={actionRef}
        rowKey="id"
        search={{
          labelWidth: 120,
        }}
        columns={columns}
        //数据绑定
        request={async (params) => {
          var data = [];
          var total = 0;
          await getSplitOrdersList(params).then((r) => {
            data = r.data.data;
            total = r.data.total;
          });
          return {
            data: data,
            success: true,
            total: total,
          };
        }}
        // 每行选择点击事件
      ></ProTable>
    </PageContainer>
  );
};

export default PlanManage;
