...
|
...
|
@@ -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();
|
...
|
...
|
|