xujing 4 年前
父节点
当前提交
1d569b5337

+ 51
- 52
src/components/uploadImage/Upload.jsx 查看文件

@@ -1,81 +1,80 @@
1 1
 import React from 'react';
2
-import { Upload, Icon, message, Modal } from 'antd';
2
+import { Upload, Icon, Modal } from 'antd';
3 3
 import './style.less';
4 4
 import { uploaderProps } from '../../utils/upload';
5 5
 
6
-
7
-
8
-class ImageUpload extends React.Component {
9
-
6
+/**
7
+ * unlimited  属性表示上传图片无限制
8
+ * 例子: <ImageListUpload unlimited/>
9
+ */
10
+class ImageListUpload extends React.Component {
10 11
   state = {
11
-    loading: false,
12 12
     previewVisible: false,
13 13
     previewImage: '',
14
-    fileList: this.getPropsFileList(),
14
+    loadding: false,
15 15
   };
16 16
 
17
-  componentDidUpdate(prevProps) {
18
-    // 直接 setState 会死循环
19
-    if (prevProps.value !== this.props.value) {
20
-      this.setState({ fileList: this.getPropsFileList() })
21
-    }
22
-  }
23
-
24
-  getPropsFileList() {
25
-    return !this.props.value ? [] : [{
26
-      uid: '-1',
27
-      name: 'image.png',
28
-      status: 'done',
29
-      url: this.props.value,
30
-    }]
17
+  getFileList = () => {
18
+    return (this.props.value || []).map((img, inx) => ({ uid: inx, url: img, status: 'done' }))
31 19
   }
32 20
 
33
-
34
-  handleChange = ({ file, fileList }) => {
35
-    const { status, response } = file
36
-    this.setState({ fileList, loading: status === "uploading" })
37
-
38
-    if (typeof this.props.onChange === 'function' && status != "uploading") {
39
-      const image = status === 'done' ? response : undefined
40
-      this.props.onChange(image);
41
-    }
42
-  };
43
-
44 21
   handleCancel = () => this.setState({ previewVisible: false });
45 22
 
46 23
   handlePreview = async file => {
47
-    console.log(file)
48 24
     this.setState({
49
-      previewImage: file.url,
25
+      previewImage: file.url ,
50 26
       previewVisible: true,
51 27
     });
52 28
   };
53 29
 
30
+  handleChange = (e) => {
31
+    if (e.file.status === "uploading") {
32
+      this.setState({ loading: true });
33
+      return;
34
+    }
35
+
36
+    const fileList = (this.props.value || []).filter(x => x != e.file.url);
37
+    this.props.onChange(fileList);
38
+
39
+  };
40
+
41
+  handleUploadSucess = (url) => {
42
+    this.setState({ loading: false });
43
+    if (typeof this.props.onChange === 'function') {
44
+      const fileList = this.props.value || [];
45
+      this.props.onChange([...fileList, url]);
46
+    }
47
+  }
48
+
54 49
   render() {
50
+    const { previewVisible, previewImage } = this.state;
51
+    const fileList = this.getFileList();
52
+
55 53
     const uploadButton = (
56 54
       <div>
57
-        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"} />
55
+        <Icon style={{ fontSize: '2em', color: '#aaa' }} type={this.state.loading ? "loading" : "plus"}  />
58 56
       </div>
59 57
     );
60
-
61 58
     return (
62
-      <>
63
-      <Upload
64
-        {...uploaderProps}
65
-        listType="picture-card"
66
-        className="avatar-uploader"
67
-        onChange={this.handleChange}
68
-        fileList={this.state.fileList}
69
-        onPreview={this.handlePreview}
70
-      >
71
-        {this.state.fileList.length >= 6 ? null : uploadButton}  
72
-      </Upload>
73
-      <Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
74
-      <img alt="example" style={{ width: '100%' }} src={this.state.previewImage} />
75
-      </Modal>
76
-      </>
59
+      <div className="clearfix">
60
+        <Upload
61
+          listType="picture-card"
62
+          multiple={true}
63
+          fileList={fileList}
64
+          onPreview={this.handlePreview}
65
+          onChange={this.handleChange}
66
+          { ...uploaderProps }
67
+          onSuccess={this.handleUploadSucess}
68
+        >
69
+          {/* unlimited 表示上传无限制数量 */}
70
+          {(this.props.unlimited && uploadButton) || ((fileList || images).length >= 6 ? null : uploadButton)}
71
+        </Upload>
72
+        <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
73
+          <img alt="example" style={{ width: '100%' }} src={previewImage} />
74
+        </Modal>
75
+      </div>
77 76
     );
78 77
   }
79 78
 }
80 79
 
81
-export default ImageUpload;
80
+export default ImageListUpload;

+ 3
- 2
src/pages/fundManagement/AccountManagement.jsx 查看文件

@@ -10,6 +10,7 @@ import { fetch, apis } from '../../utils/request';
10 10
 import request from '../../utils/request';
11 11
 import AuthButton from '@/components/AuthButton';
12 12
 import Recharge from './components/Recharge'
13
+import Refund from './components/Refund'
13 14
 
14 15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 16
 
@@ -102,8 +103,8 @@ function header(props) {
102 103
             render: (x, row) => (
103 104
                 <>
104 105
                     <span style={{ color: '#FF925C', cursor: 'pointer', marginRight: '16px', display: 'inline-block' }}><Recharge orgId={row.orgId} accountId={row.accountId} /></span>
105
-                    <span style={{ color: '#FF925C', cursor: 'pointer' }} >
106
-                        退款
106
+                    <span style={{ color: '#FF925C', cursor: 'pointer', display: 'inline-block' }} >
107
+                        <Refund orgId={row.orgId} accountId={row.accountId} realBalance={row.realBalance || '0'} />
107 108
                     </span>
108 109
                 </>
109 110
             ),

+ 18
- 0
src/pages/fundManagement/RechargeOrder.jsx 查看文件

@@ -128,7 +128,22 @@ function header(props) {
128 128
         props.form.resetFields();
129 129
         getList({ pageNum: 1, pageSize: 10, orderType: 'recharge' })
130 130
     }
131
+    // 导出
132
+    const exportList = () => {
131 133
 
134
+        request({ ...apis.fund.orderExport, params: { orderType: 'recharge', ...props.form.getFieldsValue() } }).then(data => {
135
+            if (!data) {
136
+                return
137
+            }
138
+            const url = window.URL.createObjectURL(new Blob([data]))
139
+            const link = document.createElement('a')
140
+            link.style.display = 'none'
141
+            link.href = url
142
+            link.setAttribute('download', '充值订单表.xlsx')
143
+            document.body.append(link)
144
+            link.click()
145
+        }).catch()
146
+    }
132 147
     const { getFieldDecorator } = props.form
133 148
     return (
134 149
 
@@ -184,6 +199,9 @@ function header(props) {
184 199
           </Button>
185 200
                 </Form.Item>
186 201
             </Form>
202
+            <div>
203
+                <Button type="danger" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={() => exportList()} >导出</Button>
204
+            </div>
187 205
             <Table rowKey={r => r.tradeNo} dataSource={data.records} columns={columns} pagination={false} />
188 206
             <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
189 207
                 <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />

+ 1
- 6
src/pages/fundManagement/components/Recharge.jsx 查看文件

@@ -31,11 +31,6 @@ const SelectContact = props => {
31 31
 
32 32
 
33 33
 
34
-
35
-    const handleSubmit = (e) => {
36
-
37
-
38
-    }
39 34
     const handleOk = (e) => {
40 35
         props.form.validateFieldsAndScroll((err, values) => {
41 36
             console.log(values, "valuesvaluesvaluesvaluesvaluesvaluesvalues")
@@ -67,7 +62,7 @@ const SelectContact = props => {
67 62
             >
68 63
                 <div>
69 64
                     <p style={{ color: 'red' }}>请先进行线下实际充值操作后再执行线上充值存档</p>
70
-                    <Form {...formItemLayout} onSubmit={handleSubmit}>
65
+                    <Form {...formItemLayout} >
71 66
 
72 67
                         <Form.Item label="充值金额" >
73 68
                             {getFieldDecorator('rechargeAmount', {

+ 89
- 0
src/pages/fundManagement/components/Refund.jsx 查看文件

@@ -0,0 +1,89 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Modal, Button, Table, message, Input, Icon, Pagination } from 'antd';
3
+import XForm, { FieldTypes } from '../../../components/XForm';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import router from 'umi/router';
7
+import Upload from '../../../components/uploadImage/Upload'
8
+
9
+const { Column, ColumnGroup } = Table;
10
+
11
+const formItemLayout = {
12
+    labelCol: {
13
+        xs: { span: 6 },
14
+        sm: { span: 6 },
15
+    },
16
+    wrapperCol: {
17
+        xs: { span: 18 },
18
+        sm: { span: 18 },
19
+    },
20
+};
21
+
22
+const SelectContact = props => {
23
+
24
+    const [data, setData] = useState([]);
25
+    const [visible, setVisible] = useState(false);
26
+    const [group, setGroup] = useState({ groupId: undefined, groupName: '退款' })
27
+
28
+    useEffect(() => {
29
+
30
+    }, [props.value])
31
+
32
+
33
+    const handleOk = (e) => {
34
+        props.form.validateFieldsAndScroll((err, values) => {
35
+            console.log(values, "valuesvaluesvaluesvaluesvaluesvaluesvalues")
36
+            if (!err) {
37
+                request({ ...apis.fund.recharge, urlData: { id: props.accountId || '' }, data: { ...values, orgId: props.orgId } }).then((data) => {
38
+                    message.info("操作成功")
39
+                    setVisible(false)
40
+                })
41
+            }
42
+        });
43
+
44
+
45
+    }
46
+
47
+    const { getFieldDecorator } = props.form;
48
+    return (
49
+        <div>
50
+            <span onClick={() => setVisible(true)}>{group.groupName}</span>
51
+
52
+            <Modal
53
+                visible={visible}
54
+                title="确认退款"
55
+                onOk={() => handleOk()}
56
+                onCancel={() => setVisible(false)}
57
+                footer={[
58
+                    <Button key="back" size="large" onClick={() => setVisible(false)}>取消</Button>,
59
+                    <Button key="submit" type="primary" size="large" onClick={() => handleOk()}>确认</Button>,
60
+                ]}
61
+            >
62
+                <div>
63
+                    <p style={{ color: 'red' }}>请先进行线下实际退款操作后再执行线上退款存档</p>
64
+                    <Form {...formItemLayout} >
65
+
66
+                        <Form.Item label="充值金额" >
67
+                            {getFieldDecorator('rechargeAmount', {
68
+                                rules: [{ required: true, message: '退款金额不能为空' },
69
+                                { max: 20 }],
70
+                            })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
71
+                        </Form.Item>
72
+                        <div style={{marginBottom:'25px'}}><span style={{ width: '25%', display: 'inline-block', textAlign: 'right' }}>余额:</span>{props.realBalance}元</div>
73
+                        <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
74
+                            {getFieldDecorator('certificateList', {
75
+                                rules: [{ required: false }],
76
+                            })(
77
+                                <Upload />,
78
+                            )}
79
+                        </Form.Item>
80
+                    </Form>
81
+                </div>
82
+
83
+            </Modal>
84
+        </div>
85
+    )
86
+}
87
+
88
+const WrappedRegistrationForm = Form.create()(SelectContact);
89
+export default WrappedRegistrationForm;

+ 5
- 0
src/services/apis.js 查看文件

@@ -253,6 +253,11 @@ const apis = {
253 253
       method: 'GET',
254 254
       action: 'channel',
255 255
     },
256
+    orderExport: {
257
+      url: `${prefix}/taOrgOrder/orgOrderExport`,
258
+      method: 'GET',
259
+      action: 'channel',
260
+    },
256 261
 
257 262
   },
258 263
   relatedOrganization: {