Commit 41e40b76 by Denglingling

增加【历史订单】组件,以及订单对应的【行表】组件,store 数据、接口函数等;

parent ff1d5203
...@@ -19,6 +19,7 @@ import QuickOrderPage from './containers/quickOrder/QuickOrderPage'; ...@@ -19,6 +19,7 @@ import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import TransOrderPage from './containers/transOrder/TransOrderPage'; import TransOrderPage from './containers/transOrder/TransOrderPage';
import TransSearchPage from './containers/transOrder/module/TransSearchPage'; import TransSearchPage from './containers/transOrder/module/TransSearchPage';
import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage'; import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage';
import LineOrderPage from './containers/historicalOrder/module/LineOrderPage';
import SubSuccPage from './containers/common/SubSuccPage'; import SubSuccPage from './containers/common/SubSuccPage';
const Router = createAppContainer(createStackNavigator({ const Router = createAppContainer(createStackNavigator({
...@@ -35,6 +36,7 @@ const Router = createAppContainer(createStackNavigator({ ...@@ -35,6 +36,7 @@ const Router = createAppContainer(createStackNavigator({
TransOrderPage: {screen: TransOrderPage}, TransOrderPage: {screen: TransOrderPage},
TransSearchPage: {screen: TransSearchPage}, TransSearchPage: {screen: TransSearchPage},
HistoricalOrderPage: {screen: HistoricalOrderPage}, HistoricalOrderPage: {screen: HistoricalOrderPage},
LineOrderPage: {screen: LineOrderPage},
SubSuccPage: {screen: SubSuccPage} SubSuccPage: {screen: SubSuccPage}
}, { }, {
navigationOptions: { navigationOptions: {
......
import { PostRequest,GetRequest } from '../network/RequestUtils';
import { show, getUrlParams } from '../utils/Utils';
import {
HISTOR_ORDER_SEARCH_DOING,
HISTOR_ORDER_SEARCH_SUCCESS,
HISTOR_ORDER_SEARCH_FAILURE
} from '../base/ActionTypes';
import { exitLoginStatus } from './LoginAction';
// 历史订单-获取组织 params={access_token:''}
export const requestHistorOrganizations = async (global_domain_config, params) => {
console.log('----requestHistorOrganizations----', params)
return await GetRequest(global_domain_config, getUrlParams('/authorized_inventory/search', params))
}
// 获取手术医院 params={access_token:'', org_code:'', seller_code:''}
export const requestHistorSurgeryHospital = async (global_domain_config, params) => {
console.log('----requestHistorSurgeryHospital----', params)
return await GetRequest(global_domain_config, getUrlParams('/sale/seller_customer/search', params))
}
// 获取订单类型 params={access_token:'', value_set_code:'SUR_ORDER_TYPE'}
export const requestHistorOrderType = async (global_domain_config, params) => {
console.log('----requestHistorOrderType----', params)
return await GetRequest(global_domain_config, getUrlParams('/system/value_set/search', params))
}
// 借货订单查询 params: {access_token: '', ...}
export function requestGetAllBorrow(params) {
console.log('----requestGetAllBorrow----', params)
return (dispatch, getState) => {
dispatch(requestSearching())
let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/collect_order/search', params))
.then(res => {
console.log('res=====', Object.keys(res), res);
if(res.error_code == 0) {
// 待定!======!!!
let { data: { surgery_collect_headers } } = res
dispatch(requestSearchSuccess(surgery_collect_headers));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestSearchFail());
}
})
.catch(err => {
console.log('------err--====requestGetAllBorrow----', Object.keys(err), err)
show(err.error);
})
}
}
// 借货订单-行表查询 params: {access_token: '', surgery_collect_number: ''}
export const requestGetLineFormBorrow = async (global_domain_config, params) => {
console.log('----requestGetLineFormBorrow----', params)
return await GetRequest(global_domain_config, getUrlParams('/surgery/collect_line/search', params))
}
// 消耗订单查询 params: {access_token: '', ...}
export function requestGetAllConsume(params) {
console.log('----requestGetAllConsume----', params)
return (dispatch, getState) => {
dispatch(requestSearching())
let {global_domain_config} = getState().login
GetRequest(global_domain_config, getUrlParams('/surgery/consume_header/search', params))
.then(res => {
console.log('res=====', Object.keys(res), res);
if(res.error_code == 0) {
// 待定!======!!!
let { data: { sur_consume_headers } } = res
dispatch(requestSearchSuccess(sur_consume_headers));
} else if(res.error_code === 41006) {
show('登录过期,请重新登录');
dispatch(exitLoginStatus());
} else {
let error_msg = res.error_msg || res.message
show(error_msg);
dispatch(requestSearchFail());
}
})
.catch(err => {
console.log('------err--====requestGetAllBorrow----', Object.keys(err), err)
show(err.error);
})
}
}
// 消耗订单-行表查询 params: {access_token: '', consume_order_number: ''}
export const requestGetLineFormConsume = async (global_domain_config, params) => {
console.log('----requestGetLineFormConsume----', params)
return await GetRequest(global_domain_config, getUrlParams('/surgery/consume_line/search', params))
}
// 转单订单查询
function requestSearching() {
return {
type: HISTOR_ORDER_SEARCH_DOING
}
}
function requestSearchSuccess(data) {
return {
type: HISTOR_ORDER_SEARCH_SUCCESS,
rawData: data
}
}
function requestSearchFail() {
return {
type: HISTOR_ORDER_SEARCH_FAILURE
}
}
\ No newline at end of file
...@@ -18,7 +18,8 @@ import { ...@@ -18,7 +18,8 @@ import {
promary_color promary_color
} from '../../base/BaseStyle'; } from '../../base/BaseStyle';
import DatePicker from 'react-native-date-picker'; import DatePicker from 'react-native-date-picker';
import { changeDateFormat } from '../../utils/Utils'; // import { changeDateFormat } from '../../utils/Utils';
import moment from 'moment';
class DateModel extends Component { class DateModel extends Component {
constructor(props) { constructor(props) {
...@@ -26,22 +27,29 @@ class DateModel extends Component { ...@@ -26,22 +27,29 @@ class DateModel extends Component {
this.state = { this.state = {
isVisible: this.props.show, isVisible: this.props.show,
// entityList: this.props.entityList // entityList: this.props.entityList
currentDate: this.props.date currentDate: this.props.date,
date_mode: 'datetime'
} }
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
// console.warn('------show--------------',nextProps.show, this.state.isVisible ) // console.warn('------show--------------',nextProps.show, this.state.isVisible )
if (this.state.isVisible != nextProps.show) { let {isVisible, currentDate, date_mode} = this.state
if (isVisible != nextProps.show) {
this.setState({ this.setState({
isVisible: nextProps.show isVisible: nextProps.show
}); });
} }
if (this.state.currentDate != nextProps.date) { if (currentDate != nextProps.date) {
this.setState({ this.setState({
currentDate: nextProps.date currentDate: nextProps.date
}); });
} }
if (date_mode != nextProps.date_mode) {
this.setState({
date_mode: nextProps.date_mode
})
}
} }
handleCloseModal() { handleCloseModal() {
...@@ -58,9 +66,22 @@ class DateModel extends Component { ...@@ -58,9 +66,22 @@ class DateModel extends Component {
subSure(date) { subSure(date) {
// console.warn('确认',date, date instanceof Date) // console.warn('确认',date, date instanceof Date)
let {date_mode} = this.state
if(date instanceof Date) { if(date instanceof Date) {
date = changeDateFormat(date, 'yyyy-MM-dd hh:mm') // date = changeDateFormat(date, 'yyyy-MM-dd hh:mm')
switch(date_mode) {
case 'datetime':
date = moment(date).format("YYYY-MM-DD HH:mm");
break;
case 'date':
date = moment(date).format("YYYY-MM-DD");
break;
default:
date = moment(date).format("YYYY-MM-DD HH:mm");
break;
}
} }
// console.warn('确认 ---callback',date)
this.props.callback(date) this.props.callback(date)
this.handleCloseModal() this.handleCloseModal()
} }
...@@ -76,8 +97,7 @@ class DateModel extends Component { ...@@ -76,8 +97,7 @@ class DateModel extends Component {
} }
renderDialog() { renderDialog() {
// let { entityList } = this.state let { currentDate, date_mode } = this.state
let { currentDate } = this.state
return ( return (
<View style={styles.opt_area}> <View style={styles.opt_area}>
<View style={styles.modal_style}> <View style={styles.modal_style}>
...@@ -103,7 +123,7 @@ class DateModel extends Component { ...@@ -103,7 +123,7 @@ class DateModel extends Component {
date={currentDate} date={currentDate}
onDateChange={(date) => this.currentDateChange(date)} onDateChange={(date) => this.currentDateChange(date)}
locale="zh" locale="zh"
mode="datetime" mode={date_mode}
// style={{height:100}} // style={{height:100}}
/> />
</View> </View>
......
This diff could not be displayed because it is too large.
...@@ -4,6 +4,7 @@ import login from './module/login'; ...@@ -4,6 +4,7 @@ import login from './module/login';
import quick from './module/quick'; import quick from './module/quick';
import selfOrder from './module/selfOrder'; import selfOrder from './module/selfOrder';
import equip from './module/equip'; import equip from './module/equip';
import histor from './module/histor';
const loginConfig = { const loginConfig = {
key: 'login', key: 'login',
...@@ -33,11 +34,19 @@ const equipConfig = { ...@@ -33,11 +34,19 @@ const equipConfig = {
blackList: [] blackList: []
} }
const historConfig = {
key: 'histor',
storage,
debug: false,
blackList: []
}
const rootReducer = { const rootReducer = {
login: persistReducer(loginConfig,login), login: persistReducer(loginConfig,login),
selfOrder: persistReducer(selfConfig,selfOrder), selfOrder: persistReducer(selfConfig,selfOrder),
quick: persistReducer(quickConfig,quick), quick: persistReducer(quickConfig,quick),
equip: persistReducer(equipConfig,equip), equip: persistReducer(equipConfig,equip),
histor: persistReducer(historConfig, histor),
} }
export default rootReducer; export default rootReducer;
\ No newline at end of file
import {
HISTOR_ORDER_SEARCH_NO,
HISTOR_ORDER_SEARCH_DOING,
HISTOR_ORDER_SEARCH_SUCCESS,
HISTOR_ORDER_SEARCH_FAILURE
} from '../../base/ActionTypes';
// 历史订单状态
const defaultState = {
histor_search_status: HISTOR_ORDER_SEARCH_NO, // 获取筛选状态
historOrderOption: [] // 历史订单头表筛选数据
}
export default histor = (state = defaultState, action) => {
switch (action.type) {
case HISTOR_ORDER_SEARCH_DOING:
return Object.assign({}, state, {
histor_search_status: HISTOR_ORDER_SEARCH_DOING
});
case HISTOR_ORDER_SEARCH_SUCCESS:
return Object.assign({}, state, {
histor_search_status: HISTOR_ORDER_SEARCH_SUCCESS,
historOrderOption: action.rawData
});
case HISTOR_ORDER_SEARCH_FAILURE:
return Object.assign({}, state, {
histor_search_status: HISTOR_ORDER_SEARCH_FAILURE,
historOrderOption: []
});
default:
return state;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment