Authored by 陈林

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

Dev 67900



See merge request !19
... ... @@ -25,6 +25,7 @@ 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';
... ... @@ -131,6 +132,14 @@ export default function native(platform) {
<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}>
... ...
... ... @@ -52,16 +52,8 @@ export default class Data extends Component {
let settlementAmount = this.props.settlementInfo.settlementInfoData.settlementAmount;
settlementAmount = settlementAmount ? settlementAmount : '0';
//当前粉丝数空值判断
let fansAmount = this.props.shareTotalInfo.shareTotalInfoData.fans;
fansAmount = fansAmount ? fansAmount : '0';
//邀请好友数空值判断
let invitesAmount = this.props.shareTotalInfo.shareTotalInfoData.inviteNum;
invitesAmount = invitesAmount ? invitesAmount : '0';
return (
<ScrollView style={styles.container} scrollEnabled = {true}>
<ScrollView style={styles.container} scrollEnabled = {scrollEnabled}>
<TipsAlert
tips={this.props.tips}
isShow={isShowTipsAlert}
... ... @@ -140,25 +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'}}/>
<View style={styles.statisticsView}>
<View style={styles.attentionView}>
<Text style={[styles.hasWithDrawText,{marginLeft: 10}]}>当前粉丝数</Text>
<Text style={[styles.hasWithDrawText, {marginRight: 10}]}>{fansAmount}</Text>
</View>
<View style={styles.spaceView}/>
<TouchableOpacity activeOpacity={1} style={styles.attentionView} onPress={() => {
this.props.jumpWithUrl && this.props.jumpWithUrl('邀请好友', 'invitedFriends');
}}>
<Text style={[styles.hasWithDrawText],{marginLeft: 10}}>邀请好友数</Text>
<Text style={[styles.hasWithDrawText],{marginRight: 10}}>{invitesAmount}</Text>
</TouchableOpacity>
</View>
</ScrollView>
);
}
... ... @@ -270,26 +249,6 @@ let styles = StyleSheet.create({
width: width,
height: 0.5,
backgroundColor: '#e0e0e0'
},
statisticsView: {
width: width,
height: 50,
backgroundColor: 'white',
flexDirection: 'row',
alignItems: 'center',
},
attentionView: {
width: width/2,
height: 50,
backgroundColor: 'white',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
},
spaceView: {
width: 0.5,
height: 50,
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: this.props.tabType,
timeType: this.props.timeType,
};
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' ? '待结算' : '';
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
... ...
... ... @@ -7,11 +7,13 @@ 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),
});
... ... @@ -23,7 +25,7 @@ export default class InvitedFriends extends Component {
<View style={styles.rowView}>
<View style={styles.rowItemStyle}>
<Text style={styles.nameStyle}>{rowData.get("name")}</Text>
<Text style={styles.rowTextStyle}>{rowData.get("name")}</Text>
</View>
<View style={styles.rowItemStyle}>
... ... @@ -39,10 +41,20 @@ export default class InvitedFriends extends Component {
</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 {
... ... @@ -79,22 +91,26 @@ export default class InvitedFriends extends Component {
</View>
<View style={styles.lineView}/>
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(invitersList)}
renderRow={this._renderRow}
onEndReached={() => {
if (invitersList.size !== 0) {
this.props.onEndReached && this.props.onEndReached();
}
}}/>
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>
... ... @@ -116,7 +132,7 @@ const styles = StyleSheet.create({
},
topImageView: {
width: width,
height: 120 * DEVICE_WIDTH_RATIO,
height: 118 * DEVICE_WIDTH_RATIO,
},
middleView: {
height: 50 * DEVICE_WIDTH_RATIO,
... ... @@ -129,12 +145,12 @@ const styles = StyleSheet.create({
paddingVertical: 18,
},
textsStyle: {
fontFamily: 'PingFang-SC-Regular',
fontFamily: 'PingFang-SC-Medium',
fontSize: 12,
color: 'black',
color: '#444444',
},
rowView: {
height: 44 * DEVICE_WIDTH_RATIO,
height: 50 * DEVICE_WIDTH_RATIO,
flexDirection: 'row',
alignItems: 'center',
},
... ... @@ -145,13 +161,8 @@ const styles = StyleSheet.create({
},
rowTextStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 10,
color: '#323232',
},
nameStyle: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 10,
color: 'black',
fontSize: 11,
color: '#444444',
},
buttonStyle: {
fontFamily: 'PingFang-SC-Regular',
... ... @@ -169,6 +180,10 @@ const styles = StyleSheet.create({
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 spaceShowStyle = fansShow ? {height: 10, 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={spaceShowStyle}/>
<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>
);
}
... ... @@ -155,6 +193,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,63 @@ 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: -10}}>
<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: -10}}>
<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>
<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>
<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={styles.statisticsView}>
<View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}>
<Text style={styles.numberText}>{statisticsInfo.orderNum}</Text>
<Text style={styles.tipsText}>订单数</Text>
</View>
<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>
</View>
</View>
</TouchableOpacity>
<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,
... ...
... ... @@ -60,7 +60,6 @@ class DataContainer extends Component {
componentDidMount() {
this.props.actions.getSettlementInfo();
this.props.actions.getStatisticsInfo(1);
this.props.actions.getShareTotalInfo();
}
componentWillUnmount() {
... ...
'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, true);
}
render() {
let {estimateList} = this.props.alliance;
let isFetching = estimateList.isFetching;
return (
<View style={styles.container}>
<EstimateIncome
estimateList={estimateList}
jumpWithUrl={this._jumpWithUrl}
onEndReached={this._onEndReached}
/>
<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 { StyleSheet, View } from "react-native";
import ReactNative, { StyleSheet, View } from "react-native";
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Map } from 'immutable';
... ... @@ -51,6 +51,10 @@ class InvitedFriendsContainer extends Component {
this.props.actions.getInvitedFriends();
}
_shareForInvite() {
ReactNative.NativeModules.YH_CommonHelper.shareCpsInvite();
}
render() {
let {invitedFriendsList} = this.props.alliance;
let isFetching = invitedFriendsList.isFetching;
... ... @@ -58,7 +62,8 @@ class InvitedFriendsContainer extends Component {
<View style={styles.container}>
<InvitedFriends
invitedFriendsList={invitedFriendsList}
onEndReached={this._onEndReached}/>
onEndReached={this._onEndReached}
shareForInvite={this._shareForInvite}/>
<LoadingIndicator isVisible={isFetching}/>
</View>
)
... ...
... ... @@ -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,
... ... @@ -394,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,
... ... @@ -917,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();
... ...
... ... @@ -100,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,
... ...
... ... @@ -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,
... ... @@ -403,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);
... ...
... ... @@ -230,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';
... ...