浏览代码

Merge branch 'dev' of http://git.ycjcjy.com/estateagents/pc-channel into dev

# Conflicts:
#	src/pages/fundManagement/RefundOrder.jsx
魏超 4 年前
父节点
当前提交
5f41726e9f

+ 7
- 6
src/pages/fundManagement/AccountDetail.jsx 查看文件

12
 import ConsumeOrder from './ConsumeOrder';
12
 import ConsumeOrder from './ConsumeOrder';
13
 import RefundOrder from './RefundOrder';
13
 import RefundOrder from './RefundOrder';
14
 import Recharge from './components/Recharge'
14
 import Recharge from './components/Recharge'
15
+import { regFenToYuan } from '@/utils/money';
15
 
16
 
16
 function header(props) {
17
 function header(props) {
17
     const orgId = props.location.query.id || ''
18
     const orgId = props.location.query.id || ''
57
             label: '总充值金额',
58
             label: '总充值金额',
58
             name: 'recharge',
59
             name: 'recharge',
59
             type: FieldTypes.Message,
60
             type: FieldTypes.Message,
60
-            value: newsData.totalRechargeAmount || '0',
61
+            value: regFenToYuan(newsData.totalRechargeAmount) || '0',
61
             help: '对账请在充值订单中查看充值状态为“已支付”的充值记录',
62
             help: '对账请在充值订单中查看充值状态为“已支付”的充值记录',
62
         },
63
         },
63
         {
64
         {
64
             label: '已消费金额',
65
             label: '已消费金额',
65
             name: 'consume',
66
             name: 'consume',
66
             type: FieldTypes.Message,
67
             type: FieldTypes.Message,
67
-            value: newsData.purchaseAmount || '0',
68
+            value: regFenToYuan(newsData.purchaseAmount) || '0',
68
             help: '对账请在充值订单中查看充值状态为“成功”的充值记录',
69
             help: '对账请在充值订单中查看充值状态为“成功”的充值记录',
69
         },
70
         },
70
         {
71
         {
71
             label: '已退款金额',
72
             label: '已退款金额',
72
             name: 'refund',
73
             name: 'refund',
73
             type: FieldTypes.Message,
74
             type: FieldTypes.Message,
74
-            value: newsData.totalRefund || '0',
75
+            value: regFenToYuan(newsData.totalRefund) || '0',
75
             help: '对账请在充值订单中查看充值状态为“已退款”的退款记录',
76
             help: '对账请在充值订单中查看充值状态为“已退款”的退款记录',
76
         },
77
         },
77
         {
78
         {
78
             label: '退款冻结金额',
79
             label: '退款冻结金额',
79
             name: 'consume',
80
             name: 'consume',
80
             type: FieldTypes.Message,
81
             type: FieldTypes.Message,
81
-            value: newsData.refundBlockedAmonut || '0',
82
+            value: regFenToYuan(newsData.refundBlockedAmonut) || '0',
82
             help: '对账请在充值订单中查看充值状态为“已申请”的退款记录',
83
             help: '对账请在充值订单中查看充值状态为“已申请”的退款记录',
83
         },
84
         },
84
         {
85
         {
85
             label: '账户余额',
86
             label: '账户余额',
86
             name: 'consume',
87
             name: 'consume',
87
             type: FieldTypes.Message,
88
             type: FieldTypes.Message,
88
-            value: newsData.realBalance || '0',
89
+            value: regFenToYuan(newsData.realBalance) || '0',
89
             help: '对账户余额=总充值金额-已消费金额-已退款额-退款冻结额',
90
             help: '对账户余额=总充值金额-已消费金额-已退款额-退款冻结额',
90
         },
91
         },
91
     ]
92
     ]
110
                             <Button htmlType="submit" type="primary" style={{ marginRight: '10%' }}>
111
                             <Button htmlType="submit" type="primary" style={{ marginRight: '10%' }}>
