Commit bdddd9dc by Denglingling

调整自助下单-选择产品模块(本地模拟数据,以及部分交互)

(cherry picked from commit 74ee86e9)
parent 53b5604c
......@@ -354,17 +354,38 @@ class ProductModel extends Component {
// 修改列表计算后数据
handleCalCallBack(item, index){
// console.log('回调=====', item, index)
console.log('回调=====', item, index)
let {topProcOptionList, topActiveIndex} = this.state
let defauIndex = index
// SUB_LINE_NAME = 'childrenLineData' // 测试 item.superIndex
defauIndex = item.superIndex
// console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
if(SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]) {
let allCountQuantity = 0 // 初始化
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
if(topActiveIndex === 1 || topActiveIndex === 3 || topActiveIndex === 2){
//钉盒 零散器械
//初始化 中类
let deleFlag = false
let deleInd = null
listItem[SELECTED_QUQNTITY] = 0
listItem[SELECTED_DATA_ARR].forEach(function(seDa, seInd) {
if(!seDa[DEFAULT_QUANTITY]){
seDa[DEFAULT_QUANTITY] = 0
}
if(seDa[DEFAULT_QUANTITY] === 0){
deleFlag = true
deleInd = seInd
}
listItem[SELECTED_QUQNTITY] += Number(seDa[DEFAULT_QUANTITY])
})
if(deleFlag) {
listItem[SELECTED_DATA_ARR].splice(deleInd, 1)
}
}else {
let deleFlag = false
let deleInd = null
// 初始化 三级
......@@ -385,6 +406,7 @@ class ProductModel extends Component {
if(deleFlag) {
listItem[SELECTED_DATA_ARR][defauIndex]['childrenLineData'].splice(deleInd, 1)
}
// 初始化 中类
listItem[SELECTED_QUQNTITY] = 0
listItem[SELECTED_DATA_ARR].forEach(function(seDa) {
......@@ -397,7 +419,6 @@ class ProductModel extends Component {
let curObj = listItem[SELECTED_DATA_ARR][defauIndex]
// console.log('curObj----', curObj)
if(listIndex < 4){
if(curObj.id){
listItem[DEFAULT_SECOND_DATA].forEach(function(deIt) {
if(deIt.id === curObj.id){ // 本地测试'id'为唯一值
......@@ -405,9 +426,10 @@ class ProductModel extends Component {
}
})
}
}
}
}
if(!listItem[SELECTED_QUQNTITY]){
listItem[SELECTED_QUQNTITY] = 0
}
......@@ -492,12 +514,17 @@ class ProductModel extends Component {
renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state
let curData = topProcOptionList[topActiveIndex]
// console.log('已选展示信息 === curData---', topProcOptionList, topActiveIndex, curData)
// console.log('已选展示信息 === curData---', topProcOptionList)
// console.log('已选展示信息 === curData---', topActiveIndex)
// console.log('已选展示信息 === curData---', curData)
let localBottomContData = []
if(curData && curData[SELECTED_DATA_ARR]){
// localBottomContData = curData[SELECTED_DATA_ARR]
curData[SELECTED_DATA_ARR].forEach(function(sedItem) {
if(sedItem[CHILD_DATA_NAME]){
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械
localBottomContData.push(sedItem)
}else if(sedItem[CHILD_DATA_NAME]){
localBottomContData.push(...sedItem[CHILD_DATA_NAME])
}
})
......@@ -525,6 +552,20 @@ class ProductModel extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let {topActiveIndex} = this.state
let curTitText='', curTipTextOne='', curTipTextTwo=''
if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
//钉盒 零散器械
curTitText = 'title'
curTipTextOne = 'tip1'
curTipTextTwo = 'tip2'
if(topActiveIndex === 2){
curTipTextOne = 'lineTip'
curTipTextTwo = ''
}
}else {
curTitText = 'superTit'
curTipTextOne = 'superTip'
}
return (
<TouchableOpacity
activeOpacity={1}
......@@ -535,8 +576,9 @@ class ProductModel extends Component {
listIndex={index}
calField={DEFAULT_QUANTITY}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index)}
titText={'superTit'}
tipTextOne={'superTip'}
titText={curTitText}
tipTextOne={curTipTextOne}
tipTextTwo={curTipTextTwo}
// listImgIcon={'superImg'}
listPicType={'SQUARE'}
listStyleImg={styles.list_icon}
......@@ -607,7 +649,7 @@ class ProductModel extends Component {
onRequestClose={() => this.closeModal()}>
<SafeAreaView style={safe_view}>
<TouchableOpacity style={styles.container} activeOpacity={1}
// onPress={() => this.closeModal()}
onPress={() => this.closeModal()}
>
{this.renderDialog()}
</TouchableOpacity>
......@@ -642,7 +684,7 @@ const styles = StyleSheet.create({
backgroundColor: '#ffffff',
borderTopLeftRadius: 12,
borderTopRightRadius: 12,
height: pxHeight(580),
height: pxHeight(680),
// maxHeight: pxHeight(580),
// minHeight: pxHeight(360)
},
......
......@@ -38,7 +38,8 @@ class ChooseCardList extends Component {
cardCountName: PropTypes.string, // 显示计数字段
cardStyleType: PropTypes.object, // 计数样式
cardStyleType: PropTypes.string, // 计数可选样式
cardCouStyle: PropTypes.object, // 指定计数样式
// cardCountArray: PropTypes.array, // 已选数组
......@@ -78,15 +79,13 @@ class ChooseCardList extends Component {
render() {
let {cardScrollEnabled, cardHorizontal, cardShowsHorizontalScrollIndicator, cardShowsVerticalScrollIndicator, cardStyleBox, cardStyleScroll, cardListOptions, cardItemTitle, cardItemIcon, cardImgName, cardItemName,
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, ...props} = this.props
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, cardCouStyle, ...props} = this.props
let {countStyleType} = this.state
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
cardListOptions[cardImgName] = localTestImageUrls // 本地测试
return (
<View style={[styles.card_container, cardStyleBox]}>
<ScrollView
......@@ -96,8 +95,11 @@ class ChooseCardList extends Component {
showsVerticalScrollIndicator={!!cardShowsVerticalScrollIndicator}
style={[styles.card_scroll_box,cardStyleScroll]}
>
{ cardListOptions.map((item, index) =>
<View style={styles.card_list_box}>
{ cardListOptions.map((item, index) => {
if(typeof item[cardItemIcon] === 'string'){
item[cardItemIcon] = {uri: item[cardItemIcon]}
}
return <View style={styles.card_list_box}>
<TouchableOpacity
activeOpacity={.8}
style={styles.list_touch_cont}
......@@ -109,15 +111,16 @@ class ChooseCardList extends Component {
</View> : null }
<Text numberOfLines={2} style={[styles.list_item_tit, cardStyleItemTit, item[cardItemIcon] ? '' : cardStyleNotIconTit, index == curActIndex ? [styles.list_tit_act, cardStyleItemTitAct] : '']}>
{item[cardItemTitle]}
{ (item[cardCountName] && countStyleType[0] === cardStyleType) ? <Text style={styles.sum_def}>({item[cardCountName]})</Text> : null }
{ (item[cardCountName] && countStyleType[0] === cardStyleType) ? <Text style={[styles.sum_def, cardCouStyle]}>({item[cardCountName]})</Text> : null }
</Text>
</View>
</TouchableOpacity>
{ (item[cardCountName] && countStyleType[1] === cardStyleType) ? <View style={styles.card_def_count}>
{ (item[cardCountName] && countStyleType[1] === cardStyleType) ? <View style={[styles.card_def_count, cardCouStyle]}>
<Text style={styles.def_count_txt}>{item[cardCountName]}</Text>
</View> : null}
</View>
)
})
}
</ScrollView>
......@@ -142,7 +145,8 @@ const styles = StyleSheet.create({
marginRight: 14,
borderBottomWidth: 4,
borderBottomColor: home_background_color,
minWidth: 60
minWidth: 60,
maxWidth: 80
},
list_inner_act: {
borderBottomWidth: 2,
......
......@@ -34,6 +34,8 @@ class PicTitDetaiCalcu extends Component {
listCardActIndex: PropTypes.number, // 父级index = 展示index
listStyleClearBtn: PropTypes.object,
clearCallBack: PropTypes.func, // 清空图标回调函数
onlyShowNum: PropTypes.bool, // 只展示数字
onlyShowSelect: PropTypes.bool, // 只能单选
}
constructor(props) {
......@@ -49,6 +51,12 @@ class PicTitDetaiCalcu extends Component {
// reduceCallBack(item, index)
// }
// 单选点击
handelSelectCheck(item, index){
item.select = !!!item.select
this.props.subCalCallBack(item, index)
}
/**
* 点击加减
* @param {object} item 当前小类数据
......@@ -82,7 +90,8 @@ class PicTitDetaiCalcu extends Component {
render() {
let {listItem, listIndex, calField, listStyleBox, listStyleTit, listStyleTip, listStyleCalBtn, listPicType, titCallBack,
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex, listStyleClearBtn, clearCallBack} = this.props
titText, tipTextStr, tipTextOne, tipTextTwo, listImgIcon, listStyleImg, showClearIcon, showClearIndex, listCardActIndex,
listStyleClearBtn, clearCallBack, onlyShowNum, onlyShowSelect, tipTextStrTit, tipTextOneTit, tipTextTwoTit} = this.props
let {listPicTypeArr, picStyleArr} = this.state
let picOthStyle = ''
if(listPicTypeArr.indexOf(listPicType) > -1){
......@@ -93,8 +102,13 @@ class PicTitDetaiCalcu extends Component {
if(!valIsZero) {
calIcon = require('../../../images/plur_big_act.png')
}
let defSelIcon = require('../../../images/radio_no.png')
if(onlyShowSelect && listItem.select){
defSelIcon = require('../../../images/radio_yes.png')
}
console.log('每一列----',listItem[listImgIcon], listItem[listImgIcon] instanceof Array)
// console.log('每一列----',listItem[listImgIcon], listItem[listImgIcon] instanceof Array)
return (
......@@ -164,7 +178,7 @@ class PicTitDetaiCalcu extends Component {
</View> : null }
<View style={styles.ri_text_box}>
<TouchableOpacity
activeOpacity={.8}
activeOpacity={titCallBack ? .8 : 1}
onPress={() => {titCallBack ? titCallBack(listItem, listIndex) : {}}}
style={styles.oth_box}
>
......@@ -188,8 +202,9 @@ class PicTitDetaiCalcu extends Component {
<Image source={require('../../../images/close_icon.png')} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View> : <View style={styles.ri_num_box}>
{ listItem[calField] !== 0 ?
</View> :
<View style={[styles.ri_num_box, onlyShowNum ? styles.show_num_box : null]}>
{ (listItem[calField] !== 0 && !onlyShowNum && !onlyShowSelect) ?
<TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
......@@ -199,8 +214,8 @@ class PicTitDetaiCalcu extends Component {
<Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
</View>
</TouchableOpacity> : null }
{ listItem[calField] !== 0 ? <Text style={styles.thr_num}>{ listItem[calField] }</Text> : null}
<TouchableOpacity
{ (listItem[calField] !== 0 && !onlyShowSelect) ? <Text style={[styles.thr_num, onlyShowNum ? styles.show_num : null]}>{ listItem[calField] }</Text> : null}
{ (!onlyShowNum && !onlyShowSelect) ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_inner, listStyleCalBtn]}
onPress={() => this.handelCalculation(listItem, listIndex, true)}
......@@ -208,9 +223,19 @@ class PicTitDetaiCalcu extends Component {
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={calIcon} style={icon_style}></Image>
</View>
</TouchableOpacity>
</View>
</TouchableOpacity> : null}
{ onlyShowSelect ? <TouchableOpacity
activeOpacity={.9}
style={[styles.btn_sel_inner]}
onPress={() => this.handelSelectCheck(listItem, listIndex)}
>
<View style={[styles.thr_sel_btn]}>
<Image source={defSelIcon} style={icon_style}></Image>
</View>
</TouchableOpacity> : null
}
</View>
}
</View>
......@@ -270,7 +295,12 @@ const styles = StyleSheet.create({
width: pxSize(24),
height: pxSize(30)
},
thr_sel_btn: {
width: pxSize(22),
height: pxSize(22)
},
btn_inner: {},
btn_sel_inner:{},
btn_cle_box:{
marginRight: 6,
// backgroundColor: 'red',
......@@ -290,6 +320,9 @@ const styles = StyleSheet.create({
marginLeft: 6,
backgroundColor: home_background_color
},
show_num_box: {
backgroundColor: null
},
thr_btn_left: {},
thr_btn_right: {},
thr_num: {
......@@ -299,6 +332,9 @@ const styles = StyleSheet.create({
fontSize: 14,
color: first_text_color
},
show_num: {
fontSize: 18
}
})
export default PicTitDetaiCalcu;
\ No newline at end of file
......@@ -560,11 +560,7 @@ class EquipConsuPage extends Component {
handleCallBack(item, itemTitle) {
let { listOptionData} = this.state
let self = this
this.setState({
currentItem: item,
})
this.setState({
listOptionData: listOptionData.map((chItem, index) => {
listOptionData.map(function(chItem, index){
if(chItem.title === itemTitle) {
chItem.name = item.name
chItem.value = item.value
......@@ -590,11 +586,46 @@ class EquipConsuPage extends Component {
listOptionData[10].value = item.desc
}
}
return chItem
})
}, () => {
this.setState({
currentItem: item,
listOptionData: listOptionData
},() => {
self.changeCanSub()
})
// this.setState({
// listOptionData: listOptionData.map((chItem, index) => {
// if(chItem.title === itemTitle) {
// chItem.name = item.name
// chItem.value = item.value
// if(itemTitle === '组织') {
// self.clearInitNameAndValue(1)
// }
// if(itemTitle === '客户名称') {
// self.clearInitNameAndValue(2)
// }
// if (itemTitle === '主治医生') {
// if(item.name === '其他') {
// chItem.showInput = true
// } else {
// chItem.showInput = false
// chItem.inputValue = ''
// }
// self.clearInitNameAndValue(5)
// }
// if(itemTitle === '手术类型') {
// self.clearInitNameAndValue(6)
// }
// if (itemTitle === '手术模板') {
// listOptionData[10].value = item.desc
// }
// }
// return chItem
// })
// }, () => {
// self.changeCanSub()
// })
}
// 关闭弹窗
......@@ -700,7 +731,7 @@ class EquipConsuPage extends Component {
}
// 客户名称 点击
handleCustomerCheck() {
let { state, props } = this
let { state } = this
let self = this
if(this.judgeOrgIsNull()) {
self.setState({
......
......@@ -47,7 +47,9 @@ class EditThirdLevelPage extends Component {
super(props);
this.state = {
topProcOptionList: [],
topActiveIndex: 0
topActiveIndex: 0,
onlyShow: false, // 只展示
onlySignSelect: false, // 单选
}
}
......@@ -55,21 +57,62 @@ class EditThirdLevelPage extends Component {
let {params} = this.props.navigation.state
let that = this
// console.log('本地测试数据====localMockData===', localMockData)
// console.log('父组件传递的值==', params)
console.log('父组件传递的值==', params)
// 赋值测试数据
let curOptions = []
if(params.superData.leftIndex === 1){
// 钉盒
curOptions = cloneObject(localMockData.localThridOption_dh)
this.setState({
onlyShow: params.superData.thirdShow,
topProcOptionList: curOptions
})
}else if(params.superData.leftIndex === 2) {
// 器械包
curOptions = cloneObject(localMockData.localThridOption_qxb)
if(curOptions.length > 0){
curOptions.forEach(function(curIt) {
curIt.select = false // 初始化
})
}
this.setState({
onlySignSelect: params.superData.thirdSign,
topProcOptionList: curOptions
})
}else {
curOptions = cloneObject(localMockData.localThridOption)
this.setState({
topProcOptionList: cloneObject(localMockData.localThridOption)
topProcOptionList: curOptions
}, () => {
that.setAllSelectData()
})
}
}
// 修改列表计算后数据
handleCalCallBack(item, index, dataName){
let {topProcOptionList, topActiveIndex} = this.state
let {params} = this.props.navigation.state
let that = this
// console.log('修改列表计算后数据',item, index, dataName)
if(dataName && topProcOptionList[topActiveIndex][dataName]) {
console.log('修改列表计算后数据',item, index, dataName)
console.log('修改列表计算后数据',topActiveIndex, topProcOptionList)
console.log('父组件传递的值==', params.superData.leftIndex)
if(params.superData.leftIndex === 2){
topProcOptionList.map(function(topItem, topInd) {
if(topInd === index){
topItem = item
}else {
topItem.select = false // 初始化
}
})
that.setState({
topProcOptionList
})
console.log('设置当前所有已选值---', topProcOptionList)
}else if(dataName && topProcOptionList[topActiveIndex][dataName]){
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
listItem[dataName][index] = item
......@@ -98,7 +141,7 @@ class EditThirdLevelPage extends Component {
})
}
})
// console.log('设置当前所有已选值---', topProcOptionList)
console.log('设置当前所有已选值---', topProcOptionList)
this.setState({
topProcOptionList
})
......@@ -149,26 +192,36 @@ class EditThirdLevelPage extends Component {
// 返回底部主要元素
renderContItem() {
let {topProcOptionList, topActiveIndex} = this.state
let curData = topProcOptionList[topActiveIndex]
let {topProcOptionList, topActiveIndex, onlyShow} = this.state
let {params} = this.props.navigation.state
let curData = []
// 本地测试数据
let localThridContData = []
let iconImg = ''
let imgIconArr = ''
if(params.superData.leftIndex === 1){
curData = topProcOptionList
}else if(params.superData.leftIndex === 2){
localThridContData = topProcOptionList
}else{
curData = topProcOptionList[topActiveIndex]
}
if(curData && curData[DEFAULT_SECOND_DATA]) {
localThridContData = curData[DEFAULT_SECOND_DATA]
}
if(curData && curData.iconImg){
iconImg = curData.iconImg
if(curData && curData.imgIconArr){
imgIconArr = curData.imgIconArr
}
// console.log('底部数据==' , localThridContData)
console.log('底部数据==' ,curData, localThridContData, topProcOptionList)
return(
<View style={styles.edit_cont}>
{ iconImg ? <PictureZoom
{ imgIconArr ? <PictureZoom
listImageIndex={0}
listImageUrls={iconImg}
listImageUrls={imgIconArr}
listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'}
/> : null }
......@@ -190,6 +243,15 @@ class EditThirdLevelPage extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
let {onlyShow, onlySignSelect} = this.state
let {params} = this.props.navigation.state
console.log('onlySignSelect', onlySignSelect)
let curImgIcon=''
if(!onlyShow){
curImgIcon = 'imgIconArr'
}
return (
<SafeAreaView style={styles.column_container}>
<PicTitDetaiCalcu
......@@ -200,9 +262,10 @@ class EditThirdLevelPage extends Component {
titText={'title'}
tipTextStr={'tip1'}
tipTextOne={'tip2'}
// listImgIcon={'imgIcon'}
listImgIcon={'imgIconArr'}
listImgIcon={curImgIcon}
listPicType={'ROUND'}
onlyShowNum={onlyShow}
onlyShowSelect={onlySignSelect}
listStyleBox={styles.list_style_box}
/>
</SafeAreaView>
......@@ -212,6 +275,16 @@ class EditThirdLevelPage extends Component {
render() {
let {navigation} = this.props
let {title} = navigation.state.params
let {onlyShow, onlySignSelect} = this.state
console.log('onlyShow==', onlyShow)
let curShowTop = true
if(onlyShow){
curShowTop = !onlyShow
}
if(onlySignSelect) {
curShowTop = !onlySignSelect
}
return (
<View style={styles.edit_container}>
<StatusBarView
......@@ -222,10 +295,10 @@ class EditThirdLevelPage extends Component {
<SafeAreaView style={safe_view}>
<HeadBackItem title={title} navigation={navigation} />
<View style={styles.edit_main}>
{this.renderTopProItem()}
{ curShowTop ? this.renderTopProItem() : null}
{this.renderContItem()}
</View>
<View style={styles.btom_btn_box}>
{ !onlyShow ? <View style={styles.btom_btn_box}>
<FooterBtnStyle
style={styles.sub_btn_pro}
activeOpacity={.8}
......@@ -233,7 +306,7 @@ class EditThirdLevelPage extends Component {
textStyle= {styles.sub_btn_txt}
onPress={() => this.handleSubmit()}
/>
</View>
</View> : null}
</SafeAreaView>
</View>
);
......
......@@ -76,25 +76,52 @@ class ProductRightStyle extends Component {
}
}
// 大类右侧标题点击事件
// 所有二级数据标题点击事件
TitleClickEvent(item, index) {
let {superIndex} = this.props
// console.log('右侧标题点击事件 ', superIndex, index, item)
if(superIndex >= 0 && superIndex < 4) {
console.log('右侧标题点击事件 ', superIndex, index, item)
if(superIndex >= 0 && superIndex < 3) {
let curThirdShow=false, curThirdSign=false
if(superIndex === 1){
curThirdShow = true
}else if(superIndex === 2){
curThirdSign = true
}
this.props.navigation.navigate('EditThirdLevelPage', {
title: '选择产品 - 编辑模板',
superData:{
superItem: item,
superIndex: index
superIndex: index,
leftIndex: superIndex,
thirdShow: curThirdShow,
thirdSign: curThirdSign,
},
childrenPageCallBack: this.childrenPageCallBack.bind(this) // 传递函数,编辑完成时调用
})
}else if(superIndex === 3){
// 零散器械
this.canPlusOrdReduceOne(item, index)
// this.handleCalCallBack(curData, curIndex, 'rightSecondData', DEFAULT_FIELD)
// this.setState({
// rightSecondData
// })
}else {
// 单选耗材 中级标题点击之后
this.changeThrShow(true, item, index)
}
}
// 当前直接加1/减1
canPlusOrdReduceOne(item, index){
let {superIndex} = this.props
let {rightSecondData} = this.state
console.log('当前直接加1/减1:',rightSecondData)
console.log('当前直接加1/减1:',superIndex)
console.log('当前直接加1/减1:',item)
console.log('当前直接加1/减1:',index)
}
// 大类加减,小类所有加1/减1
handleAllPlusReduce(curData, curIndex, isPlus){
let {rightSecondData} = this.state
......@@ -166,8 +193,49 @@ class ProductRightStyle extends Component {
// 编辑页面的回调
childrenPageCallBack(childData, index) {
let {rightSecondData} = this.state
// console.log('编辑页面的回调----', childData, index)
let {superIndex} = this.props
console.log('编辑页面的回调----', childData, index, superIndex)
let that = this
if(superIndex === 8){ // superIndex === 2 器械包有问题
// rightSecondData.forEach(function(rsdItem, rsdIndex) {
// if(!rsdItem[CHILD_DATA_NAME]) {
// rsdItem[CHILD_DATA_NAME] = []
// }
// if(!rsdItem[DEFAULT_FIELD]) {
// rsdItem[DEFAULT_FIELD] = 0
// }
// if(rsdIndex === index) {
// rsdItem[CHILD_DATA_NAME].push(childData)
// rsdItem.lineOptions = childData
// let superTip = '', tipObj = {}
// // childData.map((chDa) => {
// // if(chDa.select) {
// // superTip += `${chDa.title}`
// // }
// // })
// rsdItem[CHILD_DATA_NAME].map(chItem => {
// chItem.forEach(childDa => {
// if(childDa.select){
// if(!tipObj[childDa.title]) {
// tipObj[childDa.title] = 1
// }else {
// tipObj[childDa.title] += 1
// }
// }
// })
// })
// console.log('tipObj',tipObj)
// for(let obj of Object.keys(tipObj)) {
// superTip += `${obj}x${tipObj[obj]}`
// }
// if(superTip){
// rsdItem.lineTip = superTip
// rsdItem[DEFAULT_FIELD] += 1
// }
// that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', DEFAULT_FIELD)
// }
// })
}else {
rightSecondData.forEach(function(rsdItem, rsdIndex) {
if(!rsdItem[CHILD_DATA_NAME]) {
rsdItem[CHILD_DATA_NAME] = []
......@@ -212,7 +280,9 @@ class ProductRightStyle extends Component {
that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', DEFAULT_FIELD)
}
})
// console.log('回调后的数组====', rightSecondData)
}
console.log('回调后的数组====', rightSecondData)
this.setState({
rightSecondData
})
......@@ -250,7 +320,7 @@ class ProductRightStyle extends Component {
// 修改列表计算后数据 - 头/行
handleCalCallBack(item, index, dataName, coutFieName){
// console.log('修改列表计算后数据==',item, index, dataName, coutFieName)
console.log('修改列表计算后数据==',item, index, dataName, coutFieName)
if(dataName && this.state[dataName]) {
let curDataName = this.state[dataName]
curDataName[index] = item
......@@ -275,6 +345,31 @@ class ProductRightStyle extends Component {
// 返回右侧二级每一列(单选耗材以上)
renderSecondtem(item, index) {
let {superIndex} = this.props
let curTitCallBack='', curPlusCallBack='', curReduceCallBack=''
if(superIndex === 1){
// 钉盒
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curPlusCallBack = ''
curReduceCallBack = ''
}else if(superIndex === 2){
// 器械包
if(item['childQuantity'] > 0) {
// 有数量时,需要点击进入选择
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
curReduceCallBack = (() => this.props.superReduceBack())
}
}else if(superIndex === 3){
// 零散器械
curTitCallBack=''
curPlusCallBack = ''
curReduceCallBack = ''
}else {
curTitCallBack=((item,index) => this.TitleClickEvent(item,index))
curPlusCallBack = ((item, index) => this.TitleClickEvent(item,index))
curReduceCallBack = (() => this.props.superReduceBack())
}
return (
<SafeAreaView style={styles.ri_container}>
<PicTitDetaiCalcu
......@@ -282,15 +377,15 @@ class ProductRightStyle extends Component {
listIndex={index}
calField={DEFAULT_FIELD}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index,'rightSecondData', DEFAULT_FIELD)}
titCallBack={(item,index) => this.TitleClickEvent(item,index)}
titCallBack={curTitCallBack}
titText={'title'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
// listImgIcon={'imgIcon'}
listImgIcon={'imgIconArr'}
listPicType={'SQUARE'}
plusCallBack={(item, index) => this.TitleClickEvent(item,index)}
reduceCallBack={() => this.props.superReduceBack()}
plusCallBack={curPlusCallBack}
reduceCallBack={curReduceCallBack}
/>
</SafeAreaView>
)
......@@ -323,6 +418,7 @@ class ProductRightStyle extends Component {
titText={'title'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
listImgIcon={'imgIconArr'}
/>
</SafeAreaView>
)
......@@ -357,7 +453,7 @@ class ProductRightStyle extends Component {
titCallBack={(item,index) => this.TitleClickEvent(item, index)}
titText={'title'}
// listImgIcon={'imgIcon'}
listImgIcon={'imgIconArr'}
// listImgIcon={'imgIconArr'}
tipTextOne={'tip1'}
tipTextTwo={'tip2'}
plusCallBack={(item, index) => this.handleAllPlusReduce(item,index, true)}
......@@ -415,12 +511,12 @@ class ProductRightStyle extends Component {
<Text style={styles.thr_head_tit}>{ curThridObj.title }</Text>
</View>
</TouchableOpacity>
<PictureZoom
{/* <PictureZoom
listImageIndex={0}
listImageUrls={curThridObj.image}
listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'}
/>
/> */}
</View>
)
}
......
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