Blame view

src/pages/Order/OrderWarning/components/DeliverInfoDrawer.tsx 3.09 KB
1
import { postDistrictSelOrderProvince } from '@/services';
zhongnanhuang authored
2
3
import { enumValueToLabel } from '@/utils';
import { getReceivingCompanyOptions } from '@/utils/order';
zhongnanhuang authored
4
import { Col, Drawer, Row } from 'antd';
5
import { useEffect, useState } from 'react';
boyang authored
6
import { PAYEE_OPTIONS } from '../../constant';
zhongnanhuang authored
7
8

export default ({ data, onClose }) => {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  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]);
zhongnanhuang authored
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  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>
53
54
55
56
57
58
          <Col span={6}>
            <span className="className='text-[#333333]'">省市区</span>
          </Col>
          <Col span={18}>
            {province}&nbsp;{city}&nbsp;{district}
          </Col>
zhongnanhuang authored
59
60
61
62
63
          <Col span={6}>
            <span className="className='text-[#333333]'">收货地址</span>
          </Col>
          <Col span={18}>{data.customerShippingAddress}</Col>
          <Col span={6}>
64
            <span className="className='text-[#333333]'">课题组老师</span>
zhongnanhuang authored
65
66
67
68
69
70
71
72
73
74
75
76
          </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}>
zhongnanhuang authored
77
78
79
80
81
            <span className="className='text-[#333333]'">开票收款单位</span>
          </Col>
          <Col span={18}>
            {enumValueToLabel(
              data.receivingCompany,
zhongnanhuang authored
82
              getReceivingCompanyOptions(PAYEE_OPTIONS),
zhongnanhuang authored
83
            )}
84
85
86
          </Col>

          <Col span={6}>
zhongnanhuang authored
87
88
89
90
91
92
93
94
95
96
97
98
            <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>
    </>
  );
};