Authored by 叶弯弯

完成发货入库模块。reviewed by shixiang。

@@ -42,6 +42,7 @@ import userInitialState from './reducers/user/userInitialState'; @@ -42,6 +42,7 @@ import userInitialState from './reducers/user/userInitialState';
42 import accountSettlementInitialState from './reducers/accountSettlement/accountSettlementInitialState'; 42 import accountSettlementInitialState from './reducers/accountSettlement/accountSettlementInitialState';
43 import saleStatisticsInitialState from './reducers/saleStatistics/saleStatisticsInitialState'; 43 import saleStatisticsInitialState from './reducers/saleStatistics/saleStatisticsInitialState';
44 import stockStatsInitialState from './reducers/stockStats/stockStatsInitialState'; 44 import stockStatsInitialState from './reducers/stockStats/stockStatsInitialState';
  45 +import deliveryStatsInitialState from './reducers/deliveryStats/deliveryStatsInitialState';
45 46
46 47
47 import App from './containers/App'; 48 import App from './containers/App';
@@ -57,6 +58,7 @@ import AccountSettlementContainer from './containers/AccountSettlementContainer' @@ -57,6 +58,7 @@ import AccountSettlementContainer from './containers/AccountSettlementContainer'
57 import AboutUsContainer from './containers/AboutUsContainer' 58 import AboutUsContainer from './containers/AboutUsContainer'
58 import StockStatsContainer from './containers/StockStatsContainer' 59 import StockStatsContainer from './containers/StockStatsContainer'
59 import SaleStatisticsContainer from './containers/SaleStatisticsContainer' 60 import SaleStatisticsContainer from './containers/SaleStatisticsContainer'
  61 +import DeliveryStatsContainer from './containers/DeliveryStatsContainer'
