Commit cd688100 by peii

消耗数量字义

parent 66740df1
......@@ -1369,12 +1369,12 @@ class EquipConsuPage extends Component {
R.pathOr([], ['listOptionData', 13, 'subOption'])
)(state)
}
if( tempSubOption.lines.length ) {
tempSubOption.lines = tempSubOption.lines.map(item => {
item['consumed_quantity'] = 1
return item
})
}
// if( tempSubOption.lines.length ) {
// tempSubOption.lines = tempSubOption.lines.map(item => {
// item['consumed_quantity'] = 1
// return item
// })
// }
tempSubOption.img_url = state.listOptionData[14].uploadImgArr.join(',')
let params = {
access_token: props.token,
......@@ -1464,7 +1464,19 @@ class EquipConsuPage extends Component {
consumeSum() {
try {
const {listOptionData} = this.state
return R.compose(R.sum, R.pluck('local_add_price'), R.pathOr([], [12, 'subOption']))(listOptionData)
return R.compose(
R.sum,
R.map(
R.converge(
R.multiply,
[
R.prop('consumed_quantity'),
R.compose(x => isNaN(x) ? 0 : x, R.prop('local_add_price'))
]
)
),
R.pathOr([], [12, 'subOption'])
)(listOptionData)
} catch (error) {
return 0
}
......@@ -1773,7 +1785,7 @@ class EquipConsuPage extends Component {
style={list_common_item.detail_sub_cont}>
<View style={list_common_item.detail_sub_tit}>
<Text style={list_common_item.detail_tit_text}>
耗材({state.listOptionData[12].subOption.length}
耗材({R.compose(R.sum, R.filter(isNotBlank),R.pluck('consumed_quantity'))(state.listOptionData[12].subOption)}
</Text>
{
userEnteredPrice !== 'N' && <Text style={list_common_item.detail_tit_text}>耗材总金额:{sum}</Text>
......@@ -1815,10 +1827,14 @@ class EquipConsuPage extends Component {
<Text style={list_common_item.de_tip}>
序列号:{item.serial_number ? item.serial_number : '无'}
</Text>
{ OBS_MOBILE_EQU_CON_DISPLAY_PRICE === 'Y' && userEnteredPrice !== 'N' ?
<Text style={list_common_item.de_tip}>
消耗数量:{item.consumed_quantity}
</Text>
{ OBS_MOBILE_EQU_CON_DISPLAY_PRICE === 'Y' && userEnteredPrice !== 'N' && (
<Text style={list_common_item.de_tip}>
单价(¥){ item.sale_price }
</Text> : null }
</Text>)
}
</View>
)
}
......
......@@ -6,12 +6,13 @@ import HeadBackItem from '../../common/HeadBackItem';
import DetailsModel from './DetailsModel';
import { requestEquipDetails} from '../../../action/EquipAction';
import { connect } from 'react-redux';
import { show} from '../../../utils/Utils';
import { isBlank, show} from '../../../utils/Utils';
import LodingModel from '../../common/LodingModel';
import { exitLoginStatus } from '../../../action/LoginAction';
import { OBS_MOBILE_EQU_CON_DISPLAY_PRICE } from '../../../base/BaseConstants';
import { LOGIN_NO } from '../../../base/ActionTypes';
import moment from 'moment';
import * as R from 'ramda';
const CONSUM_SEARCH_VALUE_BAR_CODE = 'CONSUM_SEARCH_VALUE_BAR_CODE';
......@@ -204,6 +205,16 @@ class ConsumDetailsPage extends Component {
})
}
onChangeConsumeNumber(val, item) {
if (isNaN(val)) {
return show('请输入整数')
}
if (item.collected_quantity < Number(val)) {
show(`最大可消耗数量为${item.collected_quantity}`)
}
item.consumed_quantity = Number(val)
}
// 打开/关闭 共计已选弹窗
handleCloseSelectModal(show) {
this.setState({
......@@ -221,9 +232,19 @@ class ConsumDetailsPage extends Component {
this.handleCloseSelectModal(false)
let {localSelectOption, userEnteredPrice} = this.state
if(!localSelectOption.length) {
show('请选择耗材')
return
return show('请选择耗材')
}
const setConsumeQuantity = it => isBlank(it.consumed_quantity) && (it.consumed_quantity = it.collected_quantity)
R.map(setConsumeQuantity, localSelectOption)
const pred = item => {
let n = item.consumed_quantity
if (isBlank(n) || isNaN(n)) return false
n = Number(n)
return n > 0 && n <= item.collected_quantity
}
localSelectOption = R.filter(pred)(localSelectOption)
if(OBS_MOBILE_EQU_CON_DISPLAY_PRICE === 'Y' && userEnteredPrice !== 'N'){
this.props.navigation.navigate('FillUnitPricePage', {
title: '器械消耗 - 填写单价',
......@@ -329,6 +350,22 @@ class ConsumDetailsPage extends Component {
<Text style={[styles.rig_ser, styles.te_ot_thr]} numberOfLines={1}>
过期日期:{item.expiration_date && moment(item.expiration_date).format('YYYY-MM-DD') || '无'}
</Text>
<View style={styles.input_number_box}>
<Text style={[styles.rig_ser, styles.te_ot_thr]} numberOfLines={1}>
消耗数量:
</Text>
<TextInput
placeholder="数量"
underlineColorAndroid="transparent"
style={styles.input_number}
ref={textInput => this.TextInput = textInput}
onChangeText={(text) => this.onChangeConsumeNumber(text, item)}
defaultValue={R.toString(item.collected_quantity)}
/>
<Text style={[styles.rig_ser, styles.te_ot_thr]} numberOfLines={1}>
/ {item.collected_quantity}
</Text>
</View>
</View>
</TouchableOpacity>
)
......@@ -447,6 +484,17 @@ const styles = StyleSheet.create({
fontSize: third_text_size,
fontFamily: font_family_regular,
},
input_number_box: {
flexDirection: 'row',
},
input_number: {
width: pxSize(40),
borderWidth: pxSize(1),
borderColor: '#999',
textAlign: 'right',
paddingRight: pxSize(5),
paddingLeft: pxSize(5),
},
te_ot_str: {
fontFamily: font_family_semibold,
color: list_str_color
......
......@@ -23,7 +23,18 @@ class FillUnitPricePage extends Component {
feeSum() {
const {unitPriceOption} = this.state
return R.compose(R.sum, R.map(x => isNaN(x) ? 0 : x), R.pluck('local_add_price'))(unitPriceOption)
return R.compose(
R.sum,
R.map(
R.converge(
R.multiply,
[
R.prop('consumed_quantity'),
R.compose(x => isNaN(x) ? 0 : x, R.prop('local_add_price'))
]
)
)
)(unitPriceOption)
}
// 获取选择的数据
......@@ -120,6 +131,9 @@ class FillUnitPricePage extends Component {
<Text style={[styles.cont_ser, styles.te_ot_thr]}>
序列号:{item.serial_number ? item.serial_number : '无'}
</Text>
<Text style={[styles.cont_ser, styles.te_ot_thr]}>
数量:{item.consumed_quantity}
</Text>
<View style={styles.cont_pri}>
<Text style={styles.pri_icon}>*</Text>
<Text style={styles.pri_inner}>单价:</Text>
......
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