李志伟 il y a 3 ans
Parent
révision
bd188c248b

+ 2
- 2
src/components/AMap/SearchPOI.jsx Voir le fichier

@@ -3,7 +3,7 @@ import { useState, useEffect, useRef } from 'react'
3 3
 import loader from './loader'
4 4
 import { newMarker, autoPos, autoPoi } from './utils'
5 5
 
6
-const plugins = ['AMap.Scale', 'AMap.ToolBar', 'AMap.Geolocation', 'AMap.Autocomplete', 'AMap.PlaceSearch']
6
+const plugins = ['AMap.Scale', 'AMap.ToolBar', 'AMap.Geolocation', 'AMap.AutoComplete', 'AMap.PlaceSearch']
7 7
 
8 8
 export default (props) => {
9 9
   const { className, style, onChange, value, setAddress, setLocName, setPkLocName, setParkingAddress, roomBoole } = props
@@ -65,7 +65,7 @@ export default (props) => {
65 65
       instance.on('click', handleClick);
66 66
       map.current = instance
67 67
     }).catch((err) => {
68
-      console.log(err.message)
68
+      console.error(err)
69 69
     });
70 70
   }, [])
71 71
 

+ 27
- 34
src/components/AMap/utils.js Voir le fichier

@@ -1,4 +1,3 @@
1
-
2 1
 const iconNoraml = '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png';
3 2
 const iconActive = '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png';
4 3
 
@@ -8,19 +7,19 @@ export function newMarker(AMap, options = {}) {
8 7
     size: new AMap.Size(25, 34),
9 8
     image: active ? iconActive : iconNoraml,
10 9
     imageSize: new AMap.Size(25, 34),
11
-  })
12
-  const offset = new AMap.Pixel(-13, -30)
10
+  });
11
+  const offset = new AMap.Pixel(-13, -30);
13 12
 
14 13
   return new AMap.Marker({ icon, offset, ...params });
15 14
 }
16 15
 
17 16
 export function autoPos(AMap, options = {}) {
18 17
   return new AMap.Geolocation({
19
-    enableHighAccuracy: true,//是否使用高精度定位,默认:true
20
-    timeout: 10000,          //超过10秒后停止定位,默认:5s
21
-    buttonPosition: 'RB',    //定位按钮的停靠位置
22
-    buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
23
-    zoomToAccuracy: true,   //定位成功后是否自动调整地图视野到定位点
18
+    enableHighAccuracy: true, //是否使用高精度定位,默认:true
19
+    timeout: 10000, //超过10秒后停止定位,默认:5s
20
+    buttonPosition: 'RB', //定位按钮的停靠位置
21
+    buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
22
+    zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点
24 23
     ...options,
25 24
   });
26 25
 }
