Authored by 于良

首页店铺排名环比数据增加判断 review by yewanwan

... ... @@ -131,6 +131,7 @@ class HomeContainer extends Component {
arrowUp: this.props.home.overview.rise,
bottom: `${this.props.home.overview.riseCount}`,
small: '个名次',
hasTrendData: this.props.home.overview.rankHasTrend,
}
];
... ...
... ... @@ -20,11 +20,12 @@ let InitialState = Record({
shopId: 0,
shopName: '',
overview: new (Record({
rank: 0,
rise: true,
riseCount: 0,
goodsCount: 0,
goodsAmount: 0,
rank: 0, //店铺排名
rankHasTrend: false, //店铺排名是否有环比数据
rise: true, //店铺排名是否上升
riseCount: 0, //店铺排名变动数量
goodsCount: 0, //今日有效订单商品件数
goodsAmount: 0, //今日有效订单商品金额
})),
});
... ...
... ... @@ -75,9 +75,11 @@ export default function userReducer(state = initialState, action) {
case HOME_BRABDRANK_SUCCESS: {
let rankChange = action.payload.rankChange || 0;
let rise = Math.abs(rankChange) == rankChange ? true : false;
let rankHasTrend = action.payload.rankLevelFlag;
let nextState = state.set('isFetching', false)
.set('error', null)
.setIn(['overview', 'rank'], action.payload.rankNow || 0)
.setIn(['overview', 'rankHasTrend'], rankHasTrend)
.setIn(['overview', 'rise'], rise)
.setIn(['overview', 'riseCount'], Math.abs(rankChange))
return nextState;
... ...