import React, { FC, useMemo } from 'react' import { Checkbox } from 'antd' import NestTable from './children/NestTable' import { CheckedStatus } from './children/NestTable/type' import './index.scss' type P = { checkable?: boolean //是否开始选择框 checkedStatus?: CheckedStatus productList: Array onChange?(productList) onCheckAll?(checked) } const NestOrderList: FC

= props => { const { checkable, onChange, productList, checkedStatus } = props useMemo(() => { productList }, [productList]) const renderThead = () => { const columns = [ { key: 'product', title: '商品', render: product => { return (

{product.name}

{product.num}

) }, }, { key: 'unitPrice', title: '价格', render: curVal => { const price = curVal.toFixed(2).toString() return '¥' + price.replace(/\B(?=(\d{3})+(?!\d))/g, ',') }, }, { key: 'discount', title: '采购价', }, { key: 'shopNum', title: '数量', }, { key: 'offer', //width: 150, title: '优惠', }, { key: 'price', //width: 150, title: '金额', render: curVal => { const price = curVal.toFixed(2).toString() return '¥' + price.replace(/\B(?=(\d{3})+(?!\d))/g, ',') }, }, ] return columns.map((item, index) => { return (
{item.title}
) }) } return (
{checkable ? (
全选
) : null} {renderThead()}
{!productList || !productList.length ? null : ( )}
) } export default NestOrderList