Authored by 于良

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

@@ -131,6 +131,7 @@ class HomeContainer extends Component { @@ -131,6 +131,7 @@ class HomeContainer extends Component {
131 arrowUp: this.props.home.overview.rise, 131 arrowUp: this.props.home.overview.rise,
132 bottom: `${this.props.home.overview.riseCount}`, 132 bottom: `${this.props.home.overview.riseCount}`,
133 small: '个名次', 133 small: '个名次',
  134 + hasTrendData: this.props.home.overview.rankHasTrend,
134 } 135 }
135 ]; 136 ];
136 137
@@ -20,11 +20,12 @@ let InitialState = Record({ @@ -20,11 +20,12 @@ let InitialState = Record({
20 shopId: 0, 20 shopId: 0,
21 shopName: '', 21 shopName: '',
22 overview: new (Record({ 22 overview: new (Record({
23 - rank: 0,  
24 - rise: true,  
25 - riseCount: 0,  
26 - goodsCount: 0,  
27 - goodsAmount: 0, 23 + rank: 0, //店铺排名
  24 + rankHasTrend: false, //店铺排名是否有环比数据
  25 + rise: true, //店铺排名是否上升
  26 + riseCount: 0, //店铺排名变动数量
  27 + goodsCount: 0, //今日有效订单商品件数
  28 + goodsAmount: 0, //今日有效订单商品金额
28 })), 29 })),
29 }); 30 });
30 31
@@ -75,9 +75,11 @@ export default function userReducer(state = initialState, action) { @@ -75,9 +75,11 @@ export default function userReducer(state = initialState, action) {
75 case HOME_BRABDRANK_SUCCESS: { 75 case HOME_BRABDRANK_SUCCESS: {
76 let rankChange = action.payload.rankChange || 0; 76 let rankChange = action.payload.rankChange || 0;
77 let rise = Math.abs(rankChange) == rankChange ? true : false; 77 let rise = Math.abs(rankChange) == rankChange ? true : false;
  78 + let rankHasTrend = action.payload.rankLevelFlag;
78 let nextState = state.set('isFetching', false) 79 let nextState = state.set('isFetching', false)
79 .set('error', null) 80 .set('error', null)
80 .setIn(['overview', 'rank'], action.payload.rankNow || 0) 81 .setIn(['overview', 'rank'], action.payload.rankNow || 0)
  82 + .setIn(['overview', 'rankHasTrend'], rankHasTrend)
81 .setIn(['overview', 'rise'], rise) 83 .setIn(['overview', 'rise'], rise)
82 .setIn(['overview', 'riseCount'], Math.abs(rankChange)) 84 .setIn(['overview', 'riseCount'], Math.abs(rankChange))
83 return nextState; 85 return nextState;