import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
import { MyModal } from '@/components/MyModal';
import { Apis } from '@/gen/Apis';
import {
  HouseOrdersOrderStatusEnum,
  HouseOrdersPaymentMethodEnum,
} from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';

export default function TaskShow(props: MyBetaModalFormProps) {
  const navigate = useNavigate();
  return (
    <MyModal
      title={props.title || '查看'}
      type={props.item?.type || 'primary'}
      width="1000px"
      node={
        <ProTable
          {...MyProTableProps.props}
          request={async (params, sort) =>
            MyProTableProps.request(
              { ...params, house_orders_id: props?.item?.id },
              sort,
              Apis.HouseOrder.HouseOrderPayments.List,
            )
          }
          // options={false}
          columns={[
            MyColumns.ID(),
            MyColumns.EnumTag({
              title: '支付状态',
              dataIndex: 'payment_status',
              valueEnum: HouseOrdersOrderStatusEnum,
            }),
            MyColumns.EnumTag({
              title: '支付方式',
              dataIndex: 'payment_method',
              valueEnum: HouseOrdersPaymentMethodEnum,
            }),
            {
              title: '账单金额',
              dataIndex: 'amount',
              render: (value: any) => `${value / 100}元`,
              search: false,
            },
            {
              title: '实际金额',
              dataIndex: 'actual_amount',
              render: (value: any) => `${value / 100}元`,
              search: false,
            },

            {
              title: '支付人',
              render: (record: any) =>
                `${record?.customer?.name || ''}${
                  record?.customer?.phone || ''
                }`,

              search: false,
            },
            {
              title: '备注',
              dataIndex: 'remark',
              search: false,
            },
            {
              title: '支付单号',
              dataIndex: 'payment_no',
              search: false,
            },
            MyColumns.UpdatedAt(),
          ]}
        />
      }
    />
  );
}
