|
@@ -1,11 +1,187 @@
|
|
import React from 'react'
|
|
import React from 'react'
|
|
|
|
+import type { ActionType } from '@ant-design/pro-table'
|
|
|
|
+import ProTable from '@ant-design/pro-table'
|
|
|
|
+import {Button, Modal, Form, Radio, Input, message, Select, DatePicker, Upload} from 'antd'
|
|
|
|
+import { withRouter } from 'react-router-dom'
|
|
|
|
+import { User } from '../../services/user'
|
|
|
|
+import './index.scss'
|
|
|
|
+import {PlusOutlined} from "@ant-design/icons";
|
|
|
|
|
|
-const CustomerService: React.FC = () => {
|
|
|
|
- return (
|
|
|
|
|
|
+const Complaint: React.FC = (props: any) => {
|
|
|
|
+ const columns: any = [
|
|
|
|
+ {
|
|
|
|
+ title: 'ID',
|
|
|
|
+ dataIndex: 'id',
|
|
|
|
+ search: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '投诉类型',
|
|
|
|
+ dataIndex: 'suggestion_type',
|
|
|
|
+ search: true,
|
|
|
|
+ valueEnum: {
|
|
|
|
+ 1: { text: '投诉' },
|
|
|
|
+ 2: { text: '建议' }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '投诉人',
|
|
|
|
+ dataIndex: 'user_name',
|
|
|
|
+ search: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '联系电话',
|
|
|
|
+ dataIndex: 'user_name',
|
|
|
|
+ search: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '投诉内容',
|
|
|
|
+ dataIndex: 'user_name',
|
|
|
|
+ search: false,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '投诉日期',
|
|
|
|
+ dataIndex: 'user_name',
|
|
|
|
+ search: false,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '状态',
|
|
|
|
+ dataIndex: 'phone',
|
|
|
|
+ search: false,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '操作',
|
|
|
|
+ dataIndex: 'option',
|
|
|
|
+ search: false,
|
|
|
|
+ render: (_, row, index, action) => {
|
|
|
|
+ return [
|
|
|
|
+ <Button
|
|
|
|
+ className="mr-1.5"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ form.setFieldsValue(row)
|
|
|
|
+ setState(prevState => ({
|
|
|
|
+ ...prevState,
|
|
|
|
+ visible: true,
|
|
|
|
+ editId: row.id
|
|
|
|
+ }))
|
|
|
|
+ }}
|
|
|
|
+ >编辑</Button>,
|
|
|
|
+ <Button
|
|
|
|
+ className="mr-1.5"
|
|
|
|
+ onClick={() => {}}
|
|
|
|
+ >派单</Button>,
|
|
|
|
+ <Button
|
|
|
|
+ className="mr-1.5"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ props.history.push('/admin/complaint/detail')
|
|
|
|
+ }}
|
|
|
|
+ >详情</Button>,
|
|
|
|
+ <Button onClick={() => {
|
|
|
|
+ Modal.confirm({
|
|
|
|
+ title: '删除记录',
|
|
|
|
+ content: '你确定删除这条记录吗?',
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ await User({ method: 'delete', id: row.id })
|
|
|
|
+ message.success('操作成功!')
|
|
|
|
+ actionRef.current.reload()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }}>删除</Button>
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ const [pic, setPic]: any = React.useState([])
|
|
|
|
+
|
|
|
|
+ const uploadButton = (
|
|
<div>
|
|
<div>
|
|
- Im客服
|
|
|
|
|
|
+ <PlusOutlined />
|
|
|
|
+ <div style={{ marginTop: 8 }}>上传图片</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
|
|
+ const [state, setState] = React.useState({
|
|
|
|
+ visible: false,
|
|
|
|
+ orderVisible: false,
|
|
|
|
+ editId: null
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const actionRef: any = React.useRef<ActionType>()
|
|
|
|
+ const [form] = Form.useForm()
|
|
|
|
+ const [orderForm] = Form.useForm()
|
|
|
|
+
|
|
|
|
+ const onSubmit = () => {
|
|
|
|
+ form.validateFields().then(async values => {
|
|
|
|
+ await User({
|
|
|
|
+ method: 'post',
|
|
|
|
+ ...values,
|
|
|
|
+ group_id: 11,
|
|
|
|
+ department_id: 0
|
|
|
|
+ })
|
|
|
|
+ message.success('操作成功!')
|
|
|
|
+ form.resetFields()
|
|
|
|
+ actionRef.current?.reloadAndRest()
|
|
|
|
+ setState(prevState => ({ ...prevState, visible: false }))
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <React.Fragment>
|
|
|
|
+ <ProTable
|
|
|
|
+ headerTitle="投诉建议/投诉录入"
|
|
|
|
+ actionRef={actionRef}
|
|
|
|
+ rowKey="key"
|
|
|
|
+ request={User}
|
|
|
|
+ toolBarRender={() => [
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ key="primary"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ setState(preState => ({ ...preState, visible: true }))
|
|
|
|
+ }}
|
|
|
|
+ >添加</Button>
|
|
|
|
+ ]}
|
|
|
|
+ columns={columns}
|
|
|
|
+ />
|
|
|
|
+ <Modal
|
|
|
|
+ title='添加投诉建议'
|
|
|
|
+ visible={state.visible}
|
|
|
|
+ onOk={onSubmit}
|
|
|
|
+ onCancel={() => setState(pre => ({ ...pre, visible: false }))}
|
|
|
|
+ >
|
|
|
|
+ <Form
|
|
|
|
+ labelCol={{ span: 5 }}
|
|
|
|
+ wrapperCol={{ span: 15 }}
|
|
|
|
+ form={form}
|
|
|
|
+ >
|
|
|
|
+ <Form.Item label='投诉类型' name="group_id" rules={[{ required: true }]}>
|
|
|
|
+ <Select placeholder='请选择' options={[
|
|
|
|
+ { label: '投诉', value: 1 },
|
|
|
|
+ { label: '建议', value: 2 },
|
|
|
|
+ ]} />
|
|
|
|
+ </Form.Item>
|
|
|
|
+ <Form.Item label='投诉人' name="user_name" rules={[{ required: true }]}>
|
|
|
|
+ <Input placeholder="请输入" />
|
|
|
|
+ </Form.Item>
|
|
|
|
+ <Form.Item label='联系方式' name="user_name" rules={[{ required: true }]}>
|
|
|
|
+ <Input placeholder="请输入" />
|
|
|
|
+ </Form.Item>
|
|
|
|
+ <Form.Item label='投诉内容' name="user_name" rules={[{ required: true }]}>
|
|
|
|
+ <Input.TextArea placeholder="多行输入" rows={4} />
|
|
|
|
+ </Form.Item>
|
|
|
|
+ <Form.Item label='投诉图片' name="user_name" rules={[{ required: false }]}>
|
|
|
|
+ <Upload
|
|
|
|
+ action="http://localhost:3000/api/v1/upload"
|
|
|
|
+ listType="picture-card"
|
|
|
|
+ fileList={pic}
|
|
|
|
+ onChange={(({ fileList }) => setPic(fileList))}
|
|
|
|
+ >
|
|
|
|
+ { uploadButton }
|
|
|
|
+ </Upload>
|
|
|
|
+ </Form.Item>
|
|
|
|
+ </Form>
|
|
|
|
+ </Modal>
|
|
|
|
+ </React.Fragment>
|
|
|
|
+ )
|
|
}
|
|
}
|
|
|
|
|
|
-export default CustomerService
|
|
|
|
|
|
+export default withRouter(Complaint)
|