李志伟 3 年之前
父節點
當前提交
9bda658a33

+ 13
- 6
config/routes.js 查看文件

@@ -129,6 +129,13 @@ export default [
129 129
         access: 'orderjob',
130 130
         component: './OrderManage',
131 131
       },
132
+      {
133
+        path: '/OrderManage/dispatch.jsx',
134
+        name: '调度详情',
135
+        access: 'orderjob',
136
+        component: './OrderManage/dispatch.jsx',
137
+        hideInMenu: true,
138
+      },
132 139
       {
133 140
         path: '/OrderManage/JobWarning/index.jsx',
134 141
         name: '预警监管',
@@ -156,12 +163,12 @@ export default [
156 163
         access: 'st-work',
157 164
         component: './JobStatistics/Job',
158 165
       },
159
-      {
160
-        path: '/JobStatistics/RevenueExpenditure',
161
-        name: '收支统计',
162
-        access: 'st-finance',
163
-        component: './JobStatistics/RevenueExpenditure',
164
-      },
166
+      // {
167
+      //   path: '/JobStatistics/RevenueExpenditure',
168
+      //   name: '收支统计',
169
+      //   access: 'st-finance',
170
+      //   component: './JobStatistics/RevenueExpenditure',
171
+      // },
165 172
     ],
166 173
   },
