李志伟 3 年前
父节点
当前提交
bda800f5b9

src/assets/walletCard/index.jsx → src/components/walletCard/index.jsx 查看文件

@@ -3,13 +3,15 @@ import walletImg from '@/assets/bank/walletBgi.png'
3 3
 import './style.less'
4 4
 
5 5
 export default (props) => {
6
-  const {value,onClick}=props
6
+  const {value,onClick,tixian}=props
7 7
   return (
8 8
     <View className='walletCard'>
9 9
       <Image src={walletImg} className='walletImg' />
10 10
       <View className='title'>钱包余额(元)</View>
11
-      <View className='price'>2022.56</View>
12
-      <View className='withdrawalBtn' onClick={onClick}>提现</View>
11
+      <View className='price'>{value}</View>
12
+      {
13
+        !tixian&&<View className='withdrawalBtn' onClick={onClick}>提现</View>
14
+      }
13 15
     </View>
14 16
     )
15 17
 }

src/assets/walletCard/style.less → src/components/walletCard/style.less 查看文件


+ 1
- 1
src/pages/index/components/User/index.jsx 查看文件

@@ -30,7 +30,7 @@ export default (props) => {
30 30
     Taro.navigateTo({ url: '/pages/machineryList/index' });
31 31
    }
32 32
   const goWallet = () => {
33
-    Taro.navigateTo({ url: '/pages/wallet/index' });
33
+    Taro.navigateTo({ url: '/pages/wallet/index?balance=2022.56' });
34 34
    }
35 35
   const goBank = () => { }
