Commit 41e40b76 by Denglingling

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

parent ff1d5203
......@@ -19,6 +19,7 @@ import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import TransOrderPage from './containers/transOrder/TransOrderPage';
import TransSearchPage from './containers/transOrder/module/TransSearchPage';
import HistoricalOrderPage from './containers/historicalOrder/HistoricalOrderPage';
import LineOrderPage from './containers/historicalOrder/module/LineOrderPage';
import SubSuccPage from './containers/common/SubSuccPage';
const Router = createAppContainer(createStackNavigator({
......@@ -35,6 +36,7 @@ const Router = createAppContainer(createStackNavigator({
TransOrderPage: {screen: TransOrderPage},
TransSearchPage: {screen: TransSearchPage},
HistoricalOrderPage: {screen: HistoricalOrderPage},
LineOrderPage: {screen: LineOrderPage},
SubSuccPage: {screen: SubSuccPage}
}, {
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 {
promary_color
} from '../../base/BaseStyle';
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 {
constructor(props) {
......@@ -26,22 +27,29 @@ class DateModel extends Component {
this.state = {
isVisible: this.props.show,
// entityList: this.props.entityList
currentDate: this.props.date
currentDate: this.props.date,
date_mode: 'datetime'
}
}
componentWillReceiveProps(nextProps) {
// 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({
isVisible: nextProps.show
});
}
if (this.state.currentDate != nextProps.date) {
if (currentDate != nextProps.date) {
this.setState({
currentDate: nextProps.date
});
}
if (date_mode != nextProps.date_mode) {
this.setState({
date_mode: nextProps.date_mode
})
}
}
handleCloseModal() {
......@@ -58,9 +66,22 @@ class DateModel extends Component {
subSure(date) {
// console.warn('确认',date, date instanceof Date)
let {date_mode} = this.state
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.handleCloseModal()
}
......@@ -76,8 +97,7 @@ class DateModel extends Component {
}
renderDialog() {
// let { entityList } = this.state
let { currentDate } = this.state
let { currentDate, date_mode } = this.state
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
......@@ -103,7 +123,7 @@ class DateModel extends Component {
date={currentDate}
onDateChange={(date) => this.currentDateChange(date)}
locale="zh"
mode="datetime"
mode={date_mode}
// style={{height:100}}
/>
</View>
......
This diff could not be displayed because it is too large.
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Image,
TouchableOpacity,
ScrollView,
SafeAreaView
} from 'react-native';
import {
promary_color,
safe_view,
list_common_item,
icon_style,
font_family_medium,
second_text_color,
font_family_regular,
third_text_size,
second_text_size,
home_background_color
} from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
import HeadBackItem from '../../common/HeadBackItem';
import { CellTextStyle } from '../../common/CellTextStyle';
import LodingModel from '../../common/LodingModel';
import {
requestGetLineFormBorrow,
requestGetLineFormConsume
} from '../../../action/HistorAction';
import { connect } from 'react-redux';
import { show } from '../../../utils/Utils';
import {
exitLoginStatus
} from '../../../action/LoginAction';
import { LOGIN_NO } from '../../../base/ActionTypes';
class LineOrderPage extends Component {
constructor(props) {
super(props);
this.state = {
isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中',
consumaData: {
isShowSub: true, // 展开耗材
subOption: [
// {
// "id": "0",
// item_name: '人工髋关节假体-JS-HB ||| T',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "1",
// item_name: '人工髋关节假体-JS-HB ||| T2',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "2",
// item_name: '人工髋关节假体-JS-HB ||| T3',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "3",
// item_name: '人工髋关节假体-JS-HB ||| T4',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// },{
// "id": "4",
// item_name: '人工髋关节假体-JS-HB ||| T5',
// specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774'
// }
]
},
supOptions: {}, // 获取主表数据
}
}
componentDidMount() {
this.getLineOptionData()
}
componentWillReceiveProps(nextProps) {
let {loginState, navigation} = this.props
if(loginState != nextProps.loginState) {
switch(nextProps.loginState) {
case LOGIN_NO:
navigation.navigate('LoginPage')
break;
default:
break;
}
}
}
// 修改正在加载
changeSubLoding(loading, loadTit) {
this.setState({
isSubLoding: loading || false,
lodingTitle: loadTit || '加载中'
})
}
// 获取行订单数据
getLineOptionData() {
let {supIndex, data} = this.props.navigation.state.params
this.setState({
supOptions: data
})
console.log('supIndex-----', supIndex)
switch(supIndex) {
case 0:
// 借货
this.getReqBorrowLineData(data)
break;
case 1:
// 消耗
this.getReqConsumeLineData(data)
break;
case 2:
// 转单
break;
default:
break;
}
}
// 获取借货订单行数据
async getReqBorrowLineData(supData) {
let that = this
let {consumaData} = that.state
let {props} = this
that.changeSubLoding(true)
let params = {
access_token: props.token,
surgery_collect_number: supData.local_his_number
}
let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params)
if(bowResult.error_code == 0) {
that.changeSubLoding(false)
// 成功
let {surgery_collect_lines} = bowResult.data
consumaData.subOption = [...surgery_collect_lines]
that.setState({
consumaData
})
} else if(bowResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = bowResult.error_msg || bowResult.message
show(error_msg);
}
}
// 获取消耗订单行数据
async getReqConsumeLineData(supData) {
let that = this
let {consumaData} = that.state
let {props} = this
that.changeSubLoding(true)
let params = {
access_token: props.token,
consume_order_number: supData.local_his_number
}
let conResult = await requestGetLineFormConsume(props.global_domain_config, params)
if(conResult.error_code == 0) {
that.changeSubLoding(false)
// 成功
let {sur_consume_lines} = conResult.data
consumaData.subOption = [...sur_consume_lines]
that.setState({
consumaData
})
} else if(conResult.error_code == 41006) {
that.changeSubLoding(false)
show('登录过期,请重新登录');
props.exitLoginStatus();
} else {
that.changeSubLoding(false)
let error_msg = conResult.error_msg || conResult.message
show(error_msg);
}
}
// 耗材明细 隐藏/显示子项
handleDetailBtmCheck(flagType) {
let {consumaData} = this.state
consumaData.isShowSub = flagType
this.setState({
consumaData
})
}
// 返回耗材内容
renderConsumablesItem() {
let { state } = this
return (
<CellTextStyle style={list_common_item.consu_detail}>
<View style={list_common_item.detail_inner}>
{
state.consumaData.subOption.length ?
<View style={list_common_item.detail_sub_cont}>
<View style={list_common_item.detail_sub_tit}>
<Text style={list_common_item.detail_tit_text}>
耗材({state.consumaData.subOption.length}
</Text>
{
state.consumaData.isShowSub ?
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.detail_icon}
onPress={() => this.handleDetailBtmCheck(false)}
>
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_btm.png')} />
</TouchableOpacity> :
<TouchableOpacity
activeOpacity={.8}
style={[list_common_item.detail_icon, list_common_item.detail_icon_rig]}
onPress={() => this.handleDetailBtmCheck(true)}
>
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_rig.png')} />
</TouchableOpacity>
}
</View>
{
state.consumaData.isShowSub ?
<View style={list_common_item.detail_sub_inner}>
{
state.consumaData.subOption.map((item, index) => {
return this.renderConDeSubItem(item, index)
})
}
</View> : null
}
</View> : null
}
</View>
</CellTextStyle>
)
}
// 返回耗材明细子项
renderConDeSubItem(item, index) {
return(
<View style={list_common_item.con_de_sub} key={index}>
<Text style={list_common_item.de_sub_tit}>
{index+1}{ item.item_name } - {item.specification}
</Text>
{
item.serial_number ?
<Text style={list_common_item.de_tip}>
序列号:{ item.serial_number }
</Text>
: null
}
{
item.item_code ?
<Text style={list_common_item.de_tip}>
物料代码:{ item.item_code }
</Text>
: null
}
</View>
)
}
// 返回主要内容
renderContItem() {
let {supOptions} = this.state
let {supIndex} = this.props.navigation.state.params
let tempTit = []
if(supIndex == 0) {
tempTit.push('手术名称:', '手术时间:')
} else if(supIndex == 1) {
tempTit.push('结单标识:', '消耗时间:')
}
return (
<ScrollView style={styles.line_cont_scroll}>
<View style={styles.line_cont}>
<Text style={styles.cont_tip_tit}>订单详情</Text>
{ this.renderConsumablesItem() }
<View style={styles.line_footer}>
<View style={styles.fo_cont_inner}>
<View style={styles.fo_tit_box}>
<Text style={styles.fo_txt}>
备注:{supOptions.surgery_desc ? supOptions.surgery_desc : '无'}
</Text>
</View>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
{tempTit[0]}{supOptions.local_his_name}
</Text>
</View>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
手术医生:{supOptions.doctor_name ? supOptions.doctor_name : '无'}
</Text>
</View>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
{tempTit[1]}{supOptions.local_his_time}
</Text>
</View>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
客户名称:{supOptions.customer_name ? supOptions.customer_name : '无'}
</Text>
</View>
<View style={styles.fo_cell_box}>
<Text style={styles.fo_tip_txt}>
订单号:{supOptions.local_his_number}
</Text>
</View>
</View>
<View style={styles.fo_sta_inner}>
<Text style={[
styles.fo_sta_txt,
supOptions.local_his_status == '待审核' ? styles.status_audit : '',
supOptions.local_his_status == '待还货' ? styles.status_return : '',
supOptions.local_his_status == '其他' ? styles.status_other : ''
]}>
{supOptions.local_his_status}
</Text>
</View>
</View>
</View>
</ScrollView>
)
}
// 返回正在加载中
renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state
return(
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
}
render() {
let {navigation} = this.props
let {title} = navigation.state.params
return (
<View style={styles.line_container}>
<StatusBarView
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.line_main}>
{ this.renderContItem() }
{this.renderLodingItem()}
</View>
</SafeAreaView>
</View>
);
}
}
const styles = StyleSheet.create({
line_container: {
flex: 1,
backgroundColor: home_background_color,
padding: 0,
margin: 0
},
line_main: {
flex: 1
},
loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)'
},
line_cont_scroll: {},
line_cont: {
paddingHorizontal: 20,
paddingVertical: 16,
paddingBottom: 20
},
cont_tip_tit: {
fontSize: 14,
fontFamily: font_family_medium,
color: second_text_color
},
line_footer: {},
fo_cont_inner: {
borderBottomWidth: 1,
borderBottomColor: '#CCCCCC',
paddingBottom: 18
},
fo_tit_box: {
paddingBottom: 12
},
fo_txt: {
fontSize: 14,
fontFamily: font_family_regular,
color: second_text_color
},
fo_cell_box: {},
fo_tip_txt: {
fontSize: third_text_size,
fontFamily: font_family_regular,
color: second_text_color,
lineHeight: 18
},
fo_sta_inner: {
paddingTop: 12,
alignItems: 'flex-end'
},
fo_sta_txt: {
fontSize: second_text_size,
fontFamily: font_family_medium,
color: '#01B2B9'
},
status_audit: {
color: '#FF0000'
},
status_return: {
color: '#007EFF'
},
status_other: {
color: '#F4B61B'
},
})
const mapStateToProps = (state) => {
return {
token: state.login.token,
loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config
}
}
const mapDispatchToProps = (dispatch) => {
return {
exitLoginStatus: () => {
dispatch(exitLoginStatus())
},
}
}
export default connect(mapStateToProps, mapDispatchToProps)(LineOrderPage);
\ No newline at end of file
......@@ -4,6 +4,7 @@ import login from './module/login';
import quick from './module/quick';
import selfOrder from './module/selfOrder';
import equip from './module/equip';
import histor from './module/histor';
const loginConfig = {
key: 'login',
......@@ -33,11 +34,19 @@ const equipConfig = {
blackList: []
}
const historConfig = {
key: 'histor',
storage,
debug: false,
blackList: []
}
const rootReducer = {
login: persistReducer(loginConfig,login),
selfOrder: persistReducer(selfConfig,selfOrder),
quick: persistReducer(quickConfig,quick),
equip: persistReducer(equipConfig,equip),
histor: persistReducer(historConfig, histor),
}
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