Your Name 3 anos atrás
pai
commit
28021bc416

+ 6
- 5
src/components/Tabs/index.jsx Ver arquivo

@@ -1,11 +1,12 @@
1
-import React, { useState } from 'react'
1
+import React, { useRef, useState } from 'react'
2 2
 import { View, ScrollView } from '@tarojs/components'
3 3
 import './style.scss'
4 4
 
5 5
 export default (props) => {
6 6
   const { current, tabs, onChange } = props
7
+  const idPreRef = useRef(`scroll-it-${Math.random().toString(26).substring(2, 9)}`)
7 8
 
8
-  const handleTabClick = (index) => () => {
9
+  const handleTabClick = (index) => {
9 10
     if (onChange) {
10 11
       onChange(index + 1)
11 12
     }
@@ -13,7 +14,7 @@ export default (props) => {
13 14
 
14 15
   return (
15 16
     <View className='yz-tabs'>
16
-      <ScrollView scrollX scrollIntoView={`item-${current}`}>
17
+      <ScrollView scrollX scrollIntoView={`${idPreRef.current}-${current}`}>
17 18
         <View className='yz-tabs-nav'>
18 19
         {
19 20
           (tabs||[]).map((item, index) => {
@@ -22,9 +23,9 @@ export default (props) => {
22 23
             return (
23 24
               <View
24 25
                 key={item}
25
-                id={`item-${index}`}
26
+                id={`${idPreRef.current}-${index}`}
26 27
                 className={`yz-tabs-tab ${activeClass}`}
27
-                onClick={handleTabClick(index)}
28
+                onClick={() => handleTabClick(index)}
28 29
               >{item}</View>
29 30
             )
30 31
           })

+ 1
- 0
src/components/Tabs/style.scss Ver arquivo

@@ -4,6 +4,7 @@
4 4
   position: relative;
5 5
   border-top: 1px solid #eee;
6 6
   border-bottom: 1px solid #eee;
7
+  box-sizing: border-box;
7 8
 
8 9
   .yz-tabs-nav {
9 10
     width: 100%;

+ 5
- 5
src/native/PageContainer/index.js Ver arquivo

@@ -25,7 +25,7 @@ Component({
25 25
       value: '100%',
26 26
       observer: function(val) {
27 27
         const h = val || '100%'
28
-        const customStyle = 'height: '+ h +';'
28
+        const customStyle = 'height: '+ h +'; z-index:999'
29 29
         this.setData({ customStyle })
30 30
       }
31 31
     },
@@ -33,16 +33,16 @@ Component({
33 33
       type: String,
34 34
       value: 'black',
35 35
       observer: function(val) {
36
-        let overlayStyle = ''
36
+        let overlayStyle = 'z-index:99'
37 37
         switch(val) {
38 38
           case 'white':
39
-            overlayStyle = 'background-color: rgba(255, 255, 255, 0.7)'
39
+            overlayStyle += 'background-color: rgba(255, 255, 255, 0.7)'
40 40
             break
41 41
           case 'blur':
42
-            overlayStyle = 'background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);'
42
+            overlayStyle += 'background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);'
43 43
             break
44 44
           default:
45
-            overlayStyle = 'background-color: rgba(0, 0, 0, 0.7)'
45
+            overlayStyle += 'background-color: rgba(0, 0, 0, 0.7)'
46 46
         }
47 47
         this.setData({ overlayStyle })
48 48
       }

+ 134
- 97
src/pages/mine/mortgageCalc/calc.js Ver arquivo

@@ -5,130 +5,167 @@
5 5
  * @param {*} year 
6 6
  * @param {*} rate 
7 7
  */
8
-export function calcBJSummary (moneyW, year, rateB) {
9
-  let money = moneyW * 10000;
8
+export function calcBJ (moneyW, year, rateB) {
9
+  const money = moneyW * 10000;
10 10
   const month = year * 12;
11
-  const rate= rateB / 100;
12
-  let benjin= money / month; //每个月还款本金 
13
-  
14
-  let lxTotal=0;
15
-  let mostlx = 0; // 最高利息
16
-  let emTotal = 0; // 最高月付
11
+  const rate= rateB / 100 / 12; // 月利率
12
+
13
+  // 等额本金 每个月还款本金是固定的, 利息不固定
14
+  const benjin = money / month; //每个月还款本金 
15
+
16
+  const list = [];
17
+  let bjLeft = money; //剩余本金
18
+  let paid = 0; // 已还贷款
19
+  let totalRate = 0;
20
+  let firstRate = 0; // 最高利息
21
+  let firstMoney = 0; // 最高月付
17 22
   for(let i = 0; i < month; i += 1) {
18
-    const lixi = (money * rate / 12); //每月还款利息 
19
-    money -= benjin; //剩余本金
20
-    lxTotal += lixi; //利息总额
23
+    // 每月还款利息
24
+    const lx = bjLeft * rate;
25
+    // 每月还金额
26
+    const benxi = benjin + lx;
27
+
28
+    bjLeft -= benjin; //剩余本金
29
+    totalRate += lx; //利息总额
30
+    paid += benxi;
21 31
 
22 32
     if(i === 0) {
23
-      mostlx = lixi;
24
-      emTotal = benjin + mostlx;
33
+      firstRate = lx;
34
+      firstMoney = benjin + firstRate;
25 35
     }
26
-  }
27 36
 
28
-  return {
29
-    totalRate: parseFloat(lxTotal/10000).toFixed(2),
30
-    totalMoney: parseFloat((moneyW*10000+lxTotal)/10000).toFixed(2),
31
-    rateOfFirstMonth: parseFloat(mostlx/10000).toFixed(2),
32
-    moneyOfFirstMonth: parseFloat(emTotal/10000).toFixed(2),
33
-  }
34
-}
35
-
36
-/**
37
- * 等额本金 列表
38
- * @param {*} moneyW 
39
- * @param {*} year 
40
- * @param {*} rateB 
41
- * @returns 
42
- */
43
-export function calcBJList (moneyW, year, rateB) {
44
-  let money = moneyW * 10000;
45
-  const month = year * 12;
46
-  const rate = rateB / 100;
47
-  const benjin = money / month; //每个月还款本金 
48
-
49
-  const result = [];
50
-  for(let i = 0; i < month; i += 1) {
51
-    const lx = (money * rate / 12); // 每月还款利息
52
-    money -= benjin; //剩余本金
53
-
54
-    result.push({
55
-      benjin: parseFloat(benjin).toFixed(2),
56
-      benxi: parseFloat(benjin +lx).toFixed(2),
57
-      rate: parseFloat(lx).toFixed(2),
58
-      left: parseFloat(money).toFixed(2),
37
+    list.push({
38
+      benjin,
39
+      benxi,
40
+      rate: lx,
41
+      paid,
59 42
     })
60 43
   }
61 44
 
62
-  if (result.length > 0) {
63
-    // 修改最后一条记录的剩余金额为0
64
-    result[result.length - 1].left = 0
45
+  const summary = {
46
+    year,
47
+    money,
48
+    totalRate,
49
+    totalMoney: money + totalRate,
50
+    rateOfFirstMonth: firstRate,
51
+    moneyOfFirstMonth: firstMoney,
65 52
   }
66 53
 
67
-  return result;
54
+  return { summary, list }
68 55
 }
69 56
 
57
+// /**
58
+//  * 等额本金 列表
59
+//  * @param {*} moneyW 
60
+//  * @param {*} year 
61
+//  * @param {*} rateB 
62
+//  * @returns 
63
+//  */
64
+// export function calcBJList (moneyW, year, rateB) {
65
+//   let money = moneyW * 10000;
66
+//   const month = year * 12;
67
+//   const rate = rateB / 100 / 12; // 月利率
68
+//   const benjin = money / month; //每个月还款本金 
69
+
70
+//   const result = [];
71
+//   let left = money;
72
+//   for(let i = 0; i < month; i += 1) {
73
+//     const lx = (money * rate); // 每月还款利息
74
+//     money -= benjin;
75
+//     left = left - benjin - lx;
76
+
77
+//     result.push({
78
+//       benjin,
79
+//       benxi: benjin + lx,
80
+//       rate: lx,
81
+//       left,
82
+//     })
83
+//   }
84
+
85
+//   return result;
86
+// }
87
+
70 88
 /**
71 89
  * 等额本息 摘要
72 90
  * @param {*} moneyW 
73 91
  * @param {*} year 
74 92
  * @param {*} rateB 
75 93
  */
76
-export function calcBXSummary (moneyW, year, rateB) {
77
-  let money = moneyW*10000;
94
+export function calcBX (moneyW, year, rateB) {
95
+  const money = moneyW * 10000;
78 96
   const month = year * 12;
79
-  const rate = rateB/100;
80
-  const emTotal = (money * rate / 12 * Math.pow(1 + rate / 12, month) / (Math.pow(1 + rate/ 12, month) - 1)); //每月还款金额
97
+  const rate = rateB / 100 / 12; // 月利息
81 98
 
82
-  let lxTotal = 0; //总利息
83
-  let mostlx = 0;
84
-  for (var i = 0; i < month; i+=1) {
85
-      const lx=(money * rate / 12);  //每月还款利息 
86
-      if(i===0) mostlx=lx; //最高利息
87
-      const em = emTotal-lx; //每月还款本金 
88
-      money -= em;
89
-      lxTotal+=lx;
90
-  }
99
+  // 等额本息 每个月还款额是固定的, 本金 与 利息不固定
100
+  const benxi = (money * rate * Math.pow(1 + rate, month) / (Math.pow(1 + rate, month) - 1)); // 每月还款金额
91 101
 
92
-  return {
93
-    totalRate: parseFloat(lxTotal/10000).toFixed(2),
94
-    totalMoney: parseFloat((moneyW*10000+lxTotal)/10000).toFixed(2),
95
-    rateOfFirstMonth: parseFloat(mostlx/10000).toFixed(2),
96
-    moneyOfFirstMonth: parseFloat(emTotal/10000).toFixed(2),
97
-  }
98
-}
99
-
100
-/**
101
- * 等额本息 列表
102
- * @param {*} moneyW 
103
- * @param {*} year 
104
- * @param {*} rateB 
105
- * @returns 
106
- */
107
-export function calcBXList (moneyW, year, rateB) {
108
-  let money = moneyW*10000;
109
-  const month = year * 12;
110
-  const rate = rateB/100;
111
-  const emTotal = (money * rate / 12 * Math.pow(1 + rate / 12, month) / (Math.pow(1 + rate/ 12, month) - 1)); //每月还款金额
112
-
113
-  const result = [];
114
-  for(let i = 0; i < month; i += 1) {
115
-    const lx=(money * rate / 12);  //每月还款利息 
116
-    const em = emTotal-lx; //每月还款本金 
117
-    money = money - em;
102
+  const list = [];
103
+  let bjLeft = money; //剩余本金
104
+  let paid = 0; // 已还贷款
105
+  let totalRate = 0;
106
+  let firstRate = 0; // 
107
+  for (var i = 0; i < month; i+=1) {
108
+    // 每月还款利息
109
+    const lx = bjLeft * rate;
110
+    //每月还款本金
111
+    const benjin = benxi - lx;
118 112
 
113
+    bjLeft -= benjin;
114
+    totalRate += lx;
115
+    paid += benxi;
119 116
 
120
-    result.push({
121
-      benjin: parseFloat(em).toFixed(2),
122
-      benxi: parseFloat(em +lx).toFixed(2),
123
-      rate: parseFloat(lx).toFixed(2),
124
-      left: parseFloat(money).toFixed(2),
117
+    if (i === 0) {
118
+      firstRate = lx
119
+    }
120
+      
121
+    list.push({
122
+      benjin,
123
+      benxi,
124
+      rate: lx,
125
+      paid,
125 126
     })
126 127
   }
127 128
 
128
-  if (result.length > 0) {
129
-    // 修改最后一条记录的剩余金额为0
130
-    result[result.length - 1].left = 0
129
+  const summary = {
130
+    year,
131
+    money,
132
+    totalRate,
133
+    totalMoney: money + totalRate,
134
+    rateOfFirstMonth: firstRate,
135
+    moneyOfFirstMonth: benxi,
131 136
   }
132 137
 
133
-  return result;
138
+  return { summary, list } 
134 139
 }
140
+
141
+// /**
142
+//  * 等额本息 列表
143
+//  * @param {*} moneyW 
144
+//  * @param {*} year 
145
+//  * @param {*} rateB 
146
+//  * @returns 
147
+//  */
148
+// export function calcBXList (moneyW, year, rateB) {
149
+//   let money = moneyW*10000;
150
+//   const month = year * 12;
151
+//   const rate = rateB / 100 / 12; // 月利息
152
+//   const emTotal = (money * rate * Math.pow(1 + rate, month) / (Math.pow(1 + rate, month) - 1)); //每月还款金额
153
+
154
+//   const result = [];
155
+//   let left = money;
156
+//   for(let i = 0; i < month; i += 1) {
157
+//     const lx = money * rate;  //每月还款利息
158
+//     const em = emTotal-lx; //每月还款本金 
159
+//     money -= em;
160
+//     left = left - em - lx;
161
+
162
+//     result.push({
163
+//       benjin: parseFloat(em).toFixed(2),
164
+//       benxi: parseFloat(em +lx).toFixed(2),
165
+//       rate: parseFloat(lx).toFixed(2),
166
+//       left: parseFloat(left).toFixed(2),
167
+//     })
168
+//   }
169
+
170
+//   return result;
171
+// }

+ 3
- 3
src/pages/mine/mortgageCalc/components/GJJForm.jsx Ver arquivo

@@ -11,9 +11,9 @@ export default (props) => {
11 11
   useEffect(() => {
12 12
     if (onChange) {
13 13
       onChange({
14
-        money: money||0 - 0,
15
-        year: year||0 - 0,
16
-        rate: rate||0 - 0,
14
+        money: (money||0) - 0,
15
+        year: (year||0) - 0,
16
+        rate: (rate||0) - 0,
17 17
       })
18 18
     }
19 19
   }, [money, year, rate, onChange])

+ 164
- 0
src/pages/mine/mortgageCalc/components/Result.jsx Ver arquivo

@@ -0,0 +1,164 @@
1
+import React, { useEffect, useState } from 'react'
2
+import { ScrollView } from '@tarojs/components'
3
+import InnerTabs from '@/components/Tabs'
4
+import './style.scss'
5
+
6
+const tabs = ['等额本息', '等额本金']
7
+
8
+const getMixList = (lst1, lst2) => {
9
+  const len = lst1.length > lst2.length ? lst1.length : lst2.length
10
+  const rtn = []
11
+
12
+  let lastPaid1 = 0;
13
+  let lastPaid2 = 0;
14
+  for (let i = 0; i < len; i += 1) {
15
+    const it1 = lst1[i] || {}
16
+    const it2 = lst2[i] || {}
17
+
18
+    const paid1 = it1.paid||0;
19
+    const paid2 = it2.paid||0;
20
+
21
+    rtn.push({
22
+      benjin: (it1.benjin||0) + (it2.benjin||0),
23
+      benxi: (it1.benxi||0) + (it2.benxi||0),
24
+      rate: (it1.rate||0) + (it2.rate||0),
25
+      paid: (paid1||lastPaid1) + (paid2||lastPaid2),
26
+    })
27
+
28
+    if (paid1 > 0) {
29
+      lastPaid1 = paid1;
30
+    }
31
+    if (paid2 > 0) {
32
+      lastPaid2 = paid2;
33
+    }
34
+  }
35
+
36
+  return rtn;
37
+}
38
+
39
+export default (props) => {
40
+  const { dataSource, isMixed, onClose } = props
41
+
42
+  const [current, setCurrent] = useState(1)
43
+  const [data, setData] = useState({})
44
+  const [summary, setSummary] = useState({})
45
+  const [list, setList] = useState([])
46
+
47
+  const tipText = isMixed ? '贷款总额' : (current === 1 ? '每月还款' : '首月还款')
48
+
49
+  useEffect(() => {
50
+    if (!dataSource[0] && !dataSource[1]) return;
51
+
52
+    if (isMixed) {
53
+      //
54
+      const bj = {
55
+        summary: {
56
+          money: dataSource[0].bj.summary.money + dataSource[1].bj.summary.money,
57
+          totalRate: dataSource[0].bj.summary.totalRate + dataSource[1].bj.summary.totalRate,
58
+          totalMoney: dataSource[0].bj.summary.totalMoney + dataSource[1].bj.summary.totalMoney,
59
+        },
60
+        list: getMixList(dataSource[0].bj.list, dataSource[1].bj.list)
61
+      }
62
+      const bx = {
63
+        summary: {
64
+          money: dataSource[0].bx.summary.money + dataSource[1].bx.summary.money,
65
+          totalRate: dataSource[0].bx.summary.totalRate + dataSource[1].bx.summary.totalRate,
66
+          totalMoney: dataSource[0].bx.summary.totalMoney + dataSource[1].bx.summary.totalMoney,
67
+        },
68
+        list: getMixList(dataSource[0].bx.list, dataSource[1].bx.list)
69
+      }
70
+
71
+      setData({bj, bx})
72
+    } else {
73
+      const res = dataSource[0] || dataSource[1]
74
+      setData(res)
75
+    }
76
+  }, [dataSource, isMixed])
77
+
78
+  useEffect(() => {
79
+    const {bj, bx} = data || {}
80
+    if (current === 1) {
81
+      setSummary(bx?.summary||{})
82
+      setList(bx?.list||[])
83
+    } else {
84
+      setSummary(bj?.summary||{})
85
+      setList(bj?.list||[])
86
+    }
87
+  }, [current, data])
88
+
89
+  return (
90
+    <view className='calc-result'>
91
+      <view className='header-nav'>
92
+        <InnerTabs tabs={tabs} current={current} onChange={setCurrent} />
93
+        <view className='header-close' onClick={onClose}>
94
+          <text>×</text>
95
+        </view>
96
+      </view>
97
+
98
+      <view className='summary-card'>
99
+        <view className='tip'>{tipText}</view>
100
+        <view className='money'>
101
+          {isMixed ? Number(summary.money/10000).toFixed(0) : Number(summary.moneyOfFirstMonth||0).toFixed(2)}
102
+          <text className='small'>{isMixed ? '万元' : '元'}</text>
103
+        </view>
104
+        <view className='footer flex'>
105
+          <view>
106
+            <view>{`${Number((summary.totalRate||0)/10000).toFixed(2)}万`}</view>
107
+            <view className='label'>利息总额</view>
108
+          </view>
109
+          <view>
110
+            <view>{`${Number((summary.totalMoney||0)/10000).toFixed(2)}万`}</view>
111
+            <view className='label'>还款总额</view>
112
+          </view>
113
+          {
114
+            !isMixed && (
115
+              <view>
116
+                <view>{`${Number(summary.money/10000).toFixed(0)}万`}</view>
117
+                <view className='label'>贷款金额</view>
118
+              </view>
119
+            )
120
+          }
121
+          {
122
+            !isMixed && (
123
+              <view>
124
+                <view>{`${summary.year||0}年`}</view>
125
+                <view className='label'>贷款期限</view>
126
+              </view>
127
+            )
128
+          }
129
+        </view>
130
+      </view>
131
+
132
+      <view className='result-list'>
133
+        <view className='flex result-list-item result-list-title'>
134
+          <view>期数</view>
135
+          <view>月供总额</view>
136
+          <view>月供本金</view>
137
+          <view>月供利息</view>
138
+          <view>剩余还款</view>
139
+        </view>
140
+        <ScrollView scrollY className='result-scroll'>
141
+          {
142
+            list.map((it, inx) => {
143
+              const no = inx + 1
144
+              const benxi = Number(it.benxi).toFixed(0)
145
+              const benjin = Number(it.benjin).toFixed(0)
146
+              const rate = Number(it.rate).toFixed(0)
147
+              const left = Number(summary.totalMoney - it.paid).toFixed(0)
148
+
149
+              return (
150
+                <view className='flex result-list-item' key={inx}>
151
+                  <view>{no}</view>
152
+                  <view>{benxi}</view>
153
+                  <view>{benjin}</view>
154
+                  <view>{rate}</view>
155
+                  <view>{left}</view>
156
+                </view>
157
+              )
158
+            })
159
+          }
160
+        </ScrollView>
161
+      </view>
162
+    </view>
163
+  )
164
+}

+ 3
- 3
src/pages/mine/mortgageCalc/components/SYForm.jsx Ver arquivo

@@ -17,9 +17,9 @@ export default (props) => {
17 17
   useEffect(() => {
18 18
     if (onChange) {
19 19
       onChange({
20
-        money: money||0 - 0,
21
-        year: year||0 - 0,
22
-        rate: rate||0 - 0,
20
+        money: (money||0) - 0,
21
+        year: (year||0) - 0,
22
+        rate: (rate||0) - 0,
23 23
       })
24 24
     }
25 25
   }, [money, year, rate, onChange])

+ 98
- 0
src/pages/mine/mortgageCalc/components/style.scss Ver arquivo

@@ -0,0 +1,98 @@
1
+.calc-result {
2
+  .header-nav {
3
+    display: flex;
4
+
5
+    & > view {
6
+      &:first-child {
7
+        flex: auto;
8
+      }
9
+    }
10
+
11
+    .header-close {
12
+      flex: none;
13
+      width: 3em;
14
+      text-align: center;
15
+      box-sizing: border-box;
16
+      border: 1px solid #eee;
17
+      line-height: 100%;
18
+      vertical-align: middle;
19
+
20
+      text {
21
+        font-size: 2em;
22
+        line-height: 1.1em;
23
+        display: inline-block;
24
+      }
25
+    }
26
+  }
27
+
28
+  .summary-card {
29
+    color: #fff;
30
+    background: #193C83;
31
+    border-radius: 24px;
32
+    box-sizing: border-box;
33
+    padding: 1em;
34
+    margin: 1em;
35
+
36
+    .tip {
37
+      font-size: .8em;
38
+    }
39
+
40
+    .money {
41
+      font-size: 1.8em;
42
+      line-height: 2.0em;
43
+
44
+      .small {
45
+        display: inline-block;
46
+        margin-left: 1em;
47
+        font-size: .5em;
48
+        color: #fff;
49
+      }
50
+    }
51
+
52
+    .footer {
53
+      & > view {
54
+        color: #fff;
55
+        font-size: .8em;
56
+        text-align: center;
57
+        line-height: 1.6em;
58
+      }
59
+
60
+      .label {
61
+        color: rgba(255,255,255, .6);
62
+      }
63
+    }
64
+  }
65
+
66
+  .flex {
67
+    display: flex;
68
+    & > view {
69
+      flex: auto;
70
+    }
71
+  }
72
+
73
+  .result-scroll {
74
+    height: calc(100vh - 560rpx);
75
+  }
76
+
77
+  .result-list {
78
+    margin-top: .5em;
79
+    padding: 0 1em;
80
+
81
+    .result-list-title {
82
+      background:rgba(25,60,131, .1) !important;
83
+    }
84
+
85
+    .result-list-item {
86
+      font-size: .9em;
87
+      line-height: 2.4em;
88
+      text-align: center;
89
+
90
+      &:nth-of-type(odd) {
91
+        background: #fff;
92
+      }
93
+      &:nth-of-type(even) {
94
+        background:rgba(25,60,131, .1);
95
+      }
96
+    }
97
+  }
98
+}

+ 4
- 1
src/pages/mine/mortgageCalc/index.config.js Ver arquivo

@@ -1,3 +1,6 @@
1 1
 export default {
2
-  navigationBarTitleText: '房贷计算器'
2
+  navigationBarTitleText: '房贷计算器',
3
+  usingComponents: {
4
+    'page-modal': '@/native/PageContainer/index'
5
+  }
3 6
 }

+ 21
- 20
src/pages/mine/mortgageCalc/index.jsx Ver arquivo

@@ -6,6 +6,7 @@ import Tabs from '@/components/Tabs'
6 6
 import Cell from '@/components/Cell'
7 7
 import GJJForm from './components/GJJForm'
8 8
 import SYForm from './components/SYForm'
9
+import Result from './components/Result'
9 10
 import * as sdk from './calc'
10 11
 import './index.scss'
11 12
 
@@ -15,10 +16,12 @@ const showError = title => Taro.showToast({ title, icon: 'none'});
15 16
 
16 17
 export default withLayout(() => {
17 18
   const [loading, setLoading] = useState(false)
19
+  const [visible, setVisible] = useState(false)
18 20
   const [current, setCurrent] = useState(1)
19 21
 
20 22
   const [SYFormData, setSYFormData] = useState()
21 23
   const [GJJFormData, setGJJFormData] = useState()
24
+  const [result, setResult] = useState([])
22 25
 
23 26
   const handleCalc = () => {
24 27
     // 校验商业贷款
@@ -47,33 +50,29 @@ export default withLayout(() => {
47 50
     }
48 51
 
49 52
     setLoading(true)
50
-    const syResult ={}
53
+    const syResult = {}
51 54
     const gjjResult = {}
52 55
     if (current !== 2) {
53
-      syResult.bj = {
54
-        summary: sdk.calcBJSummary(SYFormData.money, SYFormData.year, SYFormData.rate),
55
-        list: sdk.calcBJList(SYFormData.money, SYFormData.year, SYFormData.rate),
56
-      }
57
-      syResult.bx = {
58
-        summary: sdk.calcBXSummary(SYFormData.money, SYFormData.year, SYFormData.rate),
59
-        list: sdk.calcBXList(SYFormData.money, SYFormData.year, SYFormData.rate),
60
-      }
56
+      syResult.bj = sdk.calcBJ(SYFormData.money, SYFormData.year, SYFormData.rate)
57
+      syResult.bx = sdk.calcBX(SYFormData.money, SYFormData.year, SYFormData.rate)
61 58
     }
62 59
 
63 60
     if (current !== 1) {
64
-      gjjResult.bj = {
65
-        summary: sdk.calcBJSummary(GJJFormData.money, GJJFormData.year, GJJFormData.rate),
66
-        list: sdk.calcBJList(GJJFormData.money, GJJFormData.year, GJJFormData.rate),
67
-      }
68
-      gjjResult.bx = {
69
-        summary: sdk.calcBXSummary(GJJFormData.money, GJJFormData.year, GJJFormData.rate),
70
-        list: sdk.calcBXList(GJJFormData.money, GJJFormData.year, GJJFormData.rate),
71
-      }
61
+      gjjResult.bj = sdk.calcBJ(GJJFormData.money, GJJFormData.year, GJJFormData.rate)
62
+      gjjResult.bx = sdk.calcBX(GJJFormData.money, GJJFormData.year, GJJFormData.rate)
72 63
     }
73 64
     setLoading(false)
74 65
 
75
-    console.log('------商业------>', syResult)
76
-    console.log('------公积金------>', gjjResult)
66
+    const res = [undefined, undefined]
67
+    if (current !== 2) {
68
+      res[0] = syResult
69
+    }
70
+    if (current !== 1) {
71
+      res[1] = gjjResult
72
+    }
73
+
74
+    setResult(res)
75
+    setVisible(true)
77 76
   }
78 77
 
79 78
   return (
@@ -104,7 +103,9 @@ export default withLayout(() => {
104 103
       <view className='Btn'>
105 104
         <button loading={loading} onClick={handleCalc}>开始计算</button>
106 105
       </view>
107
-
106
+      <page-modal show={visible} position='bottom'>
107
+        <Result dataSource={result} isMixed={current === 3} onClose={() => setVisible(false)} />
108
+      </page-modal>
108 109
     </view>
109 110
   )
110 111
 })