Commit 36a653ff by Giang Tran

update code

parent 4314d546
...@@ -9,7 +9,23 @@ const TransferView = (props) => { ...@@ -9,7 +9,23 @@ const TransferView = (props) => {
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'Chuyển khoản'} /> <HeaderBack title={'Chuyển khoản'} />
<View style={{flex: 1, paddingHorizontal: 10, paddingTop: 10}}> <View
style={{
flex: 1,
paddingHorizontal: 20,
justifyContent: 'center',
alignItems: 'center',
}}>
<Text
style={{
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
}}>
Tính năng đang được phát trin, vui lòng quay li sau!
</Text>
</View>
{/* <View style={{flex: 1, paddingHorizontal: 10, paddingTop: 10}}>
<TextField <TextField
onChangeText={(val) => consoele.log(val)} onChangeText={(val) => consoele.log(val)}
title={'Số tiền'} title={'Số tiền'}
...@@ -26,7 +42,7 @@ const TransferView = (props) => { ...@@ -26,7 +42,7 @@ const TransferView = (props) => {
</View> </View>
<View style={styles.containerBtn}> <View style={styles.containerBtn}>
<Button title={'Chuyển tiền'} /> <Button title={'Chuyển tiền'} />
</View> </View> */}
</View> </View>
); );
}; };
......
import React from 'react'; import React, {useEffect, useState} from 'react';
import {View, Alert} from 'react-native';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {getTransaction} from '../../apis/Functions/users';
import HomeView from './HomeView'; import HomeView from './HomeView';
const Home = (props) => { const Home = (props) => {
return <HomeView />; const [data, setData] = useState({total_deposit: 0, total_withdraw: 0});
useEffect(() => {
getData();
}, []);
const getData = async () => {
const res = await getTransaction({});
if (res.data.code == 200 && res.data.data) {
setData(res.data.data);
} else {
Alert.alert('Thông báo!', 'Không lấy được thông tin!');
}
};
return <HomeView data={data} />;
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
......
...@@ -11,6 +11,7 @@ import Footer from './Footer'; ...@@ -11,6 +11,7 @@ import Footer from './Footer';
import {HEIGHT, HEIGHTXD, toPriceVnd, getFontXD} from '../../Config/Functions'; import {HEIGHT, HEIGHTXD, toPriceVnd, getFontXD} from '../../Config/Functions';
import R from '../../assets/R'; import R from '../../assets/R';
const HomeView = (props) => { const HomeView = (props) => {
const {total_deposit, total_withdraw} = props.data;
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderHome /> <HeaderHome />
...@@ -24,14 +25,22 @@ const HomeView = (props) => { ...@@ -24,14 +25,22 @@ const HomeView = (props) => {
<View style={styles.row}> <View style={styles.row}>
<View style={styles.itemMenu}> <View style={styles.itemMenu}>
<Text style={styles.txtTitle}>Np tin</Text> <Text style={styles.txtTitle}>Np tin</Text>
<Text style={styles.txtMoney}> {toPriceVnd(1000000)} Đ </Text> <Text style={styles.txtMoney}>
{' '}
{total_deposit == 0 ? 0 : toPriceVnd(total_deposit)} Đ{' '}
</Text>
</View> </View>
<View <View
style={{width: 0.5, backgroundColor: R.colors.borderGray}} style={{width: 0.5, backgroundColor: R.colors.borderGray}}
/> />
<View style={styles.itemMenu}> <View style={styles.itemMenu}>
<Text style={styles.txtTitle}>Rút tin</Text> <Text style={styles.txtTitle}>Rút tin</Text>
<Text style={styles.txtMoney}> {toPriceVnd(1000000)} Đ </Text> <Text style={styles.txtMoney}>
{' '}
{total_withdraw == 0
? 0
: toPriceVnd(total_withdraw)} Đ{' '}
</Text>
</View> </View>
</View> </View>
</View> </View>
...@@ -39,17 +48,14 @@ const HomeView = (props) => { ...@@ -39,17 +48,14 @@ const HomeView = (props) => {
<View style={styles.row}> <View style={styles.row}>
<View style={styles.itemMenu}> <View style={styles.itemMenu}>
<Text style={styles.txtTitle}>Hoa hng</Text> <Text style={styles.txtTitle}>Hoa hng</Text>
<Text style={styles.txtMoney1}>+ {toPriceVnd(1000000)} Đ </Text> <Text style={styles.txtMoney1}>+ 0 Đ </Text>
</View> </View>
<View <View
style={{width: 0.5, backgroundColor: R.colors.borderGray}} style={{width: 0.5, backgroundColor: R.colors.borderGray}}
/> />
<View style={styles.itemMenu}> <View style={styles.itemMenu}>
<Text style={styles.txtTitle}>Li nhun</Text> <Text style={styles.txtTitle}>Li nhun</Text>
<Text style={styles.txtMoney1}> <Text style={styles.txtMoney1}>0 Đ</Text>
{' '}
+ {toPriceVnd(1000000)} Đ{' '}
</Text>
</View> </View>
</View> </View>
</View> </View>
...@@ -99,8 +105,9 @@ const styles = StyleSheet.create({ ...@@ -99,8 +105,9 @@ const styles = StyleSheet.create({
}, },
txtTitle: { txtTitle: {
fontSize: getFontXD(36), fontSize: getFontXD(36),
color: R.colors.txtMain2, color: '#00359C',
textTransform: 'uppercase', textTransform: 'uppercase',
fontWeight: 'bold',
}, },
txtMoney: { txtMoney: {
fontSize: getFontXD(42), fontSize: getFontXD(42),
......
import React, {useState} from 'react'; import React, {useState, useEffect} from 'react';
import { import {
View, View,
Text, Text,
...@@ -6,57 +6,112 @@ import { ...@@ -6,57 +6,112 @@ import {
FlatList, FlatList,
Dimensions, Dimensions,
TouchableOpacity, TouchableOpacity,
Alert,
} from 'react-native'; } from 'react-native';
import {connect} from 'react-redux';
import R from '../../assets/R'; import R from '../../assets/R';
import HeaderBack from '../../components/Header/HeaderBack'; import HeaderBack from '../../components/Header/HeaderBack';
import Item from './Item'; import Item from './Item';
import {getFontXD, WIDTHXD} from '../../Config/Functions'; import {getFontXD, WIDTHXD, checkFormatArray} from '../../Config/Functions';
import TextField from '../../components/Input/TextField'; import TextField from '../../components/Input/TextField';
import PickerItem from '../../components/Picker/PickerItem'; import PickerItem from '../../components/Picker/PickerItem';
import {getListBank, addMethodBank} from '../../apis/Functions/Widthdraw';
import {showLoading, hideLoading} from '../../actions/loadingAction';
import {useNavigation} from '@react-navigation/native';
const {width} = Dimensions.get('window'); const {width} = Dimensions.get('window');
const dataTest = [
{
value: '1',
name: 'Vietnamese',
},
{
value: '2',
name: 'English',
},
];
const AddMethodPay = (props) => { const AddMethodPay = (props) => {
const [language, setLanguage] = useState(dataTest[0].name); const [data, setData] = useState([]);
const navigate = useNavigation();
const [bank_id, setBankID] = useState();
const [branch_name, setBankName] = useState();
const [account_name, setAccountName] = useState();
const [account_no, setAccountNo] = useState();
useEffect(() => {
getData();
}, []);
const getData = async () => {
const res = await getListBank({
platform: Platform.OS,
});
if (res.data.code == 200 && res.data.data) {
setData(res.data.data);
} else {
alert('Không lấy được danh sách ngân hàng!');
}
};
const onLick = async () => {
const titles = [
'ngân hàng',
'chi nhánh',
'chủ tài khoản',
'số tài khoản ngân hàng',
];
const index = checkFormatArray([
bank_id,
branch_name,
account_name,
account_no,
]);
if (index === true) {
props.showLoading();
const res = await addMethodBank({
platform: Platform.OS,
bank_id: bank_id.id,
branch_name,
account_name,
account_no,
});
props.hideLoading();
if (res.data.code == 200) {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
navigate.goBack();
}, 500);
} else {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
}, 500);
}
} else {
Alert.alert('Vui lòng điền ' + titles[index]);
}
};
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'Thêm phương thức thanh toán'} /> <HeaderBack title={'Thêm phương thức thanh toán'} />
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.txtTitle}>Chn ngân hàng </Text> <Text style={styles.txtTitle}>Chn ngân hàng </Text>
<PickerItem <PickerItem
defaultValue={language} value={bank_id}
value={language} data={data}
data={dataTest}
onValueChange={(value, items) => { onValueChange={(value, items) => {
setLanguage(items.name); setBankID(items);
}} }}
/> />
<TextField <TextField
onChangeText={(val) => consoele.log(val)} onChangeText={(val) => setBankName(val)}
title={'Chi nhánh'} title={'Chi nhánh'}
/> />
<TextField <TextField
onChangeText={(val) => consoele.log(val)} onChangeText={(val) => setAccountName(val)}
title={'Tên chủ tài khoản'} title={'Tên chủ tài khoản'}
/> />
<TextField <TextField
onChangeText={(val) => consoele.log(val)} onChangeText={(val) => setAccountNo(val)}
title={'Số tài khoản ngân hàng'} title={'Số tài khoản ngân hàng'}
isNumber={true} isNumber={true}
/> />
</View> </View>
<TouchableOpacity style={styles.btn}> <TouchableOpacity onPress={onLick} style={styles.btn}>
<Text style={styles.txtAdd}>Thêm</Text> <Text style={styles.txtAdd}>Thêm</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
...@@ -93,4 +148,12 @@ const styles = StyleSheet.create({ ...@@ -93,4 +148,12 @@ const styles = StyleSheet.create({
}, },
}); });
export default AddMethodPay; const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {
showLoading,
hideLoading,
})(AddMethodPay);
...@@ -4,26 +4,29 @@ import {getFontXD, HEIGHTXD, WIDTHXD, toPriceVnd} from '../../Config/Functions'; ...@@ -4,26 +4,29 @@ import {getFontXD, HEIGHTXD, WIDTHXD, toPriceVnd} from '../../Config/Functions';
import R from '../../assets/R'; import R from '../../assets/R';
import Block from '../../components/Block'; import Block from '../../components/Block';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {useNavigation} from '@react-navigation/native';
import {METHODPAYDETAIL} from '../../routers/ScreenNames';
const Item = (props) => { const Item = (props) => {
const navigate = useNavigation();
const {item} = props; const {item} = props;
return ( return (
<TouchableOpacity onPress={() => console.log('HEllo')}> <TouchableOpacity onPress={() => navigate.navigate(METHODPAYDETAIL, item)}>
<View style={styles.container}> <View style={styles.container}>
<Block flex={1} row center padding={[10, 20]}> <Block flex={1} row center padding={[10, 20]}>
<Image source={item.image} style={styles.imgIcon} /> <Image source={{uri: item.bank.logo}} style={styles.imgIcon} />
<Block padding={[0, 10]}> <Block padding={[0, 10]}>
<Text style={styles.txtBig}>{item.title}</Text> <Text style={styles.txtBig}>{item.title}</Text>
<Block space={'between'} margin={[10, 0, 0, 0]} row flex={1}> <Block space={'between'} row flex={1}>
<Block> <Block>
<Text style={styles.txtLeft}>Tin np ti thiu</Text> <Text style={styles.txtLeft}>Ch TK</Text>
<Text style={styles.txtLeft}>Hoa hng</Text> <Text style={styles.txtLeft}>STK</Text>
<Text style={styles.txtLeft}>Thi gian</Text> <Text style={styles.txtLeft}>Chi nhánh</Text>
</Block> </Block>
<Block> <Block>
<Text style={styles.txtRight}>{item.minPay} USD</Text> <Text style={styles.txtRight}>{item.account_name}</Text>
<Text style={styles.txtRight}>{item.rose} USD</Text> <Text style={styles.txtRight}>{item.account_no}</Text>
<Text style={styles.txtRight}>{item.time}</Text> <Text style={styles.txtRight}>{item.branch_name}</Text>
</Block> </Block>
</Block> </Block>
</Block> </Block>
...@@ -97,7 +100,6 @@ const styles = StyleSheet.create({ ...@@ -97,7 +100,6 @@ const styles = StyleSheet.create({
}, },
txtRight: { txtRight: {
fontSize: getFontXD(36), fontSize: getFontXD(36),
fontWeight: 'bold',
marginBottom: 5, marginBottom: 5,
}, },
}); });
import React from 'react'; import React, {useState, useEffect} from 'react';
import MethodPayView from './MethodPayView'; import MethodPayView from './MethodPayView';
import {getListWidthDraw} from '../../apis/Functions/Widthdraw';
import {useNavigation} from '@react-navigation/native';
const MethodPay = (props) => { const MethodPay = (props) => {
return <MethodPayView />; const [data, setData] = useState([]);
const [isRefresh, setRefresh] = useState(true);
const navigation = useNavigation();
useEffect(() => {
const unsubscribe = navigation.addListener('focus', () => {
getData();
});
return unsubscribe;
}, [navigation]);
const getData = async () => {
const res = await getListWidthDraw({
platform: Platform.OS,
});
if (res.data.code == 200 && res.data.data) {
setData(res.data.data);
} else {
alert('Không lấy được danh sách phương thức thanh toán!');
}
};
return <MethodPayView listMethod={data} />;
}; };
export default MethodPay; export default MethodPay;
import React, {useState, useEffect} from 'react';
import {
View,
Text,
StyleSheet,
FlatList,
Dimensions,
TouchableOpacity,
Alert,
} from 'react-native';
import {connect} from 'react-redux';
import R from '../../assets/R';
import HeaderBack from '../../components/Header/HeaderBack';
import Item from './Item';
import {getFontXD, WIDTHXD, checkFormatArray} from '../../Config/Functions';
import TextField from '../../components/Input/TextField';
import PickerItem from '../../components/Picker/PickerItem';
import {
deleteMethodBank,
addMethodBank,
updateMethodBank,
} from '../../apis/Functions/Widthdraw';
import {showLoading, hideLoading} from '../../actions/loadingAction';
import {useNavigation} from '@react-navigation/native';
import BankInfor from '../../components/BankInfor';
const {width} = Dimensions.get('window');
const MethodPayDetail = (props) => {
const [data, setData] = useState([]);
const {params} = props.route;
const [disable, setDisable] = useState(true);
const navigate = useNavigation();
const [branch_name, setBankName] = useState(params.branch_name);
const [account_name, setAccountName] = useState(params.account_name);
const [account_no, setAccountNo] = useState(params.account_no);
const onUpdate = async () => {
const titles = ['chi nhánh', 'chủ tài khoản', 'số tài khoản ngân hàng'];
const index = checkFormatArray([branch_name, account_name, account_no]);
console.log('Index', index);
if (index === true) {
if (
branch_name != params.branch_name ||
account_name != params.account_name ||
account_no != params.account_no
) {
props.showLoading();
const res = await updateMethodBank({
platform: Platform.OS,
id: params.id,
branch_name,
account_name,
account_no,
});
props.hideLoading();
if (res.data.code == 200) {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
navigate.goBack();
}, 500);
} else {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
}, 500);
}
} else {
Alert.alert('Thông báo!', 'Không có gì thay đổi');
}
} else Alert.alert('Thông báo!', 'Vui lòng điền ' + titles[index]);
};
const onRemove = async () => {
props.showLoading();
const res = await deleteMethodBank({
platform: Platform.OS,
id: params.id,
});
props.hideLoading();
if (res.data.code == 200) {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
navigate.goBack();
}, 500);
} else {
setTimeout(() => {
Alert.alert('Thông báo!', res.data.message);
}, 500);
}
};
return (
<View style={{flex: 1}}>
<HeaderBack title={'Chi tiết phương thức'} />
<View style={styles.container}>
<BankInfor
linkImg={params.bank.logo}
title={'Chọn ngân hàng'}
value={params.bank.name}
/>
<TextField
onChangeText={(val) => setBankName(val)}
title={'Chi nhánh'}
value={branch_name}
/>
<TextField
onChangeText={(val) => setAccountName(val)}
title={'Tên chủ tài khoản'}
value={account_name}
/>
<TextField
onChangeText={(val) => setAccountNo(val)}
title={'Số tài khoản ngân hàng'}
isNumber={true}
value={account_no}
/>
</View>
<TouchableOpacity onPress={onUpdate} style={styles.btnLeft}>
<Text style={styles.txtAdd}>Cp nht</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => {
Alert.alert(
'Thông báo!',
'Bạn có chắc chắn muốn xoá phương thức thanh toán',
[
{
text: 'Từ chối',
style: 'cancel',
},
{text: 'Đồng ý', onPress: () => onRemove()},
],
);
}}
style={styles.btnRight}>
<Text style={styles.txtAdd}>Xoá</Text>
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
container: {
paddingHorizontal: 20,
paddingTop: 10,
},
btnLeft: {
width: 150,
height: 40,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: R.colors.main,
borderRadius: 5,
position: 'absolute',
bottom: 30,
left: 20,
},
btnRight: {
width: 150,
height: 40,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: R.colors.main,
borderRadius: 5,
position: 'absolute',
bottom: 30,
right: 20,
},
txtAdd: {
color: R.colors.white,
fontSize: getFontXD(46),
textTransform: 'uppercase',
fontWeight: 'bold',
},
txtTitle: {
fontSize: getFontXD(42),
color: R.colors.color777,
marginBottom: 5,
},
});
const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {
showLoading,
hideLoading,
})(MethodPayDetail);
...@@ -7,59 +7,10 @@ import {WIDTHXD} from '../../Config/Functions'; ...@@ -7,59 +7,10 @@ import {WIDTHXD} from '../../Config/Functions';
import Icon from 'react-native-vector-icons/Entypo'; import Icon from 'react-native-vector-icons/Entypo';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
import {ADDMETHODPAY} from '../../routers/ScreenNames'; import {ADDMETHODPAY} from '../../routers/ScreenNames';
const data = [
{
image: R.images.iconNganLuong,
title: 'Ngân lượng',
rose: 0,
time: 'Tức thời',
minPay: 5,
id: '1',
},
{
image: R.images.iconVisa,
title: 'Visa bank',
rose: 0,
time: 'Tức thời',
minPay: 1,
id: '2',
},
{
image: R.images.iconInternet,
title: 'Internet banking',
rose: 0,
time: 'Tức thời',
minPay: 5,
id: '3',
},
{
image: R.images.iconBitcoin,
title: 'Bitcoin',
rose: 0,
time: 'Tức thời',
minPay: 2,
id: '4',
},
{
image: R.images.iconSticpay,
title: 'Sticpay',
rose: 0,
time: 'Tức thời',
minPay: 1,
id: '5',
},
{
image: R.images.iconTether,
title: 'Tether',
rose: 0,
time: 'Tức thời',
minPay: 10,
id: '6',
},
];
const MethodPayView = (props) => { const MethodPayView = (props) => {
const navigate = useNavigation(); const navigate = useNavigation();
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'Cài đặt phương thức thanh toán'} /> <HeaderBack title={'Cài đặt phương thức thanh toán'} />
...@@ -67,7 +18,8 @@ const MethodPayView = (props) => { ...@@ -67,7 +18,8 @@ const MethodPayView = (props) => {
<FlatList <FlatList
keyExtractor={(item) => item.id} keyExtractor={(item) => item.id}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
data={data} onEndReachedThreshold={0.01}
data={props.listMethod}
renderItem={({item}) => <Item item={item} />} renderItem={({item}) => <Item item={item} />}
/> />
......
...@@ -11,3 +11,21 @@ export const widthDraw = async (body) => ...@@ -11,3 +11,21 @@ export const widthDraw = async (body) =>
PostData(url.urlWithdraw, body) PostData(url.urlWithdraw, body)
.then((res) => res) .then((res) => res)
.catch((err) => err); .catch((err) => err);
export const getListBank = async (body) =>
GetData(url.urlListBank, body)
.then((res) => res)
.catch((err) => err);
export const addMethodBank = async (body) =>
PostData(url.urlAddMethodBank, body)
.then((res) => res)
.catch((err) => err);
export const deleteMethodBank = async (body) =>
PostData(url.urlDeleteMethodBank, body)
.then((res) => res)
.catch((err) => err);
export const updateMethodBank = async (body) =>
PostData(url.urlUpdateMethodBank, body)
.then((res) => res)
.catch((err) => err);
import {PostLogin, PostData, PostFormData} from '../helpers'; import {PostLogin, PostData, GetData, PostFormData} from '../helpers';
import url from '../url'; import url from '../url';
...@@ -36,3 +36,8 @@ export const verifyAccountApi = async (body) => ...@@ -36,3 +36,8 @@ export const verifyAccountApi = async (body) =>
PostFormData(url.urlVerifyAccount, body) PostFormData(url.urlVerifyAccount, body)
.then((res) => res) .then((res) => res)
.catch((err) => err); .catch((err) => err);
export const getTransaction = async (body) =>
GetData(url.urlGetTransaction, body)
.then((res) => res)
.catch((err) => err);
...@@ -14,7 +14,14 @@ export default { ...@@ -14,7 +14,14 @@ export default {
urlMediaDetail: root + 'api/v1/videos/detail', urlMediaDetail: root + 'api/v1/videos/detail',
urlGetListCalendar: root + 'api/v1/news/calendar', urlGetListCalendar: root + 'api/v1/news/calendar',
//Withdraw //Methodpay
urlGetListWithDraw: root + 'api/v1/payments/get-list-withdraw-method', urlGetListWithDraw: root + 'api/v1/payments/get-list-withdraw-method',
urlWithdraw: root + 'api/v1/customers/request-withdraw', urlWithdraw: root + 'api/v1/customers/request-withdraw',
urlListBank: root + 'api/v1/payments/get-list-bank',
urlAddMethodBank: root + 'api/v1/customers/store-payment-method',
urlDeleteMethodBank: root + 'api/v1/customers/delete-payment-method',
urlUpdateMethodBank: root + 'api/v1/customers/update-payment-method',
//Home
urlGetTransaction: root + 'api/v1/customers/statistic-transaction',
}; };
...@@ -7,12 +7,9 @@ const AlertMessage = (message: string, title?: string, onPressOk?: any, cancel?: ...@@ -7,12 +7,9 @@ const AlertMessage = (message: string, title?: string, onPressOk?: any, cancel?:
message, message,
cancel cancel
? [ ? [
{ {
text:"Hien thi btn khong", text: 'Đồng ý',
style: 'default',
},
{
text: 'Title btn co',
onPress: () => { onPress: () => {
if (typeof onPressOk === 'function') { if (typeof onPressOk === 'function') {
onPressOk(); onPressOk();
...@@ -23,7 +20,7 @@ const AlertMessage = (message: string, title?: string, onPressOk?: any, cancel?: ...@@ -23,7 +20,7 @@ const AlertMessage = (message: string, title?: string, onPressOk?: any, cancel?:
] ]
: [ : [
{ {
text:"Hien thi thong bao khong co cancel", text:"Từ chối",
onPress: () => { onPress: () => {
if (typeof onPressOk === 'function') { if (typeof onPressOk === 'function') {
onPressOk(); onPressOk();
......
import React from 'react';
import {View, Text, TextInput, Image} from 'react-native';
import {HEIGHTXD, WIDTHXD, getFontXD} from '../Config/Functions';
import R from '../assets/R';
const TextField = (props) => {
const {title, value, linkImg} = props;
return (
<View style={{marginVertical: 5}}>
<Text
style={{
fontSize: getFontXD(42),
color: R.colors.color777,
marginBottom: 5,
}}>
{title ? title : ''}
</Text>
<View
style={{
height: HEIGHTXD(109),
borderRadius: 7,
borderWidth: 0.7,
flexDirection: 'row',
borderColor: '#DBDBDB',
fontSize: getFontXD(42),
paddingVertical: 5,
paddingHorizontal: 10,
backgroundColor: '#E9E9E9',
shadowColor: '#AFA9A9',
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.25,
shadowRadius: 1.84,
elevation: 1,
alignItems: 'center',
}}>
<Image
resizeMode={'contain'}
source={{uri: linkImg}}
style={{width: 50, height: HEIGHTXD(109), marginRight: 10}}
/>
<Text numberOfLines={1}>{value}</Text>
</View>
</View>
);
};
export default React.memo(TextField);
...@@ -30,7 +30,7 @@ import { ...@@ -30,7 +30,7 @@ import {
WALLETWITHDRAW, WALLETWITHDRAW,
} from '../../routers/ScreenNames'; } from '../../routers/ScreenNames';
const renderWallet = (status) => { const renderWallet = (status, current_money, current_cqg_money) => {
const navigate = useNavigation(); const navigate = useNavigation();
if (status == 3) if (status == 3)
return ( return (
...@@ -38,16 +38,19 @@ const renderWallet = (status) => { ...@@ -38,16 +38,19 @@ const renderWallet = (status) => {
<View style={styles.containerWallet}> <View style={styles.containerWallet}>
<Text style={styles.txtWallet}>Tài khon ví</Text> <Text style={styles.txtWallet}>Tài khon ví</Text>
<View style={{flexDirection: 'row'}}> <View style={{flexDirection: 'row'}}>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text> <Text style={styles.txtMoney}>
{current_money == 0 ? 0 : toPriceVnd(current_money)}
</Text>
<Text style={styles.txtUnit}>Đ</Text> <Text style={styles.txtUnit}>Đ</Text>
</View> </View>
</View> </View>
<View style={{width: 1, backgroundColor: '#EDEDF1', height: '100%'}} /> <View style={{width: 1, backgroundColor: '#EDEDF1', height: '100%'}} />
<View style={styles.containerWallet}> <View style={styles.containerWallet}>
<Text style={styles.txtWallet}>Tài khon CQG</Text> <Text style={styles.txtWallet}>Tài khon CQG</Text>
<View style={{flexDirection: 'row'}}> <View style={{flexDirection: 'row'}}>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text> <Text style={styles.txtMoney}>
{current_cqg_money == 0 ? 0 : toPriceVnd(current_cqg_money)}
</Text>
<Text style={styles.txtUnit}>Đ</Text> <Text style={styles.txtUnit}>Đ</Text>
</View> </View>
</View> </View>
...@@ -105,6 +108,7 @@ const renderLabel = (status) => { ...@@ -105,6 +108,7 @@ const renderLabel = (status) => {
const HeaderHome = (props) => { const HeaderHome = (props) => {
const navigate = useNavigation(); const navigate = useNavigation();
console.log(props.user);
const copyToClipboard = () => { const copyToClipboard = () => {
Alert.alert('Đã sao chép link giới thiệu!'); Alert.alert('Đã sao chép link giới thiệu!');
...@@ -151,7 +155,11 @@ const HeaderHome = (props) => { ...@@ -151,7 +155,11 @@ const HeaderHome = (props) => {
</View> </View>
<View style={styles.wrapWallet}> <View style={styles.wrapWallet}>
{renderWallet(props.user.status)} {renderWallet(
props.user.status,
props.user.current_money,
props.user.current_cqg_money,
)}
</View> </View>
<View style={styles.containerMenu}> <View style={styles.containerMenu}>
<TouchableOpacity <TouchableOpacity
......
...@@ -57,3 +57,4 @@ export const WALLETDEPOSIT = 'WALLETDEPOSIT'; ...@@ -57,3 +57,4 @@ export const WALLETDEPOSIT = 'WALLETDEPOSIT';
export const WALLETWITHDRAW = 'WALLETWITHDRAW'; export const WALLETWITHDRAW = 'WALLETWITHDRAW';
export const PACKETCQG = 'PACKETCQG'; export const PACKETCQG = 'PACKETCQG';
export const MEDIADETAIL = 'MEDIADETAIL'; export const MEDIADETAIL = 'MEDIADETAIL';
export const METHODPAYDETAIL = 'METHODPAYDETAIL';
...@@ -38,6 +38,7 @@ import WalletDeposit from '../Screens/Action/Wallet/WalletDeposit'; ...@@ -38,6 +38,7 @@ import WalletDeposit from '../Screens/Action/Wallet/WalletDeposit';
import WalletWithdraw from '../Screens/Action/Wallet/WalletWithdraw'; import WalletWithdraw from '../Screens/Action/Wallet/WalletWithdraw';
import PacketCQG from '../Screens/Account/PacrtCQG/PacketCQG'; import PacketCQG from '../Screens/Account/PacrtCQG/PacketCQG';
import MediaDetail from '../Screens/NewFeed/Media/MediaDetail'; import MediaDetail from '../Screens/NewFeed/Media/MediaDetail';
import MethodPayDetail from '../Screens/MethodPay/MethodPayDetail';
import * as ScreenName from './ScreenNames'; import * as ScreenName from './ScreenNames';
...@@ -59,6 +60,10 @@ function MyStack(props) { ...@@ -59,6 +60,10 @@ function MyStack(props) {
<Stack.Screen name={ScreenName.WALLET} component={Wallet} /> <Stack.Screen name={ScreenName.WALLET} component={Wallet} />
<Stack.Screen name={ScreenName.WALLETDEPOSIT} component={WalletDeposit} /> <Stack.Screen name={ScreenName.WALLETDEPOSIT} component={WalletDeposit} />
<Stack.Screen <Stack.Screen
name={ScreenName.METHODPAYDETAIL}
component={MethodPayDetail}
/>
<Stack.Screen
name={ScreenName.WALLETWITHDRAW} name={ScreenName.WALLETWITHDRAW}
component={WalletWithdraw} component={WalletWithdraw}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment