Authored by 孙凯

add 发货页面 review by hongmo

... ... @@ -37,6 +37,7 @@ import requestStatsInitialState from './reducers/requestStats/requestStatsInitia
import refoundStatisticsInitialState from './reducers/refoundStatistics/refoundStatisticsInitialState';
import transferShipmentInitialState from './reducers/transferShipment/transferShipmentInitialState';
import outOfStockInitialState from './reducers/outOfStock/outOfStockInitialState';
import deliverGoodsInitialState from './reducers/deliverGoods/deliverGoodsInitialState';
import App from './containers/App';
import GuideContainer from './containers/GuideContainer';
... ... @@ -57,6 +58,7 @@ import RequestStatsContainer from './containers/RequestStatsContainer'
import RefoundStatisticsContainer from './containers/RefoundStatisticsContainer'
import TransferShipmentContainer from './containers/TransferShipmentContainer'
import OutOfStockContainer from './containers/OutOfStockContainer'
import DeliverGoodsContainer from './containers/DeliverGoodsContainer'
import NavBar from './components/NavBar';
import TabIcon from './containers/TabIcon';
... ... @@ -282,6 +284,10 @@ export default function native(platform) {
component={TransferShipmentContainer}
title='调拨发货'
hideNavBar={false}
rightTitle='发货'
onRight={()=>{
Actions.DeliverGoods();
}}
initial={false}
navBar={NavBar}
titleStyle={styles.navTitle}
... ... @@ -300,6 +306,21 @@ export default function native(platform) {
panHandlers={Platform.OS === 'android' ? null : undefined}
/>
<Scene
key="DeliverGoods"
component={DeliverGoodsContainer}
hideNavBar={false}
initial={false}
navBar={NavBar}
title='发货'
rightTitle='提交'
onRight={()=>{
console.log('sssssssssssss');;
}}
titleStyle={styles.navTitle}
type="push"
panHandlers={Platform.OS === 'android' ? null : undefined}
/>
<Scene
key='AboutUs'
component={AboutUsContainer}
title='关于我们'
... ...
'use strict';
import React, {Component} from 'react';
import LoadMoreIndicator from '../indicator/LoadMoreIndicator';
import LoadingIndicator from '../indicator/LoadingIndicator';
import moment from 'moment';
import DeliverGoodsCell from './DeliverGoodsCell';
import {
StyleSheet,
View,
Text,
ListView,
Image,
Dimensions,
TouchableOpacity,
TextInput,
Picker,
} from 'react-native';
export default class DeliverGoods extends Component {
constructor(props) {
super (props);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
this._renderRow = this._renderRow.bind(this);
this._picker = this._picker.bind(this);
this.state = {
express: '1',
showPicker: false,
};
}
_renderRow(rowData, sectionID, rowID) {
return(
<DeliverGoodsCell />
);
}
_picker() {
return (
<View style={styles.pickerContainer}>
<TouchableOpacity onPress={() => {
this.setState({showPicker: false});
}}>
<View style={styles.pickerSpaceContainer}/>
</TouchableOpacity>
<View style={styles.pickerSubContainer}>
<Picker
selectedValue={this.state.express}
onValueChange={(lang) => this.setState({express: lang})}>
<Picker.Item label="Java" value="java" />
<Picker.Item label="1" value="1" />
<Picker.Item label="2" value="2" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
</View>
</View>
);
}
render() {
return (
<View style={styles.container}>
<View style={styles.cell0}>
<Text style={styles.numberName} numberOfLines={1}>
物流公司:
</Text>
<TouchableOpacity onPress={() => {
this.setState({showPicker: !this.state.showPicker});
}}>
<View style={styles.pickerView}>
<Text style={styles.pickerText} numberOfLines={1}>
{this.state.express}
</Text>
</View>
</TouchableOpacity>
</View>
<View style={styles.cell0}>
<Text style={styles.numberName} numberOfLines={1}>
物流单号:
</Text>
<TextInput style={styles.numberInputText}
ref = 'textInput1'
placeholder={'输入物流单号'}
/>
<TouchableOpacity onPress={() => {
}}>
<View style={styles.camera}>
</View>
</TouchableOpacity>
</View>
<View style={styles.cellAddress}>
<Text style={styles.cellAddressText} numberOfLines={3}>
收货地址:南京1号仓库 江苏省南京市江宁区江宁开发经济技术开发区 苏源大道87YOHO!有货物流中心东一楼 曾庆红
</Text>
</View>
<ListView
style={styles.listContainer}
dataSource={this.dataSource.cloneWithRows([1,1,11,1,1,1,1])}
renderRow={this._renderRow}
/>
{this.state.showPicker ? this._picker() : null}
</View>
);
}
}
let {width, height} = Dimensions.get('window');
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
cell0: {
width: width,
height: 50,
backgroundColor: 'white',
flexDirection: 'row',
borderBottomWidth: 1,
borderBottomColor: 'black',
alignItems: 'center',
},
numberName: {
backgroundColor: 'transparent',
fontSize:15,
alignItems: 'center',
textAlign: 'left',
marginLeft: 10,
},
numberInputText:{
width: width - 150,
height: 40,
backgroundColor:'transparent',
fontSize:15,
marginLeft: 5,
borderWidth: 1,
borderColor: '#CCC',
borderRadius: 4,
marginTop: 5,
},
pickerView: {
width: width - 150,
height: 40,
backgroundColor:'transparent',
marginLeft: 5,
borderWidth: 1,
borderColor: '#CCC',
borderRadius: 4,
justifyContent: 'center',
},
pickerText: {
},
camera: {
width: 30,
height: 30,
backgroundColor: 'red',
marginLeft: 10,
},
cellAddress: {
width: width,
height: 60,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center',
},
cellAddressText: {
width: width - 20,
backgroundColor: 'white',
fontSize:15,
alignItems: 'center',
textAlign: 'left',
},
listContainer: {
flex: 1,
},
pickerContainer: {
flex: 1,
flexDirection: 'column',
top: 0,
left: 0,
width: width,
height: height ,
position: 'absolute',
backgroundColor: 'transparent',
},
pickerSpaceContainer: {
width: width,
height: height - 400 ,
backgroundColor: 'transparent',
},
pickerSubContainer: {
flex: 1,
flexDirection: 'column',
bottom: 0,
width: width,
height: 400 ,
backgroundColor: 'white',
},
});
... ...
'use strict';
import React, {Component} from 'react';
import CheckBox from 'react-native-checkbox';
import CONFIG from '../../constants/config';
import {
StyleSheet,
View,
Text,
ListView,
Image,
Dimensions,
TextInput,
TouchableOpacity,
} from 'react-native';
export default class DeliverGoodsCell extends Component {
constructor(props) {
super (props);
}
render() {
let num = 2;
let tags = [1,1];
return (
<View style={{width: width,height: headerH + cellH * num,backgroundColor: 'white',}}>
<View style={styles.header}>
<Text style={styles.title} numberOfLines={1}>单号:175321</Text>
</View>
{tags.map((value, i) => {
return (
<View style={styles.cell}>
<Text style={styles.cellText1} numberOfLines={1}>SKU:2564123</Text>
<Text style={styles.cellText2} numberOfLines={1}>商品条码:KT-2017156 红色/L</Text>
<Text style={styles.cellText3} numberOfLines={1}>当前需发数:5</Text>
</View>
);
})}
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let headerH = 30;
let cellH = 40;
const styles = StyleSheet.create({
container: {
},
header: {
width: width,
height: headerH,
backgroundColor: 'gray',
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize:15,
alignItems: 'center',
textAlign: 'left',
marginLeft: 10,
width: width-20,
},
cell: {
width: width,
height: 40,
backgroundColor: 'white',
flexDirection: 'row',
alignItems: 'center',
borderBottomWidth: 1,
borderBottomColor: 'black',
},
cellText1: {
fontSize:12,
marginLeft: 10,
width: Math.ceil((width-20)/3)-30,
textAlign: 'left',
color: 'black',
},
cellText2: {
fontSize:12,
width: Math.ceil((width-20)/3)+60,
textAlign: 'center',
color: 'black',
},
cellText3: {
fontSize:12,
width: Math.ceil((width-20)/3)-30,
textAlign: 'right',
color: 'black',
},
});
... ...
... ... @@ -27,6 +27,7 @@ module.exports = {
requestStats: 'requestStats',
transferShipment: 'transferShipment',
outOfStock: 'outOfStock',
deliverGoods: 'deliverGoods',
},
dateFilterKey: {
date: 1,//天
... ...
'use strict';
import React, { Component } from 'react';
import Immutable, {List, Record} from 'immutable';
import DeliverGoods from '../components/DeliverGoods/DeliverGoods'
import {
StyleSheet,
View,
Text,
ListView,
Dimensions,
Platform,
} from 'react-native';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as deliverGoodsActions from '../reducers/deliverGoods/deliverGoodsActions';
const actions = [
deliverGoodsActions,
];
function mapStateToProps(state) {
return {
...state
}
};
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class DeliverGoodsContainer extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
}
componentWillUnmount() {
}
render() {
return (
<View style={styles.container}>
<DeliverGoods />
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let navbarHeight = (Platform.OS === 'android') ? 50 : 64;
let styles = StyleSheet.create({
container: {
top: navbarHeight,
height: height - navbarHeight,
paddingBottom: (Platform.OS === 'android') ? 24 : 0,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(DeliverGoodsContainer);
... ...
/**
* # guideActions.js
*
* App user guide
*
*/
'use strict';
import {Actions} from 'react-native-router-flux';
import DeliverGoodsService from '../../services/DeliverGoodsService';
import {Alert, Linking} from 'react-native';
const {
LOGOUT,
} = require('../../constants/actionTypes').default;
... ...
'use strict';
/**
* ## Import immutable record
*/
import {List, Record} from 'immutable';
let InitialState = Record({
});
export default InitialState;
... ...
'use strict';
/**
* ## Imports
*
* InitialState
*/
import InitialState from './deliverGoodsInitialState';
import Immutable, {List, Record} from 'immutable';
const {
LOGOUT,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
/**
* ## guideReducer function
* @param {Object} state - initialState
* @param {Object} action - type and payload
*/
export default function userReducer(state = initialState, action) {
if (!(state instanceof InitialState)) return initialState.merge(state);
switch (action.type) {
case LOGOUT:{
return state;
}
return state;
}
return state;
}
... ...
... ... @@ -23,6 +23,7 @@ import requestStats from './requestStats/requestStatsReducer';
import refoundStats from './refoundStatistics/refoundStatisticsReducer'
import transferShipment from './transferShipment/transferShipmentReducer'
import outOfStock from './outOfStock/outOfStockReducer'
import deliverGoods from './deliverGoods/deliverGoodsReducer'
import { combineReducers } from 'redux';
... ... @@ -46,6 +47,7 @@ const rootReducer = combineReducers({
refoundStats,
transferShipment,
outOfStock,
deliverGoods,
});
export default rootReducer;
... ...
'use strict';
import Request from './Request';
import moment from 'moment';
export default class DeliverGoodsService {
constructor () {
this.api = new Request();
}
}
... ...