60 62
61 import NavBar from './components/NavBar'; 63 import NavBar from './components/NavBar';
62 import TabIcon from './containers/TabIcon'; 64 import TabIcon from './containers/TabIcon';
@@ -80,6 +82,7 @@ function getInitialState() { @@ -80,6 +82,7 @@ function getInitialState() {
80 actStmt: (new accountSettlementInitialState), 82 actStmt: (new accountSettlementInitialState),
81 saleStats: (new saleStatisticsInitialState()), 83 saleStats: (new saleStatisticsInitialState()),
82 stockStats: (new stockStatsInitialState()), 84 stockStats: (new stockStatsInitialState()),
  85 + deliveryStats: (new deliveryStatsInitialState()),
83 }; 86 };
84 return _initState; 87 return _initState;
85 } 88 }
@@ -161,9 +164,9 @@ export default function native(platform) { @@ -161,9 +164,9 @@ export default function native(platform) {
161 /> 164 />
162 165
163 <Scene 166 <Scene
164 - key='AccountSettlement'  
165 - component={AccountSettlementContainer}  
166 - title='对账结算' 167 + key='DeliveryStats'
  168 + component={DeliveryStatsContainer}
  169 + title='发货入库'
167 hideNavBar={false} 170 hideNavBar={false}
168 initial={false} 171 initial={false}
169 navBar={NavBar} 172 navBar={NavBar}
@@ -183,6 +186,17 @@ export default function native(platform) { @@ -183,6 +186,17 @@ export default function native(platform) {
183 /> 186 />
184 187
185 <Scene 188 <Scene
  189 + key='AccountSettlement'
  190 + component={AccountSettlementContainer}
  191 + title='对账结算'
  192 + hideNavBar={false}
  193 + initial={false}
  194 + navBar={NavBar}
  195 + titleStyle={styles.navTitle}
  196 + type='push'
  197 + />
  198 +
  199 + <Scene
186 key='AboutUs' 200 key='AboutUs'
187 component={AboutUsContainer} 201 component={AboutUsContainer}
188 title='关于我们' 202 title='关于我们'
  1 +'use strict';
  2 +
  3 +import React from 'react-native';
  4 +
  5 +
  6 +let {
  7 + Component,
  8 + View,
  9 + Text,
  10 + StyleSheet,
  11 + Dimensions,
  12 + Platform,
  13 + DatePickerAndroid,
  14 + TouchableHighlight,
  15 + Image,
  16 +} = React;
  17 +
  18 +
  19 +export default class DatePicker extends Component {
  20 +
  21 + static propTypes = {
  22 + containerStyle: View.propTypes.style,
  23 + };
  24 +
  25 + constructor(props) {
  26 + super(props);
  27 + this._showDatePicker = this._showDatePicker.bind(this);
  28 + }
  29 +
  30 + render() {
  31 +
  32 + return (
  33 + <View style={[styles.container, this.props.containerStyle]}>
  34 +
  35 + <TouchableHighlight underlayColor={'white'}
  36 + onPress={() => {this._showDatePicker(this.props.currentStartDate, '2000-1-1', this.props.currentEndDate, true)}}>
  37 + <View style={styles.dateContainer}>
  38 + <Text style={styles.dateText}>{this.props.currentStartDate}</Text>
  39 + <Image source={require('../images/down.png')}/>
  40 + </View>
  41 + </TouchableHighlight>
  42 + <Text style={styles.middleText}></Text>
  43 + <TouchableHighlight underlayColor={'white'}
  44 + onPress={() => {this._showDatePicker(this.props.currentEndDate, this.props.currentStartDate, this.props.maxDate, false)}}>
  45 + <View style={styles.dateContainer}>
  46 + <Text style={styles.dateText}>{this.props.currentEndDate}</Text>
  47 + <Image source={require('../images/down.png')}/>
  48 + </View>
  49 + </TouchableHighlight>
  50 +
  51 + </View>
  52 + );
  53 + }
  54 +
  55 + async _showDatePicker(currentDate, minDate, maxDate, ifStartDate) {
  56 + let currentDateArr = currentDate.split('-');
  57 + let minDateArr = minDate.split('-');
  58 + let maxDateArr = maxDate.split('-');
  59 + if (Platform.OS === 'android') {
  60 + try {
  61 + const {action, year, month, day} = await DatePickerAndroid.open({
  62 + date: new Date(currentDateArr[0], (currentDateArr[1] - 1), currentDateArr[2]),
  63 + minDate: new Date(minDateArr[0], (minDateArr[1] - 1), minDateArr[2]),
  64 + maxDate: new Date(maxDateArr[0], (maxDateArr[1] - 1), maxDateArr[2]),
  65 + });
  66 + if (action !== DatePickerAndroid.dismissedAction) {
  67 + let pickedDate = year + '-' + (month + 1) + '-' + day;
  68 + this.props.newDatePicked(pickedDate, ifStartDate);
  69 + }
  70 + } catch ({code, message}) {
  71 +
  72 + }
  73 +
  74 + } else {
  75 +
  76 + }
  77 +
  78 + }
  79 +}
  80 +
  81 +let {width, height} = Dimensions.get('window');
  82 +
  83 +let styles = StyleSheet.create({
  84 + container: {
  85 + width,
  86 + height: 45,
  87 + backgroundColor: 'white',
  88 + flexDirection: 'row',
  89 + alignItems: 'center',
  90 + justifyContent: 'center',
  91 + },
  92 + middleText: {
  93 + marginLeft: 15,
  94 + marginRight: 15,
  95 + color: '#444444',
  96 + fontSize: 14,
  97 + },
  98 + dateText: {
  99 + color: '#444444',
  100 + fontSize: 14,
  101 + paddingRight: 5,
  102 + },
  103 + dateContainer: {
  104 + flex: 1,
  105 + flexDirection: 'row',
  106 + alignItems: 'center',
  107 + justifyContent: 'center',
  108 + }
  109 +
  110 +});
  1 +'use strict';
  2 +
  3 +import React, {Component} from 'react';
  4 +import PlainTextSection from './PlainTextSection';
  5 +import Placeholder from './Placeholder';
  6 +import DatePicker from './DatePicker';
  7 +import FixedHeaderList from './FixedHeaderList';
  8 +
  9 +import {
  10 + StyleSheet,
  11 + View,
  12 +} from 'react-native';
  13 +
  14 +export default class DeliveryStats extends Component {
  15 +
  16 + constructor(props) {
  17 + super (props);
  18 + }
  19 +
  20 + render() {
  21 + return (
  22 + <View style={styles.container}>
  23 + <DatePicker currentStartDate={this.props.currentStartDate}
  24 + currentEndDate={this.props.currentEndDate}
  25 + maxDate={this.props.maxDate}
  26 + newDatePicked={this.props.newDatePicked}/>
  27 + <Placeholder />
  28 + <PlainTextSection content={this.props.section2} />
  29 + <Placeholder />
  30 + <FixedHeaderList content={this.props.content}
  31 + header={this.props.header}/>
  32 + </View>
  33 + );
  34 + }
  35 +
  36 +}
  37 +
  38 +const styles = StyleSheet.create({
  39 + container: {
  40 + flex: 1,
  41 + },
  42 +});
  1 +'use strict';
  2 +
  3 +import React from 'react-native';
  4 +
  5 +
  6 +let {
  7 + Component,
  8 + View,
  9 + Text,
  10 + Image,
  11 + ListView,
  12 + TouchableHighlight,
  13 + Dimensions,
  14 + StyleSheet,
  15 +} = React;
  16 +
  17 +
  18 +export default class FixedHeaderList extends Component {
  19 +
  20 + // static propTypes = {
  21 + // content: React.PropTypes.arrayOf(
  22 + // React.PropTypes.shape({
  23 + // type: React.PropTypes.string,
  24 + // thumb: React.PropTypes.number,
  25 + // title: React.PropTypes.string,
  26 + // })
  27 + // ),
  28 + // onPress: React.PropTypes.func,
  29 + // };
  30 +
  31 + constructor(props) {
  32 + super(props);
  33 +
  34 + this._renderRow = this._renderRow.bind(this);
  35 + this._renderHeader = this._renderHeader.bind(this);
  36 +
  37 + this.ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
  38 + // this.dataSource = ds.cloneWithRows(this.props.content);
  39 +
  40 + this.headers = [];
  41 + for (let i = 0; i < this.props.header.length; i++) {
  42 + this.headers.push(<Text style={styles.headerText}>{this.props.header[i]}</Text>);
  43 + if (i !== (this.props.header.length - 1)) {
  44 + this.headers.push(<View style={{width: 1, height: 14, backgroundColor: '#e5e5e5'}}/>);
  45 + }
  46 + }
  47 + }
  48 +
  49 + _renderRow(rowData, sectionID, rowID) {
  50 + return (
  51 + <TouchableHighlight onPress={() => {}} underlayColor={'white'} >
  52 + <View style={styles.row}>
  53 + <View style={styles.firstColumn}>
  54 + <Text style={styles.blackText}>{rowData.id}</Text>
  55 + <Text style={styles.blackText}>{rowData.date}</Text>
  56 + </View>
  57 + <Text style={styles.redText}>{rowData.deliveryNum}</Text>
  58 + <Text style={styles.redText}>{rowData.deliveryAmount}</Text>
  59 + </View>
  60 + </TouchableHighlight>
  61 + );
  62 + }
  63 +
  64 + _renderHeader() {
  65 + return (
  66 + <View key={'listHeader'} style={styles.headerContainer}>
  67 + {this.headers}
  68 + </View>
  69 + );
  70 + }
  71 +
  72 + render() {
  73 + return (
  74 + <ListView
  75 + style={styles.container}
  76 + dataSource={this.ds.cloneWithRows(this.props.content)}
  77 + renderRow={this._renderRow}
  78 + renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator}/>}
  79 + renderHeader={this._renderHeader}
  80 + enableEmptySections={true}
  81 + />
  82 + );
  83 + }
  84 +}
  85 +
  86 +let {width, height} = Dimensions.get('window');
  87 +
  88 +let styles = StyleSheet.create({
  89 + container: {
  90 + flex: 1,
  91 + },
  92 + separator: {
  93 + height: 1,
  94 +
  95 + },
  96 + headerContainer: {
  97 + flexDirection: 'row',
  98 + backgroundColor: 'white',
  99 + height: 45,
  100 + alignItems: 'center',
  101 + borderBottomColor: '#F0F0F0',
  102 + borderBottomWidth: 1,
  103 + },
  104 + headerText: {
  105 + fontSize: 14,
  106 + color: '#444444',
  107 + textAlign: 'center',
  108 + flex: 1,
  109 + },
  110 + row: {
  111 + flexDirection: 'row',
  112 + paddingTop: 15,
  113 + paddingBottom: 15,
  114 + alignItems: 'center',
  115 + backgroundColor: 'white',
  116 + },
  117 + firstColumn: {
  118 + flex: 1,
  119 + flexDirection: 'column',
  120 + justifyContent: 'center',
  121 + alignItems: 'center',
  122 + },
  123 + blackText: {
  124 + fontSize: 14,
  125 + color: '#444444',
  126 + textAlign: 'center',
  127 + },
  128 + redText: {
  129 + fontSize: 14,
  130 + color: '#D0021B',
  131 + flex: 1,
  132 + textAlign: 'center',
  133 + }
  134 +
  135 +});
@@ -56,7 +56,7 @@ export default class StockStats extends Component { @@ -56,7 +56,7 @@ export default class StockStats extends Component {
56 dataSource={this.ds.cloneWithRows(this.props.section3)} 56 dataSource={this.ds.cloneWithRows(this.props.section3)}
57 renderRow={this._renderRow} 57 renderRow={this._renderRow}
58 renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator}/>} 58 renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator}/>}
59 - onEndReachedThreshold={-50} 59 + onEndReachedThreshold={-10}
60 onEndReached={this.props.requestData} 60 onEndReached={this.props.requestData}
61 enableEmptySections={true} /> 61 enableEmptySections={true} />
62 </View> 62 </View>
@@ -73,7 +73,7 @@ const styles = StyleSheet.create({ @@ -73,7 +73,7 @@ const styles = StyleSheet.create({
73 flexDirection: 'row', 73 flexDirection: 'row',
74 justifyContent: 'center', 74 justifyContent: 'center',
75 alignItems: 'center', 75 alignItems: 'center',
76 - height: 50, 76 + height: 45,
77 backgroundColor: 'white', 77 backgroundColor: 'white',
78 }, 78 },
79 date: { 79 date: {
@@ -61,10 +61,17 @@ export default keyMirror({ @@ -61,10 +61,17 @@ export default keyMirror({
61 STOCK_STATS_REQUEST: null, 61 STOCK_STATS_REQUEST: null,
62 STOCK_STATS_SUCCESS: null, 62 STOCK_STATS_SUCCESS: null,
63 STOCK_STATS_FAILURE: null, 63 STOCK_STATS_FAILURE: null,
  64 +
64 SALE_STATS_REQUEST: null, 65 SALE_STATS_REQUEST: null,
65 SALE_STATS_SUCCESS: null, 66 SALE_STATS_SUCCESS: null,
66 SALE_STATS_FAILURE: null, 67 SALE_STATS_FAILURE: null,
67 68
  69 + DELIVERY_STATS_REQUEST: null,
  70 + DELIVERY_STATS_SUCCESS: null,
  71 + DELIVERY_STATS_FAILURE: null,
  72 + CHOOSE_DELIVERY_START_DATE: null,
  73 + CHOOSE_DELIVERY_END_DATE: null,
  74 +
68 /* 75 /*
69 GET_PROFILE_REQUEST: null, 76 GET_PROFILE_REQUEST: null,
70 GET_PROFILE_SUCCESS: null, 77 GET_PROFILE_SUCCESS: null,
  1 +
  2 +'use strict';
  3 +
  4 +import React, { Component } from 'react';
  5 +
  6 +import DeliveryStats from '../components/DeliveryStats'
  7 +
  8 +import {
  9 + StyleSheet,
  10 + View,
  11 + Text,
  12 + ListView,
  13 + Dimensions,
  14 + Platform,
  15 +} from 'react-native';
  16 +
  17 +import {bindActionCreators} from 'redux';
  18 +import {connect} from 'react-redux';
  19 +
  20 +import {Map} from 'immutable';
  21 +
  22 +import * as deliveryStatsActions from '../reducers/deliveryStats/deliveryStatsActions';
  23 +import {getLastDay} from '../utils/dateTool';
  24 +
  25 +const actions = [
  26 + deliveryStatsActions,
  27 +];
  28 +
  29 +
  30 +function mapStateToProps(state) {
  31 + return {
  32 + ...state
  33 + }
  34 +};
  35 +
  36 +function mapDispatchToProps(dispatch) {
  37 +
  38 + const creators = Map()
  39 + .merge(...actions)
  40 + .filter(value => typeof value === 'function')
  41 + .toObject();
  42 +
  43 + return {
  44 + actions: bindActionCreators(creators, dispatch),
  45 + dispatch
  46 + };
  47 +}
  48 +
  49 +export default class DeliveryStatsContainer extends Component {
  50 +
  51 + constructor(props) {
  52 + super(props);
  53 + this._requestData = this._requestData.bind(this);
  54 + }
  55 +
  56 + componentDidMount() {
  57 + this.props.actions.requestData();
  58 + }
  59 +
  60 + _requestData() {
  61 + this.props.actions.requestData();
  62 + }
  63 +
  64 + render() {
  65 +
  66 + let section2 = [
  67 + {
  68 + top: '到货入库总数量',
  69 + bottom: `${this.props.deliveryStats.sum}`,
  70 + },
  71 + {
  72 + top: '到货入库总金额(元)',
  73 + bottom: `${this.props.deliveryStats.totalAmount}`,
  74 + }
  75 + ];
  76 + let header = [
  77 + '单号/时间', '发货入库数量', '发货入库总金额(元)'
  78 + ];
  79 +
  80 + return (
  81 + <View style={styles.container}>
  82 + <DeliveryStats
  83 + currentStartDate={this.props.deliveryStats.startDay}
  84 + currentEndDate={this.props.deliveryStats.endDay}
  85 + maxDate={getLastDay()}
  86 + newDatePicked={this.props.actions.newDatePicked}
  87 + section2={section2}
  88 + content={this.props.deliveryStats.jsonData.toJS()}
  89 + header={header}
  90 + />
  91 + </View>
  92 + );
  93 + }
  94 +}
  95 +
  96 +let {width, height} = Dimensions.get('window');
  97 +let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
  98 +
  99 +let styles = StyleSheet.create({
  100 + container: {
  101 + flex: 1,
  102 + top: navbarHeight,
  103 + height: height - navbarHeight,
  104 + },
  105 +
  106 +});
  107 +
  108 +export default connect(mapStateToProps, mapDispatchToProps)(DeliveryStatsContainer);
@@ -93,6 +93,7 @@ let navbarHeight = (Platform.OS === 'android') ? 50 : 64; @@ -93,6 +93,7 @@ let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
93 93
94 let styles = StyleSheet.create({ 94 let styles = StyleSheet.create({
95 container: { 95 container: {
  96 + flex: 1,
96 top: navbarHeight, 97 top: navbarHeight,
97 height: height - navbarHeight, 98 height: height - navbarHeight,
98 }, 99 },
  1 +'use strict';
  2 +import Request from '../../services/Request';
  3 +import DeliveryStatsService from '../../services/HomeService';
  4 +
  5 +const {
  6 + DELIVERY_STATS_REQUEST,
  7 + DELIVERY_STATS_SUCCESS,
  8 + DELIVERY_STATS_FAILURE,
  9 + CHOOSE_DELIVERY_START_DATE,
  10 + CHOOSE_DELIVERY_END_DATE,
  11 +} = require('../../constants/actionTypes').default;
  12 +
  13 +export function chooseStartDate(startDay) {
  14 + return {
  15 + type: CHOOSE_DELIVERY_START_DATE,
  16 + payload: startDay,
  17 + }
  18 +}
  19 +
  20 +export function chooseEndDate(endDay) {
  21 + return {
  22 + type: CHOOSE_DELIVERY_END_DATE,
  23 + payload: endDay,
  24 + }
  25 +}
  26 +
  27 +export function newDatePicked(pickedDate, ifStartDate) {
  28 + return ifStartDate ? chooseStartDate(pickedDate) : chooseEndDate(pickedDate);
  29 +}
  30 +
  31 +export function request() {
  32 + return {
  33 + type: DELIVERY_STATS_REQUEST,
  34 + }
  35 +}
  36 +
  37 +export function success(json) {
  38 + return {
  39 + type: DELIVERY_STATS_SUCCESS,
  40 + payload: json,
  41 + }
  42 +}
  43 +
  44 +export function failure(error) {
  45 + return {
  46 + type: DELIVERY_STATS_FAILURE,
  47 + payload: error,
  48 + }
  49 +}
  50 +
  51 +export function requestData() {
  52 + // return dispatch => {
  53 + // dispatch(request());
  54 + // return new DeliveryStatsService()
  55 + // .deliveryStatsData()
  56 + // .then(json => {
  57 + // dispatch(success(json));
  58 + // })
  59 + // .catch(error => {
  60 + // dispatch(failure(error));
  61 + // })
  62 + // };
  63 + return success(testStockStatsData);
  64 +}
  65 +
  66 +let testStockStatsData = {
  67 + sum: '100',
  68 + totalAmount: '100000.00',
  69 + list: [
  70 + {
  71 + id: '1111',
  72 + date: '2016-05-06',
  73 + deliveryNum: '222222',
  74 + deliveryAmount: '1111.00',
  75 + },
  76 + {
  77 + id: '1111',
  78 + date: '2016-05-06',
  79 + deliveryNum: '222222',
  80 + deliveryAmount: '1111.00',
  81 + },
  82 + {
  83 + id: '1111',
  84 + date: '2016-05-06',
  85 + deliveryNum: '222222',
  86 + deliveryAmount: '1111.00',
  87 + },
  88 + {
  89 + id: '1111',
  90 + date: '2016-05-06',
  91 + deliveryNum: '222222',
  92 + deliveryAmount: '1111.00',
  93 + },
  94 + {
  95 + id: '1111',
  96 + date: '2016-05-06',
  97 + deliveryNum: '222222',
  98 + deliveryAmount: '1111.00',
  99 + },
  100 + {
  101 + id: '1111',
  102 + date: '2016-05-06',
  103 + deliveryNum: '222222',
  104 + deliveryAmount: '1111.00',
  105 + },
  106 + {
  107 + id: '1111',
  108 + date: '2016-05-06',
  109 + deliveryNum: '222222',
  110 + deliveryAmount: '1111.00',
  111 + },
  112 + {
  113 + id: '0000',
  114 + date: '2016-05-06',
  115 + deliveryNum: '222222',
  116 + deliveryAmount: '1111.00',
  117 + },
  118 + ]
  119 +}
  1 +'use strict';
  2 +
  3 +import {List, Record} from 'immutable';
  4 +import {getLastDay} from '../../utils/dateTool';
  5 +
  6 +let InitialState = Record({
  7 + error: null,
  8 + isFetching: false,
  9 + pageCount: 0,
  10 + startDay: getLastDay(),
  11 + endDay: getLastDay(),
  12 + sum: '0',
  13 + totalAmount: '0',
  14 + jsonData: List([]),
  15 +});
  16 +
  17 +export default InitialState;
  1 +'use strict';
  2 +
  3 +import DeliveryStatsInitialState from './deliveryStatsInitialState'
  4 +import Immutable, {List, Record} from 'immutable';
  5 +
  6 +const {
  7 + DELIVERY_STATS_REQUEST,
  8 + DELIVERY_STATS_SUCCESS,
  9 + DELIVERY_STATS_FAILURE,
  10 + CHOOSE_DELIVERY_START_DATE,
  11 + CHOOSE_DELIVERY_END_DATE,
  12 +} = require('../../constants/actionTypes').default;
  13 +
  14 +const initialState = new DeliveryStatsInitialState;
  15 +
  16 +export default function deliveryStatsReducer(state = initialState, action) {
  17 + if (!(state instanceof DeliveryStatsInitialState)) return initialState.merge(state);
  18 +
  19 + switch (action.type) {
  20 + case DELIVERY_STATS_REQUEST: {
  21 + let nextState = state.set('isFetching', true).set('error', null);
  22 + return nextState;
  23 + }
  24 + case DELIVERY_STATS_SUCCESS: {
  25 + const {jsonData} = state;
  26 + // let origin = jsonData.toJS();
  27 + let data = [...action.payload.list];
  28 + // let newPageCount = action.payload.list ? state.pageCount + 1 : state.pageCount;
  29 + let nextState = state.set('isFetching',false)
  30 + .set('sum', action.payload.sum)
  31 + .set('totalAmount', action.payload.totalAmount)
  32 + .set('jsonData', List(data));
  33 + // .set('pageCount', newPageCount)
  34 + return nextState;
  35 + }
  36 + case DELIVERY_STATS_FAILURE: {
  37 + let nextState = state.set('isFetching', false)
  38 + .set('error', action.playload);
  39 + return nextState;
  40 + }
  41 + case CHOOSE_DELIVERY_START_DATE: {
  42 + let nextState = state.set('startDay', action.payload);
  43 + return nextState;
  44 + }
  45 + case CHOOSE_DELIVERY_END_DATE: {
  46 + let nextState = state.set('endDay', action.payload);
  47 + return nextState;
  48 + }
  49 + }
  50 +
  51 + return state;
  52 +}
@@ -18,6 +18,7 @@ import user from './user/userReducer'; @@ -18,6 +18,7 @@ import user from './user/userReducer';
18 import stockStats from './stockStats/stockStatsReducer'; 18 import stockStats from './stockStats/stockStatsReducer';
19 import actStmt from './accountSettlement/accountSettlementReducer'; 19 import actStmt from './accountSettlement/accountSettlementReducer';
20 import saleStats from './saleStatistics/saleStatisticsReducer'; 20 import saleStats from './saleStatistics/saleStatisticsReducer';
  21 +import deliveryStats from './deliveryStats/deliveryStatsReducer';
21 22
22 import { combineReducers } from 'redux'; 23 import { combineReducers } from 'redux';
23 24
@@ -35,7 +36,8 @@ const rootReducer = combineReducers({ @@ -35,7 +36,8 @@ const rootReducer = combineReducers({
35 user, 36 user,
36 actStmt, 37 actStmt,
37 stockStats, 38 stockStats,
38 - saleStats 39 + saleStats,
  40 + deliveryStats,
39 }); 41 });
40 42
41 export default rootReducer; 43 export default rootReducer;
@@ -45,8 +45,8 @@ export function requestData() { @@ -45,8 +45,8 @@ export function requestData() {
45 } 45 }
46 46
47 let testStockStatsData = { 47 let testStockStatsData = {
48 - sum: 100,  
49 - totalAmount: 100000.00, 48 + sum: '100',
  49 + totalAmount: '100000.00',
50 list: [ 50 list: [
51 { 51 {
52 brand: 'vans', 52 brand: 'vans',
@@ -120,141 +120,5 @@ let testStockStatsData = { @@ -120,141 +120,5 @@ let testStockStatsData = {
120 stockNum: '77', 120 stockNum: '77',
121 thumb: 'https://facebook.github.io/react/img/logo_og.png', 121 thumb: 'https://facebook.github.io/react/img/logo_og.png',
122 }, 122 },
123 - {  
124 - brand: 'vans',  
125 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
126 - vendor: '222222',  
127 - sku: '111111111',  
128 - importPrice: '222',  
129 - stockNum: '78',  
130 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
131 - },  
132 - {  
133 - brand: 'vans',  
134 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
135 - vendor: '222222',  
136 - sku: '111111111',  
137 - importPrice: '222',  
138 - stockNum: '79',  
139 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
140 - },  
141 - {  
142 - brand: 'vans',  
143 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
144 - vendor: '222222',  
145 - sku: '111111111',  
146 - importPrice: '222',  
147 - stockNum: '80',  
148 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
149 - },  
150 - {  
151 - brand: 'vans',  
152 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
153 - vendor: '222222',  
154 - sku: '111111111',  
155 - importPrice: '222',  
156 - stockNum: '81',  
157 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
158 - },  
159 - {  
160 - brand: 'vans',  
161 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
162 - vendor: '222222',  
163 - sku: '111111111',  
164 - importPrice: '222',  
165 - stockNum: '82',  
166 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
167 - },  
168 - {  
169 - brand: 'vans',  
170 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
171 - vendor: '222222',  
172 - sku: '111111111',  
173 - importPrice: '222',  
174 - stockNum: '83',  
175 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
176 - },  
177 - {  
178 - brand: 'vans',  
179 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
180 - vendor: '222222',  
181 - sku: '111111111',  
182 - importPrice: '222',  
183 - stockNum: '84',  
184 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
185 - },  
186 - {  
187 - brand: 'vans',  
188 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
189 - vendor: '222222',  
190 - sku: '111111111',  
191 - importPrice: '222',  
192 - stockNum: '85',  
193 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
194 - },  
195 - {  
196 - brand: 'vans',  
197 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
198 - vendor: '222222',  
199 - sku: '111111111',  
200 - importPrice: '222',  
201 - stockNum: '86',  
202 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
203 - },  
204 - {  
205 - brand: 'vans',  
206 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
207 - vendor: '222222',  
208 - sku: '111111111',  
209 - importPrice: '222',  
210 - stockNum: '87',  
211 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
212 - },  
213 - {  
214 - brand: 'vans',  
215 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
216 - vendor: '222222',  
217 - sku: '111111111',  
218 - importPrice: '222',  
219 - stockNum: '88',  
220 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
221 - },  
222 - {  
223 - brand: 'vans',  
224 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
225 - vendor: '222222',  
226 - sku: '111111111',  
227 - importPrice: '222',  
228 - stockNum: '89',  
229 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
230 - },  
231 - {  
232 - brand: 'vans',  
233 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
234 - vendor: '222222',  
235 - sku: '111111111',  
236 - importPrice: '222',  
237 - stockNum: '90',  
238 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
239 - },  
240 - {  
241 - brand: 'vans',  
242 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
243 - vendor: '222222',  
244 - sku: '111111111',  
245 - importPrice: '222',  
246 - stockNum: '91',  
247 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
248 - },  
249 - {  
250 - brand: 'vans',  
251 - product: 'dddddddddddddddddddddddd 超清来袭ddddddddddd',  
252 - vendor: '222222',  
253 - sku: '111111111',  
254 - importPrice: '222',  
255 - stockNum: '92',  
256 - thumb: 'https://facebook.github.io/react/img/logo_og.png',  
257 - },  
258 -  
259 ] 123 ]
260 } 124 }
@@ -60,6 +60,21 @@ export default class UserService { @@ -60,6 +60,21 @@ export default class UserService {
60 throw(error); 60 throw(error);
61 }) 61 })
62 } 62 }
  63 +
  64 + async deliveryStatsData() {
  65 + return await this.api.get({
  66 + url: '/',
  67 + body: {
  68 +
  69 + }
  70 + })
  71 + .then((json) => {
  72 + return json;
  73 + })
  74 + .catch((error) => {
  75 + throw(error);
  76 + })
  77 + }
63 } 78 }
64 79
65 80
  1 +'use strict'
  2 +
  3 +export function getLastDay() {
  4 + let date = new Date();
  5 + let lastDay = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + (date.getDate() - 1);
  6 + return lastDay;
  7 +}