111
                                 <Recharge orgId={newsData.orgId || ''} onClick={() => getDetail(orgId)} accountId={newsData.accountId || ''} />
112
                                 <Recharge orgId={newsData.orgId || ''} onClick={() => getDetail(orgId)} accountId={newsData.accountId || ''} />
112
                             </Button>
113
                             </Button>
113
-                            <Button >返回</Button>
114
+                            <Button onClick={() => router.go(-1)}>返回</Button>
114
                         </div>
115
                         </div>
115
                     </div>
116
                     </div>
116
                 }
117
                 }

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

11
 import AuthButton from '@/components/AuthButton';
11
 import AuthButton from '@/components/AuthButton';
12
 import Recharge from './components/Recharge'
12
 import Recharge from './components/Recharge'
13
 import Refund from './components/Refund'
13
 import Refund from './components/Refund'
14
+import { regFenToYuan } from '@/utils/money';
14
 
15
 
15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16
 
17
 
75
             dataIndex: 'totalRechargeAmount',
76
             dataIndex: 'totalRechargeAmount',
76
             key: 'totalRechargeAmount',
77
             key: 'totalRechargeAmount',
77
             align: 'center',
78
             align: 'center',
79
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
78
         },
80
         },
79
         {
81
         {
80
             title: '已消费金额',
82
             title: '已消费金额',
81
             dataIndex: 'purchaseAmount',
83
             dataIndex: 'purchaseAmount',
82
             key: 'purchaseAmount',
84
             key: 'purchaseAmount',
83
             align: 'center',
85
             align: 'center',
86
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
84
         },
87
         },
85
         {
88
         {
86
             title: '已退款金额',
89
             title: '已退款金额',
87
             dataIndex: 'totalRefund',
90
             dataIndex: 'totalRefund',
88
             key: 'totalRefund',
91
             key: 'totalRefund',
89
             align: 'center',
92
             align: 'center',
93
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
90
         },
94
         },
91
         {
95
         {
92
             title: '余额',
96
             title: '余额',
93
             dataIndex: 'realBalance',
97
             dataIndex: 'realBalance',
94
             key: 'realBalance',
98
             key: 'realBalance',
95
             align: 'center',
99
             align: 'center',
100
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
96
         },
101
         },
97
         {
102
         {
98
             title: '操作',
103
             title: '操作',
102
             width: '120px',
107
             width: '120px',
103
             render: (x, row) => (
108
             render: (x, row) => (
104
                 <>
109
                 <>
105
-                    <span style={{ color: '#FF925C', cursor: 'pointer', marginRight: '16px', display: 'inline-block' }}><Recharge  onClick={() => getList({ pageNum: 1, pageSize: 10 })} orgId={row.orgId} accountId={row.accountId} /></span>
110
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginRight: '16px', display: 'inline-block' }}><Recharge onClick={handleReset} orgId={row.orgId} accountId={row.accountId} /></span>
106
                     <span style={{ color: '#FF925C', cursor: 'pointer', display: 'inline-block' }} >
111
                     <span style={{ color: '#FF925C', cursor: 'pointer', display: 'inline-block' }} >
107
-                        <Refund orgId={row.orgId} accountId={row.accountId} onClick={() => getList({ pageNum: 1, pageSize: 10 })}  realBalance={row.realBalance || '0'} />
112
+                        <Refund orgId={row.orgId} accountId={row.accountId} onClick={handleReset} realBalance={row.realBalance || '0'} />
108
                     </span>
113
                     </span>
109
                 </>
114
                 </>
110
             ),
115
             ),

+ 3
- 1
src/pages/fundManagement/ConsumeOrder.jsx 查看文件

9
 import { fetch, apis } from '../../utils/request';
9
 import { fetch, apis } from '../../utils/request';
10
 import request from '../../utils/request';
10
 import request from '../../utils/request';
11
 import AuthButton from '@/components/AuthButton';
11
 import AuthButton from '@/components/AuthButton';
