Bläddra i källkod

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

# Conflicts:
#	src/pages/fundManagement/RefundOrder.jsx
魏超 4 år sedan
förälder
incheckning
5f41726e9f

+ 7
- 6
src/pages/fundManagement/AccountDetail.jsx Visa fil

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

+ 7
- 2
src/pages/fundManagement/AccountManagement.jsx Visa fil

@@ -11,6 +11,7 @@ import request from '../../utils/request';
11 11
 import AuthButton from '@/components/AuthButton';
12 12
 import Recharge from './components/Recharge'
13 13
 import Refund from './components/Refund'
14
+import { regFenToYuan } from '@/utils/money';
14 15
 
15 16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16 17
 
@@ -75,24 +76,28 @@ function header(props) {
75 76
             dataIndex: 'totalRechargeAmount',
76 77
             key: 'totalRechargeAmount',
77 78
             align: 'center',
79
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
78 80
         },
79 81
         {
80 82
             title: '已消费金额',
81 83
             dataIndex: 'purchaseAmount',
82 84
             key: 'purchaseAmount',
83 85
             align: 'center',
86
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
84 87
         },
85 88
         {
86 89
             title: '已退款金额',
87 90
             dataIndex: 'totalRefund',
88 91
             key: 'totalRefund',
89 92
             align: 'center',
93
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
90 94
         },
91 95
         {
92 96
             title: '余额',
93 97
             dataIndex: 'realBalance',
94 98
             key: 'realBalance',
95 99
             align: 'center',
100
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
96 101
         },
