Authored by 陈林

Merge branch 'V6.7.9_dev' into 'master'

V6.7.9 dev



See merge request !20
... ... @@ -24,6 +24,8 @@ import BankListContainer from './containers/BankListContainer';
import RecommendContainer from './containers/RecommendContainer';
import TalentRankContainer from './containers/TalentRankContainer';
import ShareDetailContainer from './containers/ShareDetailContainer';
import InvitedFriendsContainer from './containers/InvitedFriendsContainer';
import EstimateDetailContainer from './containers/EstimateDetailContainer';
import {setChannel, setHost, setPlatform, setServiceHost, setproductPool, setSkns} from './reducers/app/appActions';
import {setOrderCode, setActivityId, setSrc, setJumpUrl} from './reducers/alliance/allianceActions';
... ... @@ -124,6 +126,20 @@ export default function native(platform) {
<RecommendContainer/>
</Provider>
);
} else if (type === 'invitedFriends') {
return (
<Provider store={store}>
<InvitedFriendsContainer/>
</Provider>
);
} else if (type === 'estimateDetails') {
return (
<Provider store={store}>
<EstimateDetailContainer
time_type={this.props.time_type}
tab_type={this.props.tab_type}/>
</Provider>
);
} else {
return (
<Provider store={store}>
... ...
... ... @@ -132,10 +132,12 @@ export default class Data extends Component {
renderTabBar={() => <TabStatistics tabNames={tabTitles}/>}
onChangeTab={(obj) => {this.props.changeTab && this.props.changeTab(obj.i + 1);}}
>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} currentTab = {1} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} currentTab = {2} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} currentTab = {3} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/>
</ScrollableTabView>
<View style={{height: 10, backgroundColor: '#f0f0f0'}}/>
</ScrollView>
);
}
... ... @@ -247,6 +249,6 @@ let styles = StyleSheet.create({
width: width,
height: 0.5,
backgroundColor: '#e0e0e0'
},
}
})
;
... ...
'use strict';
import React, {Component} from 'react';
import {Dimensions, ListView, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import {Immutable} from 'immutable';
export default class EstimateIncome extends Component {
constructor(props) {
super(props);
this.state = {
tabType: props.tabType,
};
this._renderRow = this._renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID) {
let status = rowData.get('status') === '10' ? '待结算' : '';
console.log(this.state.tabType);
return (
<View>
<TouchableOpacity activeOpacity={1} onPress={() => {
this.props.jumpWithUrl && (this.state.tabType === "1" ? this.props.jumpWithUrl('订单详情', 'orderDetail', rowData.get('orderCode')) : this.props.jumpWithUrl('佣金详情', 'activityOrderDetail', rowData.get('id')) );
}}>
<View style={styles.rowView}>
<View style={{height: 70, paddingTop: 12, paddingBottom: 12}}>
{ this.state.tabType === "1" ? <Text style={styles.numberText}>订单金额:{rowData.get('lastOrderAmountStr')}</Text> : <Text style={styles.numberText}>活动名称:{rowData.get('activityName')}</Text>}
<View style={{flexDirection: 'row', marginTop: 6}}>
<Text style={styles.timeText}>{rowData.get('orderTimeStr')}</Text>
{rowData.get('isNew') === 1 && this.state.tabType === "1" ?
<View style={styles.statusTextContainer}>
<Text style={styles.statusText}>新客订单</Text>
</View>: null}
</View>
</View>
<View>
<Text style={styles.priceText}>{rowData.get('amountStr')}</Text>
<Text style={[styles.timeText, {fontSize:12, textAlign:'right'}]}>{status}</Text>
</View>
</View>
<View style={styles.lineView}/>
</TouchableOpacity>
</View>
);
}
render() {
let {estimateList} = this.props;
let estimateLists = estimateList.list ? estimateList.list.toArray() : [];
return (
<View style={styles.container}>
<ListView
ref={(c) => {
this.listView = c;
}}
// yh_viewVisible={true}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(estimateLists)}
renderRow={this._renderRow}
onEndReached={() => {
if (estimateLists.size !== 0) {
this.props.onEndReached && this.props.onEndReached();
}
}}/>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0',
alignItems: 'center'
},
contentContainer: {
width: width,
backgroundColor: 'white'
},
rowView: {
width: width,
height: 70,
flexDirection: 'row',
paddingLeft: 15,
paddingRight: 15,
alignItems: 'center',
justifyContent: 'space-between'
},
underLine: {
width: 56,
height: 2,
backgroundColor: '#444444',
},
lineView: {
width: width,
height: 0.5,
backgroundColor: '#e0e0e0'
},
numberText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
color: '#444444',
letterSpacing: -0.19,
},
priceText: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 16,
color: '#444444',
letterSpacing: -0.21,
fontWeight: 'bold'
},
timeText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
color: '#B0B0B0',
letterSpacing: -0.19,
},
statusTextContainer: {
width: 48,
height: 18,
marginLeft: 10,
borderWidth: 1,
borderColor: '#D0021B',
borderRadius: 2,
alignItems: 'center',
justifyContent: 'center',
},
statusText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 10,
color: '#D0021B',
letterSpacing: -0.24,
textAlign: 'center',
},
});
\ No newline at end of file
... ...
'use strict';
import React, { Component } from 'react';
import { Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { Immutable } from 'immutable';
const DEVICE_WIDTH_RATIO = Dimensions.get('window').width / 375;
const { width } = Dimensions.get('window');
export default class InvitedFriends extends Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderFooter = this._renderFooter.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID) {
return (
<View>
<View style={styles.rowView}>
<View style={styles.rowItemStyle}>
<Text style={styles.nameItemStyle} numberOfLines={1}>{rowData.get("name")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("dateStr")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("orderNum")}</Text>
</View>
<View style={styles.rowItemStyle}>
<Text style={styles.rowTextStyle}>{rowData.get("orderAmountStr")}</Text>
</View>
</View>
<View style={styles.lineView}/>
</View>
);
}
_renderFooter(){
return (
<View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}>
<Text style={{textAlign: 'center', fontFamily: 'PingFang-SC-Regular', fontSize: 12, color: '#B0B0B0',}}>暂无更多数据</Text>
</View>
)
}
render() {
let {
invitedFriendsList,
} = this.props;
let invitersList = invitedFriendsList.list ? invitedFriendsList.list.toArray() : [];
return (
<View style={styles.container}>
<View style={styles.topImageView}>
<Image style={styles.topImageView} source={{uri:'https://cdn.yoho.cn/app/yohogain/invite/banner.jpg'}} resizeMode={'contain'}/>
</View>
<View style={styles.spaceView}/>
<View style={styles.middleView}>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>我邀请的好友</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>申请时间</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>7天订单数</Text>
</View>
<View style={styles.textItemStyle}>
<Text style={styles.textsStyle}>7天订单金额</Text>
</View>
</View>
<View style={styles.lineView}/>
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(invitersList)}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
onEndReached={() => {
if (invitersList.size !== 0) {
this.props.onEndReached && this.props.onEndReached();
}
}}/>
<TouchableOpacity activeOpacity={1} style={styles.touchableStyle} onPress={() => {
this.props.shareForInvite && this.props.shareForInvite();
}}>
<Text style={styles.buttonStyle}>邀请好友加入有货有赚</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
contentContainer: {
width: width,
backgroundColor: 'white',
paddingBottom: 55 * DEVICE_WIDTH_RATIO,
},
topImageView: {
width: width,
height: 118 * DEVICE_WIDTH_RATIO,
},
middleView: {
backgroundColor: 'white',
height: 50 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
textItemStyle: {
width: width / 4,
alignItems: 'center',
paddingVertical: 18,
},
textsStyle: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 12,
color: '#444444',
},
rowView: {
height: 50 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
rowItemStyle: {
width: width / 4,
alignItems: 'center',
paddingVertical: 15,
},
nameItemStyle: {
width: width/4-25,
fontFamily: 'PingFang-SC-Regular',
fontSize: 11,
color: '#444444',
textAlign: 'center',
},
rowTextStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 11,
color: '#444444',
},
buttonStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 16,
fontWeight: 'bold',
color: '#FFFFFF',
textAlign: 'center',
},
touchableStyle: {
position: 'absolute',
width: width,
height: 55,
bottom: 0,
borderRadius: 2,
backgroundColor: '#D0021B',
justifyContent: 'center'
},
lineView: {
height: 0.5,
backgroundColor: '#e0e0e0'
},
spaceView: {
height: 10 * DEVICE_WIDTH_RATIO,
backgroundColor: '#F0F0F0'
},
});
... ...
... ... @@ -38,6 +38,20 @@ export default class Mine extends Component {
let ico = this.props.profile.head_ico;
let imageUrl = YH_Image.getSlicedUrl(ico, 50, 50, 2);
let nickname = this.props.profile.nickname;
//当前粉丝数空值判断
let fansAmount = this.props.shareTotalInfo.shareTotalInfoData.fans;
fansAmount = fansAmount ? fansAmount : '0';
let fansShow = this.props.shareTotalInfo.shareTotalInfoData.showFans;
let fansShowStyle = fansShow ? {width: width, height: 50, backgroundColor: '#FFFFFF', flexDirection: 'row',
paddingLeft: 15, alignItems: 'center', justifyContent: 'space-between'} : {height: 0, width: 0};
let lineShowStyle = fansShow ? {height: 1.0, backgroundColor: '#f0f0f0'} : {height: 0};
//邀请好友数空值判断
let invitesAmount = this.props.shareTotalInfo.shareTotalInfoData.inviteNum;
invitesAmount = invitesAmount ? invitesAmount : '0';
return (
<View>
<View style={styles.headerBackground}>
... ... @@ -57,6 +71,30 @@ export default class Mine extends Component {
</View>
</TouchableOpacity>
<View style={{height: 10, backgroundColor: '#f0f0f0'}}/>
<TouchableOpacity activeOpacity={1} style={styles.withdrawView} onPress={() => {
this.props.jumpWithUrl && this.props.jumpWithUrl('邀请好友', 'invitedFriends');
}}>
<Text style={styles.hasWithDrawText}>邀请好友数</Text>
<View style={[styles.textView, {flexDirection: 'row', paddingRight: 15}]}>
<Text style={[styles.hasWithDrawText]}>{invitesAmount}</Text>
<Image style={styles.arrowImage} source={require('../images/arrow.png')}/>
</View>
</TouchableOpacity>
<View style={lineShowStyle}/>
<TouchableOpacity activeOpacity={1} style={fansShowStyle} onPress={() => {
}}>
<Text style={styles.hasWithDrawText}>当前粉丝数</Text>
<View style={[styles.textView, {flexDirection: 'row', paddingRight: 15}]}>
<Text style={[styles.hasWithDrawText]}>{fansAmount}</Text>
<Image style={styles.arrowImage} source={require('../images/arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{height: 10, backgroundColor: '#f0f0f0'}}/>
</View>
);
}
... ... @@ -72,16 +110,15 @@ export default class Mine extends Component {
<MineCell
resource={rowData.get('data')}
resourceJumpWithUrl={this.props.resourceJumpWithUrl}
styles={styles}
/>
styles={styles} />
);
} else if (templatename === 'newSingleImage' && rowData) {
console.log(rowData.toJS());
return (
<SingleImage
data={rowData}
resourceJumpWithUrl={this.props.resourceJumpWithUrl}
/>)
resourceJumpWithUrl={this.props.resourceJumpWithUrl} />
)
} else {
return null
}
... ... @@ -155,6 +192,11 @@ let styles = StyleSheet.create({
fontSize: 14,
color: '#444444',
},
hasNumText: {
fontFamily: 'SanFranciscoText-Medium',
fontSize: 14,
color: '#444444',
},
arrowImage: {
width: 16,
height: 16,
... ...
... ... @@ -20,37 +20,77 @@ export default class Statistics extends Component {
render() {
let {statisticsInfo} = this.props;
let currentTab = this.props.currentTab;
return (
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
this.props.jumpWithUrl && this.props.jumpWithUrl('全部佣金', 'orderIncome');
}} >
<View style={styles.container}>
<View style={styles.statisticsView}>
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>¥{statisticsInfo.orderAmountSum}</Text>
<Text style={styles.tipsText}>预估订单佣金</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"1"}}`;
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
}} >
<View style={{width: width / 2, paddingLeft: 30, marginTop: -8}}>
<Text style={styles.numberText}>¥{statisticsInfo.orderAmountSum}</Text>
<Text style={styles.tipsText}>预估订单佣金</Text>
</View>
</TouchableOpacity>
<View style={styles.spaceView}/>
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>¥{statisticsInfo.extraAmountSum}</Text>
<Text style={styles.tipsText}>预估其他佣金</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"2"}}`;
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
}} >
<View style={{width: width / 2, paddingLeft: 30, marginTop: -8}}>
<Text style={styles.numberText}>¥{statisticsInfo.extraAmountSum}</Text>
<Text style={styles.tipsText}>预估其他佣金</Text>
</View>
</TouchableOpacity>
</View>
<View style={styles.lineView}/>
<View style={styles.statisticsView}>
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>{statisticsInfo.orderNum}</Text>
<Text style={styles.tipsText}>订单数</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"1"}}`;
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
}} >
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>{statisticsInfo.orderNum}</Text>
<Text style={styles.tipsText}>订单数</Text>
</View>
</TouchableOpacity>
<View style={styles.spaceView}/>
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>{statisticsInfo.clickNum}</Text>
<Text style={styles.tipsText}>点击数</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"全部佣金","type":"orderIncome"}}`;
this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url);
}} >
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>{statisticsInfo.clickNum}</Text>
<Text style={styles.tipsText}>点击数</Text>
</View>
</TouchableOpacity>
</View>
<View style={styles.lineView}/>
</View>
</TouchableOpacity>
);
}
... ...
... ... @@ -69,6 +69,10 @@ export default keyMirror({
ORDER_LIST_SUCCESS: null,
ORDER_LIST_FAILURE: null,
ESTIMATE_LIST_REQUEST: null,
ESTIMATE_LIST_SUCCESS: null,
ESTIMATE_LIST_FAILURE: null,
TOP_LIST_REQUEST: null,
TOP_LIST_SUCCESS: null,
TOP_LIST_FAILURE: null,
... ... @@ -145,4 +149,12 @@ export default keyMirror({
SHARE_CODE_INFO_REQUEST: null,
SHARE_CODE_INFO_SUCCESS: null,
SHARE_CODE_INFO_FAILURE: null,
INVITED_FRIENDS_REQUEST: null,
INVITED_FRIENDS_SUCCESS: null,
INVITED_FRIENDS_FAILURE: null,
SHARETOTAL_REQUEST: null,
SHARETOTAL_SUCCESS: null,
SHARETOTAL_FAILURE: null,
});
... ...
... ... @@ -136,6 +136,7 @@ class DataContainer extends Component {
settlementInfo,
addSettlement,
statisticsInfo,
shareTotalInfo,
} = this.props.alliance;
let tip = this.state.tips;
let isFetching = settlementInfo.isFetching;
... ... @@ -149,6 +150,7 @@ class DataContainer extends Component {
settlementInfo={settlementInfo}
addSettlement={addSettlement}
statisticsInfo={statisticsInfo}
shareTotalInfo={shareTotalInfo}
tips={tip}
showTipsAlertDialog={this._showTipsAlertDialog}
hiddenTipsAlertDialog={this._hiddenTipsAlertDialog}
... ...
'use strict';
import React, {Component} from 'react';
import {StyleSheet, View} from 'react-native';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as allianceActions from '../reducers/alliance/allianceActions';
import EstimateIncome from "../components/EstimateIncome";
import LoadingIndicator from '../../common/components/LoadingIndicator';
import ReactNative from "react-native";
const actions = [
allianceActions,
];
function mapStateToProps(state) {
return {
...state
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class EstimateDetailContainer extends Component {
constructor(props) {
super(props);
this.state = {
tabType: this.props.tab_type, //1 订单收入,2活动收入
timeType: this.props.time_type, //1 昨日 2 本月 3 上月
};
this._jumpWithUrl = this._jumpWithUrl.bind(this);
this._onEndReached = this._onEndReached.bind(this);
}
componentDidMount() {
this.props.actions.getEstimateList(this.state.tabType, this.state.timeType, true);
}
componentWillUnmount() {
}
_jumpWithUrl(title='', type='', orderCode='') {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"${title}","type":"${type}","order_code":"${orderCode}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
_onEndReached() {
this.props.actions.getEstimateList(this.state.tabType, this.state.timeType, false);
}
render() {
let {estimateList} = this.props.alliance;
let isFetching = estimateList.isFetching;
return (
<View style={styles.container}>
<EstimateIncome
estimateList={estimateList}
jumpWithUrl={this._jumpWithUrl}
onEndReached={this._onEndReached}
tabType={this.state.tabType} />
<LoadingIndicator isVisible={isFetching}/>
</View>
)
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(EstimateDetailContainer);
\ No newline at end of file
... ...
'use strict';
import React, { Component } from 'react';
import ReactNative, { StyleSheet, View } from "react-native";
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Map } from 'immutable';
import LoadingIndicator from '../../common/components/LoadingIndicator';
import * as allianceActions from '../reducers/alliance/allianceActions';
import InvitedFriends from '../components/InvitedFriends';
const actions = [
allianceActions,
];
function mapStateToProps(state) {
return {
...state
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class InvitedFriendsContainer extends Component {
constructor(props) {
super(props);
this._onEndReached = this._onEndReached.bind(this);
}
componentDidMount() {
this.props.actions.getInvitedFriends();
}
componentWillUnmount() {
}
_onEndReached() {
this.props.actions.getInvitedFriends();
}
_shareForInvite() {
ReactNative.NativeModules.YH_CommonHelper.shareCpsInvite();
}
render() {
let {invitedFriendsList} = this.props.alliance;
let isFetching = invitedFriendsList.isFetching;
return (
<View style={styles.container}>
<InvitedFriends
invitedFriendsList={invitedFriendsList}
onEndReached={this._onEndReached}
shareForInvite={this._shareForInvite}/>
<LoadingIndicator isVisible={isFetching}/>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
}
})
export default connect(mapStateToProps, mapDispatchToProps)(InvitedFriendsContainer);
... ...
... ... @@ -45,6 +45,7 @@ class MineContainer extends Component {
this.props.actions.getMineUserInfo();
this.props.actions.getSettlementInfo();
this.props.actions.getMineResourceInfo();
this.props.actions.getShareTotalInfo();
}
componentWillUnmount() {
... ... @@ -73,6 +74,7 @@ class MineContainer extends Component {
profile,
settlementInfo,
mineResourceInfo,
shareTotalInfo,
} = this.props.alliance;
let isFetching = settlementInfo.isFetching;
return (
... ... @@ -81,6 +83,7 @@ class MineContainer extends Component {
profile={profile}
settlementInfo={settlementInfo}
mineResourceInfo={mineResourceInfo}
shareTotalInfo={shareTotalInfo}
jumpWithUrl={this._jumpWithUrl}
resourceJumpWithUrl={this._resourceJumpWithUrl}
refreshSettlementInfo={this._refreshSettlementInfo}
... ...
... ... @@ -67,6 +67,10 @@ const {
ORDER_LIST_SUCCESS,
ORDER_LIST_FAILURE,
ESTIMATE_LIST_REQUEST,
ESTIMATE_LIST_SUCCESS,
ESTIMATE_LIST_FAILURE,
TOP_LIST_REQUEST,
TOP_LIST_SUCCESS,
TOP_LIST_FAILURE,
... ... @@ -95,6 +99,14 @@ const {
GET_MINEUSERINFO_SUCCESS,
GET_MINEUSERINFO_FAILURE,
SHARETOTAL_REQUEST,
SHARETOTAL_SUCCESS,
SHARETOTAL_FAILURE,
INVITED_FRIENDS_REQUEST,
INVITED_FRIENDS_SUCCESS,
INVITED_FRIENDS_FAILURE,
} = require('../../constants/actionTypes').default;
export function showTipsAlertDialog() {
... ... @@ -386,6 +398,26 @@ export function orderListFailure(error) {
};
}
export function estimateListRequest() {
return {
type: ESTIMATE_LIST_REQUEST,
};
}
export function estimateListSuccess(json) {
return {
type: ESTIMATE_LIST_SUCCESS,
payload: json
};
}
export function estimateListFailure(error) {
return {
type: ESTIMATE_LIST_FAILURE,
payload: error
};
}
export function topListRequest() {
return {
type: TOP_LIST_REQUEST,
... ... @@ -506,6 +538,26 @@ export function getStatisticsInfoFailure() {
}
}
export function getShareTotalInfoRequest() {
return {
type: SHARETOTAL_REQUEST,
};
}
export function getShareTotalInfoSuccess(json) {
return {
type: SHARETOTAL_SUCCESS,
payload: json,
}
}
export function getShareTotalInfoFailure() {
return {
type: SHARETOTAL_FAILURE,
payload: error
}
}
export function getMineUserInfoSuccess(json) {
return {
type: GET_MINEUSERINFO_SUCCESS,
... ... @@ -527,6 +579,26 @@ export function getMineUserInfoRequest() {
}
export function invitedFriendsRequest() {
return {
type: INVITED_FRIENDS_REQUEST
}
}
export function invitedFriendsSuccess(json) {
return {
type: INVITED_FRIENDS_SUCCESS,
payload: json
}
}
export function invitedFriendsFailue(error) {
return {
type: INVITED_FRIENDS_FAILURE,
payload: error
}
}
export function getSettlementInfo() {
return (dispatch, getState) => {
let {app} = getState();
... ... @@ -771,6 +843,55 @@ export function getSettlementRecord() {
};
}
export function getInvitedFriends() {
return (dispatch, getState) => {
let {app, alliance} = getState();
let list = alliance.invitedFriendsList;
/**
* page: 0, //当前页面
* page_size: 20, //每页显示的数量
* total: 0, //总共多少条
* totalPage: 0, //总共多少页
* endReached: false, //到达底部
*/
if (list.isFetching || list.endReached || list.error || (!list.endReached && list.totalPage === 1)) {
return;
}
let page = list.page + 1;
let pageSize = list.page_size;
let fetchInvitedFriends = (uid) => {
dispatch(invitedFriendsRequest());
return new AllianceService(app.host).fetchInvitedFriends(uid, page, pageSize)
.then(json => {
let payload = json;
payload.endReached = (payload.page === payload.totalPage) && (payload.totalPage !== 1);
if (payload.page > 1) {
let oldList = list.list.toJS();
let newList = [...oldList, ...payload.list];
payload.list = newList;
}
dispatch(invitedFriendsSuccess(payload));
})
.catch(error => {
dispatch(invitedFriendsFailue(error));
});
};
let uid = 0;
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
fetchInvitedFriends(uid)
})
.catch(error => {
fetchInvitedFriends(uid)
});
};
}
export function getOrderList(orderType, orderStatus, isChanged) {
return (dispatch, getState) => {
let {app, alliance} = getState();
... ... @@ -820,6 +941,55 @@ export function getOrderList(orderType, orderStatus, isChanged) {
};
}
export function getEstimateList(tabType, timeType, isChanged) {
return (dispatch, getState) => {
let {app, alliance} = getState();
let list = alliance.estimateList;
/**
* page: 0, //当前页面
* page_size: 20, //每页显示的数量
* total: 0, //总共多少条
* totalPage: 0, //总共多少页
* endReached: false, //到达底部
*/
if (!isChanged && (list.isFetching || list.endReached || list.error || (!list.endReached && list.totalPage === 1))) {
return;
}
let page = isChanged ? 1 : list.page + 1;
let pageSize = list.page_size;
let fetchEstimateList = (uid) => {
dispatch(estimateListRequest());
return new AllianceService(app.host).fetchEstimateList(uid, tabType, timeType, page, pageSize)
.then(json => {
let payload = json;
payload.endReached = (payload.page === payload.totalPage) && (payload.totalPage !== 1);
if (payload.page > 1) {
let oldList = list.list.toJS();
let newList = [...oldList, ...payload.list];
payload.list = newList;
}
dispatch(estimateListSuccess(payload));
})
.catch(error => {
dispatch(estimateListFailure(error));
});
};
let uid = 0;
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
fetchEstimateList(uid)
})
.catch(error => {
fetchEstimateList(uid)
});
};
}
export function getTop100List() {
return (dispatch, getState) => {
let {app, alliance} = getState();
... ... @@ -1000,6 +1170,31 @@ export function getStatisticsInfo(queryTimeType) {
}
}
export function getShareTotalInfo() {
return (dispatch, getState) => {
let {app} = getState();
let fetchShareTotalInfo = (uid) => {
dispatch(getShareTotalInfoRequest());
return new AllianceService(app.host).fetchShareTotalInfo(uid)
.then(json => {
dispatch(getShareTotalInfoSuccess(json));
})
.catch(error => {
dispatch(getShareTotalInfoFailure());
});
};
let uid = 0;
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
fetchShareTotalInfo(uid)
})
.catch(error => {
fetchShareTotalInfo(uid)
});
}
}
export function getMineUserInfo() {
return (dispatch, getState) => {
let {app} = getState();
... ...
... ... @@ -19,6 +19,12 @@ let InitialState = Record({
settlementInfoData: Map(),
})),
shareTotalInfo: new (Record({
isFetching: false,
error: null,
shareTotalInfoData: Map(),
})),
addSettlement: new (Record({
isFetching: false,
error: null,
... ... @@ -94,6 +100,17 @@ let InitialState = Record({
list: List(),
})),
estimateList: new (Record({
isFetching: false,
error: null,
page: 0, //当前页面
page_size: 20, //每页显示的数量
total: 0, //总共多少条
totalPage: 0, //总共多少页
endReached: false, //到达底部
list: List(),
})),
settlementRecordList: new (Record({
isFetching: false,
error: null,
... ... @@ -105,6 +122,17 @@ let InitialState = Record({
list: List(),
})),
invitedFriendsList: new (Record({
isFetching: false,
error: null,
page: 0, //当前页面
page_size: 20, //每页显示的数量
total: 0, //总共多少条
totalPage: 0, //总共多少页
endReached: false, //到达底部
list: List(),
})),
topList: new (Record({
isFetching: false,
error: null,
... ...
... ... @@ -65,6 +65,10 @@ const {
ORDER_LIST_SUCCESS,
ORDER_LIST_FAILURE,
ESTIMATE_LIST_REQUEST,
ESTIMATE_LIST_SUCCESS,
ESTIMATE_LIST_FAILURE,
TOP_LIST_REQUEST,
TOP_LIST_SUCCESS,
TOP_LIST_FAILURE,
... ... @@ -93,6 +97,14 @@ const {
GET_MINEUSERINFO_SUCCESS,
GET_MINEUSERINFO_FAILURE,
SHARETOTAL_REQUEST,
SHARETOTAL_SUCCESS,
SHARETOTAL_FAILURE,
INVITED_FRIENDS_REQUEST,
INVITED_FRIENDS_SUCCESS,
INVITED_FRIENDS_FAILURE,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -344,6 +356,31 @@ export default function couponReducer(state = initialState, action) {
.setIn(['settlementRecordList', 'error'], action.payload);
}
case INVITED_FRIENDS_REQUEST: {
return state.setIn(['invitedFriendsList', 'isFetching'], true)
.setIn(['invitedFriendsList', 'error'], null);
}
case INVITED_FRIENDS_SUCCESS: {
let {
page,
totalPage,
endReached,
list,
} = action.payload;
return state.setIn(['invitedFriendsList', 'isFetching'], false)
.setIn(['invitedFriendsList', 'page'], page)
.setIn(['invitedFriendsList', 'totalPage'], totalPage)
.setIn(['invitedFriendsList', 'endReached'], endReached)
.setIn(['invitedFriendsList', 'list'], Immutable.fromJS(list))
.setIn(['invitedFriendsList', 'error'], null);
}
case INVITED_FRIENDS_FAILURE: {
return state.setIn(['invitedFriendsList', 'isFetching'], false)
.setIn(['invitedFriendsList', 'error'], action.payload);
}
case ORDER_LIST_REQUEST: {
return state.setIn(['orderList', 'isFetching'], true)
.setIn(['orderList', 'error'], null);
... ... @@ -370,6 +407,32 @@ export default function couponReducer(state = initialState, action) {
.setIn(['orderList', 'error'], action.payload);
}
case ESTIMATE_LIST_REQUEST: {
return state.setIn(['estimateList', 'isFetching'], true)
.setIn(['estimateList', 'error'], null);
}
case ESTIMATE_LIST_SUCCESS: {
let {
page,
totalPage,
endReached,
list,
} = action.payload;
return state.setIn(['estimateList', 'isFetching'], false)
.setIn(['estimateList', 'page'], page)
.setIn(['estimateList', 'totalPage'], totalPage)
.setIn(['estimateList', 'endReached'], endReached)
.setIn(['estimateList', 'list'], Immutable.fromJS(list))
.setIn(['estimateList', 'error'], null);
}
case ESTIMATE_LIST_FAILURE: {
return state.setIn(['estimateList', 'isFetching'], false)
.setIn(['estimateList', 'error'], action.payload);
}
case TOP_LIST_REQUEST: {
return state.setIn(['topList', 'isFetching'], true)
.setIn(['topList', 'error'], null);
... ... @@ -521,6 +584,23 @@ export default function couponReducer(state = initialState, action) {
return state.setIn(['profile', 'isFetching'], false)
.setIn(['profile', 'error'], null);
case SHARETOTAL_REQUEST: {
return state.setIn(['shareTotalInfo', 'isFetching'], true)
.setIn(['shareTotalInfo', 'error'], null);
}
case SHARETOTAL_SUCCESS: {
return state.setIn(['shareTotalInfo', 'isFetching'], false)
.setIn(['shareTotalInfo', 'shareTotalInfoData'], action.payload)
.setIn(['shareTotalInfo', 'error'], null);
}
case SHARETOTAL_FAILURE: {
return state.setIn(['shareTotalInfo', 'isFetching'], false)
.setIn(['shareTotalInfo', 'error'], action.payload);
}
}
return state;
... ...
... ... @@ -156,6 +156,25 @@ export default class AllianceService {
});
}
//(邀请好友列表)
async fetchInvitedFriends(uid, page, size) {
return await this.api.get({
url: '',
body: {
uid,
page,
size,
method: 'app.union.shareOrder.queryInviteList',
}
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
//(订单列表)
/**
*
... ... @@ -211,6 +230,40 @@ export default class AllianceService {
});
}
//(预估收入详细列表)
/**
* @param uid
* @param type 1-订单收入,2-其他收入
* @param time_type 1-昨日,2-本月,3-上月
* @param page
* @param size
* @returns {Promise<T>}
*/
async fetchEstimateList(uid, tab_type, time_type, page, size) {
let converted_tab_type, converted_time_type;
let customBody = {
uid,
type: tab_type,
time_type: time_type,
page,
size,
method: 'app.union.shareOrder.queryEstimateDetails',
}
return await this.api.get({
url: '',
body: customBody
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
//获取热卖Top100列表
async fetchTop100List(uid, page, limit) {
let fromPage = Platform.OS === 'android' ? 'aFP_Alliance' : 'iFP_Alliance';
... ... @@ -347,5 +400,21 @@ export default class AllianceService {
});
}
//获取分享数量统计
async fetchShareTotalInfo(uid) {
return await this.api.get({
url: '',
body: {
uid,
method: 'app.union.shareOrder.queryShareTotal',
}
})
.then((json) => {
return json;
})
.catch((error) => {
throw(error);
});
}
}
... ...
... ... @@ -44,16 +44,20 @@ class TipsAlert extends React.Component {
}
_renderChildren(children) {
return children.map((element, index) => {
return (
<React.Fragment key={index}>
{element}
if (index !== children.length) {
<View style={{ width: 0.5, height: '100%', backgroundColor: '#e0e0e0' }}></View>
}
</React.Fragment>
)
});
if('[object Array]' == Object.prototype.toString.call(children)){
return children.map((element, index) => {
if (index === children.length) return element
return (
<React.Fragment>
{element}
<View style={{width: 0.5, height: '100%', backgroundColor: '#e0e0e0'}}></View>
</React.Fragment>
)
});
}else {
return children
}
}
render() {
... ... @@ -137,4 +141,10 @@ let styles = StyleSheet.create({
letterSpacing: -0.41,
fontWeight: 'bold'
},
common: {
fontSize: 17,
color: 'black',
letterSpacing: -0.41,
fontFamily: 'PingFang-SC-Regular'
},
});
... ...