李志伟 3 年之前
父節點
當前提交
556cd3e11c

二進制
src/assets/bank/jianhang.jpg 查看文件


+ 16
- 42
src/pages/addBankCard/index.jsx 查看文件

@@ -1,59 +1,27 @@
1
-import React, { useState } from "react"
1
+import React, { useState,useEffect } from "react"
2 2
 import Taro from "@tarojs/taro"
3 3
 import { View, Input, Picker } from "@tarojs/components"
4 4
 import withLayout from '@/layouts'
5 5
 import CustomNav from "@/components/CustomNav"
6 6
 import MyButton from "@/components/MyButton"
7 7
 import { useModel } from "@/store"
8
-import { addBank } from '@/services/bank'
8
+import { addBank ,getBankTypeList} from '@/services/bank'
9
+
9 10
 import './style.less'
10 11
 
11
-const bankList = [
12
-  {
13
-    key: 1,
14
-    value: '中国建设银行'
15
-  },
16
-  {
17
-    key: 2,
18
-    value: '中国农业银行'
19
-  },
20
-  {
21
-    key: 3,
22
-    value: '中国银行'
23
-  },
24
-  // {
25
-  //   key: 4,
26
-  //   value: '中国工商银行'
27
-  // },
28
-  // {
29
-  //   key: 5,
30
-  //   value: '中国招商银行'
31
-  // },
32
-  // {
33
-  //   key: 6,
34
-  //   value: '中国交通银行'
35
-  // },
36
-  // {
37
-  //   key: 7,
38
-  //   value: '中国邮政银行'
39
-  // },
40
-]
41
-const bankContentList = ['中国建设银行', '中国农业银行', '中国银行']
42 12
 
