Authored by 于良

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

... ... @@ -25,6 +25,7 @@ export default class RefoundStatistics extends Component {
top: React.PropTypes.string,
bottom: React.PropTypes.string,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
section2: React.PropTypes.arrayOf(
... ... @@ -32,6 +33,7 @@ export default class RefoundStatistics extends Component {
top: React.PropTypes.string,
bottom: React.PropTypes.string,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
section3: React.PropTypes.arrayOf(
... ... @@ -39,6 +41,7 @@ export default class RefoundStatistics extends Component {
top: React.PropTypes.string,
bottom: React.PropTypes.string,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
};
... ... @@ -90,7 +93,7 @@ export default class RefoundStatistics extends Component {
}
render() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<CalendarTrigger date={this.state.selectdDate} toogleSelector={this.toogleSelector} />
... ...
... ... @@ -30,6 +30,7 @@ export default class SaleStatistics extends Component {
bottom: React.PropTypes.string,
style: View.propTypes.style,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
section2: React.PropTypes.arrayOf(
... ... @@ -38,6 +39,7 @@ export default class SaleStatistics extends Component {
bottom: React.PropTypes.string,
style: View.propTypes.style,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
};
... ...
... ... @@ -30,22 +30,36 @@ export default class TrendText extends Component {
bottomTextStyle: View.propTypes.style,
imageStyle: View.propTypes.style,
smallTextStyle: View.propTypes.style,
hasTrendData: React.PropTypes.bool,
};
render() {
renderTrendText() {
let arrow = this.props.arrowUp ? require('../images/arrow_up.png') : require('../images/arrow_down.png');
let bottomTextColor = this.props.arrowUp ? styles.bottomTextUp : styles.bottomTextDown;
return (
<View style={[styles.container, this.props.containerStyle]}>
<Text style={[styles.topText, this.props.topTextStyle]}>{this.props.topText}</Text>
if (this.props.hasTrendData) {
return (
<View style={styles.richContainer}>
<Image source={arrow} style={[styles.image, this.props.imageStyle]} />
<Text style={[styles.bottomText, bottomTextColor, this.props.bottomTextStyle]}>{this.props.bottomText}</Text>
<Text style={[styles.smallText, this.props.smallTextStyle]}>{this.props.smallText}</Text>
</View>
);
} else {
return (
<View style={styles.richContainer}>
<Text style={[styles.bottomText, bottomTextColor, this.props.bottomTextStyle]}>--</Text>
</View>
);
}
}
render() {
return (
<View style={[styles.container, this.props.containerStyle]}>
<Text style={[styles.topText, this.props.topTextStyle]}>{this.props.topText}</Text>
{this.renderTrendText()}
</View>
);
}
... ...
... ... @@ -30,6 +30,7 @@ export default class TrendTextSection extends Component {
small: React.PropTypes.string,
style: View.propTypes.style,
arrowUp: React.PropTypes.bool,
hasTrendData: React.PropTypes.bool,
})
),
};
... ... @@ -52,6 +53,7 @@ export default class TrendTextSection extends Component {
bottomText={item2.bottom}
arrowUp={item2.arrowUp}
smallText={item2.small}
hasTrendData={item2.hasTrendData}
containerStyle={[styles.contentContainerStyle, item2.style]}
/>
</View>
... ...
... ... @@ -92,6 +92,7 @@ export default class RefoundStatisticsContainer extends Component {
top: '环比',
arrowUp: this.props.refoundStats.sumRise,
bottom: `${this.props.refoundStats.sumRatio}`,
hasTrendData: this.props.refoundStats.sumHasTrendData,
}
];
... ... @@ -104,18 +105,20 @@ export default class RefoundStatisticsContainer extends Component {
top: '环比',
arrowUp: this.props.refoundStats.countRise,
bottom: `${this.props.refoundStats.countRatio}`,
hasTrendData: this.props.refoundStats.countHasTrendData,
}
];
let section3 =[
{
top:'退货率',
bottom:`${this.props.refoundStats.refoundPercent}`,
bottom:`${this.props.refoundStats.refoundPercent}%`,
},
{
top:'环比',
arrowUp: this.props.refoundStats.percentRise,
bottom: `${this.props.refoundStats.percentRatio}`,
hasTrendData: this.props.refoundStats.percentHasTrendData,
},
];
... ...
... ... @@ -122,6 +122,7 @@ class SalestisticsContainer extends Component {
top: '环比',
arrowUp: this.props.saleStats.amountRise,
bottom: `${this.props.saleStats.amountRisePercent}`,
hasTrendData: this.props.saleStats.amountHasTrendData,
}
];
... ... @@ -134,6 +135,7 @@ class SalestisticsContainer extends Component {
top: '环比',
arrowUp: this.props.saleStats.countRise,
bottom: `${this.props.saleStats.countRisePercent}`,
hasTrendData: this.props.saleStats.countHasTrendData,
}
];
... ...
... ... @@ -6,19 +6,22 @@ let InitialState = Record({
isFetching: false,
error: null,
month:'',
month: '',
refoundSum:0,
sumRatio:0,
sumRise:true,
refoundCount:0,
countRatio:0,
countRise:true,
refoundPercent:0,
percentRatio:0,
percentRise:false,
sixMonths: List(),
trendInSixMonth: List(),
refoundSum: 0, //退货金额
sumHasTrendData: false, //退货金额是否有环比数据
sumRatio: 0, //退货金额环比百分比
sumRise: true, //退货金额环比是否上升
refoundCount: 0, //退货数
countHasTrendData: false, //退货数是否有环比数据
countRatio: 0, //退货数环比百分比
countRise: true, //退货数环比是否上升
refoundPercent: 0, //退货率
percentHasTrendData: false, //退货率是否有环比数据
percentRatio: 0, //退货率环比百分比
percentRise: false, //退货率环比是否上升
sixMonths: List(), //近六月退货趋势月份数组
trendInSixMonth: List(), //近六月退货趋势数据
});
export default InitialState;
... ...
... ... @@ -41,16 +41,22 @@ export default function refoundStatisticsReducer(state = initialState, action) {
let amountRate = additionInfo.allAmountRate || 0;
let countRate = additionInfo.allNumberRate || 0;
let percentRate = additionInfo.returnRingRate || 0;
let sumHasTrendData = additionInfo.allAmountRateFlag;
let countHasTrendData = additionInfo.allNumberRateFlag;
let percentHasTrendData = additionInfo.returnRingRateFlag;
let nextState = state.set('isFetching', false)
.set('error', null)
.set('refoundSum', additionInfo.allAmount || 0)
.set('sumHasTrendData', sumHasTrendData)
.set('sumRatio', Math.abs(amountRate))
.set('sumRise', amountRate >= 0)
.set('refoundCount', additionInfo.allNumber || 0)
.set('countHasTrendData', countHasTrendData)
.set('countRatio', Math.abs(countRate))
.set('countRise', countRate >= 0)
.set('refoundPercent',additionInfo.returnAmountRate || 0)
.set('percentHasTrendData', percentHasTrendData)
.set('percentRatio', Math.abs(percentRate))
.set('percentRise', percentRate >= 0)
.set('sixMonths', Immutable.fromJS(sixMonths))
... ...
... ... @@ -24,14 +24,16 @@ let InitialState = Record({
endDay: '',
month: '',
goodsAmount: 0,
amountRise: true,
amountRisePercent: '',
goodsCount: 0,
countRise: true,
countRisePercent: '',
sevenDays: List(),
trendInSevenDays: List(),
goodsAmount: 0, //有效订单商品金额
amountHasTrendData: false, //金额是否有环比数据
amountRise: true, //金额环比是否上升
amountRisePercent: '', //金额环比上升百分比
goodsCount: 0, //有效订单商品件数
countHasTrendData: false, //件数是否有环比数据
countRise: true, //件数环比是否上升
countRisePercent: '', //件数环比上升百分比
sevenDays: List(), //7天交易趋势天数数组
trendInSevenDays: List(), //7天交易趋势数据
});
export default InitialState;
... ...
... ... @@ -57,13 +57,17 @@ export default function saleStatisticsReducer(state = initialState, action) {
let amountRate = additionInfo.allAmountRate || 0;
let countRate = additionInfo.allNumberRate || 0;
let amountHasTrendData = additionInfo.allAmountRateFlag;
let countHasTrendData = additionInfo.allNumberRateFlag;
let nextState = state.set('isFetching', false)
.set('error', null)
.set('goodsAmount', additionInfo.allAmount || 0)
.set('amountHasTrendData', amountHasTrendData)
.set('amountRise', amountRate >= 0)
.set('amountRisePercent', Math.abs(amountRate))
.set('goodsCount', additionInfo.allNumber || 0)
.set('countHasTrendData', countHasTrendData)
.set('countRise', countRate >= 0)
.set('countRisePercent', Math.abs(countRate))
.set('sevenDays', Immutable.fromJS(sevenDays))
... ...