Commit 48af5802 by wong.peiyi

消耗价格及费用汇总

parent 3878bca4
......@@ -1357,6 +1357,10 @@ class EquipConsuPage extends Component {
})
}
/**
* @description: 耗材总金额
* @return {*}
*/
consumeSum() {
try {
const {listOptionData} = this.state
......@@ -1366,6 +1370,20 @@ class EquipConsuPage extends Component {
}
}
feeSum() {
try {
const {listOptionData} = this.state
return R.compose(
R.sum,
R.map(x => Number(x)),
R.pluck('fee_amount'),
R.pathOr([], [13, 'subOption'])
)(listOptionData)
} catch (error) {
return 0
}
}
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop, sysValues } = this.state
......@@ -1632,10 +1650,9 @@ class EquipConsuPage extends Component {
return (
<CellTextStyle style={list_common_item.consu_detail}>
<View style={list_common_item.detail_inner}>
<View style={list_common_item.detail_title_box}>
{/* <View style={list_common_item.detail_title_box}> */}
<Text style={list_common_item.detail_tit}>耗材明细</Text>
<Text style={list_common_item.detail_tit}>总金额(){sum}</Text>
</View>
{/* </View> */}
{
state.listOptionData[12].subOption.length ?
......@@ -1645,6 +1662,7 @@ class EquipConsuPage extends Component {
<Text style={list_common_item.detail_tit_text}>
耗材({state.listOptionData[12].subOption.length}
</Text>
<Text style={list_common_item.detail_tit_text}>耗材总金额:{sum}</Text>
</View>
{
state.listOptionData[12].isShowSub ?
......@@ -1691,6 +1709,8 @@ class EquipConsuPage extends Component {
// 返回费用明细
renderChargeDetailsItem() {
let { state } = this
const sum = this.feeSum()
return (
<CellTextStyle style={list_common_item.consu_detail}>
<View style={list_common_item.detail_inner}>
......@@ -1703,6 +1723,7 @@ class EquipConsuPage extends Component {
<Text style={list_common_item.detail_tit_text}>
费用({state.listOptionData[13].subOption.length}
</Text>
<Text style={list_common_item.detail_tit_text}>费用总金额:{sum}</Text>
</View>
{
state.listOptionData[13].isShowSub ?
......@@ -1745,10 +1766,15 @@ class EquipConsuPage extends Component {
// 返回添加图片
renderAddPicturesItem() {
let { state } = this
const sum = this.feeSum() + this.consumeSum()
return (
<CellTextStyle style={list_common_item.consu_addpic}>
<View style={list_common_item.addpic_inner}>
<Text style={list_common_item.addpic_tit}>添加图片</Text>
<View style={list_common_item.detail_title_box}>
<Text style={list_common_item.addpic_tit}>添加图片</Text>
<Text style={list_common_item.detail_tit}>耗材+费用总金额:{sum}</Text>
</View>
<View style={list_common_item.addpic_cont}>
{state.localPhoOption.length
? state.localPhoOption.map((item, index) => this.renderPicItem(item, index) )
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ScrollView, FlatList, TextInput } from 'react-native';
import { home_background_color, promary_color, safe_view, list_common_item, placehold_text_color, second_text_size, promary_text_color, font_family_regular, font_family_medium, list_tit_color, list_str_color, list_one_color, list_thr_color, third_text_size, font_family_semibold } from '../../../base/BaseStyle';
import {second_text_color, home_background_color, promary_color, safe_view, list_common_item, placehold_text_color, second_text_size, promary_text_color, font_family_regular, font_family_medium, list_tit_color, list_str_color, list_one_color, list_thr_color, third_text_size, font_family_semibold, third_text_color } from '../../../base/BaseStyle';
import StatusBarView from '../../common/StatusBarView';
import HeadBackItem from '../../common/HeadBackItem';
import { show } from '../../../utils/Utils';
import { setSubdetailOption } from '../../../action/EquipAction';
import { connect } from 'react-redux';
import * as R from 'ramda';
// 可填写单价
class FillUnitPricePage extends Component {
constructor(props) {
super(props);
this.state = {
this.state = {
unitPriceOption: []
}
}
......@@ -20,6 +21,11 @@ class FillUnitPricePage extends Component {
this.getLocalSelectedData()
}
feeSum() {
const {unitPriceOption} = this.state
return R.compose(R.sum, R.map(x => isNaN(x) ? 0 : x), R.pluck('local_add_price'))(unitPriceOption)
}
// 获取选择的数据
getLocalSelectedData() {
let {localSelectOption} = this.props.navigation.state.params
......@@ -157,7 +163,10 @@ class FillUnitPricePage extends Component {
render() {
let {navigation} = this.props
let {title} = navigation.state.params
return (
const {unitPriceOption} = this.state
const sum = this.feeSum()
return (
<View style={styles.cu_dl_container}>
<StatusBarView
isReactStackNavigator={true}
......@@ -168,6 +177,10 @@ class FillUnitPricePage extends Component {
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.cu_dl_main}>
{ this.renderContItem() }
<View style={styles.sum_box}>
<Text style={styles.sum_text}>总数量:{unitPriceOption.length}</Text>
<Text style={styles.sum_text}>总金额:{sum}</Text>
</View>
</View>
{this.renderFooterBtnItem()}
</SafeAreaView>
......@@ -241,9 +254,16 @@ const styles = StyleSheet.create({
fontSize: 14,
color: list_thr_color
},
sum_box: {
flexDirection: 'row',
justifyContent: 'flex-end',
paddingTop: 15,
paddingBottom:15
},
sum_text: {
color: second_text_color,
paddingRight: 20,
},
fot_btn: {
width: '100%',
borderRadius: 10
......@@ -261,5 +281,5 @@ const mapDispatchToProps = (dispatch) => {
}
}
}
export default connect(mapStateToProps, mapDispatchToProps)(FillUnitPricePage);
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(FillUnitPricePage);
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