43 13
 export default withLayout((props) => {
44 14
   const { person } = useModel('person')
45 15
   const [name, setName] = useState()
46 16
   const [bankCode, setBankCode] = useState()
47
-  const [bankAddress, setBankAddress] = useState(bankContentList[0])
17
+  const [bankList,setBankList]=useState([])
18
+  const [bankAddress, setBankAddress] = useState()
48 19
   const [phone, setPhone] = useState()
49
-  const [index, setIndex] = useState(0)
50 20
   const [loading, setLoading] = useState(false)
51 21
 
52 22
 
53 23
   const onChange = e => {
54
-    console.log(bankList[e.detail.value])
55
-    setBankAddress(bankContentList[e.detail.value])
56
-    setIndex(e.detail.value)
24
+    setBankAddress(bankList[e.detail.value])
57 25
   }
58 26
   const rulePhone = (val) => {
59 27
     if (!/^1[0-9]{10}$/.test(val)) {
@@ -66,9 +34,9 @@ export default withLayout((props) => {
66 34
     } else return true
67 35
   }
68 36
   const ruleCard = (val) => {
69
-    if (!/[0-9]{19}$/.test(val)) {
37
+    if (!val||val.length<8) {
70 38
       Taro.showToast({
71
-        title: '请输入正确的19位银行卡号',
39
+        title: '请输入正确的银行卡号',
72 40
         icon: 'none',
73 41
         duration: 2000
74 42
       })
@@ -104,6 +72,12 @@ export default withLayout((props) => {
104 72
       })
105 73
     }
106 74
   }
75
+  useEffect(()=>{
76
+    getBankTypeList({pageSize:500}).then((res)=>{
77
+      setBankList(res.records.map(item=>item.name))
78
+      setBankAddress(res.records[0].name)
79
+    })
80
+  },[])
107 81
   return (
108 82
     <View className='page-index'>
109 83
       <View className='index-navbar'>
@@ -126,8 +100,8 @@ export default withLayout((props) => {
126 100
           <View className='cellLeft'>
127 101
             <View className='label'>开户行</View>:
128 102
           </View>
129
-          <Picker mode='selector' style={{ width: '100%' }} range={bankContentList} onChange={onChange}>
130
-            {bankContentList[index]}
103
+          <Picker mode='selector' style={{ width: '100%' }} range={bankList} onChange={onChange}>
104
+            {bankAddress}
131 105
           </Picker>
132 106
         </View>
133 107
         <View className='addCardCell'>

+ 14
- 16
src/pages/bankCard/Card/index.jsx 查看文件

@@ -1,26 +1,24 @@
1 1
 import { View, Image, Text } from "@tarojs/components"
2
-import ABCImg from '@/assets/bank/ABCbank.png'
3
-import BOCImg from '@/assets/bank/BOCbank.png'
4
-import CCBImg from '@/assets/bank/CCBbank.png'
2
+import logoImg from '@/assets/bank/jianhang.jpg'
5 3
 import './style.less'
6 4
 
7 5
 export default (props) => {
8
-  const { type, value, onChange } = props
6
+  const { value, onChange } = props
7
+  let style = { background: `linear-gradient(0deg,#${value.color1},#${value.color2})`  }
9 8
   return (
10
-    <View className='bankCard' >
11
-      <Image src={
12
-        type === '中国农业银行' ? ABCImg :
13
-          type === '中国银行' ? BOCImg :
14
-            type === '中国建设银行' ? CCBImg : ''
15
-      } className='CardImg'
16
-      />
17
-      <View className='unBind' onClick={onChange}>解除绑定</View>
18
-      <View className='cardType'>储蓄卡</View>
19
-      <View className='cCode'>
20
-        <Text className='codeText'>****</Text>
9
+    <View className='bank' style={style}>
10
+      <View className='top'>
11
+        <Image className='logo' src={logoImg} />
12
+        <View className='title'>{value.ownerBank}</View>
13
+        <View className='cardType'>储蓄卡</View>
14
+        <View className='light'>Bank</View>
15
+        <View className='unBind' onClick={onChange}>解除绑定</View>
16
+      </View>
17
+      <View className='bottom'>
18
+        <Text className='codeText'>{value.cardNo.substr(0, 4)}</Text>
21 19
         <Text className='codeText'>****</Text>
22 20
         <Text className='codeText'>****</Text>
23
-        <Text className='codeText'>{value.substr(15, 4)}</Text>
21
+        <Text className='codeText'>{value.cardNo.slice(-4)}</Text>
24 22
       </View>
25 23
     </View>
26 24
   )

+ 39
- 30
src/pages/bankCard/Card/style.less 查看文件

@@ -1,39 +1,48 @@
1
-.bankCard{
2
-  height: calc( calc(100vw - 60px) * 0.36);
1
+.bank{
2
+  // background: linear-gradient(0deg,#375BCA,#5E93E0);
3 3
   border-radius: 40px;
4
+  color: #FFFFFF;
4 5
   position: relative;
5
-  color: #fff;
6
+  font-weight: bold;
7
+  padding: 60px 20px 70px 60px;
6 8
   margin-bottom: 30px;
7
-  .CardImg{
8
-    width: 100%;
9
-    height: calc( calc(100vw - 60px) * 0.36);
10
-    position: absolute;
11
-    z-index: -1;
12
-  }
13
-  .unBind{
14
-    position: absolute;
15
-    font-size: 28px;
16
-    font-weight: bold;
17
-    right: 36px;
18
-    top: 41px;
19
-  }
20
-  .cardType{
21
-    position: absolute;
22
-    font-size: 28px;
23
-    font-weight: 400;
24
-    left: 40vw;
25
-    top: 69px;
9
+  .top{
10
+    display: flex;
11
+    align-items: center;
12
+    margin-bottom: 40px;
13
+    .logo{
14
+      width: 40px;
15
+      height: 40px;
16
+      border-radius: 50%;
17
+    }
18
+    .title{
19
+      font-size: 36px;
20
+      margin: 0 21px 0 16px;
21
+    }
22
+    .cardType{
23
+      font-size: 28px;
24
+      font-weight: 400;
25
+    }
26
+    .light{
27
+      font-size: 89px;
28
+      opacity: 0.1;
29
+      position: absolute;
30
+      right: 20px;
31
+      letter-spacing: 10px;
32
+    }
33
+    .unBind{
34
+      font-size: 28px;
35
+      position: absolute;
36
+      right: 20px;
37
+      top: 40px;
38
+    }
26 39
   }
27
-  .cCode{
28
-    position: absolute;
29
-    font-size: 40px;
30
-    font-weight: bold;
31
-    bottom: 69px;
32
-    left: 8vw;
33
-    // left: calc(calc(50vw - 30px) - 5.5em);
40
+  .bottom{
41
+    .codeText{
42
+      font-size: 40px;
43
+    }
34 44
     .codeText+.codeText{
35 45
       margin-left: 1em;
36 46
     }
37 47
   }
38
-  
39 48
 }

+ 13
- 5
src/pages/bankCard/index.jsx 查看文件

@@ -1,10 +1,10 @@
1 1
 import { useState, useEffect } from "react"
2 2
 import Taro, { useDidShow } from "@tarojs/taro"
3
-import { View, Image, ScrollView } from "@tarojs/components"
3
+import { View, Image, ScrollView, Text } from "@tarojs/components"
4 4
 import withLayout from '@/layouts'
5 5
 import NullCard from "@/components/NullCard";
6 6
 import CustomNav from "@/components/CustomNav"
7
-import { getBankList, deleteBank } from '@/services/bank'
7
+import { getBankList, deleteBank,getBankTypeList } from '@/services/bank'
8 8
 import addImg from '@/assets/bank/addBank.png'
9 9
 import BankCard from './Card'
10 10
 import './style.less'
@@ -41,8 +41,16 @@ export default withLayout((props) => {
41 41
     getList()
42 42
   })
43 43
   const getList = () => {
44
-    getBankList().then((res) => {
45
-      setBankList(res.records)
44
+    getBankList({pageSize:500}).then((res) => {
45
+      getBankTypeList({pageSize:500}).then((res2)=>{
46
+        let list1=[]
47
+        let current
48
+        res.records.forEach(item => {
49
+          current= res2.records.filter(v=>item.ownerBank==v.name)[0]
50
+          list1.push({...item,color1:current.color1,color2:current.color2})
51
+        });
52
+        setBankList(list1)
53
+      })
46 54
     })
47 55
   }
48 56
   useEffect(() => {
@@ -59,7 +67,7 @@ export default withLayout((props) => {
59 67
             bankList.length == 0 ?
60 68
               <NullCard value='您还没有添加银行卡!' /> :
61 69
               bankList.map(item => {
62
-                return <BankCard type={item.ownerBank} key={item.cardId} value={item.cardNo} onChange={() => unBind(item.cardId)} />
70
+                return <BankCard key={item.cardId} value={item} onChange={() => unBind(item.cardId)} />
63 71
               })
64 72
           }
65 73
         </ScrollView>

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

@@ -1,4 +1,3 @@
1
-import { useState, useEffect } from "react"
2 1
 import { useModel } from '@/store'
3 2
 import Taro from "@tarojs/taro"
4 3
 import { View, Image, ScrollView } from "@tarojs/components"
@@ -18,6 +17,8 @@ import './style.less'
18 17
 export default (props) => {
19 18
   const { person } = useModel('person')
20 19
 
20
+  const { isOrgManager } = person
21
+
21 22
   const handleAccount = () => {
22 23
     Taro.navigateTo({ url: '/pages/userInfo/index' });
23 24
   }
@@ -34,20 +35,24 @@ export default (props) => {
34 35
     Taro.navigateTo({ url: '/pages/machineryList/index' });
35 36
   }
36 37
   const goWallet = () => {
37
-    Taro.navigateTo({ url: '/pages/wallet/index?balance=2022.56' });
38
+    if (isOrgManager) {
39
+      Taro.navigateTo({ url: '/pages/wallet/index' });
40
+    }
38 41
   }
39 42
   const goBank = () => {
40
-    Taro.navigateTo({ url: '/pages/bankCard/index' });
43
+    if (isOrgManager) {
44
+      Taro.navigateTo({ url: '/pages/bankCard/index' });
45
+    }
41 46
   }
42 47
   return (
43 48
     <ScrollView scrollY style={{ height: '100%' }}>
44
-      <View className='personTip'>该账号归{person.nickName||'张三'}所属</View>
49
+      <View className='personTip'>该账号归{person.nickName || '张三'}所属</View>
45 50
       <View className='userHead' onClick={handleAccount}>
46 51
         <Image src={userBgi} className='userBgi' />
47 52
         <View className='headcontent' >
48
-          <Image src={person.avatar||avatar} className='avatar' />
53
+          <Image src={person.avatar || avatar} className='avatar' />
49 54
           <View>
50
-            <View>{person.nickName||''}</View>
55
+            <View>{person.nickName || ''}</View>
51 56
             <View>{person.phone}</View>
52 57
           </View>
53 58
         </View>
@@ -61,14 +66,14 @@ export default (props) => {
61 66
           <View className='text'>我的农机</View>
62 67
         </View>
63 68
         <View
64
-          className='cardItem'
69
+          className={['cardItem', isOrgManager ? '' : 'graystyle']}
65 70
           onClick={() => goWallet()}
66 71
         >
67 72
           <Image className='cardImg' src={wallet}></Image>
68 73
           <View className='text'>我的钱包</View>
69 74
         </View>
70 75
         <View
71
-          className='cardItem'
76
+          className={['cardItem', isOrgManager ? '' : 'graystyle']}
72 77
           onClick={() => goBank()}
73 78
         >
74 79
           <Image className='cardImg' src={bankCard}></Image>

+ 11
- 0
src/pages/index/components/User/style.less 查看文件

@@ -69,4 +69,15 @@
69 69
       color: #333333;
70 70
     }
71 71
   }
72
+  .graystyle{
73
+    -webkit-filter: grayscale(100%);
74
+    -moz-filter: grayscale(100%);
75
+    -ms-filter: grayscale(100%);
76
+    -o-filter: grayscale(100%);
77
+    filter: grayscale(100%);
78
+    filter: gray;
79
+    view{
80
+      color: gray !important;
81
+    }
82
+  }
72 83
 }

+ 33
- 25
src/pages/wallet/index.jsx 查看文件

@@ -1,17 +1,31 @@
1 1
 import Taro from "@tarojs/taro"
2 2
 import { View, ScrollView } from "@tarojs/components"
3
+import { useEffect,useState } from "react"
3 4
 import withLayout from '@/layouts'
4 5
 import CustomNav from "@/components/CustomNav"
5 6
 import WalletCard from "@/components/walletCard"
6 7
 import ListTitle from "@/components/ListTitle"
8
+import {getAccount,getLogList} from '@/services/account'
7 9
 import './style.less'
8 10
 
11
+
9 12
 export default withLayout((props) => {
10
-  const { router } = props
11
-  let { balance } = router.params
12
-  const goWithdrawal = () => { 
13
+  const [balance,setBlance]=useState(0)
14
+  const [logList,setLogList]=useState([])
15
+  const goWithdrawal = () => {
13 16
     Taro.navigateTo({ url: `/pages/withdrawal/index?balance=${balance}` });
14 17
   }
18
+  const getList=()=>{
19
+    getAccount().then(res=>{
20
+      setBlance(res.amounts)
21
+    })
22
+    getLogList().then(res=>{
23
+      setLogList(res.records)
24
+    })
25
+  }
26
+  useEffect(()=>{
27
+    getList()
28
+  },[])
15 29
   return (
16 30
     <View className='page-index'>
17 31
       <View className='index-navbar'>
@@ -21,39 +35,33 @@ export default withLayout((props) => {
21 35
         <ScrollView scrollY style={{ height: '100%' }}>
22 36
           <WalletCard onClick={goWithdrawal} value={balance} />
23 37
           <ListTitle value='零钱明细' />
24
-          <View className='dayClass'>2022-03-10</View>
25 38
           <View className='walletCell'>
26
-            <View className='content'>
27
-              <View>提现</View>
28
-              <View className='withDrawalDetail'>申请提现,建设银行5321532154646465
29
-                4135456465465</View>
39
+            <View className='flexTop'>
40
+              <View className='content'>提现</View>
41
+              <View className='money'>-9000</View>
30 42
             </View>
31
-            <View className='money'>-9000元</View>
43
+            <View className='withDrawalDetail'>2022-4-10 10:55</View>
32 44
           </View>
33 45
           <View className='walletCell'>
34
-            <View className='content'>
35
-              <View>提现</View>
36
-              <View className='withDrawalDetail'>申请提现,建设银行5321532154646465
37
-                4135456465465</View>
46
+            <View className='flexTop'>
47
+              <View className='content'>提现</View>
48
+              <View className='money'>-9</View>
38 49
             </View>
39
-            <View className='money'>-9元</View>
50
+            <View className='withDrawalDetail'>2022-4-8 10:55</View>
40 51
           </View>
41
-
42
-          <View className='dayClass'>2022-03-10</View>
43 52
           <View className='walletCell'>
44
-            <View className='content'>
45
-              <View>收入</View>
46
-              <View className='withDrawalDetail'>取消订单-退回未使用金额</View>
53
+            <View className='flexTop'>
54
+              <View className='content'>收入</View>
55
+              <View className='money revenue'>+200</View>
47 56
             </View>
48
-            <View className='money revenue'>+200元</View>
57
+            <View className='withDrawalDetail'>2022-2-10 10:55</View>
49 58
           </View>
50 59
           <View className='walletCell'>
51
-            <View className='content'>
52
-              <View>提现</View>
53
-              <View className='withDrawalDetail'>申请提现,建设银行5321532154646465
54
-                4135456465465</View>
60
+            <View className='flexTop'>
61
+              <View className='content'>提现</View>
62
+              <View className='money'>-90</View>
55 63
             </View>
56
-            <View className='money'>-90元</View>
64
+            <View className='withDrawalDetail'>2022-4-1 10:55</View>
57 65
           </View>
58 66
         </ScrollView>
59 67
       </View>

+ 29
- 35
src/pages/wallet/style.less 查看文件

@@ -1,47 +1,41 @@
1 1
 .wallet{
2 2
   margin: 30px;
3 3
   font-weight: bold;
4
-  .dayClass{
5
-    height: 68px;
6
-    background: #F8F8F8;
7
-    font-size: 30px;
8
-    color: #333333;
9
-    line-height: 68px;
10
-    margin-top: 30px;
11
-    padding-left: 20px;
12
-  }
13 4
   .walletCell{
14 5
     background: #FFF;
15 6
     box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.12);
16
-    font-weight: bold;
17
-    display: flex;
18
-    align-items: center;
7
+    font-weight: bold;    
19 8
     padding: 30px 20px;
20
-    margin-bottom: 1px;
21
-    .content{
22
-      width: 63vw;
23
-      font-size: 32px;
24
-      line-height: 32px;
25
-      color: #333;
26
-      .withDrawalDetail{
27
-        margin-top: 26px;
28
-        font-style: 30px;
29
-        color: #666;
30
-        font-weight:400;
31
-        overflow: hidden;
32
-        text-overflow:ellipsis;
33
-        white-space: nowrap;
9
+    margin-bottom: 2px;
10
+    .flexTop{
11
+      display: flex;
12
+      align-items: center;
13
+      .content{
14
+        width: 63vw;
15
+        font-size: 32px;
16
+        line-height: 32px;
17
+        color: #333;      
18
+      }
19
+      .money{
20
+        font-size: 40px;
21
+        color: #FF3F3F;
22
+        position: absolute;
23
+        right: 30px;
24
+      }
25
+      .revenue{
26
+        font-size: 30px;
27
+        color: #00AE3A;
34 28
       }
35 29
     }
36
-    .money{
37
-      font-size: 40px;
38
-      color: #FF3F3F;
39
-      position: absolute;
40
-      right: 30px;
41
-    }
42
-    .revenue{
43
-      font-size: 30px;
44
-      color: #00AE3A;
30
+    .withDrawalDetail{
31
+      margin-top: 26px;
32
+      font-style: 30px;
33
+      color: #666;
34
+      font-weight:400;
35
+      overflow: hidden;
36
+      text-overflow:ellipsis;
37
+      white-space: nowrap;
45 38
     }
39
+    
46 40
   }
47 41
 }

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

@@ -59,7 +59,7 @@ export default withLayout((props) => {
59 59
       if (res.records.length != 0) {
60 60
         setBankList(res.records)
61 61
         setBankContentList(res.records.map(item => {
62
-          return item.ownerBank + '(' + item.cardNo.substr(15, 4) + ')'
62
+          return item.ownerBank + '(' + item.cardNo.slice(-4) + ')'
63 63
         }))
64 64
       }
65 65
     })

+ 17
- 0
src/services/account.js 查看文件

@@ -0,0 +1,17 @@
1
+import request from '@/utils/request'
2
+
3
+
4
+/**
5
+  * 我的钱包
6
+  * @returns 
7
+  * params 搜索条件放这里
8
+  */
9
+ export const getAccount = (params) => request('/account/mine', { params })
10
+
11
+ 
12
+/**
13
+  * 我的流水
14
+  * @returns 
15
+  * params 搜索条件放这里
16
+  */
17
+ export const getLogList = (params) => request('/account-log', { params })

+ 6
- 0
src/services/bank.js 查看文件

@@ -6,6 +6,12 @@ import request from '@/utils/request'
6 6
   * params 搜索条件放这里
7 7
   */
8 8
  export const getBankList = (params) => request('/bankcard', { params })
9
+/**
10
+  * 银行列表
11
+  * @returns 
12
+  * params 搜索条件放这里
13
+  */
14
+ export const getBankTypeList = (params) => request('/bank', { params })
9 15
 
10 16
 /**
11 17
   * 银行卡详情