DeliverInfoDrawer.tsx 3.09 KB
import { postDistrictSelOrderProvince } from '@/services';
import { enumValueToLabel } from '@/utils';
import { getReceivingCompanyOptions } from '@/utils/order';
import { Col, Drawer, Row } from 'antd';
import { useEffect, useState } from 'react';
import { PAYEE_OPTIONS } from './constant';

export default ({ data, onClose }) => {
  const [province, setProvince] = useState('');
  const [city, setCity] = useState('');
  const [district, setDistrict] = useState('');

  useEffect(() => {
    const fetchData = async () => {
      if (data.id !== undefined) {
        const resp = await postDistrictSelOrderProvince({
          data: data.id,
        });
        if (resp && resp.data) {
          if (resp.data.province) {
            setProvince(resp.data.province);
          }
          if (resp.data.city) {
            setCity(resp.data.city);
          }
          if (resp.data.district) {
            setDistrict(resp.data.district);
          }
        }
      }
    };

    fetchData();
  }, [data.id]);
  return (
    <>
      <Drawer
        width={500}
        title="基本信息"
        placement="right"
        onClose={onClose}
        open
      >
        <Row gutter={[16, 24]}>
          <Col span={6}>
            <span className="text-[#333333]">收货人</span>
          </Col>
          <Col span={18}>{data.customerName}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">联系方式</span>
          </Col>
          <Col span={18}>{data.customerContactNumber}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">省市区</span>
          </Col>
          <Col span={18}>
            {province}&nbsp;{city}&nbsp;{district}
          </Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">收货地址</span>
          </Col>
          <Col span={18}>{data.customerShippingAddress}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">课题组老师</span>
          </Col>
          <Col span={18}>{data.institutionContactName}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">单位名称</span>
          </Col>
          <Col span={18}>{data.institution}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">开户银行</span>
          </Col>
          <Col span={18}>{data.bank}</Col>

          <Col span={6}>
            <span className="className='text-[#333333]'">开票收款单位</span>
          </Col>
          <Col span={18}>
            {enumValueToLabel(
              data.receivingCompany,
              getReceivingCompanyOptions(PAYEE_OPTIONS),
            )}
          </Col>

          <Col span={6}>
            <span className="className='text-[#333333]'">银行账号</span>
          </Col>
          <Col span={18}>{data.bankAccountNumber}</Col>
          <Col span={6}>
            <span className="className='text-[#333333]'">开票识别号</span>
          </Col>
          <Col span={18}>{data.invoiceIdentificationNumber}</Col>
        </Row>
      </Drawer>
    </>
  );
};