12
+import { regFenToYuan } from '@/utils/money';
12
 
13
 
13
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
 
15
 
87
             dataIndex: 'amount',
88
             dataIndex: 'amount',
88
             key: 'amount',
89
             key: 'amount',
89
             align: 'center',
90
             align: 'center',
91
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
90
 
92
 
91
         },
93
         },
92
         {
94
         {
146
             submitValue.startDate = null
148
             submitValue.startDate = null
147
             submitValue.endDate = null
149
             submitValue.endDate = null
148
         }
150
         }
149
-        request({ ...apis.fund.consumeOrderExport, params: { itemType: 'redPacket', orgId, ...submitValue } }).then(data => {
151
+        request({ ...apis.fund.consumeOrderExport, params: { orderType: 'redPacket', orgId, ...submitValue } }).then(data => {
150
             if (!data) {
152
             if (!data) {
151
                 return
153
                 return
152
             }
154
             }

+ 3
- 1
src/pages/fundManagement/RechargeOrder.jsx 查看文件

9
 import { fetch, apis } from '../../utils/request';
9
 import { fetch, apis } from '../../utils/request';
10
 import request from '../../utils/request';
10
 import request from '../../utils/request';
11
 import AuthButton from '@/components/AuthButton';
11
 import AuthButton from '@/components/AuthButton';
12
+import { regFenToYuan } from '@/utils/money';
12
 
13
 
13
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
 
15
 
86
             dataIndex: 'amount',
87
             dataIndex: 'amount',
87
             key: 'amount',
88
             key: 'amount',
88
             align: 'center',
89
             align: 'center',
90
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
89
 
91
 
90
         },
92
         },
91
         {
93
         {
139
             submitValue.startDate = null
141
             submitValue.startDate = null
140
             submitValue.endDate = null
142
             submitValue.endDate = null
141
         }
143
         }
142
-        request({ ...apis.fund.rechargeOrderExport, params: { itemType: 'recharge', orgId, ...submitValue } }).then(data => {
144
+        request({ ...apis.fund.rechargeOrderExport, params: { orderType: 'recharge', orgId, ...submitValue } }).then(data => {
143
             if (!data) {
145
             if (!data) {
144
                 return
146
                 return
145
             }
147
             }

+ 4
- 2
src/pages/fundManagement/RefundOrder.jsx 查看文件

10
 import request from '../../utils/request';
10
 import request from '../../utils/request';
11
 import AuthButton from '@/components/AuthButton';
11
 import AuthButton from '@/components/AuthButton';
12
 import Swiper from './components/Swiper';
12
 import Swiper from './components/Swiper';
13
+import { regFenToYuan } from '@/utils/money';
13
 
14
 
14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
 
16
 
102
             dataIndex: 'amount',
103
             dataIndex: 'amount',
103
             key: 'amount',
104
             key: 'amount',
104
             align: 'center',
105
             align: 'center',
106
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
105
         },
107
         },
106
         {
108
         {
107
             title: '退款创建时间',
109
             title: '退款创建时间',
122
             dataIndex: 'auditResult',
124
             dataIndex: 'auditResult',
123
             key: 'auditResult',
125
             key: 'auditResult',
124
             align: 'center',
126
             align: 'center',
125
-            render: (x, row) => <>{row.tradingStatus == '2' && <span>{row.auditResult}</span>}</>
127
+            render: (x, row) => <>{row.tradingStatus == 'fail' && <span>{row.auditResult}</span>}</>
126
         },
128
         },
127
         {
129
         {
128
             title: '退款凭证',
130
             title: '退款凭证',
242
             submitValue.startDate = null
244
             submitValue.startDate = null
243
             submitValue.endDate = null
245
             submitValue.endDate = null
244
         }
246
         }
245
-        request({ ...apis.fund.refundOrderExport, params: { itemType: 'refund', orgId, ...submitValue } }).then(data => {
247
+        request({ ...apis.fund.refundOrderExport, params: { orderType: 'refund', orgId, ...submitValue } }).then(data => {
246
             if (!data) {
248
             if (!data) {
247
                 return
249
                 return
248
             }
250
             }

+ 11
- 3
src/pages/fundManagement/components/Recharge.jsx 查看文件

34
     const handleOk = (e) => {
34
     const handleOk = (e) => {
35
         props.form.validateFieldsAndScroll((err, values) => {
35
         props.form.validateFieldsAndScroll((err, values) => {
36
             console.log(values, "valuesvaluesvaluesvaluesvaluesvaluesvalues")
36
             console.log(values, "valuesvaluesvaluesvaluesvaluesvaluesvalues")
37
+
37
             if (!err) {
38
             if (!err) {
38
                 request({ ...apis.fund.recharge, urlData: { id: props.accountId || '' }, data: { ...values, orgId: props.orgId } }).then((data) => {
39
                 request({ ...apis.fund.recharge, urlData: { id: props.accountId || '' }, data: { ...values, orgId: props.orgId } }).then((data) => {
39
                     message.info("操作成功")
40
                     message.info("操作成功")
47
     }
48
     }
48
 
49
 
49
     const { getFieldDecorator } = props.form;
50
     const { getFieldDecorator } = props.form;
51
+    const regMoney = /^(\d+|\d+\.\d{1,2})$/;
50
     return (
52
     return (
51
         <div>
53
         <div>
52
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
54
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
67
 
69
 
68
                         <Form.Item label="充值金额" >
70
                         <Form.Item label="充值金额" >
69
                             {getFieldDecorator('rechargeAmount', {
71
                             {getFieldDecorator('rechargeAmount', {
70
-                                rules: [{ required: true, message: '充值金额不能为空' },
71
-                                { max: 20 }],
72
-                            })(<Input type='number' placeholder="支持2位小数" />)}
72
+                                rules: [
73
+                                    { required: true, message: '充值金额不能为空' },
74
+                                    {
75
+                                        validator: (rule, value, callback) => {
76
+                                            callback(value < 0.01 || value > 99999.99 ? '金额最多5位整数 2位小数' : !regMoney.test(value) ? '金额最多两位小数' : undefined)
77
+                                        }
78
+                                    }
79
+                                ],
80
+                            })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
73
                         </Form.Item>
81
                         </Form.Item>
74
 
82
 
75
                         <Form.Item label="充值凭证" help="可上传银行转账截图等作为查账线索">
83
                         <Form.Item label="充值凭证" help="可上传银行转账截图等作为查账线索">

+ 14
- 4
src/pages/fundManagement/components/Refund.jsx 查看文件

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Modal, Button, Table, message, Input, Icon, Pagination } from 'antd';
2
+import { Form, Modal, Button, Table, message, Input, InputNumber, Icon, Pagination } from 'antd';
3
 import XForm, { FieldTypes } from '../../../components/XForm';
3
 import XForm, { FieldTypes } from '../../../components/XForm';
4
 import request from '../../../utils/request';
4
 import request from '../../../utils/request';
5
 import apis from '../../../services/apis';
5
 import apis from '../../../services/apis';
6
 import router from 'umi/router';
6
 import router from 'umi/router';
7
 import Upload from '../../../components/uploadImage/Upload'
7
 import Upload from '../../../components/uploadImage/Upload'
8
+import { regFenToYuan } from '@/utils/money';
8
 
9
 
9
 const { Column, ColumnGroup } = Table;
10
 const { Column, ColumnGroup } = Table;
10
 
11
 
46
     }
47
     }
47
 
48
 
48
     const { getFieldDecorator } = props.form;
49
     const { getFieldDecorator } = props.form;
50
+    const balance = regFenToYuan(props.realBalance)
51
+    const regMoney = /^(\d+|\d+\.\d{1,2})$/;
49
     return (
52
     return (
50
         <div>
53
         <div>
51
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
54
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
64
                     <p style={{ color: 'red' }}>请先进行线下实际退款操作后再执行线上退款存档</p>
67
                     <p style={{ color: 'red' }}>请先进行线下实际退款操作后再执行线上退款存档</p>
65
                     <Form {...formItemLayout} >
68
                     <Form {...formItemLayout} >
66
 
69
 
67
-                        <Form.Item label="充值金额" >
70
+                        <Form.Item label="退款金额" >
68
                             {getFieldDecorator('refundAmount', {
71
                             {getFieldDecorator('refundAmount', {
69
                                 rules: [{ required: true, message: '退款金额不能为空' },
72
                                 rules: [{ required: true, message: '退款金额不能为空' },
70
-                                { max: 20 }],
73
+                                {
74
+                                    validator: (rule, value, callback) => {
75
+
76
+                                        callback(!regMoney.test(value) ? '金额最多两位小数' : value > balance.toString() ? '退款金额不能大于余额' : value < 0.01 ? '金额不得小于0.01' : undefined)
77
+
78
+                                    }
79
+                                }
80
+                                ],
71
                             })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
81
                             })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
72
                         </Form.Item>
82
                         </Form.Item>
73
-                        <div style={{ marginBottom: '25px' }}><span style={{ width: '25%', display: 'inline-block', textAlign: 'right' }}>余额:</span>{props.realBalance}元</div>
83
+                        <div style={{ marginBottom: '25px' }}><span style={{ width: '25%', display: 'inline-block', textAlign: 'right' }}>余额:</span>{balance}元</div>
74
                         <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
84
                         <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
75
                             {getFieldDecorator('certificateList', {
85
                             {getFieldDecorator('certificateList', {
76
                                 rules: [{ required: false }],
86
                                 rules: [{ required: false }],

+ 37
- 32
src/pages/fundManagement/components/Swiper.jsx 查看文件

1
 import React, { useEffect } from "react";
1
 import React, { useEffect } from "react";
2
-import Swiper from 'swiper';
2
+// import Swiper from 'swiper';
3
 import styles from './style.less'
3
 import styles from './style.less'
4
 import classNames from 'classnames';
4
 import classNames from 'classnames';
5
 import closeImg from '../../../assets/close.png';
5
 import closeImg from '../../../assets/close.png';
6
-import 'swiper/css/swiper.min.css';
7
-
6
+// import 'swiper/css/swiper.min.css';
7
+import { Carousel } from 'antd';
8
 
8
 
9
 const swiper = ({ list, onClose }) => {
9
 const swiper = ({ list, onClose }) => {
10
 
10
 
11
     useEffect(() => {
11
     useEffect(() => {
12
-        if (list.length > 0) {
13
-            //swiper初始化
14
-            if (list.length > 1) {
15
-                this.swiper = new Swiper('.swiper-container', {
16
-                    slidesPerView: 1,
17
-                    loop: true,
18
-                    autoplay: {
19
-                        disableOnInteraction: false,
20
-                    },
21
-                    touchRatio: 1.5,
22
-                    pagination: {
23
-                        el: '.swiper-pagination',
24
-                        bulletElement: 'li',
25
-                        clickable: true,
26
-                        bulletActiveClass: 'antd-pro-pages-swiper-style-active',
27
-                    },
28
-                    observer: true,//修改swiper自己或子元素时,自动初始化swiper
29
-                    observeParents: true,//修改swiper的父元素时,自动初始化swiper
30
-                })
31
-            } else {
32
-                this.swiper = new Swiper('.swiper-container', {
33
-                    loop: false,
34
-                    observer: true,//修改swiper自己或子元素时,自动初始化swiper
35
-                    observeParents: true,//修改swiper的父元素时,自动初始化swiper
36
-                })
37
-            }
12
+        // if (list.length > 0) {
13
+        //     //swiper初始化
14
+        //     if (list.length > 1) {
15
+        //         this.swiper = new Swiper('.swiper-container', {
16
+        //             slidesPerView: 1,
17
+        //             loop: true,
18
+        //             autoplay: {
19
+        //                 disableOnInteraction: false,
20
+        //             },
21
+        //             touchRatio: 1.5,
22
+        //             pagination: {
23
+        //                 el: '.swiper-pagination',
24
+        //                 bulletElement: 'li',
25
+        //                 clickable: true,
26
+        //                 bulletActiveClass: 'antd-pro-pages-swiper-style-active',
27
+        //             },
28
+        //             observer: true,//修改swiper自己或子元素时,自动初始化swiper
29
+        //             observeParents: true,//修改swiper的父元素时,自动初始化swiper
30
+        //         })
31
+        //     } else {
32
+        //         this.swiper = new Swiper('.swiper-container', {
33
+        //             loop: false,
34
+        //             observer: true,//修改swiper自己或子元素时,自动初始化swiper
35
+        //             observeParents: true,//修改swiper的父元素时,自动初始化swiper
36
+        //         })
37
+        //     }
38
 
38
 
39
-        }
39
+        // }
40
     }, [])
40
     }, [])
41
 
41
 
42
     return (
42
     return (
44
             {list.length > 0 && <div className={styles.mask}>
44
             {list.length > 0 && <div className={styles.mask}>
45
                 <div className={styles.content}>
45
                 <div className={styles.content}>
46
                     <img src={closeImg} alt="" className={styles.close} onClick={onClose} />
46
                     <img src={closeImg} alt="" className={styles.close} onClick={onClose} />
47
-                    <div className={classNames(['swiper-container', styles.carousel])}  >
47
+                    <Carousel autoplay>
48
+                        {list.map((item, index) =>
49
+                            <img style={{ width: '100%', height: '100%', borderRadius: '10px' }} src={item} alt="" />
50
+                        )}
51
+                    </Carousel>
52
+                    {/* <div className={classNames(['swiper-container', styles.carousel])}  >
48
                         <div className={classNames(['swiper-wrapper', styles.carousel])} >
53
                         <div className={classNames(['swiper-wrapper', styles.carousel])} >
49
                             {list.map((item, index) =>
54
                             {list.map((item, index) =>
50
                                 <div key={'swiper' + index} className={classNames(['swiper-slide', styles.carouselItem])} >
55
                                 <div key={'swiper' + index} className={classNames(['swiper-slide', styles.carouselItem])} >
53
                             )}
58
                             )}
54
                         </div>
59
                         </div>
55
                         <div className={classNames(['swiper-pagination', styles.dots])}  ></div>
60
                         <div className={classNames(['swiper-pagination', styles.dots])}  ></div>
56
-                    </div>
61
+                    </div> */}
57
                 </div>
62
                 </div>
58
             </div>}
63
             </div>}
59
         </>
64
         </>

+ 32
- 0
src/utils/money.js 查看文件

1
+
2
+const toDecimal2 = (x) => {
3
+    var f = parseFloat(x);
4
+    if (isNaN(f)) {
5
+        return false;
6
+    }
7
+    var f = Math.round(x * 100) / 100;
8
+    var s = f.toString();
9
+    var rs = s.indexOf('.');
10
+    if (rs < 0) {
11
+        rs = s.length;
12
+        s += '.';
13
+    }
14
+    while (s.length <= rs + 2) {
15
+        s += '0';
16
+    }
17
+    return s;
18
+}
19
+export const regFenToYuan = (fen) => {
20
+    var num = fen;
21
+    num = fen * 0.01;
22
+    num += '';
23
+    var reg = num.indexOf('.') > -1 ? /(\d{1,3})(?=(?:\d{3})+\.)/g : /(\d{1,3})(?=(?:\d{3})+$)/g;
24
+    num = num.replace(reg, '$1');
25
+    num = toDecimal2(num)
26
+    return num
27
+}
28
+
29
+export const regYuanToFen = (yuan) => {
30
+
31
+    return yuan * 100
32
+}