xujing 5 years ago
parent
commit
3e9ed29559

+ 6
- 5
src/pages/fundManagement/AccountDetail.jsx View File

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
     ]

+ 7
- 2
src/pages/fundManagement/AccountManagement.jsx View File

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={() => getList({ pageNum: 1, pageSize: 10 })} 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={() => getList({ pageNum: 1, pageSize: 10 })} realBalance={row.realBalance || '0'} />
108
                     </span>
113
                     </span>
109
                 </>
114
                 </>
110
             ),
115
             ),

+ 2
- 0
src/pages/fundManagement/ConsumeOrder.jsx View File

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
         {

+ 2
- 0
src/pages/fundManagement/RechargeOrder.jsx View File

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
         {

+ 2
- 0
src/pages/fundManagement/RefundOrder.jsx View File

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: '退款创建时间',

+ 3
- 3
src/pages/fundManagement/components/Recharge.jsx View File

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("操作成功")
67
 
68
 
68
                         <Form.Item label="充值金额" >
69
                         <Form.Item label="充值金额" >
69
                             {getFieldDecorator('rechargeAmount', {
70
                             {getFieldDecorator('rechargeAmount', {
70
-                                rules: [{ required: true, message: '充值金额不能为空' },
71
-                                { max: 20 }],
72
-                            })(<Input type='number' placeholder="支持2位小数" />)}
71
+                                rules: [{ required: true, message: '充值金额不能为空' }],
72
+                            })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
73
                         </Form.Item>
73
                         </Form.Item>
74
 
74
 
75
                         <Form.Item label="充值凭证" help="可上传银行转账截图等作为查账线索">
75
                         <Form.Item label="充值凭证" help="可上传银行转账截图等作为查账线索">

+ 2
- 1
src/pages/fundManagement/components/Refund.jsx View File

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
 
70
                                 { max: 20 }],
71
                                 { max: 20 }],
71
                             })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
72
                             })(<Input type='number' placeholder="支持2位小数" addonAfter="元" />)}
72
                         </Form.Item>
73
                         </Form.Item>
73
-                        <div style={{ marginBottom: '25px' }}><span style={{ width: '25%', display: 'inline-block', textAlign: 'right' }}>余额:</span>{props.realBalance}元</div>
74
+                        <div style={{ marginBottom: '25px' }}><span style={{ width: '25%', display: 'inline-block', textAlign: 'right' }}>余额:</span>{regFenToYuan(props.realBalance)}元</div>
74
                         <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
75
                         <Form.Item label="退款凭证" help="可上传银行转账截图、微信退款订单等截图作为查账线索">
75
                             {getFieldDecorator('certificateList', {
76
                             {getFieldDecorator('certificateList', {
76
                                 rules: [{ required: false }],
77
                                 rules: [{ required: false }],

+ 37
- 32
src/pages/fundManagement/components/Swiper.jsx View File

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 View File

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
+}