知与行后台管理端

audit.jsx 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. import React, { useState, useEffect } from 'react';
  2. import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Upload, message } from 'antd';
  3. import ImageUpload from '../../../components/XForm/ImageUpload';
  4. import moment from 'moment';
  5. import request from '../../../utils/request';
  6. import apis from '../../../services/apis';
  7. import Styles from './style.less';
  8. import { router } from 'umi';
  9. const { Option } = Select;
  10. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  11. const { Meta } = Card;
  12. const { TextArea } = Input;
  13. const tailFormItemLayout = {
  14. labelCol: {
  15. xs: { span: 20 },
  16. sm: { span: 3 },
  17. },
  18. wrapperCol: {
  19. xs: { span: 20 },
  20. sm: { span: 16 },
  21. },
  22. };
  23. function body(props) {
  24. const { getFieldDecorator } = props.form
  25. // eslint-disable-next-line react-hooks/rules-of-hooks
  26. const [dataSource, setDataSource] = useState({ picture: '' })
  27. const { id } = props.location.query;
  28. if (id !== '') {
  29. // eslint-disable-next-line react-hooks/rules-of-hooks
  30. useEffect(() => {
  31. getById(id)
  32. }, [])
  33. }
  34. // 获取详情信息
  35. function getById(currentId) {
  36. request({ ...apis.customer.recommendGetById, urlData: { id: currentId } }).then(res => {
  37. res.reportDate = moment(res.reportDate)
  38. props.form.setFieldsValue(res)
  39. })
  40. }
  41. function submitDate(params) {
  42. // props.form.setFieldsValue(res)
  43. request({ ...apis.customer.auto, urlData: { id: params.customerId }, params: { verifyStatus: params.verifyStatus } }).then(() => {
  44. // eslint-disable-next-line no-unused-expressions
  45. <Alert
  46. style={{
  47. marginBottom: 24,
  48. }}
  49. message="操作成功"
  50. type="success"
  51. showIcon
  52. />
  53. router.go(-1)
  54. }).catch(err => {
  55. // eslint-disable-next-line no-unused-expressions
  56. <Alert
  57. style={{
  58. marginBottom: 24,
  59. }}
  60. message={err}
  61. type="error"
  62. showIcon
  63. />
  64. })
  65. }
  66. // 提交事件
  67. function handleSubmit(e) {
  68. e.preventDefault();
  69. props.form.validateFields((err, values) => {
  70. if (!err) {
  71. submitDate({ ...values })
  72. }
  73. });
  74. }
  75. // Change 事件
  76. function handleSelectChange(e) {
  77. // eslint-disable-next-line no-console
  78. console.log(e)
  79. }
  80. return (
  81. <>
  82. <Form {...tailFormItemLayout} onSubmit={e => handleSubmit(e)} style={{ width: '800px', margin: 'auto' }}>
  83. <Form.Item label="客户ID" style={{ display: 'none' }}>
  84. {getFieldDecorator('customerId')(
  85. <Input
  86. placeholder="客户ID"
  87. />,
  88. )}
  89. </Form.Item>
  90. <Form.Item label="意向项目:">
  91. {getFieldDecorator('intention')(
  92. <Input
  93. placeholder="意向项目"
  94. />,
  95. )}
  96. </Form.Item>
  97. <Form.Item label="客户照片">
  98. {getFieldDecorator('picture')(
  99. <ImageUpload value={dataSource.picture} />,
  100. )}
  101. </Form.Item>
  102. <Form.Item label="客户姓名">
  103. {getFieldDecorator('name')(
  104. <Input placeholder="客户姓名" />,
  105. )}
  106. </Form.Item>
  107. <Form.Item label="客户电话">
  108. {getFieldDecorator('phone')(
  109. <Input placeholder="客户电话" />,
  110. )}
  111. </Form.Item>
  112. <Form.Item label="客户性别">
  113. {getFieldDecorator('sex')(
  114. <Radio.Group>
  115. <Radio value={1}>男</Radio>
  116. <Radio value={2}>女</Radio>
  117. </Radio.Group>,
  118. )}
  119. </Form.Item>
  120. <Form.Item label="到访人数">
  121. {getFieldDecorator('visiteNum')(
  122. <Input placeholder="到访人数" />,
  123. )}
  124. </Form.Item>
  125. <Form.Item label="客户描述">
  126. {getFieldDecorator('describe')(
  127. <TextArea placeholder="客户描述" rows={10} />,
  128. )}
  129. </Form.Item>
  130. <Form.Item label="物业类型">
  131. {getFieldDecorator('realtyManageType')(
  132. <Input placeholder="物业类型" />,
  133. )}
  134. </Form.Item>
  135. <Form.Item label="需求类型">
  136. {getFieldDecorator('demandType')(
  137. <Input placeholder="需求类型" />,
  138. )}
  139. </Form.Item>
  140. <Form.Item label="价格区间">
  141. {getFieldDecorator('priceRange')(
  142. <Input placeholder="价格区间" />,
  143. )}
  144. </Form.Item>
  145. <Form.Item label="报备日期">
  146. {getFieldDecorator('reportDate')(
  147. <DatePicker showTime placeholder="报备日期" />,
  148. )}
  149. </Form.Item>
  150. <Form.Item label="状态">
  151. {getFieldDecorator('verifyStatus')(
  152. <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
  153. <Option value={0}>未通过</Option>
  154. <Option value={1}>已通过</Option>
  155. <Option value={2}>已驳回</Option>
  156. </Select>,
  157. )}
  158. </Form.Item>
  159. <Form.Item label="归属置业顾问">
  160. <Row gutter={8}>
  161. <Col span={12}>
  162. {getFieldDecorator('consultantName')(<Input placeholder="归属置业顾问" />)}
  163. </Col>
  164. <Col span={12}>
  165. <Button>选择</Button>
  166. </Col>
  167. </Row>
  168. </Form.Item>
  169. <Form.Item style={{ display: 'flex', justifyContent: 'center' }}>
  170. <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
  171. 确定
  172. </Button>
  173. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  174. <Button onClick={() => router.go(-1)}>
  175. 取消
  176. </Button>
  177. </Form.Item>
  178. </Form>
  179. </>
  180. );
  181. }
  182. const WrappedBody = Form.create({ name: 'body' })(body);
  183. export default WrappedBody