@@ -30,22 +29,20 @@ const labelStyle = `
30 29
   border-radius: .25rem;
31 30
   background-color: white;
32 31
   box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
33
-`
32
+`;
34 33
 
35 34
 export function autoPoi(map, AMap, inputRef, evt) {
36
-
37
-
38
-  var locationNmae = ''
35
+  var locationNmae = '';
39 36
 
40 37
   const markers = [];
41
-  const input = inputRef.current
38
+  const input = inputRef.current;
42 39
 
43 40
   const destroy = () => {
44 41
     if (markers.length) {
45
-      markers.forEach((m) => map.remove(m))
46
-      markers.splice(0, markers.length)
42
+      markers.forEach((m) => map.remove(m));
43
+      markers.splice(0, markers.length);
47 44
     }
48
-  }
45
+  };
49 46
 
50 47
   const handleSearchResult = (status, result) => {
51 48
     // 先清空
@@ -54,7 +51,7 @@ export function autoPoi(map, AMap, inputRef, evt) {
54 51
     const { pois } = result.poiList;
55 52
     (pois || []).forEach((poi) => {
56 53
       const { location, name } = poi;
57
-      const pos = `${location.lng},${location.lat}`
54
+      const pos = `${location.lng},${location.lat}`;
58 55
 
59 56
       const marker = newMarker(AMap, {
60 57
         map,
@@ -66,31 +63,27 @@ export function autoPoi(map, AMap, inputRef, evt) {
66 63
           name: name,
67 64
           locationNmae: locationNmae,
68 65
           position: pos,
69
-
70
-
71 66
         },
72
-      })
73
-      marker.on('click', evt.click)
74
-      markers.push(marker)
75
-    })
67
+      });
68
+      marker.on('click', evt.click);
69
+      markers.push(marker);
70
+    });
76 71
     // map.setZoom(18);
77 72
     map.setFitView();
78
-  }
73
+  };
79 74
 
80 75
   const placeSearch = new AMap.PlaceSearch({ pageSize: 20 });
81
-  const autoComplete = new AMap.Autocomplete({ input });
82
-
76
+  const autoComplete = new AMap.AutoComplete({ input });
83 77
 
84 78
   // 选择自动填充
85
-  autoComplete.on('select', e => {
86
-    const val = `${e.poi?.district}${e.poi?.address}`
87
-    locationNmae = val
88
-    placeSearch.setCity(e.poi.adcode)
89
-    placeSearch.search(e.poi.name, handleSearchResult)
90
-
91
-  })
79
+  autoComplete.on('select', (e) => {
80
+    const val = `${e.poi?.district}${e.poi?.address}`;
81
+    locationNmae = val;
82
+    placeSearch.setCity(e.poi.adcode);
83
+    placeSearch.search(e.poi.name, handleSearchResult);
84
+  });
92 85
 
93
-  autoComplete.on('error', (err) => console.error(err))
86
+  autoComplete.on('error', (err) => console.error(err));
94 87
 
95 88
   return autoComplete;
96 89
 }

+ 36
- 11
src/pages/Finance/AccountLog/index.jsx Voir le fichier

@@ -1,18 +1,35 @@
1
+import React, { useState, useRef } from 'react';
1 2
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { DatePicker } from 'antd';
2 4
 import moment from 'moment';
3 5
 import PageTable from '@/components/PageTable';
4 6
 import { getAccountLogList } from '@/services/accountLog'
5 7
 
8
+const { RangePicker } = DatePicker;
9
+
6 10
 const formatterTime = (val) => {
7 11
   return val ? moment(val).format('YYYY-MM-DD HH:mm:ss') : '';
8 12
 };
9 13
 
14
+
10 15
 export default (props) => {
16
+  const [start, setStartDate] = useState()
17
+  const [end, setEndDate] = useState()
18
+  const handelChange = (date, dateStrings) => {
19
+    setStartDate(dateStrings[0])
20
+    setEndDate(dateStrings[1])
21
+  }
22
+  const ref = useRef();
23
+  const Reset = () => {
24
+    setStartDate()
25
+    setEndDate()
26
+    ref.current.reload();
27
+  }
11 28
   const columns = [
12 29
     {
13 30
       title: '发生时间',
14
-      dataIndex: 'payDate',
15
-      key: 'payDate',
31
+      dataIndex: 'createDate',
32
+      key: 'createDate',
16 33
       search: false,
17 34
       render: (t) => formatterTime(t),
18 35
     },
@@ -21,11 +38,6 @@ export default (props) => {
21 38
       dataIndex: 'personName',
22 39
       key: 'personName',
23 40
     },
24
-    {
25
-      title: '手机号',
26
-      dataIndex: 'phone',
27
-      key: 'phone',
28
-    },
29 41
     {
30 42
       title: '订单号',
31 43
       dataIndex: 'orderNo',
@@ -50,14 +62,25 @@ export default (props) => {
50 62
         'withdraw': { text: '提现' },
51 63
       },
52 64
     },
65
+    //专门用来搜索
66
+    {
67
+      title: '发生时间',//结束时间
68
+      dataIndex: 'createDate',
69
+      key: 'createDate',
70
+      hideInTable: true,
71
+      render: (t, render) => formatterTime(render.createDate),
72
+      renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD' onChange={handelChange} />
73
+    },
53 74
     {
54 75
       title: '支付方式',
55
-      dataIndex: 'feeType',
56
-      key: 'feeType',
76
+      dataIndex: 'payType',
77
+      key: 'payType',
57 78
       search: false,
58 79
       render: (_, record) => {
59 80
         return record.chargeType === 'order_refund' ? '原路返回' :
60
-          record.chargeType === 'withdraw' ? '银行卡转账' : ''
81
+          record.chargeType === 'withdraw' ? '银行卡转账' :
82
+            record.payType === 'wx' ? '微信' :
83
+              record.payType === 'zfb' ? '支付宝' : ''
61 84
       },
62 85
     },
63 86
     {
@@ -75,12 +98,14 @@ export default (props) => {
75 98
   return (
76 99
     <PageHeaderWrapper>
77 100
       <PageTable
101
+        actionRef={ref}
78 102
         request={getAccountLogList}
79 103
         // expfunc={exportPersonList}
80 104
         columns={columns}
81 105
         rowKey="logId"
82 106
         options={false}
83
-        scroll={{ x: 1500 }}
107
+        params={{ start, end }}
108
+        onReset={Reset}
84 109
       />
85 110
     </PageHeaderWrapper>
86 111
   );

+ 77
- 46
src/pages/Finance/Withdrawal/audit.jsx Voir le fichier

@@ -1,10 +1,11 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Card, Form, Button } from 'antd';
2
+import { Card, Form, Button, message, Input } from 'antd';
3 3
 import ProCard from '@ant-design/pro-card';
4
-import { getWithdrawalDetail } from '@/services/withdrawal'
4
+import { getWithdrawalDetail, updateWithdrawal } from '@/services/withdrawal'
5
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
5 6
 import { history } from 'umi';
6
-import TextArea from 'antd/lib/input/TextArea';
7 7
 
8
+const { TextArea } = Input;
8 9
 const FormItem = Form.Item;
9 10
 const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
10 11
 const goBack = () => {
@@ -15,57 +16,87 @@ export default (props) => {
15 16
   const { id } = location.query;
16 17
   const [withdrawal, setWithdrawal] = useState();
17 18
   const [remarks, setRemarks] = useState()
19
+  const [loading, setLoading] = useState(false)
18 20
 
21
+  const handleAudit = (val) => {
22
+    if (remarks) {
23
+      if (val == 1 && withdrawal.amountLeft < withdrawal.money) {
24
+        message.success('合作社余额小于提现余额时不能提现');
25
+        return
26
+      }
27
+      setLoading(true)
28
+      updateWithdrawal(withdrawal.withdrawalId, { ...withdrawal, auditStatus: val, auditRemark: remarks }).then(() => {
29
+        message.success('操作成功');
30
+        goBack()
31
+      }).catch(err => {
32
+        console.log(err.message)
33
+        setLoading(false)
34
+      })
35
+    }
36
+    else {
37
+      message.success('请输入处理结果');
38
+    }
39
+  }
19 40
   useEffect(() => {
20 41
     getWithdrawalDetail(id).then((res) => {
21 42
       setWithdrawal(res)
43
+      setRemarks(res.auditRemark)
22 44
     }).catch((err) => {
23 45
       console.log(err.message)
24 46
     });
25 47
   }, [id])
26 48
   return (
27
-    <Card>
28
-      <ProCard tabs={{ type: 'card' }}>
29
-        <ProCard.TabPane key={1} tab="提现审批">
30
-          <Form {...formItemLayout}>
31
-            <FormItem label="申请人">
32
-              {withdrawal?.userName}
33
-            </FormItem>
34
-            <FormItem label="联系电话">
35
-              {withdrawal?.phone}
36
-            </FormItem>
37
-            <FormItem label="合作社">
38
-              {withdrawal?.orgName}
39
-            </FormItem>
40
-            <FormItem label="合作社余额">
41
-              {withdrawal?.amountLeft / 100}
42
-            </FormItem>
43
-            <FormItem label="提现银行">
44
-              {withdrawal?.bankCard.ownerBank}
45
-            </FormItem>
46
-            <FormItem label="提现账户">
47
-              {withdrawal?.bankCard.cardNo}
48
-            </FormItem>
49
-            <FormItem label="申请金额">
50
-              {withdrawal?.money / 100}
51
-            </FormItem>
52
-            <FormItem label="处理结果">
53
-              <TextArea placeholder='请输入处理结果(必填)' rows='3' style={{ width: '350px' }} value={remarks} onInput={(e) => { setRemarks(e.detail.value) }} />
54
-            </FormItem>
55
-            <FormItem label=" " colon={false}>
56
-              <Button type="primary" style={{ marginRight: '16px' }} onClick={() => goBack()}>
57
-                同意
58
-              </Button>
59
-              <Button type="primary" style={{ marginRight: '16px' }} onClick={() => goBack()}>
60
-                拒绝
61
-              </Button>
62
-              <Button type="default" onClick={() => goBack()}>
63
-                返回
64
-              </Button>
65
-            </FormItem>
66
-          </Form>
67
-        </ProCard.TabPane>
68
-      </ProCard>
69
-    </Card>
49
+    <PageHeaderWrapper
50
+      extra='合作社余额小于提现余额时不能提现'
51
+    >
52
+      <Card>
53
+        <Form {...formItemLayout}>
54
+          <FormItem label="申请人">
55
+            {withdrawal?.userName}
56
+          </FormItem>
57
+          <FormItem label="联系电话">
58
+            {withdrawal?.phone}
59
+          </FormItem>
60
+          <FormItem label="合作社">
61
+            {withdrawal?.orgName}
62
+          </FormItem>
63
+          <FormItem label="合作社余额">
64
+            {withdrawal?.amountLeft / 100}
65
+          </FormItem>
66
+          <FormItem label="提现银行">
67
+            {withdrawal?.bankCard.ownerBank}
68
+          </FormItem>
69
+          <FormItem label="提现账户">
70
+            {withdrawal?.bankCard.cardNo}
71
+          </FormItem>
72
+          <FormItem label="申请金额">
73
+            {withdrawal?.money / 100}
74
+          </FormItem>
75
+          <FormItem label="处理结果">
76
+            {
77
+              withdrawal?.auditStatus == 0 ?
78
+                <TextArea placeholder='请输入处理结果(必填)' rows='3' style={{ width: '350px' }} value={remarks} onChange={(e) => setRemarks(e.target.value)} /> :
79
+                remarks
80
+            }
81
+          </FormItem>
82
+          <FormItem label=" " colon={false}>
83
+            {
84
+              withdrawal?.auditStatus == 0 &&
85
+              <>
86
+                <Button type="primary" loading={loading} style={{ marginRight: '16px' }} onClick={() => handleAudit(1)}>
87
+                  同意
88
+                </Button>
89
+                <Button type="primary" loading={loading} style={{ marginRight: '16px' }} onClick={() => handleAudit(2)}>
90
+                  拒绝
91
+                </Button>
92
+              </>
93
+            }
94
+            <Button type="default" onClick={() => goBack()}>
95
+              返回
96
+            </Button>
97
+          </FormItem>
98
+        </Form>
99
+      </Card>
100
+    </PageHeaderWrapper>
70 101
   );
71 102
 };

+ 31
- 4
src/pages/Finance/Withdrawal/index.jsx Voir le fichier

@@ -1,4 +1,6 @@
1
+import React, { useState, useRef } from 'react';
1 2
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { DatePicker } from 'antd';
2 4
 import { history } from 'umi';
3 5
 import moment from 'moment';
4 6
 import { Button } from 'antd'
@@ -11,7 +13,20 @@ const formatterTime = (val) => {
11 13
 const goAudit = (val) => {
12 14
   history.push(`./withdrawal/audit.jsx?id=${val.withdrawalId}`);
13 15
 }
16
+const { RangePicker } = DatePicker;
14 17
 export default (props) => {
18
+  const [start, setStartDate] = useState()
19
+  const [end, setEndDate] = useState()
20
+  const handelChange = (date, dateStrings) => {
21
+    setStartDate(dateStrings[0])
22
+    setEndDate(dateStrings[1])
23
+  }
24
+  const ref = useRef();
25
+  const Reset = () => {
26
+    setStartDate()
27
+    setEndDate()
28
+    ref.current.reload();
29
+  }
15 30
   const columns = [
16 31
     {
17 32
       title: '申请时间',
@@ -39,7 +54,7 @@ export default (props) => {
39 54
       key: 'auditStatus',
40 55
       render: (_, record) => {
41 56
         return record.auditStatus === 0 ? '未审批' :
42
-          record.auditStatus === 1 ? '未审批' : '拒绝'
57
+          record.auditStatus === 1 ? '同意' : '拒绝'
43 58
       },
44 59
       valueType: 'select',
45 60
       valueEnum: {
@@ -48,10 +63,19 @@ export default (props) => {
48 63
         '-1': { text: '拒绝' },
49 64
       },
50 65
     },
66
+    //专门用来搜索
67
+    {
68
+      title: '申请时间',
69
+      dataIndex: 'createDate',
70
+      key: 'createDate',
71
+      hideInTable: true,
72
+      render: (t, render) => formatterTime(render.createDate),
73
+      renderFormItem: (_, record) => <RangePicker placeholder={['开始日期', '结束日期']} format='YYYY-MM-DD' onChange={handelChange} />
74
+    },
51 75
     {
52 76
       title: '审批时间',
53
-      dataIndex: 'postedDate',
54
-      key: 'postedDate',
77
+      dataIndex: 'auditDate',
78
+      key: 'auditDate',
55 79
       search: false,
56 80
       render: (t) => t != '-' ? formatterTime(t) : '-',
57 81
     },
@@ -62,7 +86,7 @@ export default (props) => {
62 86
       ellipsis: true,
63 87
       render: (_, record) => [
64 88
         <Button style={{ padding: 0 }} type="link" key={1} onClick={() => goAudit(record)}>
65
-          审批
89
+          详情
66 90
         </Button>,
67 91
       ],
68 92
     },
@@ -71,11 +95,14 @@ export default (props) => {
71 95
   return (
72 96
     <PageHeaderWrapper>
73 97
       <PageTable
98
+        actionRef={ref}
74 99
         request={getWithdrawalList}
75 100
         // expfunc={exportPersonList}
76 101
         columns={columns}
77 102
         rowKey="withdrawalId"
78 103
         options={false}
104
+        params={{ start, end }}
105
+        onReset={Reset}
79 106
       />
80 107
     </PageHeaderWrapper>
81 108
   );

+ 1
- 1
src/pages/JobStatistics/Job/index.jsx Voir le fichier

@@ -126,7 +126,7 @@ export default (props) => {
126 126
       search: false,
127 127
     },
128 128
     {
129
-      title: '作业时间',//结束时间
129
+      title: '作业时间',
130 130
       dataIndex: 'endDate',
131 131
       key: 'endDate',
132 132
       render: (t, render) => formatterTime(render.startDate) + ' ~ ' + formatterTime(render.endDate),