Commit 6da86323 by peii

style: 代码格式化

parent 5f6a58ca
import React, { Component } from 'react'; import React, { Component } from 'react'
import { import { View, Text, StyleSheet, Image, TouchableOpacity, ScrollView } from 'react-native'
View,
Text,
StyleSheet,
Image,
TouchableOpacity,
ScrollView,
} from 'react-native';
import { import {
promary_color, promary_color,
icon_style, icon_style,
...@@ -22,28 +15,24 @@ import { ...@@ -22,28 +15,24 @@ import {
second_text_size, second_text_size,
Height, Height,
pxHeight, pxHeight,
} from '../../base/BaseStyle'; } from '../../base/BaseStyle'
import LodingModel from '../common/LodingModel'; import LodingModel from '../common/LodingModel'
import { connect } from 'react-redux'; import { connect } from 'react-redux'
import { exitLoginStatus } from '../../action/LoginAction'; import { exitLoginStatus } from '../../action/LoginAction'
import { import {
LOGIN_NO, LOGIN_NO,
HISTOR_ORDER_SEARCH_DOING, HISTOR_ORDER_SEARCH_DOING,
HISTOR_ORDER_SEARCH_SUCCESS, HISTOR_ORDER_SEARCH_SUCCESS,
HISTOR_ORDER_SEARCH_FAILURE HISTOR_ORDER_SEARCH_FAILURE,
} from '../../base/ActionTypes'; } from '../../base/ActionTypes'
import { import { requestGetAllBorrow, requestGetAllConsume, requestGetAllTrans } from '../../action/HistorAction'
requestGetAllBorrow, import { show, cloneObject, dedupQuoteArray } from '../../utils/Utils'
requestGetAllConsume, import moment from 'moment'
requestGetAllTrans, import FilterModel from './module/FilterModel'
} from '../../action/HistorAction';
import { show, cloneObject, dedupQuoteArray } from '../../utils/Utils';
import moment from 'moment';
import FilterModel from './module/FilterModel';
class HistoricalOrderPage extends Component { class HistoricalOrderPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
searchValue: '', searchValue: '',
isSubLoding: false, // 加载中弹窗 isSubLoding: false, // 加载中弹窗
...@@ -51,16 +40,16 @@ class HistoricalOrderPage extends Component { ...@@ -51,16 +40,16 @@ class HistoricalOrderPage extends Component {
topProcOptionList: [ topProcOptionList: [
{ {
title: '借货订单', title: '借货订单',
selIsAct: false selIsAct: false,
}, },
{ {
title: '消耗订单', title: '消耗订单',
selIsAct: false selIsAct: false,
}, },
{ {
title: '转单订单', title: '转单订单',
selIsAct: false selIsAct: false,
} },
], ],
topActiveIndex: 0, topActiveIndex: 0,
contOptionData: [ contOptionData: [
...@@ -72,25 +61,31 @@ class HistoricalOrderPage extends Component { ...@@ -72,25 +61,31 @@ class HistoricalOrderPage extends Component {
// } // }
], ],
isShowSelect: false, // 显示/隐藏 筛选内容 isShowSelect: false, // 显示/隐藏 筛选内容
borrowStatus: ['待审核','待出库','待还货','其他'], borrowStatus: ['待审核', '待出库', '待还货', '其他'],
consumeStatus: ['待确认消耗','已确认消耗'], consumeStatus: ['待确认消耗', '已确认消耗'],
transferStatus: ['已输入', '已审批', '已驳回', '已提交', '已取消'], transferStatus: ['已输入', '已审批', '已驳回', '已提交', '已取消'],
searchBorrowStatus: [ // 【借货】对应的状态值 searchBorrowStatus: [
"ENTERED,SUBMITTED", // 【借货】对应的状态值
"APPROVED,COLLECTING_WAITING_CONFIRM", 'ENTERED,SUBMITTED',
"COLLECTED,RETURNING_WAITING_CONFIRM", 'APPROVED,COLLECTING_WAITING_CONFIRM',
"RETURNED,CLOSED,REJECTED,CANCELED,CONSUMED,APPROVING,RETURNED_WAITING_CONFIRMED,COLLECTED_WAITING_CONFIRMED,REVOKED,CONFIRM_COLLECT" 'COLLECTED,RETURNING_WAITING_CONFIRM',
'RETURNED,CLOSED,REJECTED,CANCELED,CONSUMED,APPROVING,RETURNED_WAITING_CONFIRMED,COLLECTED_WAITING_CONFIRMED,REVOKED,CONFIRM_COLLECT',
], ],
searchComsumeStatus: [ // 【消耗】对应的状态值 searchComsumeStatus: [
"N", // 【消耗】对应的状态值
"Y" 'N',
'Y',
], ],
searchTransStatus: [ // 【转单】对应的状态值 searchTransStatus: [
"ENTERED", "APPROVED", "REJECTED", "SUBMITTED", "CANCELED" // 【转单】对应的状态值
'ENTERED',
'APPROVED',
'REJECTED',
'SUBMITTED',
'CANCELED',
], ],
whetherCallClick: false, // 是否调用筛选弹窗的查询 whetherCallClick: false, // 是否调用筛选弹窗的查询
wheShowNoData: false, // 是否展示无数据提示 wheShowNoData: false, // 是否展示无数据提示
} }
} }
...@@ -99,38 +94,41 @@ class HistoricalOrderPage extends Component { ...@@ -99,38 +94,41 @@ class HistoricalOrderPage extends Component {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let {loginState, navigation, histor_search_status} = this.props; let { loginState, navigation, histor_search_status } = this.props
let that = this let that = this
if(loginState != nextProps.loginState) { if (loginState != nextProps.loginState) {
switch(nextProps.loginState) { switch (nextProps.loginState) {
case LOGIN_NO: case LOGIN_NO:
navigation.navigate('LoginPage') navigation.navigate('LoginPage')
break; break
default: default:
break; break
} }
} }
if(histor_search_status != nextProps.histor_search_status) { if (histor_search_status != nextProps.histor_search_status) {
switch (nextProps.histor_search_status) { switch (nextProps.histor_search_status) {
case HISTOR_ORDER_SEARCH_DOING: case HISTOR_ORDER_SEARCH_DOING:
that.changeSubLoding(true, '查询中') that.changeSubLoding(true, '查询中')
break; break
case HISTOR_ORDER_SEARCH_SUCCESS: case HISTOR_ORDER_SEARCH_SUCCESS:
// 解决 IOS 加载弹窗消失慢 // 解决 IOS 加载弹窗消失慢
setTimeout(() => { setTimeout(() => {
that.setState({ that.setState(
isSubLoding: false {
},() => { isSubLoding: false,
that.changeCurrentOption(); },
}) () => {
that.changeCurrentOption()
},
)
}, 500) }, 500)
break; break
case HISTOR_ORDER_SEARCH_FAILURE: case HISTOR_ORDER_SEARCH_FAILURE:
that.changeSubLoding(false) that.changeSubLoding(false)
break; break
default: default:
break; break
} }
} }
} }
...@@ -138,94 +136,98 @@ class HistoricalOrderPage extends Component { ...@@ -138,94 +136,98 @@ class HistoricalOrderPage extends Component {
// 修改当前显示的查询数据 // 修改当前显示的查询数据
changeCurrentOption() { changeCurrentOption() {
let { let {
contOptionData, topActiveIndex, contOptionData,
borrowStatus, consumeStatus, topActiveIndex,
searchBorrowStatus, searchComsumeStatus, borrowStatus,
transferStatus, searchTransStatus consumeStatus,
searchBorrowStatus,
searchComsumeStatus,
transferStatus,
searchTransStatus,
} = this.state } = this.state
let {historOrderOption} = this.props let { historOrderOption } = this.props
if(!historOrderOption.length) { if (!historOrderOption.length) {
show('当前查询数据为空') show('当前查询数据为空')
this.setState({ this.setState({
wheShowNoData: true wheShowNoData: true,
}) })
return return
} }
contOptionData = cloneObject(historOrderOption) contOptionData = cloneObject(historOrderOption)
switch(topActiveIndex) { switch (topActiveIndex) {
case 0: case 0:
contOptionData = contOptionData.map((supItem, ind) => { contOptionData = contOptionData.map((supItem, ind) => {
supItem.id = ind+'' supItem.id = ind + ''
supItem.local_his_number = supItem.collect_number supItem.local_his_number = supItem.collect_number
if(!supItem.surgery_name) { if (!supItem.surgery_name) {
supItem.local_his_name = '无' supItem.local_his_name = '无'
} else { } else {
supItem.local_his_name = supItem.surgery_name supItem.local_his_name = supItem.surgery_name
} }
if(!supItem.surgery_date) { if (!supItem.surgery_date) {
supItem.local_his_time = '无' supItem.local_his_time = '无'
} else { } else {
supItem.local_his_time = moment(supItem.surgery_date).format('YYYY/MM/DD HH:mm') supItem.local_his_time = moment(supItem.surgery_date).format('YYYY/MM/DD HH:mm')
} }
for(let i in searchBorrowStatus) { for (let i in searchBorrowStatus) {
if(searchBorrowStatus[i].includes(supItem.header_status)) { if (searchBorrowStatus[i].includes(supItem.header_status)) {
supItem.local_his_status = borrowStatus[i] supItem.local_his_status = borrowStatus[i]
break; break
} }
} }
return supItem return supItem
}) })
break; break
case 1: case 1:
contOptionData = contOptionData.map((supItem, ind) => { contOptionData = contOptionData.map((supItem, ind) => {
supItem.id = ind+'' supItem.id = ind + ''
supItem.local_his_number = supItem.consume_order_number supItem.local_his_number = supItem.consume_order_number
if(supItem.settled_flag == 'Y') { if (supItem.settled_flag == 'Y') {
supItem.local_his_name = '是' supItem.local_his_name = '是'
} else { } else {
supItem.local_his_name = '否' supItem.local_his_name = '否'
} }
if(!supItem.consume_date) { if (!supItem.consume_date) {
supItem.local_his_time = '无' supItem.local_his_time = '无'
} else { } else {
supItem.local_his_time = moment(supItem.consume_date).format('YYYY/MM/DD HH:mm') supItem.local_his_time = moment(supItem.consume_date).format('YYYY/MM/DD HH:mm')
} }
if(supItem.error_code == 0) { if (supItem.error_code == 0) {
supItem.local_his_status = consumeStatus[1] supItem.local_his_status = consumeStatus[1]
} else { } else {
supItem.local_his_status = consumeStatus[0] supItem.local_his_status = consumeStatus[0]
} }
return supItem return supItem
}) })
break; break
case 2: case 2:
contOptionData = contOptionData.map((supItem, ind) => { contOptionData = contOptionData.map((supItem, ind) => {
supItem.id = ind+'' supItem.id = ind + ''
supItem.local_his_number = supItem.order_number supItem.local_his_number = supItem.order_number
if(!supItem.destination_surgery_collect_number) { if (!supItem.destination_surgery_collect_number) {
supItem.local_his_name = '无' supItem.local_his_name = '无'
} else { } else {
supItem.local_his_name = supItem.destination_surgery_collect_number supItem.local_his_name = supItem.destination_surgery_collect_number
} }
if(!supItem.destination_surgery_date) { if (!supItem.destination_surgery_date) {
supItem.local_his_time = '无' supItem.local_his_time = '无'
} else { } else {
supItem.local_his_time = moment(supItem.destination_surgery_date).format('YYYY/MM/DD HH:mm') supItem.local_his_time = moment(supItem.destination_surgery_date).format('YYYY/MM/DD HH:mm')
} }
for(let i in searchTransStatus) { for (let i in searchTransStatus) {
if(searchTransStatus[i].includes(supItem.header_status)) { if (searchTransStatus[i].includes(supItem.header_status)) {
supItem.local_his_status = transferStatus[i] supItem.local_his_status = transferStatus[i]
break; break
} }
} }
return supItem return supItem
}) })
break; break
default: default:
break; break
} }
this.setState({ this.setState({
contOptionData contOptionData,
}) })
} }
...@@ -233,84 +235,87 @@ class HistoricalOrderPage extends Component { ...@@ -233,84 +235,87 @@ class HistoricalOrderPage extends Component {
changeSubLoding(loading, loadTit) { changeSubLoding(loading, loadTit) {
this.setState({ this.setState({
isSubLoding: loading || false, isSubLoding: loading || false,
lodingTitle: loadTit || '' lodingTitle: loadTit || '',
}) })
} }
// 筛选回调 - 确定 // 筛选回调 - 确定
handleSureSubmit(params) { handleSureSubmit(params) {
let {topActiveIndex} = this.state let { topActiveIndex } = this.state
let {props} = this let { props } = this
// 初始化调用子组件查询 // 初始化调用子组件查询
this.setState({ this.setState({
whetherCallClick: false, // 初始化 whetherCallClick: false, // 初始化
contOptionData: [], // 清空查询数据 contOptionData: [], // 清空查询数据
wheShowNoData: false // 默认不展示 wheShowNoData: false, // 默认不展示
}) })
switch(topActiveIndex) { switch (topActiveIndex) {
case 0: case 0:
props.requestGetAllBorrow(params) props.requestGetAllBorrow(params)
break; break
case 1: case 1:
props.requestGetAllConsume(params) props.requestGetAllConsume(params)
break; break
case 2: case 2:
props.requestGetAllTrans(params) props.requestGetAllTrans(params)
break; break
default: default:
break; break
} }
} }
// 点击顶部菜单 // 点击顶部菜单
handleTopNav(index) { handleTopNav(index) {
let that = this let that = this
let {isShowSelect} = that.state let { isShowSelect } = that.state
that.setState({ that.setState(
topActiveIndex: index {
}, () => { topActiveIndex: index,
},
() => {
// 如果打开打开筛选弹窗,先关闭 // 如果打开打开筛选弹窗,先关闭
if(isShowSelect) { if (isShowSelect) {
this.setState({ this.setState({
isShowSelect: false isShowSelect: false,
}) })
} }
// 切换标签,调用子组件查询 // 切换标签,调用子组件查询
that.setState({ that.setState({
whetherCallClick: true whetherCallClick: true,
})
}) })
},
)
} }
// 点击筛选 // 点击筛选
handleSelectClick() { handleSelectClick() {
let {isShowSelect} = this.state let { isShowSelect } = this.state
this.setState({ this.setState({
isShowSelect: !isShowSelect isShowSelect: !isShowSelect,
}) })
} }
// 关闭筛选弹窗 回调 // 关闭筛选弹窗 回调
handleCloseFilterModal(show) { handleCloseFilterModal(show) {
this.setState({ this.setState({
isShowSelect: show isShowSelect: show,
}) })
} }
// 跳转到行页面 // 跳转到行页面
openLinePage(item) { openLinePage(item) {
let {topActiveIndex} = this.state let { topActiveIndex } = this.state
let {navigation} = this.props let { navigation } = this.props
let originalItem = item let originalItem = item
if(originalItem.order_number && originalItem.order_number.includes('(')) { if (originalItem.order_number && originalItem.order_number.includes('(')) {
originalItem.order_number = originalItem.order_number.split('(')[0] originalItem.order_number = originalItem.order_number.split('(')[0]
} }
if(navigation.navigate) { if (navigation.navigate) {
navigation.navigate('LineOrderPage',{ navigation.navigate('LineOrderPage', {
title: item.local_his_number, title: item.local_his_number,
supIndex: topActiveIndex, supIndex: topActiveIndex,
data: originalItem data: originalItem,
}) })
} }
} }
...@@ -318,62 +323,47 @@ class HistoricalOrderPage extends Component { ...@@ -318,62 +323,47 @@ class HistoricalOrderPage extends Component {
// 修改顶部筛选 // 修改顶部筛选
handleChangeTopList(data) { handleChangeTopList(data) {
this.setState({ this.setState({
topProcOptionList: data topProcOptionList: data,
}) })
} }
// 返回中间主要内容 // 返回中间主要内容
renderContItem() { renderContItem() {
let { let { whetherCallClick, topProcOptionList, topActiveIndex, contOptionData, isShowSelect, wheShowNoData } =
whetherCallClick, this.state
topProcOptionList, return (
topActiveIndex,
contOptionData,
isShowSelect,
wheShowNoData
} = this.state
return(
<View style={styles.cont_item_box}> <View style={styles.cont_item_box}>
<View style={styles.top_box}> <View style={styles.top_box}>
<View style={styles.top_tab_cont}> <View style={styles.top_tab_cont}>
{ {topProcOptionList.map((item, index) => (
topProcOptionList.map((item, index) =>
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
style={styles.top_touch_cont} style={styles.top_touch_cont}
onPress={() => this.handleTopNav(index)} onPress={() => this.handleTopNav(index)}
key={index} key={index}
> >
<View style={[ <View style={[styles.top_inner, index == topActiveIndex ? styles.top_inner_act : '']}>
styles.top_inner, <Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>{item.title}</Text>
index == topActiveIndex ? styles.top_inner_act : ''
]}>
<Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>
{item.title}
</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) ))}
}
</View> </View>
<View style={styles.top_sea_box}> <View style={styles.top_sea_box}>
<TouchableOpacity <TouchableOpacity activeOpacity={0.8} style={styles.sea_inner} onPress={() => this.handleSelectClick()}>
activeOpacity={.8} <Text
style={styles.sea_inner} style={[
onPress={() => this.handleSelectClick()}
>
<Text style={[
styles.sea_tit, styles.sea_tit,
topProcOptionList.length && topProcOptionList[topActiveIndex].selIsAct ? styles.sea_tit_act : '' topProcOptionList.length && topProcOptionList[topActiveIndex].selIsAct ? styles.sea_tit_act : '',
]}> ]}
>
筛选 筛选
</Text> </Text>
<View style={styles.sea_icon}> <View style={styles.sea_icon}>
{ {isShowSelect ? (
isShowSelect ?
<Image source={require('../../images/arr_top.png')} style={icon_style} /> <Image source={require('../../images/arr_top.png')} style={icon_style} />
: <Image source={require('../../images/arr_bom.png')} style={icon_style} /> ) : (
} <Image source={require('../../images/arr_bom.png')} style={icon_style} />
)}
</View> </View>
</TouchableOpacity> </TouchableOpacity>
{/* 筛选弹窗 */} {/* 筛选弹窗 */}
...@@ -382,96 +372,70 @@ class HistoricalOrderPage extends Component { ...@@ -382,96 +372,70 @@ class HistoricalOrderPage extends Component {
navigation={this.props.navigation} navigation={this.props.navigation}
topProcOptionList={topProcOptionList} topProcOptionList={topProcOptionList}
topActiveIndex={topActiveIndex} topActiveIndex={topActiveIndex}
closeModal={(show) => this.handleCloseFilterModal(show)} closeModal={show => this.handleCloseFilterModal(show)}
callSupLoading={(loading, loadTit) => this.changeSubLoding(loading, loadTit)} callSupLoading={(loading, loadTit) => this.changeSubLoding(loading, loadTit)}
callChangeTopNav={(index) => this.handleTopNav(index)} callChangeTopNav={index => this.handleTopNav(index)}
callSupSubmit={(params) => this.handleSureSubmit(params)} callSupSubmit={params => this.handleSureSubmit(params)}
callSupClick={whetherCallClick} callSupClick={whetherCallClick}
callSupTopList={(data) => this.handleChangeTopList(data) } callSupTopList={data => this.handleChangeTopList(data)}
/> />
</View> </View>
</View> </View>
{/* 底部筛选数据 */} {/* 底部筛选数据 */}
<View style={styles.cont_main}> <View style={styles.cont_main}>
<ScrollView <ScrollView style={styles.cont_scroll}>
style={styles.cont_scroll}
>
{/* 查询为空数据时 */} {/* 查询为空数据时 */}
{ {wheShowNoData ? (
wheShowNoData ?
<View style={styles.cont_list_item}> <View style={styles.cont_list_item}>
<TouchableOpacity <TouchableOpacity activeOpacity={1} style={styles.cont_no_list_box}>
activeOpacity={1}
style={styles.cont_no_list_box}
>
<Text style={styles.cont_no_data}>依当前条件未查询到数据</Text> <Text style={styles.cont_no_data}>依当前条件未查询到数据</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
: null ) : null}
}
{/* 底部每一列数据 */} {/* 底部每一列数据 */}
{ {contOptionData.map((item, index) => this.renderSubListItem(item, index))}
contOptionData.map((item, index) =>
this.renderSubListItem(item, index)
)
}
</ScrollView> </ScrollView>
</View> </View>
</View> </View>
) )
} }
// 返回每一列数据 // 返回每一列数据
renderSubListItem(item, index) { renderSubListItem(item, index) {
let {topActiveIndex} = this.state let { topActiveIndex } = this.state
let tempTit = '' let tempTit = ''
let tempNum = '' let tempNum = ''
if(topActiveIndex == 0) { if (topActiveIndex == 0) {
tempTit = '手术名称:' tempTit = '手术名称:'
tempNum = item.local_his_number tempNum = item.local_his_number
} else if(topActiveIndex == 1) { } else if (topActiveIndex == 1) {
tempTit = '结单标识:' tempTit = '结单标识:'
tempNum = item.surgery_collect_number // 还是显示借货单号,但是接口还是传递消耗单号 tempNum = item.surgery_collect_number // 还是显示借货单号,但是接口还是传递消耗单号
}else if(topActiveIndex == 2) { } else if (topActiveIndex == 2) {
tempTit = '目标借货订单号:' tempTit = '目标借货订单号:'
tempNum = item.local_his_number tempNum = item.local_his_number
} }
return ( return (
<View style={styles.cont_list_item} key={index}> <View style={styles.cont_list_item} key={index}>
<TouchableOpacity <TouchableOpacity activeOpacity={0.7} style={styles.cont_list_box} onPress={() => this.openLinePage(item)}>
activeOpacity={.7}
style={styles.cont_list_box}
onPress={() => this.openLinePage(item)}
>
<View style={styles.cont_lef}> <View style={styles.cont_lef}>
<Text style={styles.cont_lef_tit}> <Text style={styles.cont_lef_tit}>{tempNum}</Text>
{tempNum}
</Text>
<Text style={styles.cont_tip}> <Text style={styles.cont_tip}>
{tempTit}{item.local_his_name} {tempTit}
{item.local_his_name}
</Text> </Text>
<Text style={styles.cont_tip}> <Text style={styles.cont_tip}>{item.local_his_time}</Text>
{item.local_his_time} {topActiveIndex == 2 ? (
</Text> <Text style={styles.cont_tip}>来源借货订单号:{item.source_surgery_order_number}</Text>
{ ) : null}
topActiveIndex == 2 ? {topActiveIndex == 2 ? (
<Text style={styles.cont_tip}>
来源借货订单号:{item.source_surgery_order_number}
</Text> : null
}
{
topActiveIndex == 2 ?
<Text style={styles.cont_tip}> <Text style={styles.cont_tip}>
{item.source_surgery_date ? moment(item.source_surgery_date).format('YYYY/MM/DD HH:mm') : '无'} {item.source_surgery_date ? moment(item.source_surgery_date).format('YYYY/MM/DD HH:mm') : '无'}
</Text> : null
}
<Text style={styles.cont_tip}>
备注:{item.remark || '——'}
</Text> </Text>
) : null}
<Text style={styles.cont_tip}>备注:{item.remark || '——'}</Text>
</View> </View>
<View style={styles.cont_rig}> <View style={styles.cont_rig}>
<Text <Text
...@@ -479,8 +443,9 @@ class HistoricalOrderPage extends Component { ...@@ -479,8 +443,9 @@ class HistoricalOrderPage extends Component {
styles.cont_rig_status, styles.cont_rig_status,
['待审核', '已提交', '待确认消耗'].includes(item.local_his_status) && styles.status_audit, ['待审核', '已提交', '待确认消耗'].includes(item.local_his_status) && styles.status_audit,
['待还货', '已输入', '已驳回', '已确认消耗'].includes(item.local_his_status) && styles.status_return, ['待还货', '已输入', '已驳回', '已确认消耗'].includes(item.local_his_status) && styles.status_return,
['其他', '已取消'].includes(item.local_his_status) && styles.status_other ['其他', '已取消'].includes(item.local_his_status) && styles.status_other,
]}> ]}
>
{item.local_his_status} {item.local_his_status}
</Text> </Text>
</View> </View>
...@@ -492,18 +457,16 @@ class HistoricalOrderPage extends Component { ...@@ -492,18 +457,16 @@ class HistoricalOrderPage extends Component {
// 返回正在加载中 // 返回正在加载中
renderLodingItem() { renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state let { lodingTitle, isSubLoding } = this.state
return( return <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
} }
render() { render() {
return ( return (
<View style={styles.hist_main}> <View style={styles.hist_main}>
{ this.renderContItem() } {this.renderContItem()}
{this.renderLodingItem()} {this.renderLodingItem()}
</View> </View>
); )
} }
} }
...@@ -512,29 +475,28 @@ const styles = StyleSheet.create({ ...@@ -512,29 +475,28 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
backgroundColor: home_background_color, backgroundColor: home_background_color,
padding: 0, padding: 0,
margin: 0 margin: 0,
}, },
hist_main: { hist_main: {
flex: 1 flex: 1,
}, },
loding_back: { loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)' backgroundColor: 'rgba(0, 0, 0, 0)',
},
cont_item_box: {
}, },
cont_item_box: {},
top_box: {}, top_box: {},
top_tab_cont: { top_tab_cont: {
flexDirection: 'row', flexDirection: 'row',
backgroundColor: foundation_color, backgroundColor: foundation_color,
justifyContent: 'space-between' justifyContent: 'space-between',
}, },
top_scroll_cont: { top_scroll_cont: {
paddingBottom: 4, paddingBottom: 4,
borderBottomColor: '#DEDBDB', borderBottomColor: '#DEDBDB',
borderBottomWidth: 1 borderBottomWidth: 1,
}, },
top_touch_cont: { top_touch_cont: {
width: '33.33333%' // 三个 width: '33.33333%', // 三个
// width: '50%' // width: '50%'
}, },
top_inner: { top_inner: {
...@@ -547,17 +509,17 @@ const styles = StyleSheet.create({ ...@@ -547,17 +509,17 @@ const styles = StyleSheet.create({
}, },
top_inner_act: { top_inner_act: {
borderBottomWidth: 2, borderBottomWidth: 2,
borderBottomColor: promary_color borderBottomColor: promary_color,
}, },
top_tit: { top_tit: {
paddingTop: 16, paddingTop: 16,
paddingBottom: 12, paddingBottom: 12,
color: second_text_color, color: second_text_color,
fontSize: 14 fontSize: 14,
}, },
top_tit_act: { top_tit_act: {
color: first_text_color, color: first_text_color,
fontWeight: 'bold' fontWeight: 'bold',
}, },
top_sea_box: { top_sea_box: {
paddingVertical: 14, paddingVertical: 14,
...@@ -573,22 +535,22 @@ const styles = StyleSheet.create({ ...@@ -573,22 +535,22 @@ const styles = StyleSheet.create({
sea_tit: { sea_tit: {
fontSize: 14, fontSize: 14,
color: second_text_color, color: second_text_color,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
sea_tit_act: { sea_tit_act: {
color: '#007EFF' color: '#007EFF',
}, },
sea_icon: { sea_icon: {
width: pxSize(8), width: pxSize(8),
height: pxSize(8), height: pxSize(8),
marginLeft: 4 marginLeft: 4,
}, },
cont_main: { cont_main: {
backgroundColor: foundation_color, backgroundColor: foundation_color,
maxHeight: Height() - 240, maxHeight: Height() - 240,
minHeight: Height() - 358, minHeight: Height() - 358,
paddingBottom: pxHeight(60) paddingBottom: pxHeight(60),
}, },
cont_scroll: {}, cont_scroll: {},
cont_box: {}, cont_box: {},
...@@ -596,84 +558,84 @@ const styles = StyleSheet.create({ ...@@ -596,84 +558,84 @@ const styles = StyleSheet.create({
cont_list_item: { cont_list_item: {
marginTop: 14, marginTop: 14,
marginHorizontal: 20, marginHorizontal: 20,
borderBottomWidth: .5, borderBottomWidth: 0.5,
borderBottomColor: '#EEEEEE', borderBottomColor: '#EEEEEE',
paddingBottom: 16 paddingBottom: 16,
}, },
cont_list_box: { cont_list_box: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center' alignItems: 'center',
}, },
cont_lef: { cont_lef: {
maxWidth: '80%' maxWidth: '80%',
}, },
cont_lef_tit: { cont_lef_tit: {
color: promary_text_color, color: promary_text_color,
fontSize: 18, fontSize: 18,
fontFamily: font_family_medium fontFamily: font_family_medium,
}, },
cont_tip: { cont_tip: {
fontSize: 12, fontSize: 12,
color: third_text_color, color: third_text_color,
fontFamily: font_family_regular, fontFamily: font_family_regular,
lineHeight: 20 lineHeight: 20,
}, },
cont_rig: { cont_rig: {
justifyContent: 'flex-end' justifyContent: 'flex-end',
}, },
cont_rig_status: { cont_rig_status: {
fontSize: second_text_size, fontSize: second_text_size,
fontFamily: font_family_medium, fontFamily: font_family_medium,
color: '#01B2B9' color: '#01B2B9',
}, },
status_audit: { status_audit: {
color: '#FF0000' color: '#FF0000',
}, },
status_return: { status_return: {
color: '#007EFF' color: '#007EFF',
}, },
status_other: { status_other: {
color: '#F4B61B' color: '#F4B61B',
}, },
cont_no_list_box: { cont_no_list_box: {
flex: 1 flex: 1,
}, },
cont_no_data: { cont_no_data: {
color: third_text_color, color: third_text_color,
fontSize: 16, fontSize: 16,
fontFamily: font_family_medium, fontFamily: font_family_medium,
lineHeight: 42, lineHeight: 42,
textAlign: 'center' textAlign: 'center',
}, },
}) })
const mapStateToProps = (state) => { const mapStateToProps = state => {
return { return {
userInfo: state.login.userInfo, userInfo: state.login.userInfo,
token: state.login.token, token: state.login.token,
loginState: state.login.loginState, loginState: state.login.loginState,
global_domain_config: state.login.global_domain_config, global_domain_config: state.login.global_domain_config,
histor_search_status: state.histor.histor_search_status, histor_search_status: state.histor.histor_search_status,
historOrderOption: state.histor.historOrderOption historOrderOption: state.histor.historOrderOption,
} }
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = dispatch => {
return { return {
exitLoginStatus: () => { exitLoginStatus: () => {
dispatch(exitLoginStatus()) dispatch(exitLoginStatus())
}, },
requestGetAllBorrow: (params) => { requestGetAllBorrow: params => {
dispatch(requestGetAllBorrow(params)) dispatch(requestGetAllBorrow(params))
}, },
requestGetAllConsume: (params) => { requestGetAllConsume: params => {
dispatch(requestGetAllConsume(params)) dispatch(requestGetAllConsume(params))
}, },
requestGetAllTrans: (params) => { requestGetAllTrans: params => {
dispatch(requestGetAllTrans(params)) dispatch(requestGetAllTrans(params))
} },
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(HistoricalOrderPage); export default connect(mapStateToProps, mapDispatchToProps)(HistoricalOrderPage)
This diff could not be displayed because it is too large.
import React, { Component } from 'react'; import React, { Component } from 'react'
import { import { View, Text, StyleSheet, Image, TouchableOpacity, ScrollView, SafeAreaView } from 'react-native'
View, import * as R from 'ramda'
Text, import ImageView from 'react-native-image-preview'
StyleSheet,
Image,
TouchableOpacity,
ScrollView,
SafeAreaView
} from 'react-native';
import * as R from 'ramda';
import ImageView from 'react-native-image-preview';
import { import {
promary_color, promary_color,
safe_view, safe_view,
...@@ -23,30 +15,28 @@ import { ...@@ -23,30 +15,28 @@ import {
home_background_color, home_background_color,
first_text_color, first_text_color,
foundation_color, foundation_color,
pxSize pxSize,
} from '../../../base/BaseStyle'; } from '../../../base/BaseStyle'
import StatusBarView from '../../common/StatusBarView'; import StatusBarView from '../../common/StatusBarView'
import HeadBackItem from '../../common/HeadBackItem'; import HeadBackItem from '../../common/HeadBackItem'
import { CellTextStyle } from '../../common/CellTextStyle'; import { CellTextStyle } from '../../common/CellTextStyle'
import LodingModel from '../../common/LodingModel'; import LodingModel from '../../common/LodingModel'
import { import {
requestGetLineFormBorrow, requestGetLineFormBorrow,
requestGetLineFormConsume, requestGetLineFormConsume,
requestGetLineFormTrans, requestGetLineFormTrans,
requestCollectImage, requestCollectImage,
} from '../../../action/HistorAction'; } from '../../../action/HistorAction'
import { connect } from 'react-redux'; import { connect } from 'react-redux'
import { isNotBlank, show } from '../../../utils/Utils'; import { isNotBlank, show } from '../../../utils/Utils'
import { import { exitLoginStatus } from '../../../action/LoginAction'
exitLoginStatus import { LOGIN_NO } from '../../../base/ActionTypes'
} from '../../../action/LoginAction'; import moment from 'moment'
import { LOGIN_NO } from '../../../base/ActionTypes'; import ShowModel from '../../common/ShowModel'
import moment from 'moment';
import ShowModel from '../../common/ShowModel';
class LineOrderPage extends Component { class LineOrderPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props)
this.state = { this.state = {
isSubLoding: false, // 加载中弹窗 isSubLoding: false, // 加载中弹窗
lodingTitle: '加载中', lodingTitle: '加载中',
...@@ -59,7 +49,7 @@ class LineOrderPage extends Component { ...@@ -59,7 +49,7 @@ class LineOrderPage extends Component {
// specification: '3g,Ytg-DG-SZGT', // specification: '3g,Ytg-DG-SZGT',
// serial_number: '2001202001001774' // serial_number: '2001202001001774'
// } // }
] ],
}, },
orderSupOptions: {}, // 获取主表数据 orderSupOptions: {}, // 获取主表数据
toolShowPopup: false, // 弹窗显示 toolShowPopup: false, // 弹窗显示
...@@ -96,19 +86,20 @@ class LineOrderPage extends Component { ...@@ -96,19 +86,20 @@ class LineOrderPage extends Component {
{ {
prop: 'create_time', prop: 'create_time',
name: '下单日期', name: '下单日期',
format: data => data && moment(data).format('YYYY/MM/DD HH:mm') format: data => data && moment(data).format('YYYY/MM/DD HH:mm'),
}, },
{ {
prop: 'allPlanQuanSum', prop: 'allPlanQuanSum',
name: '下单数量', name: '下单数量',
obj: 'consumaData' obj: 'consumaData',
}, },
{ {
prop: 'surgery_desc', prop: 'surgery_desc',
name: '备注信息', name: '备注信息',
}, },
], ],
[ // 消耗订单 [
// 消耗订单
{ {
prop: 'surgery_collect_number', prop: 'surgery_collect_number',
name: '借货订单', name: '借货订单',
...@@ -125,9 +116,9 @@ class LineOrderPage extends Component { ...@@ -125,9 +116,9 @@ class LineOrderPage extends Component {
prop: 'seller_name', prop: 'seller_name',
name: '业 务 员', name: '业 务 员',
suffix: () => { suffix: () => {
const {local_his_time} = this.state.orderSupOptions const { local_his_time } = this.state.orderSupOptions
return !!local_his_time && `(${moment(local_his_time).format('YYYY/MM/DD HH:mm')})` return !!local_his_time && `(${moment(local_his_time).format('YYYY/MM/DD HH:mm')})`
} },
}, },
{ {
prop: 'customer_name', prop: 'customer_name',
...@@ -165,22 +156,24 @@ class LineOrderPage extends Component { ...@@ -165,22 +156,24 @@ class LineOrderPage extends Component {
prop: 'surgery_desc', prop: 'surgery_desc',
name: '备注信息', name: '备注信息',
}, },
], [{ ],
[
{
prop: 'local_his_name', prop: 'local_his_name',
name: '目标借货订单号', name: '目标借货订单号',
suffix: () => { suffix: () => {
const {orderSupOptions} = this.state const { orderSupOptions } = this.state
return `(${orderSupOptions.local_his_time})` return `(${orderSupOptions.local_his_time})`
} },
}, },
{ {
prop: 'source_surgery_order_number', prop: 'source_surgery_order_number',
name: '来源借货订单号', name: '来源借货订单号',
ifShow: () => !!this.state.orderSupOptions.source_surgery_order_number, ifShow: () => !!this.state.orderSupOptions.source_surgery_order_number,
suffix: () => { suffix: () => {
const {source_surgery_date} = this.state.orderSupOptions const { source_surgery_date } = this.state.orderSupOptions
return !!source_surgery_date && `(${moment(source_surgery_date).format('YYYY/MM/DD HH:mm')})` return !!source_surgery_date && `(${moment(source_surgery_date).format('YYYY/MM/DD HH:mm')})`
} },
}, },
{ {
prop: 'doctor_name', prop: 'doctor_name',
...@@ -202,35 +195,36 @@ class LineOrderPage extends Component { ...@@ -202,35 +195,36 @@ class LineOrderPage extends Component {
prop: 'surgery_desc', prop: 'surgery_desc',
name: '备注信息', name: '备注信息',
}, },
] ],
] ],
} }
} }
componentDidMount() { componentDidMount() {
let {supIndex, data} = this.props.navigation.state.params let { supIndex, data } = this.props.navigation.state.params
let { collectPhotos } = this.state let { collectPhotos } = this.state
if (supIndex == 0 && isNotBlank(data.image_url)) { if (supIndex == 0 && isNotBlank(data.image_url)) {
const images = R.compose(R.map(url => ({ const images = R.compose(
uri: this.props.global_domain_config + '/' + url R.map(url => ({
uri: this.props.global_domain_config + '/' + url,
})), })),
R.split(',') R.split(','),
)(data.image_url) )(data.image_url)
collectPhotos = images collectPhotos = images
this.setState({ collectPhotos }); this.setState({ collectPhotos })
} }
this.getLineOptionData() this.getLineOptionData()
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
let {loginState, navigation} = this.props let { loginState, navigation } = this.props
if(loginState != nextProps.loginState) { if (loginState != nextProps.loginState) {
switch(nextProps.loginState) { switch (nextProps.loginState) {
case LOGIN_NO: case LOGIN_NO:
navigation.navigate('LoginPage') navigation.navigate('LoginPage')
break; break
default: default:
break; break
} }
} }
} }
...@@ -239,96 +233,98 @@ class LineOrderPage extends Component { ...@@ -239,96 +233,98 @@ class LineOrderPage extends Component {
changeSubLoding(loading, loadTit) { changeSubLoding(loading, loadTit) {
this.setState({ this.setState({
isSubLoding: loading || false, isSubLoding: loading || false,
lodingTitle: loadTit || '加载中' lodingTitle: loadTit || '加载中',
}) })
} }
// 获取行订单数据 // 获取行订单数据
getLineOptionData() { getLineOptionData() {
let {supIndex, data} = this.props.navigation.state.params let { supIndex, data } = this.props.navigation.state.params
this.setState({ this.setState({
orderSupOptions: data orderSupOptions: data,
}) })
switch(supIndex) { switch (supIndex) {
case 0: case 0:
// 借货 // 借货
this.getReqBorrowLineData(data) this.getReqBorrowLineData(data)
this.getCollectPhoto(data) this.getCollectPhoto(data)
break; break
case 1: case 1:
// 消耗 // 消耗
this.getReqConsumeLineData(data) this.getReqConsumeLineData(data)
break; break
case 2: case 2:
// 转单 // 转单
this.getReqTransLineData(data) this.getReqTransLineData(data)
break; break
default: default:
break; break
} }
} }
// 获取借货订单行数据 // 获取借货订单行数据
async getReqBorrowLineData(supData) { async getReqBorrowLineData(supData) {
let that = this let that = this
let {consumaData} = that.state let { consumaData } = that.state
let {props} = this let { props } = this
that.changeSubLoding(true) that.changeSubLoding(true)
let params = { let params = {
access_token: props.token, access_token: props.token,
surgery_collect_number: supData.local_his_number surgery_collect_number: supData.local_his_number,
} }
let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params) let bowResult = await requestGetLineFormBorrow(props.global_domain_config, params)
console.log('获取借货订单行数据 res=====', bowResult) console.log('获取借货订单行数据 res=====', bowResult)
if(bowResult.error_code == 0) { if (bowResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
let {surgery_collect_lines} = bowResult.data let { surgery_collect_lines } = bowResult.data
let tempSum = 0 let tempSum = 0
surgery_collect_lines.length && surgery_collect_lines.forEach(item => { surgery_collect_lines.length &&
if(item.plan_quantity) { surgery_collect_lines.forEach(item => {
if (item.plan_quantity) {
tempSum += Number(item.plan_quantity) tempSum += Number(item.plan_quantity)
} }
}) })
consumaData.subOption = [...surgery_collect_lines] consumaData.subOption = [...surgery_collect_lines]
consumaData.allPlanQuanSum = tempSum consumaData.allPlanQuanSum = tempSum
that.setState({ that.setState({
consumaData consumaData,
}) })
} else if(bowResult.error_code == 41006) { } else if (bowResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
that.changeSubLoding(false) that.changeSubLoding(false)
let error_msg = bowResult.error_msg || bowResult.message let error_msg = bowResult.error_msg || bowResult.message
show(error_msg); show(error_msg)
} }
} }
// 获取消耗订单行数据 // 获取消耗订单行数据
async getReqConsumeLineData(supData) { async getReqConsumeLineData(supData) {
let that = this let that = this
let {consumaData} = that.state let { consumaData } = that.state
let {props} = this let { props } = this
that.changeSubLoding(true) that.changeSubLoding(true)
let params = { let params = {
access_token: props.token, access_token: props.token,
consume_order_number: supData.local_his_number consume_order_number: supData.local_his_number,
} }
let conResult = await requestGetLineFormConsume(props.global_domain_config, params) let conResult = await requestGetLineFormConsume(props.global_domain_config, params)
console.log('获取消耗订单行数据 res=====', conResult) console.log('获取消耗订单行数据 res=====', conResult)
if(conResult.error_code == 0) { if (conResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
let {sur_consume_lines} = conResult.data let { sur_consume_lines } = conResult.data
let tempSum = 0 let tempSum = 0
let tempConQuanSum = 0 let tempConQuanSum = 0
sur_consume_lines.length && sur_consume_lines.forEach(item => { sur_consume_lines.length &&
if(item.sale_price) { sur_consume_lines.forEach(item => {
if (item.sale_price) {
tempSum += Number(item.sale_price) tempSum += Number(item.sale_price)
} }
if(item.consumed_quantity) { if (item.consumed_quantity) {
tempConQuanSum += Number(item.consumed_quantity) tempConQuanSum += Number(item.consumed_quantity)
} }
}) })
...@@ -336,44 +332,45 @@ class LineOrderPage extends Component { ...@@ -336,44 +332,45 @@ class LineOrderPage extends Component {
consumaData.allOptSum = tempSum consumaData.allOptSum = tempSum
consumaData.allConmQuanSum = tempConQuanSum consumaData.allConmQuanSum = tempConQuanSum
that.setState({ that.setState({
consumaData consumaData,
}) })
} else if(conResult.error_code == 41006) { } else if (conResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
that.changeSubLoding(false) that.changeSubLoding(false)
let error_msg = conResult.error_msg || conResult.message let error_msg = conResult.error_msg || conResult.message
show(error_msg); show(error_msg)
} }
} }
// 获取转单订单行数据 // 获取转单订单行数据
async getReqTransLineData(supData) { async getReqTransLineData(supData) {
let that = this let that = this
let {consumaData} = that.state let { consumaData } = that.state
let {props} = this let { props } = this
that.changeSubLoding(true) that.changeSubLoding(true)
let params = { let params = {
access_token: props.token, access_token: props.token,
order_number: supData.order_number, order_number: supData.order_number,
destination_surgery_collect_number: supData.destination_surgery_collect_number, destination_surgery_collect_number: supData.destination_surgery_collect_number,
source_surgery_order_number: supData.source_surgery_order_number source_surgery_order_number: supData.source_surgery_order_number,
} }
let conResult = await requestGetLineFormTrans(props.global_domain_config, params) let conResult = await requestGetLineFormTrans(props.global_domain_config, params)
console.log('获取转单订单行数据 res=====', conResult) console.log('获取转单订单行数据 res=====', conResult)
if(conResult.error_code == 0) { if (conResult.error_code == 0) {
that.changeSubLoding(false) that.changeSubLoding(false)
// 成功 // 成功
let {sur_order_transfer_lines} = conResult.data let { sur_order_transfer_lines } = conResult.data
let tempSum = 0 let tempSum = 0
let tempConQuanSum = 0 let tempConQuanSum = 0
sur_order_transfer_lines.length && sur_order_transfer_lines.forEach(item => { sur_order_transfer_lines.length &&
if(item.sale_price) { sur_order_transfer_lines.forEach(item => {
if (item.sale_price) {
tempSum += Number(item.sale_price) tempSum += Number(item.sale_price)
} }
if(item.consumed_quantity) { if (item.consumed_quantity) {
tempConQuanSum += Number(item.consumed_quantity) tempConQuanSum += Number(item.consumed_quantity)
} }
}) })
...@@ -381,16 +378,16 @@ class LineOrderPage extends Component { ...@@ -381,16 +378,16 @@ class LineOrderPage extends Component {
consumaData.allOptSum = tempSum consumaData.allOptSum = tempSum
consumaData.allConmQuanSum = tempConQuanSum consumaData.allConmQuanSum = tempConQuanSum
that.setState({ that.setState({
consumaData consumaData,
}) })
} else if(conResult.error_code == 41006) { } else if (conResult.error_code == 41006) {
that.changeSubLoding(false) that.changeSubLoding(false)
show('登录过期,请重新登录'); show('登录过期,请重新登录')
props.exitLoginStatus(); props.exitLoginStatus()
} else { } else {
that.changeSubLoding(false) that.changeSubLoding(false)
let error_msg = conResult.error_msg || conResult.message let error_msg = conResult.error_msg || conResult.message
show(error_msg); show(error_msg)
} }
} }
...@@ -402,26 +399,29 @@ class LineOrderPage extends Component { ...@@ -402,26 +399,29 @@ class LineOrderPage extends Component {
const res = await requestCollectImage(this.props.global_domain_config, params) const res = await requestCollectImage(this.props.global_domain_config, params)
if (res.code !== 0) return if (res.code !== 0) return
const photos = R.compose(R.map(url => { const photos = R.compose(
return {uri: this.props.global_domain_config + '/' + url} R.map(url => {
}), R.pathOr([], ['data', 'photo_url']))(res) return { uri: this.props.global_domain_config + '/' + url }
}),
R.pathOr([], ['data', 'photo_url']),
)(res)
const { collectPhotos } = this.state const { collectPhotos } = this.state
this.setState({collectPhotos: R.concat(collectPhotos, photos)}); this.setState({ collectPhotos: R.concat(collectPhotos, photos) })
} }
// 耗材明细 隐藏/显示子项 // 耗材明细 隐藏/显示子项
handleDetailBtmCheck(flagType) { handleDetailBtmCheck(flagType) {
let {consumaData} = this.state let { consumaData } = this.state
consumaData.isShowSub = flagType consumaData.isShowSub = flagType
this.setState({ this.setState({
consumaData consumaData,
}) })
} }
// 关闭当前弹窗 // 关闭当前弹窗
handleCloseModal(show) { handleCloseModal(show) {
this.setState({ this.setState({
toolShowPopup: show toolShowPopup: show,
}) })
} }
...@@ -429,12 +429,12 @@ class LineOrderPage extends Component { ...@@ -429,12 +429,12 @@ class LineOrderPage extends Component {
handleIsShowDialog(item) { handleIsShowDialog(item) {
this.setState({ this.setState({
toolShowPopup: !this.state.toolShowPopup, toolShowPopup: !this.state.toolShowPopup,
popFormItem: item popFormItem: item,
}) })
} }
previewImage(imgItem) { previewImage(imgItem) {
this.setState({previewVisible: true, imageIndex: imgItem}); this.setState({ previewVisible: true, imageIndex: imgItem })
} }
// 返回耗材内容 // 返回耗材内容
...@@ -443,46 +443,44 @@ class LineOrderPage extends Component { ...@@ -443,46 +443,44 @@ class LineOrderPage extends Component {
return ( return (
<CellTextStyle style={list_common_item.consu_detail}> <CellTextStyle style={list_common_item.consu_detail}>
<View style={list_common_item.detail_inner}> <View style={list_common_item.detail_inner}>
{ {state.consumaData.subOption.length ? (
state.consumaData.subOption.length ?
<View style={list_common_item.detail_sub_cont}> <View style={list_common_item.detail_sub_cont}>
<View style={list_common_item.detail_sub_tit}> <View style={list_common_item.detail_sub_tit}>
<Text style={list_common_item.detail_tit_text}> <Text style={list_common_item.detail_tit_text}>耗材({state.consumaData.subOption.length}</Text>
耗材({state.consumaData.subOption.length}
</Text>
{ {state.consumaData.isShowSub ? (
state.consumaData.isShowSub ?
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.detail_icon} style={list_common_item.detail_icon}
onPress={() => this.handleDetailBtmCheck(false)} onPress={() => this.handleDetailBtmCheck(false)}
> >
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_btm.png')} /> <Image
</TouchableOpacity> : style={[icon_style, list_common_item.detail_top_icon]}
source={require('../../../images/arr_btm.png')}
/>
</TouchableOpacity>
) : (
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={[list_common_item.detail_icon, list_common_item.detail_icon_rig]} style={[list_common_item.detail_icon, list_common_item.detail_icon_rig]}
onPress={() => this.handleDetailBtmCheck(true)} onPress={() => this.handleDetailBtmCheck(true)}
> >
<Image style={[icon_style, list_common_item.detail_top_icon]} source={require('../../../images/arr_rig.png')} /> <Image
style={[icon_style, list_common_item.detail_top_icon]}
source={require('../../../images/arr_rig.png')}
/>
</TouchableOpacity> </TouchableOpacity>
} )}
</View> </View>
{ {state.consumaData.isShowSub ? (
state.consumaData.isShowSub ?
<View style={list_common_item.detail_sub_inner}> <View style={list_common_item.detail_sub_inner}>
{ {state.consumaData.subOption.map((item, index) => {
state.consumaData.subOption.map((item, index) => {
return this.renderConDeSubItem(item, index) return this.renderConDeSubItem(item, index)
}) })}
} </View>
</View> : null ) : null}
} </View>
) : null}
</View> : null
}
</View> </View>
</CellTextStyle> </CellTextStyle>
) )
...@@ -490,110 +488,101 @@ class LineOrderPage extends Component { ...@@ -490,110 +488,101 @@ class LineOrderPage extends Component {
// 返回耗材明细子项 // 返回耗材明细子项
renderConDeSubItem(item, index) { renderConDeSubItem(item, index) {
let {supIndex} = this.props.navigation.state.params let { supIndex } = this.props.navigation.state.params
return( return (
<TouchableOpacity <TouchableOpacity
activeOpacity={.8} activeOpacity={0.8}
style={list_common_item.con_de_sub} style={list_common_item.con_de_sub}
key={index} key={index}
onPress={() => this.handleIsShowDialog(item)} onPress={() => this.handleIsShowDialog(item)}
> >
<Text style={list_common_item.de_sub_tit}> <Text style={list_common_item.de_sub_tit}>
{index+1}{ item.item_name } - {item.specification} {index + 1}{item.item_name} - {item.specification}
</Text>
{
(supIndex == 1 && item.sale_price) ? <Text style={list_common_item.de_tip}>
单价(¥){ item.sale_price }
</Text> </Text>
: null {supIndex == 1 && item.sale_price ? (
} <Text style={list_common_item.de_tip}>单价(¥){item.sale_price}</Text>
) : null}
</TouchableOpacity> </TouchableOpacity>
) )
} }
// 返回主要内容 // 返回主要内容
renderContItem() { renderContItem() {
let {orderSupOptions, consumaData, columns, collectPhotos, previewVisible, imageIndex} = this.state let { orderSupOptions, consumaData, columns, collectPhotos, previewVisible, imageIndex } = this.state
let {supIndex, data: headerData} = this.props.navigation.state.params let { supIndex, data: headerData } = this.props.navigation.state.params
const subColumns = columns[supIndex] const subColumns = columns[supIndex]
return ( return (
<ScrollView style={styles.line_cont_scroll}> <ScrollView style={styles.line_cont_scroll}>
<View style={styles.fo_cont_inner}> <View style={styles.fo_cont_inner}>
<Text style={styles.fo_cont_top_tit}>订单信息</Text> <Text style={styles.fo_cont_top_tit}>订单信息</Text>
{ {subColumns.map(col => {
subColumns.map(col => {
const obj = this.state[col.obj] || orderSupOptions const obj = this.state[col.obj] || orderSupOptions
if(!!col.ifShow && !col.ifShow()) return null if (!!col.ifShow && !col.ifShow()) return null
return ( return (
<View key={col.name} style={styles.fo_cell_box}> <View key={col.name} style={styles.fo_cell_box}>
<View style={{minWidth: pxSize(70), }}> <View style={{ minWidth: pxSize(70) }}>
<Text style={[styles.fo_tip_txt]}>{col.name}:</Text> <Text style={[styles.fo_tip_txt]}>{col.name}:</Text>
</View> </View>
<Text style={styles.fo_tip_txt}> <Text style={styles.fo_tip_txt}>
{ {<Text>{col.format ? col.format(obj[col.prop]) : obj[col.prop] || '无'}</Text>}
<Text>{col.format ? col.format(obj[col.prop]) : obj[col.prop] || '无'}</Text> {!!col.suffix && <Text>{col.suffix()}</Text>}
}
{
!!col.suffix && <Text>{col.suffix()}</Text>
}
</Text> </Text>
</View> </View>
) )
}) })}
}
</View> </View>
<View style={styles.line_cont}> <View style={styles.line_cont}>
<View style={styles.line_cont_title}> <View style={styles.line_cont_title}>
<Text style={styles.cont_tip_tit}>订单详情</Text> <Text style={styles.cont_tip_tit}>订单详情</Text>
{ {supIndex === 1 && (
supIndex === 1 &&
<View style={[styles.line_cont_title]}> <View style={[styles.line_cont_title]}>
<Text style={{marginRight: pxSize(15)}}>数量:{consumaData.allConmQuanSum}</Text> <Text style={{ marginRight: pxSize(15) }}>数量:{consumaData.allConmQuanSum}</Text>
<Text style>金额:{consumaData.allOptSum}</Text> <Text style>金额:{consumaData.allOptSum}</Text>
</View> </View>
} )}
</View> </View>
{ this.renderConsumablesItem() } {this.renderConsumablesItem()}
{ this.renderDetailModel() } {this.renderDetailModel()}
<View style={styles.line_footer}> <View style={styles.line_footer}>
<View style={styles.fo_sta_inner}> <View style={styles.fo_sta_inner}>
<Text style={[ <Text
style={[
styles.fo_sta_txt, styles.fo_sta_txt,
['待审核', '已提交', '待确认消耗'].includes(orderSupOptions.local_his_status) && styles.status_audit, ['待审核', '已提交', '待确认消耗'].includes(orderSupOptions.local_his_status) && styles.status_audit,
['待还货', '已输入', '已驳回', '已确认消耗'].includes(orderSupOptions.local_his_status) && styles.status_return, ['待还货', '已输入', '已驳回', '已确认消耗'].includes(orderSupOptions.local_his_status) &&
['其他', '已取消'].includes(orderSupOptions.local_his_status) && styles.status_other styles.status_return,
]}> ['其他', '已取消'].includes(orderSupOptions.local_his_status) && styles.status_other,
]}
>
{orderSupOptions.local_his_status} {orderSupOptions.local_his_status}
</Text> </Text>
</View> </View>
</View> </View>
{ isNotBlank(collectPhotos) && ( {isNotBlank(collectPhotos) && (
<View style={[styles.line_cont_title_column]}> <View style={[styles.line_cont_title_column]}>
<Text style={styles.cont_tip_tit}>出库照片</Text> <Text style={styles.cont_tip_tit}>出库照片</Text>
<View style={styles.image_box}> <View style={styles.image_box}>
{ {collectPhotos &&
collectPhotos && collectPhotos.map(item => { collectPhotos.map(item => {
return ( return (
<TouchableOpacity onPress={() => this.previewImage(item)}> <TouchableOpacity onPress={() => this.previewImage(item)}>
<Image source={item} width={60} height={60} style={styles.image} resizeMode="cover" /> <Image source={item} width={60} height={60} style={styles.image} resizeMode="cover" />
</TouchableOpacity> </TouchableOpacity>
) )
}) })}
}
</View> </View>
<ImageView <ImageView
images={collectPhotos} images={collectPhotos}
source={imageIndex} source={imageIndex}
visible={previewVisible} visible={previewVisible}
close={() => this.setState({previewVisible: false})} close={() => this.setState({ previewVisible: false })}
/> />
</View> </View>
)} )}
...@@ -605,105 +594,60 @@ class LineOrderPage extends Component { ...@@ -605,105 +594,60 @@ class LineOrderPage extends Component {
// 返回正在加载中 // 返回正在加载中
renderLodingItem() { renderLodingItem() {
let { lodingTitle, isSubLoding } = this.state let { lodingTitle, isSubLoding } = this.state
return( return <LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
<LodingModel title={lodingTitle} show={isSubLoding} style_back={styles.loding_back} />
)
} }
// 返回弹窗 // 返回弹窗
renderDetailModel() { renderDetailModel() {
let {popFormItem, toolShowPopup} = this.state let { popFormItem, toolShowPopup } = this.state
const { sysProfiles } = this.props const { sysProfiles } = this.props
let {supIndex} = this.props.navigation.state.params let { supIndex } = this.props.navigation.state.params
const showSalePrice = R.compose(R.equals('Y'), R.prop('SUR_MOBILE_HISTORY_SALE_PRICE_SHOW_FLAG'))(sysProfiles) const showSalePrice = R.compose(R.equals('Y'), R.prop('SUR_MOBILE_HISTORY_SALE_PRICE_SHOW_FLAG'))(sysProfiles)
return ( return (
<ShowModel <ShowModel title={popFormItem.item_name} show={toolShowPopup} closeModal={show => this.handleCloseModal(show)}>
title={ popFormItem.item_name}
show={ toolShowPopup }
closeModal={(show) => this.handleCloseModal(show)}
>
<View style={styles.model_cont}> <View style={styles.model_cont}>
<View style={styles.model_cont_inner}> <View style={styles.model_cont_inner}>
<Text style={styles.mo_cont_title}>详细信息:</Text> <Text style={styles.mo_cont_title}>详细信息:</Text>
{ {popFormItem.item_name ? <Text style={styles.mo_cont_tip}>通用名称:{popFormItem.item_name}</Text> : null}
popFormItem.item_name ? {popFormItem.serial_number ? (
<Text style={styles.mo_cont_tip}> <Text style={styles.mo_cont_tip}>物料序列:{popFormItem.serial_number}</Text>
通用名称:{popFormItem.item_name} ) : null}
</Text> : null {popFormItem.item_code ? <Text style={styles.mo_cont_tip}>物料代码:{popFormItem.item_code}</Text> : null}
} {popFormItem.specification ? (
{ <Text style={styles.mo_cont_tip}>规格型号:{popFormItem.specification}</Text>
popFormItem.serial_number ? ) : null}
<Text style={styles.mo_cont_tip}> {popFormItem.serial_number ? (
物料序列:{popFormItem.serial_number} <Text style={styles.mo_cont_tip}>序列号:{popFormItem.serial_number}</Text>
</Text> : null ) : null}
} {popFormItem.production_batch_number ? (
{ <Text style={styles.mo_cont_tip}>生产批号:{popFormItem.production_batch_number}</Text>
popFormItem.item_code ? ) : null}
<Text style={styles.mo_cont_tip}> {popFormItem.production_serial_number ? (
物料代码:{popFormItem.item_code} <Text style={styles.mo_cont_tip}>生产序号:{popFormItem.production_serial_number}</Text>
</Text> : null ) : null}
} {popFormItem.production_date ? (
{
popFormItem.specification ?
<Text style={styles.mo_cont_tip}>
规格型号:{popFormItem.specification}
</Text> : null
}
{
popFormItem.serial_number ?
<Text style={styles.mo_cont_tip}>
序列号:{popFormItem.serial_number}
</Text> : null
}
{
popFormItem.production_batch_number ?
<Text style={styles.mo_cont_tip}>
生产批号:{popFormItem.production_batch_number}
</Text> : null
}
{
popFormItem.production_serial_number ?
<Text style={styles.mo_cont_tip}>
生产序号:{popFormItem.production_serial_number}
</Text> : null
}
{
popFormItem.production_date ?
<Text style={styles.mo_cont_tip}> <Text style={styles.mo_cont_tip}>
生产日期:{moment(popFormItem.production_date).format('YYYY-MM-DD')} 生产日期:{moment(popFormItem.production_date).format('YYYY-MM-DD')}
</Text> : null </Text>
} ) : null}
{ {popFormItem.expiration_date ? (
popFormItem.expiration_date ?
<Text style={styles.mo_cont_tip}> <Text style={styles.mo_cont_tip}>
过期日期:{moment(popFormItem.expiration_date).format('YYYY-MM-DD')} 过期日期:{moment(popFormItem.expiration_date).format('YYYY-MM-DD')}
</Text> : null
}
{
popFormItem.plan_quantity ?
<Text style={styles.mo_cont_tip}>
计划数量:{popFormItem.plan_quantity}
</Text> : null
}
{
popFormItem.storage_quantity ?
<Text style={styles.mo_cont_tip}>
库存数量:{popFormItem.storage_quantity}
</Text> : null
}
{
popFormItem.consumed_quantity ?
<Text style={styles.mo_cont_tip}>
消耗数量:{popFormItem.consumed_quantity}
</Text> : null
}
{
!popFormItem.sale_price || !showSalePrice && supIndex === 0 ? null :
<Text style={styles.mo_cont_tip}>
销售价格:{popFormItem.sale_price}
</Text> </Text>
} ) : null}
{popFormItem.plan_quantity ? (
<Text style={styles.mo_cont_tip}>计划数量:{popFormItem.plan_quantity}</Text>
) : null}
{popFormItem.storage_quantity ? (
<Text style={styles.mo_cont_tip}>库存数量:{popFormItem.storage_quantity}</Text>
) : null}
{popFormItem.consumed_quantity ? (
<Text style={styles.mo_cont_tip}>消耗数量:{popFormItem.consumed_quantity}</Text>
) : null}
{!popFormItem.sale_price || (!showSalePrice && supIndex === 0) ? null : (
<Text style={styles.mo_cont_tip}>销售价格:{popFormItem.sale_price}</Text>
)}
</View> </View>
</View> </View>
</ShowModel> </ShowModel>
...@@ -711,26 +655,21 @@ class LineOrderPage extends Component { ...@@ -711,26 +655,21 @@ class LineOrderPage extends Component {
} }
render() { render() {
let {navigation} = this.props let { navigation } = this.props
let {title} = navigation.state.params let { title } = navigation.state.params
return ( return (
<View style={styles.line_container}> <View style={styles.line_container}>
<StatusBarView <StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
isReactStackNavigator={true}
backgroundColor={promary_color}
barStyle = 'light-content'
/>
<SafeAreaView style={safe_view}> <SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
<View style={styles.line_main}> <View style={styles.line_main}>
{ this.renderContItem() } {this.renderContItem()}
{this.renderLodingItem()} {this.renderLodingItem()}
</View> </View>
</SafeAreaView> </SafeAreaView>
</View> </View>
); )
} }
} }
...@@ -739,24 +678,24 @@ const styles = StyleSheet.create({ ...@@ -739,24 +678,24 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
backgroundColor: home_background_color, backgroundColor: home_background_color,
padding: 0, padding: 0,
margin: 0 margin: 0,
}, },
line_main: { line_main: {
flex: 1 flex: 1,
}, },
loding_back: { loding_back: {
backgroundColor: 'rgba(0, 0, 0, 0)' backgroundColor: 'rgba(0, 0, 0, 0)',
}, },
line_cont_scroll: {}, line_cont_scroll: {},
line_cont: { line_cont: {
paddingHorizontal: 20, paddingHorizontal: 20,
paddingVertical: 16, paddingVertical: 16,
paddingBottom: 20 paddingBottom: 20,
}, },
line_cont_title: { line_cont_title: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: "center" alignItems: 'center',
}, },
line_cont_title_column: { line_cont_title_column: {
flexDirection: 'column', flexDirection: 'column',
...@@ -765,7 +704,7 @@ const styles = StyleSheet.create({ ...@@ -765,7 +704,7 @@ const styles = StyleSheet.create({
cont_tip_tit: { cont_tip_tit: {
fontSize: 16, fontSize: 16,
fontFamily: font_family_regular, fontFamily: font_family_regular,
color: first_text_color color: first_text_color,
}, },
line_footer: {}, line_footer: {},
...@@ -774,30 +713,30 @@ const styles = StyleSheet.create({ ...@@ -774,30 +713,30 @@ const styles = StyleSheet.create({
// borderBottomColor: '#CCCCCC', // borderBottomColor: '#CCCCCC',
// paddingBottom: 18 // paddingBottom: 18
backgroundColor: foundation_color, backgroundColor: foundation_color,
padding: 20 padding: 20,
}, },
fo_cont_top_tit: { fo_cont_top_tit: {
color: first_text_color, color: first_text_color,
fontFamily: font_family_medium, fontFamily: font_family_medium,
fontSize: second_text_size, fontSize: second_text_size,
paddingBottom: 8 paddingBottom: 8,
}, },
fo_tit_box: { fo_tit_box: {
paddingBottom: 12 paddingBottom: 12,
}, },
fo_txt: { fo_txt: {
fontSize: 14, fontSize: 14,
fontFamily: font_family_regular, fontFamily: font_family_regular,
color: second_text_color color: second_text_color,
}, },
fo_cell_box: { fo_cell_box: {
flexDirection: 'row' flexDirection: 'row',
}, },
fo_tip_txt: { fo_tip_txt: {
fontSize: third_text_size, fontSize: third_text_size,
fontFamily: font_family_regular, fontFamily: font_family_regular,
color: second_text_color, color: second_text_color,
lineHeight: 18 lineHeight: 18,
}, },
fo_tip_txt_key: { fo_tip_txt_key: {
// minWidth: pxSize(120), // minWidth: pxSize(120),
...@@ -806,7 +745,7 @@ const styles = StyleSheet.create({ ...@@ -806,7 +745,7 @@ const styles = StyleSheet.create({
color: first_text_color, color: first_text_color,
fontSize: 14, fontSize: 14,
fontFamily: font_family_medium, fontFamily: font_family_medium,
paddingTop: 8 paddingTop: 8,
}, },
fo_sta_inner: { fo_sta_inner: {
...@@ -814,41 +753,41 @@ const styles = StyleSheet.create({ ...@@ -814,41 +753,41 @@ const styles = StyleSheet.create({
alignItems: 'flex-end', alignItems: 'flex-end',
borderTopWidth: 1, borderTopWidth: 1,
borderTopColor: '#ECECEC', borderTopColor: '#ECECEC',
paddingTop: 18 paddingTop: 18,
}, },
fo_sta_txt: { fo_sta_txt: {
fontSize: second_text_size, fontSize: second_text_size,
fontFamily: font_family_medium, fontFamily: font_family_medium,
color: '#01B2B9' color: '#01B2B9',
}, },
status_audit: { status_audit: {
color: '#FF0000' color: '#FF0000',
}, },
status_return: { status_return: {
color: '#007EFF' color: '#007EFF',
}, },
status_other: { status_other: {
color: '#F4B61B' color: '#F4B61B',
}, },
// 弹窗 // 弹窗
model_cont: { model_cont: {
// flex: 1 // flex: 1
}, },
model_cont_inner: { model_cont_inner: {
marginBottom: 48 marginBottom: 48,
}, },
mo_cont_title: { mo_cont_title: {
color: first_text_color, color: first_text_color,
// fontWeight: 'bold', // fontWeight: 'bold',
fontSize: 14, fontSize: 14,
lineHeight: 24, lineHeight: 24,
fontFamily: font_family_medium fontFamily: font_family_medium,
}, },
mo_cont_tip: { mo_cont_tip: {
color: second_text_color, color: second_text_color,
fontSize: 14, fontSize: 14,
lineHeight: 24, lineHeight: 24,
fontFamily: font_family_regular fontFamily: font_family_regular,
}, },
mo_img_box: { mo_img_box: {
flex: 1, flex: 1,
...@@ -856,11 +795,11 @@ const styles = StyleSheet.create({ ...@@ -856,11 +795,11 @@ const styles = StyleSheet.create({
borderColor: '#E1E1E1', borderColor: '#E1E1E1',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
height: pxSize(120) height: pxSize(120),
}, },
mo_img: { mo_img: {
width: pxSize(100), width: pxSize(100),
height: '100%' height: '100%',
}, },
image_box: { image_box: {
flexDirection: 'row', flexDirection: 'row',
...@@ -870,11 +809,10 @@ const styles = StyleSheet.create({ ...@@ -870,11 +809,10 @@ const styles = StyleSheet.create({
width: pxSize(60), width: pxSize(60),
height: pxSize(60), height: pxSize(60),
marginRight: pxSize(10), marginRight: pxSize(10),
} },
}) })
const mapStateToProps = (state) => { const mapStateToProps = state => {
return { return {
token: state.login.token, token: state.login.token,
loginState: state.login.loginState, loginState: state.login.loginState,
...@@ -883,11 +821,11 @@ const mapStateToProps = (state) => { ...@@ -883,11 +821,11 @@ const mapStateToProps = (state) => {
} }
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = dispatch => {
return { return {
exitLoginStatus: () => { exitLoginStatus: () => {
dispatch(exitLoginStatus()) dispatch(exitLoginStatus())
}, },
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(LineOrderPage); export default connect(mapStateToProps, mapDispatchToProps)(LineOrderPage)
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