import { useAjax } from "@/Hook/useAjax"
import { getSysProductApi, GetSysProductProps } from "@/services/launchAdq/goods"
import { Button, Col, Drawer, Input, Row, Select } from "antd"
import React, { useState } from "react"
import TableData from '../../../../components/TableData'



interface Props {
    visible?: boolean,
    onClose?: () => void,
    onChange?: () => void,
    data?: any
}
/**
 * 商品管理
 * @param props 
 * @returns 
 */
const Commodity: React.FC<Props> = (props) => {

    /*************************/
    const { visible, onClose, onChange, data } = props
    const [queryForm, setQueryFrom] = useState<GetSysProductProps>({ pageNum: 1, pageSize: 20 })

    const getSysProduct = useAjax((params) => getSysProductApi(params))
    /*************************/

    return <Drawer title={data?.catalogName || '' + " 商品库"} placement="right" width={1000} onClose={() => { onClose && onClose() }} open={visible}>
        {/* <TableData
            columns={tableConfig(handle)}
            ajax={getSysProduct}
            dataSource={getSysProduct?.data?.records}
            loading={getSysProduct?.loading}
            scroll={{ y: 600, x: 1500 }}
            total={getSysProduct?.data?.total}
            page={getSysProduct?.data?.current}
            pageSize={getSysProduct?.data?.size}
            leftChild={<>
                <Row gutter={[10, 10]}>
                    <Col span={24}><Button type='primary' onClick={() => {  }}>新建商品模板</Button></Col>
                    <Col>
                        <Input placeholder='商品名称' allowClear value={queryForm?.productName} onChange={(e) => { setQueryFrom({ ...queryForm, productName: e.target.value, pageNum: 1 }) }} />
                    </Col>
                    <Col>
                        <Input placeholder='商品简称' allowClear value={queryForm?.productShortName} onChange={(e) => { setQueryFrom({ ...queryForm, productShortName: e.target.value, pageNum: 1 }) }} />
                    </Col>
                    <Col>
                        <Input placeholder='商品描述' allowClear value={queryForm?.description} onChange={(e) => { setQueryFrom({ ...queryForm, description: e.target.value, pageNum: 1 }) }} />
                    </Col>
                    <Col>
                        <Input placeholder='是否视频商品' allowClear value={queryForm?.description} onChange={(e) => { setQueryFrom({ ...queryForm, description: e.target.value, pageNum: 1 }) }} />
                    </Col>
                </Row>
            </>}
            onChange={(props: any) => {
                let { sortData, pagination } = props
                let { current, pageSize } = pagination
                setQueryFrom({ ...queryForm, pageNum: current, pageSize })
            }}
        /> */}

    </Drawer>
}

export default React.memo(Commodity)