Commit bcde79f6 by Denglingling

增加提及时确认弹窗,以及保存当前选择产品的数据

(cherry picked from commit ab9a7841)
parent cb8feca4
import React, { Component } from 'react';
import { View, Text, StyleSheet, SafeAreaView, Modal, ScrollView, TouchableOpacity, FlatList, Image } from 'react-native';
import { pxHeight, foundation_color, promary_color, second_text_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style } from '../../base/BaseStyle';
import { pxHeight, foundation_color, promary_color, second_text_color, third_text_color, first_text_color, second_text_size, Width, pxSize, safe_view, font_family_medium, font_family_light, list_common_item, third_text_size, icon_style, point_color, title_text_color } from '../../base/BaseStyle';
import { FooterBtnStyle } from '../common/CellTextStyle';
import ChooseCardList from '../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../common/listDataComponent/PicTitDetaiCalcu';
......@@ -619,21 +619,34 @@ class ProductModel extends Component {
renderFooterBtnItem() {
let {topProcOptionList} = this.state
let allCountQuantity = 0
let sel_tip = ''
topProcOptionList.map(proItem => {
if(!proItem[SELECTED_QUQNTITY]){
proItem[SELECTED_QUQNTITY] = 0
}
allCountQuantity += proItem[SELECTED_QUQNTITY]
if (proItem[SELECTED_QUQNTITY] > 0) {
sel_tip += `${proItem.category_name}x${proItem[SELECTED_QUQNTITY]} `
}
})
// console.log('弹窗===', topProcOptionList, sel_tip)
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.lef_btn}
style={[list_common_item.lef_btn, styles.fo_btn_lef]}
onPress={() => this.handleCloseSelected()}
>
<Text style={list_common_item.lef_tip}>{'已选:'}<Text style={allCountQuantity!==0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text></Text>
<Text style={list_common_item.lef_tip} numberOfLines={1}>
{/* {'已选:'} */}
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>}
{allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>}
{/* <Text style={allCountQuantity!==0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text> */}
</Text>
{allCountQuantity === 0 ? null : <View style={styles.lef_btn_num}>
<Text style={styles.lef_num_txt}>{allCountQuantity}</Text>
</View>}
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
......@@ -787,6 +800,25 @@ const styles = StyleSheet.create({
fontSize: 12,
fontFamily: font_family_light,
paddingLeft: 4
},
fo_btn_lef: {
position: 'relative'
},
lef_btn_num: {
position: 'absolute',
left: 50,
top: 4,
backgroundColor: point_color,
borderRadius: 50,
},
lef_num_txt: {
fontSize: 12,
color: title_text_color,
minWidth: 16,
textAlign: 'center'
},
lef_tip_txt: {
fontSize: 12
}
})
......
......@@ -24,7 +24,8 @@ class PageListArrow extends Component {
otherInputCallBack: PropTypes.func,
listInputPlace: PropTypes.string,
inputCallBack: PropTypes.func,
isTitInputStyle: PropTypes.bool
isTitInputStyle: PropTypes.bool,
listMaxLines: PropTypes.number, // 文本最大行数
}
constructor(props) {
......@@ -42,7 +43,11 @@ class PageListArrow extends Component {
render() {
let {listActOpa, listCallBack, listHasAster, listEditAble, listDefaValue, listItem, listTitle,
listName, listHasArrow, listOtherInput, otherInput, otherInputCallBack, listInputPlace, inputCallBack, isTitInputStyle} = this.props
listName, listHasArrow, listOtherInput, otherInput, otherInputCallBack, listInputPlace,
inputCallBack, isTitInputStyle, listMaxLines} = this.props
if(!listMaxLines){
listMaxLines = 2 // 默认
}
return (
<View style={styles.item_container}>
<TouchableOpacity
......@@ -58,7 +63,7 @@ class PageListArrow extends Component {
defaultValue={listItem[listDefaValue]}
placeholder={listInputPlace}
onChangeText={(text) => {return inputCallBack ? inputCallBack(text) : ''}}
/> : <ContTextStyle>{listItem[listName]}</ContTextStyle>
/> : <ContTextStyle numberOfLines={listMaxLines}>{listItem[listName]}</ContTextStyle>
}
{ listHasArrow ? <View style={styles.arr_icon_box}>
<Image source={require('../../../images/arr_rig.png')} style={icon_style}/>
......
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
Modal,
ScrollView,
TouchableOpacity,
Image
} from 'react-native';
import {
Width,
pxHeight,
third_text_color,
second_text_color,
first_text_color,
safe_view,
pxSize,
font_family_medium,
icon_style,
font_family_regular,
font_family_semibold,
title_text_color,
promary_color
} from '../../../base/BaseStyle';
const PropTypes = require('prop-types');
/** 提示信息并有回调的弹窗 */
class TipInfoNeedSelect extends Component {
static propTypres = {
closeCallBack: PropTypes.func, // 取消回调
submitCallBack: PropTypes.func, // 确定回调
}
constructor(props) {
super(props);
this.state = {
isVisible: false,
title: '愿意自动更换器械包?'
}
}
show(newTitle){
let {title} = this.state
if(newTitle){
title = newTitle
}
this.setState({ isVisible: true, title: title })
}
hide(){
let {title} = this.state
this.setState({ isVisible: false, title: title})
}
closeModal() {
this.props.closeCallBack()
this.hide()
}
submitModal() {
this.props.submitCallBack()
this.hide()
}
renderDialog() {
let { title } = this.state
return (
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.modal_head}>
<View style={styles.modal_tit}>
<Image style={styles.err_icon} source={require('../../../images/err_tit.png')} />
<Text style={styles.inner_tit}>{title}</Text>
</View>
{/* <TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={styles.head_tou_clo}
>
<Image style={icon_style} source={require('../../../images/close_icon.png')}></Image>
</TouchableOpacity> */}
</View>
<View style={styles.model_footer}>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={[styles.foo_btn, styles.btn_cel]}
>
<Text style={[styles.btn_tit, styles.tit_cel]}>取消</Text>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
onPress={() => this.submitModal()}
style={[styles.foo_btn, styles.btn_sub]}
>
<Text style={styles.btn_tit}>确定</Text>
</TouchableOpacity>
</View>
</View>
</View>
)
}
render() {
return (
<View style={styles.dia_container}>
<Modal
transparent={true}
visible={this.state.isVisible}
animationType={'fade'}
// onRequestClose={() => this.closeModal()}
>
<View style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity>
</View>
</Modal>
</View>
);
}
}
const styles = StyleSheet.create({
dia_container: {
flex: 1,
},
// dis_cont: {
// width: '80%',
// maxHeight: '80%',
// backgroundColor: '#FFF',
// borderRadius: 8
// },
container: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
},
opt_area: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
position: 'relative'
},
modal_style: {
position: "absolute",
left: 0,
top: '30%',
width: Width() - 44,
flex: 1,
flexDirection: "column",
backgroundColor: '#ffffff',
minHeight: pxHeight(200),
borderRadius: 8,
marginHorizontal: 22,
paddingHorizontal: 18,
paddingTop: 32
},
// scro_box: {
// marginTop: 18,
// maxHeight: pxHeight(310),
// minHeight: pxHeight(220),
// borderWidth: 1,
// borderColor: '#eaeaea',
// paddingLeft: 6,
// borderRadius: 2,
// paddingBottom: 6
// },
// item_scroll: {},
modal_head: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'flex-end'
},
modal_tit: {
flexDirection: 'row',
alignItems: 'center'
},
err_icon: {
width: pxSize(18),
height: pxSize(18),
marginRight: 6
},
inner_tit: {
fontSize: 20,
fontFamily: font_family_semibold
},
head_tou_clo: {
width: pxSize(26),
height: pxSize(26),
marginBottom: 10
},
// cont_list: {},
// co_li: {
// lineHeight: 20,
// fontSize: 12,
// fontFamily: font_family_regular,
// color: second_text_color
// },
// co_str: {
// fontFamily: font_family_semibold,
// fontWeight: '500',
// fontSize: 14,
// paddingTop: 6,
// paddingBottom: 2,
// color: first_text_color
// },
// plan_num: {
// fontSize: 14,
// fontFamily: font_family_semibold
// },
// sto_num: {
// fontSize: 14,
// fontFamily: font_family_semibold,
// color: 'red'
// },
model_footer: {
paddingTop: 30,
flexDirection: 'row',
justifyContent: 'space-around'
},
foo_btn: {
width: '38%',
height: pxSize(36),
borderRadius: 4,
marginTop: 20
},
btn_cel: {
backgroundColor: '#E7F1FD'
},
btn_sub: {
backgroundColor: promary_color
},
btn_tit: {
fontSize: 16,
color: title_text_color,
textAlign: 'center',
lineHeight: 32
},
tit_cel: {
color: '#007EFF'
},
})
export default TipInfoNeedSelect;
\ No newline at end of file
......@@ -24,6 +24,9 @@ import { exitLoginStatus } from '../../action/LoginAction';
import { SELF_ORDER_LIST_DOING, SELF_ORDER_LIST_SUCCESS, SELF_ORDER_LIST_FAILURE, LOGIN_NO, SELF_SUBMIT_DOING, SELF_SUBMIT_SUCCESS, SELF_SUBMIT_FAILURE } from '../../base/ActionTypes';
import PageListArrow from '../common/listDataComponent/PageListArrow';
import EmitterEvents from '../common/EmitterEvents';
import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
const SELECTED_QUQNTITY = 'selectedQuantity'
class SelfOrderPage extends Component {
constructor(props) {
......@@ -156,15 +159,17 @@ class SelfOrderPage extends Component {
stop: false, //录音是否停止
currentTime: 0, //录音时长
localCustomersOption: [], // 当前医院信息:客户名称、收单地点、收货地点、主治医生
local_tip:{
will: 'N', // 器械包
take_cert: 'N' // 合格证
}
}
}
componentDidMount() {
this.getSellerName()
this.getAudioAuthorize()
this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => {
console.log('选择产品返回==', params)
})
this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => this.productCallBack(params))
}
componentWillUnmount() {
......@@ -1199,6 +1204,28 @@ class SelfOrderPage extends Component {
})
}
// 选择产品 回调
productCallBack(params) {
let {listOptionData} = this.state
// console.log('选择产品返回=!!!!=', params)
// console.log('选择产品返回=!!!!=', this)
// console.log('选择产品返回=!!!!=', this.state)
listOptionData[10].value = ''
if(params && params.local_lines) {
params.local_lines.forEach(loc_item => {
if(loc_item[SELECTED_QUQNTITY] > 0){
listOptionData[10].value += `${loc_item.supplier_short_name}x${loc_item[SELECTED_QUQNTITY]} `
}
})
listOptionData[10].name = listOptionData[10].value
}
// console.log('选择产品返回=!!!=', listOptionData[10])
this.setState({
listOptionData: listOptionData
})
}
// 备注 输入
handleRemarkInput(text, curData) {
let { listOptionData } = this.state
......@@ -1216,6 +1243,12 @@ class SelfOrderPage extends Component {
// 生成订单 点击
handleSubmit() {
console.log('生成订单', this.props.navigation)
this.refs.PackageModel.show()
// this.refs.CertModel.show('需要携带合格证?')
// this.changeCanSub(true)
// let { state, props } = this
// let that = this
......@@ -1351,6 +1384,18 @@ class SelfOrderPage extends Component {
stop: false
})
}
// 提交的提示回调函数
modelPackageCertCB(typeName, nowVal){
let {local_tip} = this.state
local_tip[typeName] = nowVal
this.setState({
local_tip: local_tip
})
console.log('local_tip---', local_tip)
}
// // 库存不足弹窗回调 -- 确定
// handleNotEnoughCallBack() {
// let { submitOption } = this.state
......@@ -1627,6 +1672,7 @@ class SelfOrderPage extends Component {
listTitle={'title'}
listCallBack={() => this.handleProductCheck(listOptionData[10])}
listHasArrow={true}
listMaxLines={1}
/>
{/* <View style={styles.item_container}>
<TouchableOpacity
......@@ -1650,6 +1696,8 @@ class SelfOrderPage extends Component {
/>
{ this.renderPickerModel() }
{ this.renderTipModelPackage() }
{ this.renderTipModelCert() }
</View>
)
......@@ -1765,6 +1813,20 @@ class SelfOrderPage extends Component {
)
}
// 返回提交器械包提示
renderTipModelPackage(){
return (
<TipInfoNeedSelect ref="PackageModel" closeCallBack={() => this.modelPackageCertCB('will','N')} submitCallBack={() => this.modelPackageCertCB('will','Y')}/>
)
}
// 返回提交合格证提示
renderTipModelCert(){
return (
<TipInfoNeedSelect ref="CertModel" closeCallBack={() => this.modelPackageCertCB('take_cert','N')} submitCallBack={() => this.modelPackageCertCB('take_cert','Y')}/>
)
}
render() {
let {canSubFlag} = this.state
// console.log(this.props)
......
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, DeviceEventEmitter, SafeAreaView } from 'react-native';
import { connect } from 'react-redux';
import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item } from '../../../base/BaseStyle';
import { foundation_color, home_background_color, Width, third_text_size, pxSize, promary_color, safe_view, font_family_regular, icon_style, title_text_color, font_family_medium, list_common_item, point_color } from '../../../base/BaseStyle';
import HeadBackItem from '../../common/HeadBackItem';
import ProductRightStyle from './ProductRightStyle';
import ProductModel from '../../common/ProductModel';
......@@ -80,7 +80,7 @@ class ChooseProductPage extends Component {
setSelectProductOpts(topProcOptionList)
// 并且=======调用返回
this.props.navigation.goBack()
DeviceEventEmitter.emit(EmitterEvents.BACK_TO_SELF_PAGE, { topProcOptionList: topProcOptionList, testOne: '你好' })
DeviceEventEmitter.emit(EmitterEvents.BACK_TO_SELF_PAGE, { local_lines: topProcOptionList })
}
// 初始化获取数据
......@@ -648,9 +648,15 @@ class ChooseProductPage extends Component {
// console.log('--已选修改回调--', options)
let { topProcOptionList, topActiveIndex } = this.state
topProcOptionList[topActiveIndex].leftOptionList = options
topProcOptionList[topActiveIndex][SELECTED_QUQNTITY] = 0
options.forEach(cur_ops => {
if(cur_ops[SELECTED_QUQNTITY] > 0){
topProcOptionList[topActiveIndex][SELECTED_QUQNTITY] += cur_ops[SELECTED_QUQNTITY]
}
})
this.setState({
// leftOptionList: options,
topProcOptionList
// leftOptionList: options,
})
}
......@@ -801,20 +807,36 @@ class ChooseProductPage extends Component {
let { selectShowPopup, leftOptionList, topProcOptionList, topActiveIndex } = this.state
let allCountQuantity = this.getAllCountQuantity()
let cur_sel_options = []
let sel_tip = ''
// cur_sel_options = leftOptionList
if (topProcOptionList.length > 0) {
cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList
cur_sel_options.forEach(cur_item => {
if (cur_item[SELECTED_QUQNTITY] > 0) {
sel_tip += `${cur_item.category_name}x${cur_item[SELECTED_QUQNTITY]} `
}
})
}
console.log('返回底部按钮----', cur_sel_options)
console.log('返回底部按钮----', cur_sel_options, sel_tip)
return (
<View style={list_common_item.sub_box}>
<View style={list_common_item.sub_two_btn}>
<TouchableOpacity
activeOpacity={.8}
style={list_common_item.lef_btn}
style={[list_common_item.lef_btn, styles.fo_btn_lef]}
onPress={() => this.handleSubSelected()}
>
<Text style={list_common_item.lef_tip}>{'已选:'}<Text style={allCountQuantity !== 0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text></Text>
<Text style={list_common_item.lef_tip} numberOfLines={1}>
{/* {'已选'} */}
{allCountQuantity === 0 ? <Text>{'未选'}</Text> : <Text>{'已选: '}</Text>}
{allCountQuantity === 0 ? null : <Text style={styles.lef_tip_txt}>{sel_tip}</Text>}
{/* <Text style={allCountQuantity !== 0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text> */}
</Text>
{allCountQuantity === 0 ? null : <View style={styles.lef_btn_num}>
<Text style={styles.lef_num_txt}>{allCountQuantity}</Text>
</View>}
</TouchableOpacity>
<TouchableOpacity
activeOpacity={.8}
......@@ -988,6 +1010,25 @@ const styles = StyleSheet.create({
fontSize: 16,
fontFamily: font_family_medium
},
fo_btn_lef: {
position: 'relative'
},
lef_btn_num: {
position: 'absolute',
left: 50,
top: 4,
backgroundColor: point_color,
borderRadius: 50,
},
lef_num_txt: {
fontSize: 12,
color: title_text_color,
minWidth: 16,
textAlign: 'center'
},
lef_tip_txt: {
fontSize: 12
}
})
const mapStateToProps = (state) => {
......
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