36 36
   const signOut = () => { 

+ 8
- 7
src/pages/wallet/index.jsx 查看文件

@@ -1,12 +1,17 @@
1
+import Taro from "@tarojs/taro"
1 2
 import { View, ScrollView } from "@tarojs/components"
2 3
 import withLayout from '@/layouts'
3 4
 import CustomNav from "@/components/CustomNav"
4
-import WalletCard from "@/assets/walletCard"
5
+import WalletCard from "@/components/walletCard"
5 6
 import ListTitle from "@/components/ListTitle"
6 7
 import './style.less'
7 8
 
8 9
 export default withLayout((props) => {
9
-  const goWithdrawal = () => { }
10
+  const { router } = props
11
+  let { balance } = router.params
12
+  const goWithdrawal = () => { 
13
+    Taro.navigateTo({ url: `/pages/withdrawal/index?balance=${balance}` });
14
+  }
10 15
   return (
11 16
     <View className='page-index'>
12 17
       <View className='index-navbar'>
@@ -14,12 +19,8 @@ export default withLayout((props) => {
14 19
       </View>
15 20
       <View className='index-container wallet'>
16 21
         <ScrollView scrollY style={{ height: '100%' }}>
17
-          <WalletCard onClick={goWithdrawal} />
22
+          <WalletCard onClick={goWithdrawal} value={balance} />
18 23
           <ListTitle value='零钱明细' />
19
-          {/* <View className='listTitle'>
20
-            <View className='verticalLine' />
21
-            零钱明细
22
-          </View> */}
23 24
           <View className='dayClass'>2022-03-10</View>
24 25
           <View className='walletCell'>
25 26
             <View className='content'>

+ 0
- 13
src/pages/wallet/style.less 查看文件

@@ -1,19 +1,6 @@
1 1
 .wallet{
2 2
   margin: 30px;
3 3
   font-weight: bold;
4
-  // .listTitle{
5
-  //   display: flex;
6
-  //   align-items: center;
7
-  //   font-size: 34px;
8
-  //   color: #333;
9
-  //   margin: 60px 0 10px;
10
-  //   .verticalLine{
11
-  //     width: 8px;
12
-  //     height: 32px;
13
-  //     background: #000;
14
-  //     margin-right: 23px;
15
-  //   }
16
-  // }
17 4
   .dayClass{
18 5
     height: 68px;
19 6
     background: #F8F8F8;

+ 7
- 0
src/pages/withdrawal/index.config.js 查看文件

@@ -0,0 +1,7 @@
1
+export default {
2
+  navigationBarTitleText: '我的钱包',
3
+  navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  enableShareAppMessage: true,
6
+  disableScroll: true,
7
+}

+ 75
- 0
src/pages/withdrawal/index.jsx 查看文件

@@ -0,0 +1,75 @@
1
+import { useState } from "react"
2
+import { View, Image, Input, Picker } from "@tarojs/components"
3
+import CustomNav from "@/components/CustomNav"
4
+import WalletCard from "@/components/walletCard"
5
+import ListTitle from "@/components/ListTitle"
6
+import goto from '@/assets/user/goto.png'
7
+import MyButton from "@/components/MyButton"
8
+import withLayout from '@/layouts'
9
+import './style.less'
10
+
11
+export default withLayout((props) => {
12
+  const { router } = props
13
+  let { balance } = router.params
14
+  const [money, setMoney] = useState()
15
+
16
+  const [index, setIndex] = useState(0)
17
+  const bankList = [
18
+    {
19
+      key: 1,
20
+      value: '中国建设银行(2258)'
21
+    },
22
+    {
23
+      key: 2,
24
+      value: '中国招商银行(9755)'
25
+    },
26
+    {
27
+      key: 3,
28
+      value: '中国工商银行(5675)'
29
+    },
30
+  ]
31
+  const bankContentList = ['中国建设银行(2258)', '中国招商银行(9755)', '中国工商银行(5675)']
32
+  const onChange = e => {
33
+    console.log(bankList[e.detail.value])
34
+    setIndex(e.detail.value)
35
+  }
36
+
37
+  const onClick = () => {
38
+    if ((money - 0) > balance) {
39
+      console.log('您的余额不足');
40
+    } else {
41
+      console.log('提交成功,1到3个工作日将到您的付款账户')
42
+      // 刷新页面
43
+    }
44
+  }
45
+  const handleChanage = (e) => {
46
+    setMoney(e.detail.value)
47
+  }
48
+  return (
49
+    <View className='page-index'>
50
+      <View className='index-navbar'>
51
+        <CustomNav title='我的钱包' />
52
+      </View>
53
+      <View className='index-container withdrawal'>
54
+        <WalletCard tixian value={balance} />
55
+        <ListTitle value='选择银行卡' />
56
+        <Picker mode='selector' placeholder='请选择提现银行卡' range={bankContentList} onChange={onChange}>
57
+          <View className='bankPicker'>
58
+            <View className='body'>
59
+              {bankContentList[index]}
60
+            </View>
61
+            <Image className='cell-action-picker' src={goto} />
62
+          </View>
63
+        </Picker>
64
+        <ListTitle value='选择银行卡' />
65
+        <View className='bankInput'>
66
+          <View className='header'>¥</View>
67
+          <Input className='body' type='number' placeholder='请输入提取金额' value={money} onBlur={handleChanage} />
68
+        </View>
69
+        <View className='bottomBtn'>
70
+          <MyButton value='提现' onClick={onClick} />
71
+        </View>
72
+      </View>
73
+    </View>
74
+  )
75
+})

+ 47
- 0
src/pages/withdrawal/style.less 查看文件

@@ -0,0 +1,47 @@
1
+.withdrawal{
2
+  margin: 30px;
3
+  .bankPicker,.bankInput{
4
+    background: #FFF;
5
+    border: 2px solid #F2F2F2;
6
+    border-radius: 40px;
7
+    display: flex;
8
+    align-items: center;
9
+    padding: 36px 30px;
10
+    margin-top: 30px;
11
+    height: 108px;
12
+    box-sizing: border-box;
13
+  }
14
+  .bankPicker{
15
+    .body{
16
+      font-size: 32px;
17
+      font-weight: 500;
18
+      color: #333;
19
+      flex: 1;
20
+    }
21
+    .cell-action-picker{
22
+      width: 21px;
23
+      flex: none;
24
+      height: 36px;
25
+    }
26
+  }
27
+  .bankInput{
28
+    .header{
29
+      font-size: 48px;
30
+      font-weight: 500;
31
+      color: #333;
32
+      flex: none;
33
+      margin-right: 20px;
34
+    }
35
+    .body{
36
+      flex: 1;
37
+      font-size: 32px;
38
+      font-weight: 400;
39
+    }
40
+  }
41
+  .bottomBtn{
42
+    margin-bottom: 32px;
43
+    position: absolute;
44
+    bottom: 0;
45
+    width: 100%;
46
+  }
47
+}

+ 4
- 0
src/routes.js 查看文件

@@ -30,6 +30,10 @@ const mainPages = [
30 30
     title: '我的钱包',
31 31
     page: 'pages/wallet/index',
32 32
   },
33
+  {
34
+    title: '提现',
35
+    page: 'pages/withdrawal/index',
36
+  },
33 37
   
34 38
 ];
35 39