Commit 4daaa438 by peii

消耗选择借货单页面

parent 07e2cc1e
// TODO: 提交前删除
{
"name": "BoneHouse_Business_APP",
"displayName": "BoneHouse_Business_APP"
"name": "BoneHouse_Hospital_APP",
"displayName": "BoneHouse_Hospital_APP"
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import EquipConsuPage from './containers/equipConsu/EquipConsuPage';
import ConsumDetailsPage from './containers/equipConsu/module/ConsumDetailsPage';
import ChargeDetailsPage from './containers/equipConsu/module/ChargeDetailsPage';
import FillUnitPricePage from './containers/equipConsu/module/FillUnitPricePage';
import OrdersPage from './containers/equipConsu/module/OrdersPage';
import ShowDetailPage from './containers/equipConsu/module/ShowDetailPage';
import QuickOrderPage from './containers/quickOrder/QuickOrderPage';
import surgeryTemplatePage from './containers/quickOrder/module/surgeryTemplatePage';
......@@ -35,6 +36,7 @@ const Router = createAppContainer(createStackNavigator({
ConsumDetailsPage: {screen: ConsumDetailsPage},
ChargeDetailsPage: {screen: ChargeDetailsPage},
FillUnitPricePage: {screen: FillUnitPricePage},
OrdersPage: {screen: OrdersPage},
ShowDetailPage: {screen: ShowDetailPage},
QuickOrderPage: {screen: QuickOrderPage},
surgeryTemplatePage: {screen: surgeryTemplatePage},
......
......@@ -504,6 +504,7 @@ class EquipConsuPage extends Component {
})
tempOption = [...resultArr]
orderInfos[`${listOptionData[1].value}_${listOptionData[2].value}`] = tempOption
orderInfos[`${listOptionData[1].value}_${listOptionData[2].value}_source`] = equipOrderOption
const doctors = R.map(R.applySpec({
collect_number: R.prop('collect_number'),
......@@ -519,11 +520,14 @@ class EquipConsuPage extends Component {
localDoctors: doctors,
localFollowers: followers
})
this.props.navigation.navigate('OrdersPage', {orders: equipOrderOption, title: '选择借货订单', selectCallback: this.selectCallback.bind(this)})
return
}
this.setState({
listCurrentOption: [...tempOption]
listCurrentOption: [...tempOption],
// showTypePop: true
}, () => {
// 解决 IOS 弹窗显示问题
// 解决 IOS 弹窗显示问题, 这个问题可能是弹出来点不动?
setTimeout(() => {
that.setState({
showTypePop: true
......@@ -776,7 +780,9 @@ class EquipConsuPage extends Component {
const { orderInfos, listOptionData } = state
const options = orderInfos[`${listOptionData[1].value}_${listOptionData[2].value}`]
if (isNotBlank(options)) {
this.setState({ listCurrentOption: options, showTypePop: true })
// this.setState({ listCurrentOption: options, showTypePop: true })
const equipOrderOption = orderInfos[`${listOptionData[1].value}_${listOptionData[2].value}_source`]
this.props.navigation.navigate('OrdersPage', {orders: equipOrderOption, title: '选择借货订单', selectCallback: this.selectCallback.bind(this)})
return
}
let params = {
......@@ -795,6 +801,24 @@ class EquipConsuPage extends Component {
})
}
}
/**
* @description: 订单选择回调
* @param {*} item
* @return {*}
*/
selectCallback(item) {
const { listOptionData } = this.state
listOptionData[3].value = item.collect_number
listOptionData[3].name = item.collect_number
this.setState({ listOptionData}, () => {
this.clearInitNameAndValue(3)
this.getCurOrderDetail()
this.autoSetDoctorAndFollower()
this.setUserEnteredPrice(item.collect_number)
})
}
// 客户名称选择后,判断订单信息是否只有一条数据
async customerGetOrderInfo() {
let { state, props } = this
......
/*
* @FilePath: /BoneHouse_Business_APP/app/containers/equipConsu/module/OrdersPage.js
* @Author: peii
* @Date: 2021-07-06 15:29:45
* @LastEditTime: 2021-07-08 15:58:39
* @LastEditors: peii
* @Vision: 1.0
* @Description: 消耗时选择借货单
*/
import React, { Component } from 'react'
import {
View,
Text,
StyleSheet,
SafeAreaView,
ScrollView,
TouchableOpacity,
FlatList,
TextInput,
Image,
} from 'react-native'
import {
home_background_color,
promary_color,
safe_view,
icon_style,
placehold_text_color,
first_text_color,
font_family_regular,
pxSize,
list_common_item,
} from '../../../base/BaseStyle'
import StatusBarView from '../../common/StatusBarView'
import HeadBackItem from '../../common/HeadBackItem'
import { isBlank, isNotBlank, changeDateFormat } from '../../../utils/Utils'
import debounce from 'lodash.debounce'
import * as R from 'ramda'
export default class CollectOrder extends Component {
state = {
orders: [],
}
constructor(props) {
super(props)
this.renderItem = this.renderItem.bind(this)
this.selectHandler = this.selectHandler.bind(this)
this.changeTextHandler = debounce(this.changeTextHandler.bind(this), 300)
}
componentDidMount() {
const { orders } = this.props.navigation.state.params
this.setState({ orders: R.clone(orders) })
}
/**
* @description: 选择操作
* @param {*} item
* @return {*}
*/
selectHandler(item) {
const { navigation } = this.props
const { selectCallback } = navigation.state.params
selectCallback && selectCallback(item)
navigation.goBack()
}
/**
* @description: 搜索
* @param {*} text
* @return {*}
*/
changeTextHandler(text) {
const { orders } = this.props.navigation.state.params
let ords = R.clone(orders)
if (isBlank(text)) {
return this.setState({ orders: ords })
}
const match = R.test(new RegExp(text, 'g'))
const keys = ['collect_number', 'seller_name', 'doctor_name', 'surgery_desc', 'remark']
ords = R.filter(R.anyPass(R.map(k => R.compose(match, R.prop(k)), keys)))(ords)
this.setState({ orders: ords })
}
/**
* @description: 渲染单个
* @param {*} item
* @param {*} index
* @return {*}
*/
renderItem({ item, index }) {
return (
<TouchableOpacity style={styles.item} activeOpacity={0.8} onPress={() => this.selectHandler(item)}>
<Text style={styles.item_text}>借货单号: {item.collect_number}</Text>
<Text style={styles.item_text}> : {item.seller_name || '无'}</Text>
<Text style={styles.item_text}>主治医生: {item.doctor_name || '无'}</Text>
<Text style={styles.item_text}>
手术日期: {(item.surgery_date && changeDateFormat(item.surgery_date, 'yyyy-MM-dd')) || '无'}
</Text>
<Text style={styles.item_text}>手术说明: {item.surgery_desc || '无'}</Text>
{!!item.remark && (
<Text style={styles.item_text} numberOfLines={3}>
{item.remark}
</Text>
)}
</TouchableOpacity>
)
}
render() {
const { navigation } = this.props
const { title } = navigation.state.params
const { orders } = this.state
return (
<View style={styles.container}>
<StatusBarView isReactStackNavigator={true} backgroundColor={promary_color} barStyle="light-content" />
<View style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.search_bar}>
<Image source={require('../../../images/search_icon.png')} style={styles.search_icon} />
<TextInput
style={styles.search_input}
placeholder="搜索单号、业务员、主治、备注"
onChangeText={ev => {
this.changeTextHandler(ev)
}}
></TextInput>
</View>
<FlatList
style={styles.list}
data={orders}
renderItem={this.renderItem}
keyExtractor={item => item.collect_number}
/>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: home_background_color,
},
list: {
flex: 1,
padding: 16,
marginBottom: 16,
},
item: {
marginBottom: 16,
padding: 15,
backgroundColor: '#fff',
},
item_text: {
fontSize: 16,
fontFamily: font_family_regular,
},
search_bar: {
height: 48,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: promary_color,
paddingLeft: 20,
paddingRight: 20,
},
search_icon: {
position: 'absolute',
left: 30,
zIndex: 9,
width: 20,
height: 20,
},
search_input: {
height: 32,
backgroundColor: '#FFFFFF',
flex: 1,
paddingLeft: 30,
paddingTop: 0,
paddingBottom: 0,
borderRadius: 20,
color: '#666',
},
})
......@@ -63,9 +63,7 @@ const screenH = Dimensions.get('window').height;
export const isIphoneX = () => {
return (
Platform.OS === 'ios' &&
((screenH === X_HEIGHT && screenW === X_WIDTH) ||
(screenH === X_MAX_HEIGHT && screenW === X_MAX_WIDTH) ||
(screenH === XS_MAX_HEIGHT && screenW === XS_MAX_WIDTH))
screenH >= 728
)
};
......
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