...
|
...
|
@@ -14,6 +14,9 @@ import {Map} from 'immutable'; |
|
|
import SaleStatistics from '../components/SaleStatistics';
|
|
|
|
|
|
import * as saleStatisticsActions from '../reducers/saleStatistics/saleStatisticsActions';
|
|
|
import moment from 'moment';
|
|
|
import Immutable, {List, Record} from 'immutable';
|
|
|
import config from '../constants/config';
|
|
|
|
|
|
let {
|
|
|
Component,
|
...
|
...
|
@@ -56,11 +59,56 @@ class SalestisticsContainer extends Component { |
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
this.props.actions.saleStats(111);
|
|
|
let params = {
|
|
|
type: config.dateFilterKey.date,
|
|
|
reqTime: moment().subtract(1,'days').format('YYYYMMDD'),
|
|
|
brandId: this.props.home.get('brandId'),
|
|
|
}
|
|
|
this.props.actions.saleStats(params);
|
|
|
}
|
|
|
|
|
|
onChangeDate(selected) {
|
|
|
this.props.actions.saleStats(111);
|
|
|
|
|
|
let params = {};
|
|
|
switch (selected.selectMode) {
|
|
|
case 'day':
|
|
|
|
|
|
let wrapper = moment(selected.day);
|
|
|
let dateStr = wrapper.format('YYYYMMDD');
|
|
|
params = {
|
|
|
type: config.dateFilterKey.date,
|
|
|
reqTime: dateStr,
|
|
|
brandId: this.props.home.get('brandId'),
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case 'week':
|
|
|
params = {
|
|
|
type: config.dateFilterKey.week,
|
|
|
beginTime: moment(selected.from).format('YYYYMMDD'),
|
|
|
endTime: moment(selected.to).format('YYYYMMDD'),
|
|
|
brandId: this.props.home.get('brandId'),
|
|
|
}
|
|
|
break;
|
|
|
case 'month':
|
|
|
|
|
|
let monthStr = '';
|
|
|
if (selected.month>9) {
|
|
|
monthStr = `${selected.year}`+`${selected.month}`
|
|
|
} else {
|
|
|
monthStr = `${selected.year}`+'0'+`${selected.month}`
|
|
|
}
|
|
|
params = {
|
|
|
type: config.dateFilterKey.month,
|
|
|
reqTime: monthStr,
|
|
|
brandId: this.props.home.get('brandId'),
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
|
|
|
this.props.actions.saleStats(params);
|
|
|
}
|
|
|
|
|
|
render() {
|
...
|
...
|
@@ -94,8 +142,8 @@ class SalestisticsContainer extends Component { |
|
|
<SaleStatistics
|
|
|
section1={section1}
|
|
|
section2={section2}
|
|
|
sevenDays={this.props.saleStats.sevenDays}
|
|
|
trendInSevenDays={this.props.saleStats.trendInSevenDays}
|
|
|
sevenDays={this.props.saleStats.sevenDays.toJS()}
|
|
|
trendInSevenDays={this.props.saleStats.trendInSevenDays.toJS()}
|
|
|
onChangeDate={this.onChangeDate}
|
|
|
/>
|
|
|
</View>
|
...
|
...
|
|