Commit 48af5802 by wong.peiyi

消耗价格及费用汇总

parent 3878bca4
...@@ -1357,6 +1357,10 @@ class EquipConsuPage extends Component { ...@@ -1357,6 +1357,10 @@ class EquipConsuPage extends Component {
}) })
} }
/**
* @description: 耗材总金额
* @return {*}
*/
consumeSum() { consumeSum() {
try { try {
const {listOptionData} = this.state const {listOptionData} = this.state
...@@ -1366,6 +1370,20 @@ class EquipConsuPage extends Component { ...@@ -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() { renderListItem() {
let { listOptionData, dateModelPop, sysValues } = this.state let { listOptionData, dateModelPop, sysValues } = this.state
...@@ -1632,10 +1650,9 @@ class EquipConsuPage extends Component { ...@@ -1632,10 +1650,9 @@ class EquipConsuPage 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}>
<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}>耗材明细</Text>
<Text style={list_common_item.detail_tit}>总金额(){sum}</Text> {/* </View> */}
</View>
{ {
state.listOptionData[12].subOption.length ? state.listOptionData[12].subOption.length ?
...@@ -1645,6 +1662,7 @@ class EquipConsuPage extends Component { ...@@ -1645,6 +1662,7 @@ class EquipConsuPage extends Component {
<Text style={list_common_item.detail_tit_text}> <Text style={list_common_item.detail_tit_text}>
耗材({state.listOptionData[12].subOption.length} 耗材({state.listOptionData[12].subOption.length}
</Text> </Text>
<Text style={list_common_item.detail_tit_text}>耗材总金额:{sum}</Text>
</View> </View>
{ {
state.listOptionData[12].isShowSub ? state.listOptionData[12].isShowSub ?
...@@ -1691,6 +1709,8 @@ class EquipConsuPage extends Component { ...@@ -1691,6 +1709,8 @@ class EquipConsuPage extends Component {
// 返回费用明细 // 返回费用明细
renderChargeDetailsItem() { renderChargeDetailsItem() {
let { state } = this let { state } = this
const sum = this.feeSum()
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}>
...@@ -1703,6 +1723,7 @@ class EquipConsuPage extends Component { ...@@ -1703,6 +1723,7 @@ class EquipConsuPage extends Component {
<Text style={list_common_item.detail_tit_text}> <Text style={list_common_item.detail_tit_text}>
费用({state.listOptionData[13].subOption.length} 费用({state.listOptionData[13].subOption.length}
</Text> </Text>
<Text style={list_common_item.detail_tit_text}>费用总金额:{sum}</Text>
</View> </View>
{ {
state.listOptionData[13].isShowSub ? state.listOptionData[13].isShowSub ?
...@@ -1745,10 +1766,15 @@ class EquipConsuPage extends Component { ...@@ -1745,10 +1766,15 @@ class EquipConsuPage extends Component {
// 返回添加图片 // 返回添加图片
renderAddPicturesItem() { renderAddPicturesItem() {
let { state } = this let { state } = this
const sum = this.feeSum() + this.consumeSum()
return ( return (
<CellTextStyle style={list_common_item.consu_addpic}> <CellTextStyle style={list_common_item.consu_addpic}>
<View style={list_common_item.addpic_inner}> <View style={list_common_item.addpic_inner}>
<View style={list_common_item.detail_title_box}>
<Text style={list_common_item.addpic_tit}>添加图片</Text> <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}> <View style={list_common_item.addpic_cont}>
{state.localPhoOption.length {state.localPhoOption.length
? state.localPhoOption.map((item, index) => this.renderPicItem(item, index) ) ? state.localPhoOption.map((item, index) => this.renderPicItem(item, index) )
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ScrollView, FlatList, TextInput } from 'react-native'; 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 StatusBarView from '../../common/StatusBarView';
import HeadBackItem from '../../common/HeadBackItem'; import HeadBackItem from '../../common/HeadBackItem';
import { show } from '../../../utils/Utils'; import { show } from '../../../utils/Utils';
import { setSubdetailOption } from '../../../action/EquipAction'; import { setSubdetailOption } from '../../../action/EquipAction';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import * as R from 'ramda';
// 可填写单价 // 可填写单价
class FillUnitPricePage extends Component { class FillUnitPricePage extends Component {
...@@ -20,6 +21,11 @@ class FillUnitPricePage extends Component { ...@@ -20,6 +21,11 @@ class FillUnitPricePage extends Component {
this.getLocalSelectedData() 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() { getLocalSelectedData() {
let {localSelectOption} = this.props.navigation.state.params let {localSelectOption} = this.props.navigation.state.params
...@@ -157,6 +163,9 @@ class FillUnitPricePage extends Component { ...@@ -157,6 +163,9 @@ class FillUnitPricePage extends Component {
render() { render() {
let {navigation} = this.props let {navigation} = this.props
let {title} = navigation.state.params let {title} = navigation.state.params
const {unitPriceOption} = this.state
const sum = this.feeSum()
return ( return (
<View style={styles.cu_dl_container}> <View style={styles.cu_dl_container}>
<StatusBarView <StatusBarView
...@@ -168,6 +177,10 @@ class FillUnitPricePage extends Component { ...@@ -168,6 +177,10 @@ class FillUnitPricePage extends Component {
<HeadBackItem title={title} navigation={navigation} /> <HeadBackItem title={title} navigation={navigation} />
<View style={styles.cu_dl_main}> <View style={styles.cu_dl_main}>
{ this.renderContItem() } { this.renderContItem() }
<View style={styles.sum_box}>
<Text style={styles.sum_text}>总数量:{unitPriceOption.length}</Text>
<Text style={styles.sum_text}>总金额:{sum}</Text>
</View>
</View> </View>
{this.renderFooterBtnItem()} {this.renderFooterBtnItem()}
</SafeAreaView> </SafeAreaView>
...@@ -241,9 +254,16 @@ const styles = StyleSheet.create({ ...@@ -241,9 +254,16 @@ const styles = StyleSheet.create({
fontSize: 14, fontSize: 14,
color: list_thr_color 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: { fot_btn: {
width: '100%', width: '100%',
borderRadius: 10 borderRadius: 10
......
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