Authored by 于良

销售统计、退货统计增加是否有环比数据字段 review by yewanwan

@@ -25,6 +25,7 @@ export default class RefoundStatistics extends Component { @@ -25,6 +25,7 @@ export default class RefoundStatistics extends Component {
25 top: React.PropTypes.string, 25 top: React.PropTypes.string,
26 bottom: React.PropTypes.string, 26 bottom: React.PropTypes.string,
27 arrowUp: React.PropTypes.bool, 27 arrowUp: React.PropTypes.bool,
  28 + hasTrendData: React.PropTypes.bool,
28 }) 29 })
29 ), 30 ),
30 section2: React.PropTypes.arrayOf( 31 section2: React.PropTypes.arrayOf(
@@ -32,6 +33,7 @@ export default class RefoundStatistics extends Component { @@ -32,6 +33,7 @@ export default class RefoundStatistics extends Component {
32 top: React.PropTypes.string, 33 top: React.PropTypes.string,
33 bottom: React.PropTypes.string, 34 bottom: React.PropTypes.string,
34 arrowUp: React.PropTypes.bool, 35 arrowUp: React.PropTypes.bool,
  36 + hasTrendData: React.PropTypes.bool,
35 }) 37 })
36 ), 38 ),
37 section3: React.PropTypes.arrayOf( 39 section3: React.PropTypes.arrayOf(
@@ -39,6 +41,7 @@ export default class RefoundStatistics extends Component { @@ -39,6 +41,7 @@ export default class RefoundStatistics extends Component {
39 top: React.PropTypes.string, 41 top: React.PropTypes.string,
40 bottom: React.PropTypes.string, 42 bottom: React.PropTypes.string,
41 arrowUp: React.PropTypes.bool, 43 arrowUp: React.PropTypes.bool,
  44 + hasTrendData: React.PropTypes.bool,
42 }) 45 })
43 ), 46 ),
44 }; 47 };
@@ -90,7 +93,7 @@ export default class RefoundStatistics extends Component { @@ -90,7 +93,7 @@ export default class RefoundStatistics extends Component {
90 } 93 }
91 94
92 render() { 95 render() {
93 - 96 +
94 return ( 97 return (
95 <ScrollView contentContainerStyle={styles.contentContainer}> 98 <ScrollView contentContainerStyle={styles.contentContainer}>
96 <CalendarTrigger date={this.state.selectdDate} toogleSelector={this.toogleSelector} /> 99 <CalendarTrigger date={this.state.selectdDate} toogleSelector={this.toogleSelector} />
@@ -30,6 +30,7 @@ export default class SaleStatistics extends Component { @@ -30,6 +30,7 @@ export default class SaleStatistics extends Component {
30 bottom: React.PropTypes.string, 30 bottom: React.PropTypes.string,
31 style: View.propTypes.style, 31 style: View.propTypes.style,
32 arrowUp: React.PropTypes.bool, 32 arrowUp: React.PropTypes.bool,
  33 + hasTrendData: React.PropTypes.bool,
33 }) 34 })
34 ), 35 ),
35 section2: React.PropTypes.arrayOf( 36 section2: React.PropTypes.arrayOf(
@@ -38,6 +39,7 @@ export default class SaleStatistics extends Component { @@ -38,6 +39,7 @@ export default class SaleStatistics extends Component {
38 bottom: React.PropTypes.string, 39 bottom: React.PropTypes.string,
39 style: View.propTypes.style, 40 style: View.propTypes.style,
40 arrowUp: React.PropTypes.bool, 41 arrowUp: React.PropTypes.bool,
  42 + hasTrendData: React.PropTypes.bool,
41 }) 43 })
42 ), 44 ),
43 }; 45 };
@@ -30,22 +30,36 @@ export default class TrendText extends Component { @@ -30,22 +30,36 @@ export default class TrendText extends Component {
30 bottomTextStyle: View.propTypes.style, 30 bottomTextStyle: View.propTypes.style,
31 imageStyle: View.propTypes.style, 31 imageStyle: View.propTypes.style,
32 smallTextStyle: View.propTypes.style, 32 smallTextStyle: View.propTypes.style,
  33 + hasTrendData: React.PropTypes.bool,
33 }; 34 };
34 35
35 - render() {  
36 - 36 + renderTrendText() {
37 let arrow = this.props.arrowUp ? require('../images/arrow_up.png') : require('../images/arrow_down.png'); 37 let arrow = this.props.arrowUp ? require('../images/arrow_up.png') : require('../images/arrow_down.png');
38 let bottomTextColor = this.props.arrowUp ? styles.bottomTextUp : styles.bottomTextDown; 38 let bottomTextColor = this.props.arrowUp ? styles.bottomTextUp : styles.bottomTextDown;
39 39
40 - return (  
41 - <View style={[styles.container, this.props.containerStyle]}>  
42 - <Text style={[styles.topText, this.props.topTextStyle]}>{this.props.topText}</Text> 40 + if (this.props.hasTrendData) {
  41 + return (
43 <View style={styles.richContainer}> 42 <View style={styles.richContainer}>
44 <Image source={arrow} style={[styles.image, this.props.imageStyle]} /> 43 <Image source={arrow} style={[styles.image, this.props.imageStyle]} />
45 <Text style={[styles.bottomText, bottomTextColor, this.props.bottomTextStyle]}>{this.props.bottomText}</Text> 44 <Text style={[styles.bottomText, bottomTextColor, this.props.bottomTextStyle]}>{this.props.bottomText}</Text>
46 <Text style={[styles.smallText, this.props.smallTextStyle]}>{this.props.smallText}</Text> 45 <Text style={[styles.smallText, this.props.smallTextStyle]}>{this.props.smallText}</Text>
47 </View> 46 </View>
  47 + );
  48 + } else {
  49 + return (
  50 + <View style={styles.richContainer}>
  51 + <Text style={[styles.bottomText, bottomTextColor, this.props.bottomTextStyle]}>--</Text>
  52 + </View>
  53 + );
  54 + }
  55 + }
  56 +
  57 + render() {
48 58
  59 + return (
  60 + <View style={[styles.container, this.props.containerStyle]}>
  61 + <Text style={[styles.topText, this.props.topTextStyle]}>{this.props.topText}</Text>
  62 + {this.renderTrendText()}
49 </View> 63 </View>
50 ); 64 );
51 } 65 }
@@ -30,6 +30,7 @@ export default class TrendTextSection extends Component { @@ -30,6 +30,7 @@ export default class TrendTextSection extends Component {
30 small: React.PropTypes.string, 30 small: React.PropTypes.string,
31 style: View.propTypes.style, 31 style: View.propTypes.style,
32 arrowUp: React.PropTypes.bool, 32 arrowUp: React.PropTypes.bool,
  33 + hasTrendData: React.PropTypes.bool,
33 }) 34 })
34 ), 35 ),
35 }; 36 };
@@ -52,6 +53,7 @@ export default class TrendTextSection extends Component { @@ -52,6 +53,7 @@ export default class TrendTextSection extends Component {
52 bottomText={item2.bottom} 53 bottomText={item2.bottom}
53 arrowUp={item2.arrowUp} 54 arrowUp={item2.arrowUp}
54 smallText={item2.small} 55 smallText={item2.small}
  56 + hasTrendData={item2.hasTrendData}
55 containerStyle={[styles.contentContainerStyle, item2.style]} 57 containerStyle={[styles.contentContainerStyle, item2.style]}
56 /> 58 />
57 </View> 59 </View>
@@ -92,6 +92,7 @@ export default class RefoundStatisticsContainer extends Component { @@ -92,6 +92,7 @@ export default class RefoundStatisticsContainer extends Component {
92 top: '环比', 92 top: '环比',
93 arrowUp: this.props.refoundStats.sumRise, 93 arrowUp: this.props.refoundStats.sumRise,
94 bottom: `${this.props.refoundStats.sumRatio}`, 94 bottom: `${this.props.refoundStats.sumRatio}`,
  95 + hasTrendData: this.props.refoundStats.sumHasTrendData,
95 } 96 }
96 ]; 97 ];
97 98
@@ -104,18 +105,20 @@ export default class RefoundStatisticsContainer extends Component { @@ -104,18 +105,20 @@ export default class RefoundStatisticsContainer extends Component {
104 top: '环比', 105 top: '环比',
105 arrowUp: this.props.refoundStats.countRise, 106 arrowUp: this.props.refoundStats.countRise,
106 bottom: `${this.props.refoundStats.countRatio}`, 107 bottom: `${this.props.refoundStats.countRatio}`,
  108 + hasTrendData: this.props.refoundStats.countHasTrendData,
107 } 109 }
108 ]; 110 ];
109 111
110 let section3 =[ 112 let section3 =[
111 { 113 {
112 top:'退货率', 114 top:'退货率',
113 - bottom:`${this.props.refoundStats.refoundPercent}`, 115 + bottom:`${this.props.refoundStats.refoundPercent}%`,
114 }, 116 },
115 { 117 {
116 top:'环比', 118 top:'环比',
117 arrowUp: this.props.refoundStats.percentRise, 119 arrowUp: this.props.refoundStats.percentRise,
118 bottom: `${this.props.refoundStats.percentRatio}`, 120 bottom: `${this.props.refoundStats.percentRatio}`,
  121 + hasTrendData: this.props.refoundStats.percentHasTrendData,
119 }, 122 },
120 ]; 123 ];
121 124
@@ -122,6 +122,7 @@ class SalestisticsContainer extends Component { @@ -122,6 +122,7 @@ class SalestisticsContainer extends Component {
122 top: '环比', 122 top: '环比',
123 arrowUp: this.props.saleStats.amountRise, 123 arrowUp: this.props.saleStats.amountRise,
124 bottom: `${this.props.saleStats.amountRisePercent}`, 124 bottom: `${this.props.saleStats.amountRisePercent}`,
  125 + hasTrendData: this.props.saleStats.amountHasTrendData,
125 } 126 }
126 ]; 127 ];
127 128
@@ -134,6 +135,7 @@ class SalestisticsContainer extends Component { @@ -134,6 +135,7 @@ class SalestisticsContainer extends Component {
134 top: '环比', 135 top: '环比',
135 arrowUp: this.props.saleStats.countRise, 136 arrowUp: this.props.saleStats.countRise,
136 bottom: `${this.props.saleStats.countRisePercent}`, 137 bottom: `${this.props.saleStats.countRisePercent}`,
  138 + hasTrendData: this.props.saleStats.countHasTrendData,
137 } 139 }
138 ]; 140 ];
139 141
@@ -6,19 +6,22 @@ let InitialState = Record({ @@ -6,19 +6,22 @@ let InitialState = Record({
6 isFetching: false, 6 isFetching: false,
7 error: null, 7 error: null,
8 8
9 - month:'', 9 + month: '',
10 10
11 - refoundSum:0,  
12 - sumRatio:0,  
13 - sumRise:true,  
14 - refoundCount:0,  
15 - countRatio:0,  
16 - countRise:true,  
17 - refoundPercent:0,  
18 - percentRatio:0,  
19 - percentRise:false,  
20 - sixMonths: List(),  
21 - trendInSixMonth: List(), 11 + refoundSum: 0, //退货金额
  12 + sumHasTrendData: false, //退货金额是否有环比数据
  13 + sumRatio: 0, //退货金额环比百分比
  14 + sumRise: true, //退货金额环比是否上升
  15 + refoundCount: 0, //退货数
  16 + countHasTrendData: false, //退货数是否有环比数据
  17 + countRatio: 0, //退货数环比百分比
  18 + countRise: true, //退货数环比是否上升
  19 + refoundPercent: 0, //退货率
  20 + percentHasTrendData: false, //退货率是否有环比数据
  21 + percentRatio: 0, //退货率环比百分比
  22 + percentRise: false, //退货率环比是否上升
  23 + sixMonths: List(), //近六月退货趋势月份数组
  24 + trendInSixMonth: List(), //近六月退货趋势数据
22 }); 25 });
23 26
24 export default InitialState; 27 export default InitialState;
@@ -41,16 +41,22 @@ export default function refoundStatisticsReducer(state = initialState, action) { @@ -41,16 +41,22 @@ export default function refoundStatisticsReducer(state = initialState, action) {
41 let amountRate = additionInfo.allAmountRate || 0; 41 let amountRate = additionInfo.allAmountRate || 0;
42 let countRate = additionInfo.allNumberRate || 0; 42 let countRate = additionInfo.allNumberRate || 0;
43 let percentRate = additionInfo.returnRingRate || 0; 43 let percentRate = additionInfo.returnRingRate || 0;
  44 + let sumHasTrendData = additionInfo.allAmountRateFlag;
  45 + let countHasTrendData = additionInfo.allNumberRateFlag;
  46 + let percentHasTrendData = additionInfo.returnRingRateFlag;
44 47
45 let nextState = state.set('isFetching', false) 48 let nextState = state.set('isFetching', false)
46 .set('error', null) 49 .set('error', null)
47 .set('refoundSum', additionInfo.allAmount || 0) 50 .set('refoundSum', additionInfo.allAmount || 0)
  51 + .set('sumHasTrendData', sumHasTrendData)
48 .set('sumRatio', Math.abs(amountRate)) 52 .set('sumRatio', Math.abs(amountRate))
49 .set('sumRise', amountRate >= 0) 53 .set('sumRise', amountRate >= 0)
50 .set('refoundCount', additionInfo.allNumber || 0) 54 .set('refoundCount', additionInfo.allNumber || 0)
  55 + .set('countHasTrendData', countHasTrendData)
51 .set('countRatio', Math.abs(countRate)) 56 .set('countRatio', Math.abs(countRate))
52 .set('countRise', countRate >= 0) 57 .set('countRise', countRate >= 0)
53 .set('refoundPercent',additionInfo.returnAmountRate || 0) 58 .set('refoundPercent',additionInfo.returnAmountRate || 0)
  59 + .set('percentHasTrendData', percentHasTrendData)
54 .set('percentRatio', Math.abs(percentRate)) 60 .set('percentRatio', Math.abs(percentRate))
55 .set('percentRise', percentRate >= 0) 61 .set('percentRise', percentRate >= 0)
56 .set('sixMonths', Immutable.fromJS(sixMonths)) 62 .set('sixMonths', Immutable.fromJS(sixMonths))
@@ -24,14 +24,16 @@ let InitialState = Record({ @@ -24,14 +24,16 @@ let InitialState = Record({
24 endDay: '', 24 endDay: '',
25 month: '', 25 month: '',
26 26
27 - goodsAmount: 0,  
28 - amountRise: true,  
29 - amountRisePercent: '',  
30 - goodsCount: 0,  
31 - countRise: true,  
32 - countRisePercent: '',  
33 - sevenDays: List(),  
34 - trendInSevenDays: List(), 27 + goodsAmount: 0, //有效订单商品金额
  28 + amountHasTrendData: false, //金额是否有环比数据
  29 + amountRise: true, //金额环比是否上升
  30 + amountRisePercent: '', //金额环比上升百分比
  31 + goodsCount: 0, //有效订单商品件数
  32 + countHasTrendData: false, //件数是否有环比数据
  33 + countRise: true, //件数环比是否上升
  34 + countRisePercent: '', //件数环比上升百分比
  35 + sevenDays: List(), //7天交易趋势天数数组
  36 + trendInSevenDays: List(), //7天交易趋势数据
35 }); 37 });
36 38
37 export default InitialState; 39 export default InitialState;
@@ -57,13 +57,17 @@ export default function saleStatisticsReducer(state = initialState, action) { @@ -57,13 +57,17 @@ export default function saleStatisticsReducer(state = initialState, action) {
57 57
58 let amountRate = additionInfo.allAmountRate || 0; 58 let amountRate = additionInfo.allAmountRate || 0;
59 let countRate = additionInfo.allNumberRate || 0; 59 let countRate = additionInfo.allNumberRate || 0;
  60 + let amountHasTrendData = additionInfo.allAmountRateFlag;
  61 + let countHasTrendData = additionInfo.allNumberRateFlag;
60 62
61 let nextState = state.set('isFetching', false) 63 let nextState = state.set('isFetching', false)
62 .set('error', null) 64 .set('error', null)
63 .set('goodsAmount', additionInfo.allAmount || 0) 65 .set('goodsAmount', additionInfo.allAmount || 0)
  66 + .set('amountHasTrendData', amountHasTrendData)
64 .set('amountRise', amountRate >= 0) 67 .set('amountRise', amountRate >= 0)
65 .set('amountRisePercent', Math.abs(amountRate)) 68 .set('amountRisePercent', Math.abs(amountRate))
66 .set('goodsCount', additionInfo.allNumber || 0) 69 .set('goodsCount', additionInfo.allNumber || 0)
  70 + .set('countHasTrendData', countHasTrendData)
67 .set('countRise', countRate >= 0) 71 .set('countRise', countRate >= 0)
68 .set('countRisePercent', Math.abs(countRate)) 72 .set('countRisePercent', Math.abs(countRate))
69 .set('sevenDays', Immutable.fromJS(sevenDays)) 73 .set('sevenDays', Immutable.fromJS(sevenDays))