97 102
         {
98 103
             title: '操作',
@@ -102,9 +107,9 @@ function header(props) {
102 107
             width: '120px',
103 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 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 113
                     </span>
109 114
                 </>
110 115
             ),

+ 3
- 1
src/pages/fundManagement/ConsumeOrder.jsx Visa fil

@@ -9,6 +9,7 @@ import styles from './style.less';
9 9
 import { fetch, apis } from '../../utils/request';
10 10
 import request from '../../utils/request';
11 11
 import AuthButton from '@/components/AuthButton';
12
+import { regFenToYuan } from '@/utils/money';
12 13
 
13 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14 15
 
@@ -87,6 +88,7 @@ function header(props) {
87 88
             dataIndex: 'amount',
88 89
             key: 'amount',
89 90
             align: 'center',
91
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
90 92
 
91 93
         },
92 94
         {
@@ -146,7 +148,7 @@ function header(props) {
146 148
             submitValue.startDate = null
147 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 152
             if (!data) {
151 153
                 return
152 154
             }

+ 3
- 1
src/pages/fundManagement/RechargeOrder.jsx Visa fil

@@ -9,6 +9,7 @@ import styles from './style.less';
9 9
 import { fetch, apis } from '../../utils/request';
10 10
 import request from '../../utils/request';
11 11
 import AuthButton from '@/components/AuthButton';
12
+import { regFenToYuan } from '@/utils/money';
12 13
 
13 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14 15
 
@@ -86,6 +87,7 @@ function header(props) {
86 87
             dataIndex: 'amount',
87 88
             key: 'amount',
88 89
             align: 'center',
90
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
89 91
 
90 92
         },
91 93
         {
@@ -139,7 +141,7 @@ function header(props) {
139 141
             submitValue.startDate = null
140 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 145
             if (!data) {
144 146
                 return
145 147
             }

+ 4
- 2
src/pages/fundManagement/RefundOrder.jsx Visa fil

@@ -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 Swiper from './components/Swiper';
13
+import { regFenToYuan } from '@/utils/money';
13 14
 
14 15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 16
 
@@ -102,6 +103,7 @@ function header(props) {
102 103
             dataIndex: 'amount',
103 104
             key: 'amount',
104 105
             align: 'center',
106
+            render: (x, row) => <span>{regFenToYuan(x)}</span>
105 107
         },
106 108
         {
107 109
             title: '退款创建时间',
@@ -122,7 +124,7 @@ function header(props) {
122 124
             dataIndex: 'auditResult',
123 125
             key: 'auditResult',
124 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 130
             title: '退款凭证',
@@ -242,7 +244,7 @@ function header(props) {
242 244
             submitValue.startDate = null
243 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 248
             if (!data) {
247 249
                 return
248 250
             }

+ 11
- 3
src/pages/fundManagement/components/Recharge.jsx Visa fil

@@ -34,6 +34,7 @@ const SelectContact = props => {
34 34
     const handleOk = (e) => {
35 35
         props.form.validateFieldsAndScroll((err, values) => {
36 36
             console.log(values, "valuesvaluesvaluesvaluesvaluesvaluesvalues")
37
+
37 38
             if (!err) {
38 39
                 request({ ...apis.fund.recharge, urlData: { id: props.accountId || '' }, data: { ...values, orgId: props.orgId } }).then((data) => {
39 40
                     message.info("操作成功")
@@ -47,6 +48,7 @@ const SelectContact = props => {
47 48
     }
48 49
 
49 50
     const { getFieldDecorator } = props.form;
51
+    const regMoney = /^(\d+|\d+\.\d{1,2})$/;
50 52
     return (
51 53
         <div>
52 54
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
@@ -67,9 +69,15 @@ const SelectContact = props => {
67 69
 
68 70
                         <Form.Item label="充值金额" >
69 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 81
                         </Form.Item>
74 82
 
75 83
                         <Form.Item label="充值凭证" help="可上传银行转账截图等作为查账线索">

+ 14
- 4
src/pages/fundManagement/components/Refund.jsx Visa fil

@@ -1,10 +1,11 @@
1 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 3
 import XForm, { FieldTypes } from '../../../components/XForm';
4 4
 import request from '../../../utils/request';
5 5
 import apis from '../../../services/apis';
6 6
 import router from 'umi/router';
7 7
 import Upload from '../../../components/uploadImage/Upload'
8
+import { regFenToYuan } from '@/utils/money';
8 9
 
9 10
 const { Column, ColumnGroup } = Table;
10 11
 
@@ -46,6 +47,8 @@ const SelectContact = props => {
46 47
     }
47 48
 
48 49
     const { getFieldDecorator } = props.form;
50
+    const balance = regFenToYuan(props.realBalance)
51
+    const regMoney = /^(\d+|\d+\.\d{1,2})$/;
49 52
     return (
50 53
         <div>
51 54
             <span onClick={() => setVisible(true)}>{group.groupName}</span>
@@ -64,13 +67,20 @@ const SelectContact = props => {
64 67
                     <p style={{ color: 'red' }}>请先进行线下实际退款操作后再执行线上退款存档</p>
65 68
                     <Form {...formItemLayout} >
66 69
 
67
-                        <Form.Item label="充值金额" >
70
+                        <Form.Item label="退款金额" >
68 71
                             {getFieldDecorator('refundAmount', {
69 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 81
                             })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
72 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 84
                         <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
75 85
                             {getFieldDecorator('certificateList', {
76 86
                                 rules: [{ required: false }],

+ 37
- 32
src/pages/fundManagement/components/Swiper.jsx Visa fil

@@ -1,42 +1,42 @@
1 1
 import React, { useEffect } from "react";
2
-import Swiper from 'swiper';
2
+// import Swiper from 'swiper';
3 3
 import styles from './style.less'
4 4
 import classNames from 'classnames';
5 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 9
 const swiper = ({ list, onClose }) => {
10 10
 
11 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 42
     return (
@@ -44,7 +44,12 @@ const swiper = ({ list, onClose }) => {
44 44
             {list.length > 0 && <div className={styles.mask}>
45 45
                 <div className={styles.content}>
46 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 53
                         <div className={classNames(['swiper-wrapper', styles.carousel])} >
49 54
                             {list.map((item, index) =>
50 55
                                 <div key={'swiper' + index} className={classNames(['swiper-slide', styles.carouselItem])} >
@@ -53,7 +58,7 @@ const swiper = ({ list, onClose }) => {
53 58
                             )}
54 59
                         </div>
55 60
                         <div className={classNames(['swiper-pagination', styles.dots])}  ></div>
56
-                    </div>
61
+                    </div> */}
57 62
                 </div>
58 63
             </div>}
59 64
         </>

+ 32
- 0
src/utils/money.js Visa fil

@@ -0,0 +1,32 @@
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
+}