167 174
   {

+ 29
- 0
src/components/Money/index.jsx 查看文件

@@ -0,0 +1,29 @@
1
+import { InputNumber } from "antd"
2
+import { useEffect, useState } from "react"
3
+
4
+export default (props) => {
5
+
6
+  const { value, onChange, ...leftProps } = props
7
+
8
+  const [money, setMoney] = useState(0)
9
+
10
+  useEffect(() => {
11
+    setMoney(value / 100)
12
+  }, [value])
13
+
14
+  const handleChange = (val) => {
15
+    onChange(Math.floor(val * 100))
16
+  }
17
+
18
+  return (
19
+    <InputNumber
20
+      min='0'
21
+      {...leftProps}
22
+      value={money}
23
+      onChange={handleChange}
24
+      precision={2}
25
+      formatter={value => `¥ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
26
+      parser={value => value.replace(/\¥\s?|(,*)/g, '')}
27
+    />
28
+  )
29
+}

+ 1
- 0
src/pages/Feedback/index.jsx 查看文件

@@ -60,6 +60,7 @@ export default () => {
60 60
       title: '反馈内容',
61 61
       dataIndex: 'content',
62 62
       key: 'content',
63
+      ellipsis: true,
63 64
     },
64 65
     {
65 66
       title: '创建时间',

+ 98
- 1
src/pages/JobStatistics/Order/index.jsx 查看文件

@@ -1,3 +1,100 @@
1
+import React from 'react';
2
+import { history } from 'umi';
3
+import { Button } from 'antd';
4
+import { getOrderList } from '@/services/order';
5
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
+import moment from 'moment';
7
+import PageTable from '@/components/PageTable';
8
+
9
+const formatterTime = (val) => {
10
+  return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '';
11
+};
12
+const getDispatch = (val) => {
13
+  history.push(`./dispatch.jsx?id=${val}`);
14
+}
1 15
 export default (props) => {
2
-  return <div>订单统计</div>;
16
+  const columns = [
17
+    {
18
+      title: '机构名',
19
+      dataIndex: 'orgName',
20
+      key: 'orgName',
21
+    },
22
+    {
23
+      title: '农机名',
24
+      dataIndex: 'machineryName',
25
+      key: 'machineryName',
26
+    },
27
+    {
28
+      title: '农机型号',
29
+      dataIndex: 'typeName',
30
+      key: 'typeName',
31
+    },
32
+    {
33
+      title: '需求时间',
34
+      dataIndex: 'appointmentDate',
35
+      key: 'appointmentDate',
36
+    },
37
+    {
38
+      title: '作业面积',
39
+      dataIndex: 'amount',
40
+      key: 'amount',
41
+      search: false,
42
+    },
43
+    {
44
+      title: '费用',
45
+      dataIndex: 'charges',
46
+      key: 'charges',
47
+      render: (t) => t / 100,
48
+      search: false
49
+    },
50
+    {
51
+      title: '下单时间',
52
+      dataIndex: 'createDate',
53
+      key: 'createDate',
54
+      search: false,
55
+      render: (t) => formatterTime(t),
56
+      width: 200,
57
+    },
58
+    {
59
+      title: '调度状态',
60
+      dataIndex: 'dispatchStatus',
61
+      key: 'dispatchStatus',
62
+      valueType: 'select',
63
+      valueEnum: {
64
+        '': { text: '不限', status: 'Default' },
65
+        0: { text: '待调度' },
66
+        1: { text: '已调度' }
67
+      },
68
+    },
69
+    // {
70
+    //   title: '操作',
71
+    //   valueType: 'option',
72
+    //   render: (_, record) => [
73
+    //     <Button
74
+    //       style={{ padding: 0 }}
75
+    //       type="link"
76
+    //       key={2}
77
+    //       onClick={() => getDispatch(record.orderId)}
78
+    //     >
79
+    //       调度
80
+    //     </Button>
81
+    //   ],
82
+    // },
83
+    //操作如果是需求多台机器则需调度 状态为待确认时 状态栏显示调度按钮跳到调度页面
84
+    // 如果是申请退款 则出现处理按钮 显示需求时间 如果未到则退款并且改变已分配农机手状态和农机状态
85
+    // 如果已经服务过了 则可以打电话给农户咨询具体情况看是否退部分款项
86
+  ];
87
+
88
+  return (
89
+    <PageHeaderWrapper>
90
+      <PageTable
91
+        request={getOrderList}
92
+        // expfunc={exportPersonList}
93
+        columns={columns}
94
+        rowKey="orderId"
95
+        options={false}
96
+        scroll={{ x: 1000 }}
97
+      />
98
+    </PageHeaderWrapper>
99
+  );
3 100
 };

+ 4
- 17
src/pages/Machinery/Machinery/edit.jsx 查看文件

@@ -4,6 +4,7 @@ import { history } from 'umi';
4 4
 import ProCard from '@ant-design/pro-card';
5 5
 import ExtendContent from '@/components/ExtendContent';
6 6
 import { UploadImage, UploadImageList } from '@/components/Upload';
7
+import Money from '@/components/Money';
7 8
 import { addMachinery, updateMachinery, getMachineryDetail } from '@/services/machinery';
8 9
 import { getMachineryTypeList } from '@/services/machineryType';
9 10
 import { getRegionList } from '@/services/region';
@@ -89,7 +90,7 @@ export default (props) => {
89 90
     });
90 91
     if (id) {
91 92
       getMachineryDetail(id).then((res) => {
92
-        form.setFieldsValue({ ...res, buyDate: moment(res.buyDate, 'YYYY-MM-DD') });
93
+        form.setFieldsValue({ ...res, buyDate: res.buyDate ? moment(res.buyDate, 'YYYY-MM-DD') : null });
93 94
       });
94 95
     }
95 96
   }, [id]);
@@ -156,22 +157,8 @@ export default (props) => {
156 157
                 ))}
157 158
               </Select>
158 159
             </FormItem>
159
-            <FormItem label="价格" name="price" rules={[{ required: true, message: '请输入价格' }]}>
160
-              <InputNumber placeholder="请输入价格" style={{ width: '350px' }} />
161
-            </FormItem>
162
-            <FormItem
163
-              label="押金"
164
-              name="deposit"
165
-              rules={[{ required: true, message: '请输入押金' }]}
166
-            >
167
-              <InputNumber placeholder="请输入押金" style={{ width: '350px' }} />
168
-            </FormItem>
169
-            <FormItem
170
-              label="人工费"
171
-              name="laborCost"
172
-              rules={[{ required: true, message: '请输入人工费' }]}
173
-            >
174
-              <InputNumber placeholder="请输入人工费" style={{ width: '350px' }} />
160
+            <FormItem label="单价" name="price" rules={[{ required: true, message: '请输入价格' }]}>
161
+              <Money style={{ width: '350px' }} />
175 162
             </FormItem>
176 163
             <FormItem label="购买时间" name="buyDate">
177 164
               <DatePicker format="YYYY-MM-DD" onChange={onDateChange} style={{ width: '350px' }} />

+ 2
- 13
src/pages/Machinery/Machinery/index.jsx 查看文件

@@ -90,21 +90,10 @@ export default (props) => {
90 90
       search: false,
91 91
     },
92 92
     {
93
-      title: '农机价',
93
+      title: '农机价',
94 94
       dataIndex: 'price',
95 95
       key: 'price',
96
-      search: false,
97
-    },
98
-    {
99
-      title: '人工费',
100
-      dataIndex: 'laborCost',
101
-      key: 'laborCost',
102
-      search: false,
103
-    },
104
-    {
105
-      title: '押金',
106
-      dataIndex: 'deposit',
107
-      key: 'deposit',
96
+      render: (t) => t / 100,
108 97
       search: false,
109 98
     },
110 99
     {

+ 93
- 0
src/pages/OrderManage/dispatch.jsx 查看文件

@@ -0,0 +1,93 @@
1
+import React, { useState } from 'react';
2
+import { Card, Form, Input, Button, Select } from 'antd';
3
+import ProCard from '@ant-design/pro-card';
4
+
5
+import { getMachineryList } from '@/services/machinery';
6
+import { history } from 'umi';
7
+import { getUserList } from '@/services/user';
8
+import { useEffect } from 'react';
9
+
10
+const FormItem = Form.Item;
11
+const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
12
+const { Option } = Select;
13
+const goBack = () => {
14
+  history.goBack();
15
+};
16
+export default (props) => {
17
+  const { location } = props;
18
+  const { id } = location.query;
19
+  const [order, setOrder] = useState();
20
+  const [loading, setLoading] = useState(false);
21
+  const [machineryList, setMachineryList] = useState([]);
22
+  const [userList, setUserList] = useState([])
23
+  const submit = () => {
24
+    console.log(order)
25
+  };
26
+  const changeMachinery = (e) => {
27
+    setOrder({ ...order, machineryId: e })
28
+  }
29
+  const changeUser = (e) => {
30
+    setOrder({ ...order, userId: e })
31
+  }
32
+  useEffect(() => {
33
+    console.log(id)
34
+
35
+    getMachineryList({ pageSize: 999 }).then((res) => {
36
+      setMachineryList(res.records)
37
+    })
38
+    getUserList().then(res => {
39
+      setUserList(res.records)
40
+    })
41
+  }, [])
42
+  return (
43
+    <Card>
44
+      <ProCard tabs={{ type: 'card' }}>
45
+        <ProCard.TabPane key={1} tab="订单调度">
46
+          <Form {...formItemLayout}>
47
+            <FormItem label="客户姓名">
48
+              {order?.name}
49
+            </FormItem>
50
+            <FormItem label="联系电话">
51
+              {order?.phone}
52
+            </FormItem>
53
+            <FormItem label="预约地址">
54
+              {order?.address}
55
+            </FormItem>
56
+            <FormItem label="预约时间">
57
+              {order?.atime}
58
+            </FormItem>
59
+            <FormItem label="农机类型">
60
+              {order?.typeName}
61
+            </FormItem>
62
+            <FormItem label="农机">
63
+              <Select placeholder="请选择" value={order?.machineryId} onChange={changeMachinery} allowClear style={{ width: '350px' }}>
64
+                {machineryList.map((item) => (
65
+                  <Option value={item.machineryId} key={item.machineryId}>
66
+                    {item.name}
67
+                  </Option>
68
+                ))}
69
+              </Select>
70
+            </FormItem>
71
+            <FormItem label="农机手">
72
+              <Select placeholder="请选择" value={order?.userId} onChange={changeUser} allowClear style={{ width: '350px' }}>
73
+                {userList.map((item) => (
74
+                  <Option value={item.userId} key={item.userId}>
75
+                    {item.userName}
76
+                  </Option>
77
+                ))}
78
+              </Select>
79
+            </FormItem>
80
+            <FormItem label=" " colon={false}>
81
+              <Button type="default" onClick={() => goBack()}>
82
+                返回
83
+              </Button>
84
+              <Button type="primary" loading={loading} onClick={submit} style={{ marginLeft: '4em' }}>
85
+                保存
86
+              </Button>
87
+            </FormItem>
88
+          </Form>
89
+        </ProCard.TabPane>
90
+      </ProCard>
91
+    </Card>
92
+  );
93
+};

+ 45
- 41
src/pages/OrderManage/index.jsx 查看文件

@@ -1,5 +1,7 @@
1 1
 import React from 'react';
2
-// import { getPersonList, exportPersonList } from '@/services/person';
2
+import { history } from 'umi';
3
+import { Button } from 'antd';
4
+import { getOrderList } from '@/services/order';
3 5
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
4 6
 import moment from 'moment';
5 7
 import PageTable from '@/components/PageTable';
@@ -7,13 +9,15 @@ import PageTable from '@/components/PageTable';
7 9
 const formatterTime = (val) => {
8 10
   return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '';
9 11
 };
10
-
12
+const getDispatch = (val) => {
13
+  history.push(`./dispatch.jsx?id=${val}`);
14
+}
11 15
 export default (props) => {
12 16
   const columns = [
13 17
     {
14
-      title: '订单编号',
15
-      dataIndex: 'orderNum',
16
-      key: 'orderNum',
18
+      title: '机构名',
19
+      dataIndex: 'orgName',
20
+      key: 'orgName',
17 21
     },
18 22
     {
19 23
       title: '农机名',
@@ -22,59 +26,59 @@ export default (props) => {
22 26
     },
23 27
     {
24 28
       title: '农机型号',
25
-      dataIndex: 'type',
26
-      key: 'type',
27
-    },
28
-    {
29
-      title: '农机数量',
30
-      dataIndex: 'machineryNum',
31
-      key: 'machineryNum',
29
+      dataIndex: 'typeName',
30
+      key: 'typeName',
32 31
     },
33 32
     {
34 33
       title: '需求时间',
35
-      dataIndex: 'appointment_date',
36
-      key: 'appointment_date',
34
+      dataIndex: 'appointmentDate',
35
+      key: 'appointmentDate',
37 36
     },
38 37
     {
39
-      title: '农机价格',
40
-      dataIndex: 'price',
41
-      key: 'price',
38
+      title: '作业面积',
39
+      dataIndex: 'amount',
40
+      key: 'amount',
42 41
       search: false,
43 42
     },
44 43
     {
45
-      title: '押金',
46
-      dataIndex: 'deposit',
47
-      key: 'deposit',
44
+      title: '费用',
45
+      dataIndex: 'charges',
46
+      key: 'charges',
47
+      render: (t) => t / 100,
48
+      search: false
48 49
     },
49 50
     {
50
-      title: '费用',
51
-      dataIndex: 'laborCost',
52
-      key: 'laborCost',
51
+      title: '下单时间',
52
+      dataIndex: 'createDate',
53
+      key: 'createDate',
54
+      search: false,
55
+      render: (t) => formatterTime(t),
56
+      width: 200,
53 57
     },
54 58
     {
55
-      title: '状态',
56
-      dataIndex: 'state',
57
-      key: 'state',
59
+      title: '调度状态',
60
+      dataIndex: 'dispatchStatus',
61
+      key: 'dispatchStatus',
58 62
       valueType: 'select',
59 63
       valueEnum: {
60 64
         '': { text: '不限', status: 'Default' },
61
-        1: { text: '未付款' },
62
-        2: { text: '已付款' },
63
-        3: { text: '待确认' },
64
-        4: { text: '进行中' },
65
-        5: { text: '待评价' },
66
-        6: { text: '已评价' },
67
-        7: { text: '申请退款' },
68
-        8: { text: '已退款' },
65
+        0: { text: '待调度' },
66
+        1: { text: '已调度' }
69 67
       },
70 68
     },
71 69
     {
72
-      title: '下单时间',
73
-      dataIndex: 'createDate',
74
-      key: 'createDate',
75
-      search: false,
76
-      render: (t) => formatterTime(t),
77
-      width: 200,
70
+      title: '操作',
71
+      valueType: 'option',
72
+      render: (_, record) => [
73
+        <Button
74
+          style={{ padding: 0 }}
75
+          type="link"
76
+          key={1}
77
+          onClick={() => getDispatch(record.orderId)}
78
+        >
79
+          调度
80
+        </Button>
81
+      ],
78 82
     },
79 83
     //操作如果是需求多台机器则需调度 状态为待确认时 状态栏显示调度按钮跳到调度页面
80 84
     // 如果是申请退款 则出现处理按钮 显示需求时间 如果未到则退款并且改变已分配农机手状态和农机状态
@@ -84,7 +88,7 @@ export default (props) => {
84 88
   return (
85 89
     <PageHeaderWrapper>
86 90
       <PageTable
87
-        // request={getPersonList}
91
+        request={getOrderList}
88 92
         // expfunc={exportPersonList}
89 93
         columns={columns}
90 94
         rowKey="orderId"

+ 8
- 0
src/services/order.js 查看文件

@@ -0,0 +1,8 @@
1
+import request from '@/utils/request';
2
+
3
+/**
4
+ * 查询订单列表
5
+ * @param {*} params
6
+ * @returns
7
+ */
8
+export const getOrderList = (params) => request('/order', { params });