Commit a6b86c18 by Denglingling

增加三级编辑后,中级数量的同步

parent 8c00faca
......@@ -134,20 +134,18 @@ class ProductModel extends Component {
}
componentDidMount(){
console.log('本地测试数据====localMockData===', localMockData)
// 赋值测试数据
this.setState({
topProcOptionList: localMockData.localBottomOption
})
// console.log('本地测试数据====localMockData===', localMockData)
// // 赋值测试数据
// this.setState({
// topProcOptionList: localMockData.localBottomOption
// })
}
componentWillReceiveProps(nextProps) {
if(this.state.isVisible != nextProps.show) {
// console.log('父组件修改----', nextProps.show)
this.setState({isVisible: nextProps.show});
}
if(nextProps.modelOption) {
console.log('父组件修改---22-', nextProps.modelOption)
this.setState({topProcOptionList: nextProps.modelOption});
}
}
......@@ -196,20 +194,8 @@ class ProductModel extends Component {
// 修改列表计算后数据
handleCalCallBack(item, index, dataName){
let {topProcOptionList, topActiveIndex} = this.state
let {modelOption} = this.props
console.log('--已选===',item, topActiveIndex, index)
// if(dataName && topProcOptionList[topActiveIndex][dataName]) {
// topProcOptionList.map(function(listItem, listIndex) {
// if(listIndex === topActiveIndex){
// listItem[dataName][index] = item
// }
// })
// this.setState({
// topProcOptionList
// })
// }
// console.log('--已选===',item, topActiveIndex, index)
if(SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]) {
topProcOptionList.map(function(listItem, listIndex) {
......@@ -228,11 +214,11 @@ class ProductModel extends Component {
})
console.log('---item[DEFAULT_FIELD] ', item[DEFAULT_FIELD], index)
// console.log('---item[DEFAULT_FIELD] ', item[DEFAULT_FIELD], index)
if(item[DEFAULT_FIELD] === 0) {
topProcOptionList[topActiveIndex][SELECTED_DATA_ARR].splice(index, 1)
console.log('topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]---', topProcOptionList[topActiveIndex][SELECTED_DATA_ARR])
// console.log('topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]---', topProcOptionList[topActiveIndex][SELECTED_DATA_ARR])
}
// 修改左侧分类汇总
......@@ -258,11 +244,9 @@ class ProductModel extends Component {
}
allCountQuantity += proItem[SELECTED_QUQNTITY]
})
// this.setState({
// allCountQuantity
// })
// 回调函数
console.log('---计算后 ', topProcOptionList, allCountQuantity)
// console.log('---计算后 ', topProcOptionList, allCountQuantity)
this.props.modelCallBack(topProcOptionList)
if(allCountQuantity === 0){
......@@ -281,7 +265,7 @@ class ProductModel extends Component {
// 清空
handleClearRubbish() {
console.log('清空======')
// console.log('清空======')
let {topProcOptionList} = this.state
// 本地测试
let curCalField = 'quantity'
......@@ -293,16 +277,12 @@ class ProductModel extends Component {
deIt[curCalField] = 0
})
})
// this.setState({
// allCountQuantity: 0
// })
// 回调函数
console.log('---清空之后===== ', topProcOptionList)
// console.log('---清空之后===== ', topProcOptionList)
this.props.modelCallBack(topProcOptionList)
this.closeModal()
}
// 返回清空
......@@ -326,7 +306,6 @@ class ProductModel extends Component {
// 返回顶部编辑选项
renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state
// let {modelOption} = this.props
return (
<ChooseCardList
......@@ -346,34 +325,6 @@ class ProductModel extends Component {
cardCountName={SELECTED_QUQNTITY}
cardStyleType={'DEFAULT'}
/>
// <View style={styles.top_box}>
// <ScrollView
// style={styles.top_scroll_cont}
// horizontal={true}
// showsHorizontalScrollIndicator={false}
// >
// {
// topProcOptionList.map((item, index) =>
// <TouchableOpacity
// activeOpacity={.8}
// style={styles.top_touch_cont}
// onPress={() => this.handleTopNav(item, index)}
// >
// <View style={[
// styles.top_inner,
// (index == 1 || index == 2) ? styles.se_thr_width : '',
// index == 3 ? styles.four_width : '',
// index == topActiveIndex ? styles.top_inner_act : ''
// ]}>
// <Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>
// {item.title}
// </Text>
// </View>
// </TouchableOpacity>
// )
// }
// </ScrollView>
// </View>
)
}
......@@ -388,18 +339,14 @@ class ProductModel extends Component {
// localBottomContData = curData.localBottomContData
// }
// let {modelOption} = this.props
let curData = topProcOptionList[topActiveIndex]
console.log('已选展示信息 === curData---', topProcOptionList, topActiveIndex, curData)
// console.log('已选展示信息 === curData---', topProcOptionList, topActiveIndex, curData)
let localBottomContData = []
if(curData && curData[SELECTED_DATA_ARR]){
localBottomContData = curData[SELECTED_DATA_ARR]
}
console.log('已选展示信息---',curData,topActiveIndex, localBottomContData)
// console.log('已选展示信息---',curData,topActiveIndex, localBottomContData)
return(
<View style={styles.edit_cont}>
......
......@@ -41,8 +41,7 @@ class ChooseCardList extends Component {
cardStyleType: PropTypes.object, // 计数样式
cardCountArray: PropTypes.array, // 已选数组
// cardCountArray: PropTypes.array, // 已选数组
// cardListOptions: [
// {
......@@ -79,25 +78,14 @@ 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, cardCountArray, ...props} = this.props
let {countStyleType, countStyleName} = this.state
// let count_style = ''
// if(countStyleType.includes(cardStyleType)){
// count_style = countStyleName[countStyleType.indexOf(cardStyleType)]
// }
cardStyleListItem, cardStyleListItemAct, cardStyleItemIcon, cardStyleItemTit, cardStyleNotIconTit, cardStyleItemTitAct, cardCallBack, curActIndex, cardIsCount, cardCountName, cardStyleCount, cardStyleType, ...props} = this.props
let {countStyleType} = this.state
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
cardListOptions[cardImgName] = localTestImageUrls // 本地测试
console.log('cardStyleItemTit===', cardStyleItemTit)
// cardScrollEnabled 默认 true,是否可以滚动
// cardHorizontal=true 的时候,所有的子视图会在水平方向上排成一行,而不是默认的在垂直方向上排成一列
// showsHorizontalScrollIndicator 当此属性为 true 的时候,显示一个水平方向的滚动条
// showsVerticalScrollIndicator 当此属性为 true 的时候,显示一个垂直方向的滚动条
return (
<View style={[styles.card_container, cardStyleBox]}>
......@@ -128,11 +116,6 @@ class ChooseCardList extends Component {
{ (item[cardCountName] && countStyleType[1] === cardStyleType) ? <View style={styles.card_def_count}>
<Text style={styles.def_count_txt}>{item[cardCountName]}</Text>
</View> : null}
{/* { (!!cardIsCount && item[cardCountArray].length) ? <View style={styles.card_def_count}>
<Text style={styles.def_count_txt}>{item[cardCountArray].length}</Text>
</View> : null} */}
</View>
)
}
......
......@@ -66,15 +66,7 @@ class PictureZoom extends Component {
picOthStyle = picStyleArr[listPicTypeArr.indexOf(listPicType)]
}
// console.log('listImageUrls----', typeof listImageUrls)
// if(typeof listImageUrls !== "array"){
// listImageUrls = [{url : listImageUrls}]
// listImageIndex = 0
// }
console.log('listImageUrls----', listImageUrls, typeof listImageUrls)
// console.log('图片放大----', listImageUrls, typeof listImageUrls)
return (
<View style={[styles.container]}>
......
......@@ -76,7 +76,7 @@ class ChooseProductPage extends Component {
// 顶部产品点击
handleTopNav(item, index) {
console.log('top产品--',item, index)
// console.log('top产品--',item, index)
this.setState({
topActiveIndex: index
})
......@@ -84,11 +84,11 @@ class ChooseProductPage extends Component {
// 左侧标题点击
handleLeftNav(item, index) {
console.log('左侧标题--', index, item)
// console.log('左侧标题--', index, item)
let {leftOptionList} = this.state
this.setState({
leftActiveIndex: index,
rightSecondData: leftOptionList[index][DEFAULT_SECOND_DATA] // 本地数据
// rightSecondData: leftOptionList[index][DEFAULT_SECOND_DATA] // 本地数据
// rightSecondData: leftOptionList[index].localSecondData // 本地数据
})
......@@ -104,9 +104,8 @@ class ChooseProductPage extends Component {
// 计算中级数量
handleChangeCount(count, coutFieName) {
let {leftActiveIndex, leftOptionList, defaultThridShow, rightSecondData} = this.state
console.log('计算中级数量===', count, leftActiveIndex, defaultThridShow, rightSecondData, coutFieName)
// console.log('计算中级数量===', count, leftActiveIndex, defaultThridShow, rightSecondData, coutFieName)
// let allCountQuantity = 0 // 初始化
leftOptionList[leftActiveIndex][SELECTED_DATA_ARR] = []
leftOptionList.map(function(leItem, leIndex) {
......@@ -127,12 +126,10 @@ class ChooseProductPage extends Component {
})
}
}
// allCountQuantity += leItem[SELECTED_QUQNTITY]
})
console.log('计算中级之后---', leftOptionList)
// console.log('计算中级之后---', leftOptionList)
this.setState({
leftOptionList,
// allCountQuantity
leftOptionList
})
}
......@@ -174,7 +171,7 @@ class ChooseProductPage extends Component {
// 已选修改回调
handleSelectCallBack(options) {
console.log('--已选修改回调--', options)
// console.log('--已选修改回调--', options)
this.setState({
leftOptionList: options
})
......@@ -200,7 +197,6 @@ class ChooseProductPage extends Component {
renderTopProItem() {
let {topProcOptionList, topActiveIndex} = this.state
return (
<ChooseCardList
cardStyleBox={styles.top_box}
cardStyleScroll={styles.top_scroll_cont}
......@@ -217,39 +213,12 @@ class ChooseProductPage extends Component {
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
/>
// <View style={styles.top_box}>
// <ScrollView
// style={styles.top_scroll_cont}
// horizontal={true}
// showsHorizontalScrollIndicator={false}
// >
// {
// topProcOptionList.map((item, index) =>
// <TouchableOpacity
// activeOpacity={.8}
// style={styles.top_touch_cont}
// onPress={() => this.handleTopNav(item, index)}
// >
// <View style={[styles.top_inner, index == topActiveIndex ? styles.top_inner_act : '']}>
// <View style={styles.top_img_box}>
// <Image source={item.iconImg} style={icon_style}/>
// </View>
// <Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>{item.title}</Text>
// </View>
// </TouchableOpacity>
// )
// }
// </ScrollView>
// </View>
)
}
// 返回底部左侧元素
renderContLeftItem() {
let {leftActiveIndex, leftOptionList} = this.state
// let {leftActiveIndex} = this.state
return (
<ChooseCardList
cardStyleBox={styles.cont_left_box}
......@@ -267,43 +236,9 @@ class ChooseProductPage extends Component {
cardItemIcon={'iconImg'}
curActIndex={leftActiveIndex}
cardCallBack={(item, index) => this.handleLeftNav(item, index)}
// cardIsCount={true}
// cardCountArray={SELECTED_DATA_ARR}
cardCountName={SELECTED_QUQNTITY}
cardStyleType={'GRAPHICS'}
/>
// <View style={styles.cont_left_box}>
// <ScrollView
// style={styles.cont_left_scroll_cont}
// showsVerticalScrollIndicator={false}
// >
// {
// leftOptionList.map((item, index) =>
// <TouchableOpacity
// activeOpacity={.8}
// onPress={() => this.handleLeftNav(item, index)}
// >
// <View style={[styles.cont_left_inner, index == leftActiveIndex ? styles.cont_left_inner_act : '']}>
// {
// item.iconImg ?
// <View style={styles.cont_left_img_box}>
// <Image source={item.iconImg} style={icon_style}/>
// </View> : null
// }
// <Text style={[
// styles.cont_left_tit,
// index == leftActiveIndex ? styles.cont_left_tit_act : '',
// item.iconImg ? '' : styles.cont_left_noicon]}
// >
// {item.title}
// </Text>
// </View>
// </TouchableOpacity>
// )
// }
// </ScrollView>
// </View>
)
}
......@@ -316,15 +251,13 @@ class ChooseProductPage extends Component {
curRigSecoOption = leftOptionList[leftActiveIndex][DEFAULT_SECOND_DATA] // 本地数据
}
console.log('-返回右侧二级元素--curRigSecoOption', curRigSecoOption)
// console.log('-返回右侧二级元素--curRigSecoOption', curRigSecoOption)
return (
<View style={styles.cont_bom_box}>
{ this.renderContLeftItem() }
<ProductRightStyle
navigation={this.props.navigation}
// isStencilItem={true}
superIndex={leftActiveIndex}
defaultThridShow={defaultThridShow}
changeThrShow={(defaultThridShow) => this.handleChangeThrShow(defaultThridShow)}
......@@ -339,13 +272,6 @@ class ChooseProductPage extends Component {
// 返回底部按钮
renderFooterBtnItem() {
let {selectShowPopup, leftOptionList} = this.state
// let allCountQuantity = 0
// leftOptionList.map(leItem => {
// if(!leItem[SELECTED_QUQNTITY]){
// leItem[SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += leItem[SELECTED_QUQNTITY]
// })
let allCountQuantity = this.getAllCountQuantity()
......@@ -371,7 +297,6 @@ class ChooseProductPage extends Component {
</View>
<ProductModel
// modelShow={selectShowPopup}
show={ selectShowPopup }
closeModal={(show) => this.handleCloseSelectModal(show)}
closeSubmit={() => this.handleSubmit()}
......@@ -415,40 +340,8 @@ const styles = StyleSheet.create({
backgroundColor: home_background_color
},
choo_main: {
// position: 'relative',
// height: Height(),
// width: Width()
flex: 1
},
// ser_cont: {
// width: Width(),
// backgroundColor: promary_color,
// position: 'relative',
// height: 60,
// justifyContent: 'center',
// paddingHorizontal: 16
// },
// ser_img_box: {
// position: 'absolute',
// left: 22,
// top: 18,
// width: pxSize(24),
// height: pxSize(24)
// },
// // ser_img: {
// // width: '100%',
// // height: '100%'
// // },
// ser_text_input: {
// backgroundColor: '#F5F5F5',
// height: 38,
// paddingLeft: 30,
// borderRadius: 10,
// fontSize: second_text_size,
// fontFamily: font_family_regular
// },
top_box: {
width: Width(),
height: 89,
......@@ -461,43 +354,16 @@ const styles = StyleSheet.create({
top_scroll_cont: {},
top_touch_cont: {},
top_inner: {
// justifyContent: 'center',
// alignItems: 'center',
// marginRight: 14,
// borderBottomWidth: 4,
borderBottomColor: foundation_color,
minWidth: 60
},
top_inner_act: {
// borderBottomWidth: 2,
// borderBottomColor: promary_color
},
top_img_box: {
// width: pxSize(36),
// height: pxSize(36)
},
// top_img: {
// width: '100%',
// height: '100%'
// },
top_tit: {
// paddingTop: 10,
// paddingBottom: 14,
// color: second_text_color,
// fontSize: third_text_size,
// fontFamily: font_family_regular
},
top_tit_act: {
// color: first_text_color,
// fontSize: 14,
// fontFamily: font_family_semibold
},
top_inner_act: {},
top_img_box: {},
top_tit: {},
top_tit_act: {},
cont_bom_box: {
position: 'relative',
flex: 1
// height: Height() - 266
// height: Height() - 266
// height: pxHeight(510)
},
cont_left_box: {
backgroundColor: '#F5F5F5',
......@@ -513,12 +379,10 @@ const styles = StyleSheet.create({
flexDirection: 'row',
height: 58,
justifyContent: 'flex-start',
// justifyContent: 'center',
alignItems: 'center',
borderWidth: 0,
width: '100%',
borderBottomWidth: 0,
// paddingHorizontal: 10
borderBottomWidth: 0
},
cont_left_inner_act: {
backgroundColor: foundation_color,
......@@ -531,60 +395,14 @@ const styles = StyleSheet.create({
marginRight: 4,
marginLeft: 6
},
// cont_left_img: {
// width: '100%',
// height: '100%'
// },
cont_left_tit: {
// color: second_text_color,
// fontSize: third_text_size,
// fontFamily: font_family_regular
},
cont_left_tit: {},
cont_left_noicon: {
textAlign: 'center',
paddingHorizontal: 14
},
cont_left_tit_act: {
// color: first_text_color,
// fontWeight: 'bold',
fontSize: third_text_size
},
// cont_right_box: {
// position: 'absolute',
// left: 80,
// width: Width() - 80,
// backgroundColor: foundation_color,
// height: '100%',
// paddingHorizontal: 20
// },
// cont_right_scroll_cont: {},
// cont_right_list: {},
// ri_container: {
// borderBottomColor: '#F9F9F9',
// borderBottomWidth: 2,
// // backgroundColor: '#ccc'
// },
// ri_tou_box: {
// paddingVertical: 14
// },
// ri_inner: {
// flexDirection: 'row',
// justifyContent: 'space-between',
// alignItems: 'center'
// },
// ri_text_box: {},
// ri_te_tit: {
// fontSize: first_text_size,
// color: first_text_color,
// fontWeight: 'bold',
// fontFamily: 'PingFangSC-Medium'
// },
// ri_te_ot: {
// fontSize: second_text_size,
// color: third_text_color
// },
// ri_img_box: {},
// ri_img_check: {},
sub_box: {
width: Width(),
backgroundColor: foundation_color,
......@@ -633,44 +451,6 @@ const styles = StyleSheet.create({
fontSize: 16,
fontFamily: font_family_medium
},
// sub_btn_left: {
// // width: '50%',
// backgroundColor: '#EEECEC'
// },
// sub_btn_tit: {
// fontSize: 18
// },
// sub_btn_left_text: {
// color: third_text_color
// },
// sub_btn_rig: {
// // width: '50%',
// backgroundColor: promary_color
// },
// sub_btn_rig_text: {},
// scroll_text_cont: {
// fontSize: 30,
// marginLeft: 80,
// height: 80,
// color: '#333',
// backgroundColor: '#FF0000',
// width: '100%'
// },
// card: {
// borderWidth: 1,
// backgroundColor: '#fff',
// borderColor: 'rgba(0,0,0,0.1)',
// margin: 5,
// height: 150,
// padding: 15,
// shadowColor: '#ccc',
// shadowOffset: { width: 2, height: 2, },
// shadowOpacity: 0.5,
// shadowRadius: 3,
// }
})
export default ChooseProductPage;
\ No newline at end of file
......@@ -34,157 +34,40 @@ import ChooseCardList from '../../common/listDataComponent/ChooseCardList';
import PicTitDetaiCalcu from '../../common/listDataComponent/PicTitDetaiCalcu';
import PictureZoom from '../../common/listDataComponent/PictureZoom';
import localMockData from './mock/sen_mock';
import {cloneObject} from '../../../utils/Utils';
class EditThirdLevelPage extends Component {
class EditStencilPage extends Component {
constructor(props) {
super(props);
this.state = {
topProcOptionList: [
{
title: '编辑产品'
},
{
title: '螺钉盒'
},
{
title: '器械包'
},
{
title: '工具'
}
],
topActiveIndex: 0,
contOptionData: [ // 底部产品内容
{
"id": "0",
title: '规格:JS-CGO PE 10',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 20,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "1",
title: '规格:JS-CGO PE 10 11',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "2",
title: '规格:JS-CGO PE 10 22',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "3",
title: '规格:JS-CGO PE 10 33',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "4",
title: '规格:JS-CGO PE 10 44',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "5",
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "6",
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "7",
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
},
{
"id": "8",
title: '规格:JS-CGO PE 10 888',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../images/model_test.png'),
select: false
}
]
topProcOptionList: [],
topActiveIndex: 0
}
}
componentDidMount() {
let {params} = this.props.navigation.state
console.log('本地测试数据====localMockData===', localMockData)
console.log('本地测试数据====localMockData===', localMockData.localThridOption[0].localThridContData[0])
console.log('父组件传递的值==', params)
// 赋值测试数据
this.setState({
topProcOptionList: localMockData.localThridOption
topProcOptionList: cloneObject(localMockData.localThridOption)
})
}
/**
* 点击当前产品加减
* @param {object} item 当前小类数据
* @param {number} index 当前角标
* @param {boolean} isPlus 默认减法 false,加法 true,
*/
handelCalculationList(item, index, isPlus) {
// let { contOptionData } = this.state
// let { value } = contOptionData[index]
// if(isPlus) {
// contOptionData[index].value += 1
// } else if(!isPlus && value > 0) {
// contOptionData[index].value -= 1
// }
// this.setState({
// contOptionData
// })
}
// 修改列表计算后数据
handleCalCallBack(item, index, dataName){
let {topProcOptionList, topActiveIndex} = this.state
// this.state.topProcOptionList[this.state.topActiveIndex].localThridContData
if(dataName && topProcOptionList[topActiveIndex][dataName]) {
topProcOptionList.map(function(listItem, listIndex) {
if(listIndex === topActiveIndex){
listItem[dataName][index] = item
}
})
// let curDataName = topProcOptionList[topActiveIndex][dataName]
// curDataName[index] = item
this.setState({
// [dataName]: curDataName
topProcOptionList
})
}
......@@ -198,11 +81,23 @@ class EditStencilPage extends Component {
})
}
// 点击编辑完成
handleSubmit() {
let {topProcOptionList} = this.state
let {params} = this.props.navigation.state
console.log('编辑完成====>', topProcOptionList, params.superData.superIndex)
console.log(topProcOptionList[0].localThridContData[0])
params.childrenPageCallBack(topProcOptionList, params.superData.superIndex)
this.props.navigation.goBack()
}
// 返回顶部编辑选项
renderTopProItem() {
let { topProcOptionList, topActiveIndex } = this.state
return (
<ChooseCardList
cardStyleBox={styles.top_box}
cardStyleScroll={styles.top_scroll_cont}
......@@ -218,35 +113,6 @@ class EditStencilPage extends Component {
curActIndex={topActiveIndex}
cardCallBack={(item, index) => this.handleTopNav(item, index)}
/>
// <View style={styles.top_box}>
// <ScrollView
// style={styles.top_scroll_cont}
// horizontal={true}
// showsHorizontalScrollIndicator={false}
// >
// {
// topProcOptionList.map((item, index) =>
// <TouchableOpacity
// activeOpacity={.8}
// style={styles.top_touch_cont}
// onPress={() => this.handleTopNav(item, index)}
// >
// <View style={[
// styles.top_inner,
// (index == 1 || index == 2) ? styles.se_thr_width : '',
// index == 3 ? styles.four_width : '',
// index == topActiveIndex ? styles.top_inner_act : ''
// ]}>
// <Text style={[styles.top_tit, index == topActiveIndex ? styles.top_tit_act : '']}>
// {item.title}
// </Text>
// </View>
// </TouchableOpacity>
// )
// }
// </ScrollView>
// </View>
)
}
......@@ -256,8 +122,15 @@ class EditStencilPage extends Component {
let curData = topProcOptionList[topActiveIndex]
// 本地测试数据
let localThridContData = curData.localThridContData
let iconImg = curData.iconImg
let localThridContData = []
let iconImg = ''
if(curData && curData.localThridContData) {
localThridContData = curData.localThridContData
}
if(curData && curData.iconImg){
iconImg = curData.iconImg
}
// console.log('底部数据==' , localThridContData)
......@@ -268,9 +141,7 @@ class EditStencilPage extends Component {
listImageUrls={iconImg}
listStyleImage={styles.thr_head_tit_img}
listPicType={'RECTANGLE'}
/> : null
}
/> : null }
<ScrollView
style={styles.edit_scroll_cont}
showsVerticalScrollIndicator={false}
......@@ -289,7 +160,6 @@ class EditStencilPage extends Component {
// 返回每一列元素
renderContColumnItem(item, index) {
// console.log('item, index----', item, index)
return (
<SafeAreaView style={styles.column_container}>
<PicTitDetaiCalcu
......@@ -304,40 +174,6 @@ class EditStencilPage extends Component {
listPicType={'ROUND'}
listStyleBox={styles.list_style_box}
/>
{/* <View style={styles.ri_inner}>
<View style={styles.oth_img_box}>
<Image style={styles.oth_img} source={item.imgIcon}/>
</View>
<View style={styles.ri_text_box}>
<Text style={styles.ri_te_tit}>
{ item.title }
</Text>
<Text style={[styles.ri_te_ot, styles.thr_ot]}>{item.tip1}</Text>
<Text style={styles.ri_te_ot}>{item.tip2}</Text>
</View>
<View style={styles.ri_num_box}>
<TouchableOpacity
activeOpacity={.9}
style={styles.btn_inner}
onPress={() => this.handelCalculationList(item, index)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_left]}>
<Image source={require('../../../images/less_icon.png')} style={styles.thr_num_icon}></Image>
</View>
</TouchableOpacity>
<Text style={styles.thr_num}>{ item.value }</Text>
<TouchableOpacity
activeOpacity={.9}
style={styles.btn_inner}
onPress={() => this.handelCalculationList(item, index, true)}
>
<View style={[styles.thr_num_btn, styles.thr_btn_right]}>
<Image source={require('../../../images/plur_icon.png')} style={styles.thr_num_icon}></Image>
</View>
</TouchableOpacity>
</View>
</View> */}
</SafeAreaView>
)
}
......@@ -364,7 +200,7 @@ class EditStencilPage extends Component {
activeOpacity={.8}
title={'编辑完成'}
textStyle= {styles.sub_btn_txt}
onPress={() => console.warn('编辑完成')}
onPress={() => this.handleSubmit()}
/>
</View>
</SafeAreaView>
......@@ -525,4 +361,4 @@ const styles = StyleSheet.create({
}
})
export default EditStencilPage;
\ No newline at end of file
export default EditThirdLevelPage;
\ No newline at end of file
......@@ -92,27 +92,70 @@ class ProductRightStyle extends Component {
// this.handleRIghtStencil()
}
handleRIghtStencil() {
// handleRIghtStencil() {
// console.warn(`选中了${JSON.stringify(this.state.selectItem)}`)
}
// }
// 右侧标题点击事件
TitleClickEvent(item, index) {
let { superIndex } = this.props
let {superIndex} = this.props
let {rightSecondData} = this.state
console.log('右侧标题点击事件 ', superIndex, index, item, rightSecondData[index])
console.warn('右侧标题点击事件 ', superIndex, index, item)
if(superIndex >= 0 && superIndex < 4) {
this.props.navigation.navigate('EditThirdLevelPage', {title: '选择产品 - 编辑模板'})
this.props.navigation.navigate('EditThirdLevelPage', {
title: '选择产品 - 编辑模板',
superData:{
superItem: item,
superIndex: index
},
childrenPageCallBack: this.childrenPageCallBack.bind(this)
// 传递函数,编辑完成时调用
})
}else {
this.changeThrShow(true, item.title)
}
// else if ( superIndex > 0 && superIndex < 4) {
// this.handleIsShowDialog() // -- 之前版本
// }
}
// 编辑页面的回调
childrenPageCallBack(childData, index) {
let {rightSecondData} = this.state
// 本地测试
let childDataName = 'childrenLineData'
let curCalField = 'quantity'
let that = this
rightSecondData.forEach(function(rsdItem, rsdIndex) {
if(!rsdItem[childDataName]) {
rsdItem[childDataName] = []
}
if(!rsdItem[curCalField]) {
rsdItem[curCalField] = 0
}
if(rsdIndex === index) {
rsdItem[childDataName] = childData
rsdItem[curCalField] = Number(rsdItem[curCalField]) + 1
console.log('回调后的rsdItem====', rsdItem)
that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', curCalField)
}
})
console.log('回调后的数组====', rightSecondData)
this.setState({
rightSecondData
})
}
// // 关闭当前弹窗
// handleCloseModal(show) {
// this.setState({
......@@ -183,6 +226,9 @@ class ProductRightStyle extends Component {
// 修改列表计算后数据 - 头/行
handleCalCallBack(item, index, dataName, coutFieName){
console.log('修改列表计==',item, index, dataName, coutFieName)
if(dataName && this.state[dataName]) {
let curDataName = this.state[dataName]
curDataName[index] = item
......@@ -192,17 +238,15 @@ class ProductRightStyle extends Component {
console.log('计算==头/行===', index, dataName, curDataName)
if(coutFieName) {
let tempCount = 0
let sumCount = 0
curDataName.map(item => {
if(item[coutFieName]){
tempCount += Number(item[coutFieName])
sumCount += Number(item[coutFieName])
}
})
console.log('计算==数量汇总=字段=', coutFieName, tempCount)
this.props.superCallBack(tempCount, coutFieName)
console.log('计算==数量汇总=字段=', coutFieName, sumCount)
this.props.superCallBack(sumCount, coutFieName)
}
}
}
......
......@@ -350,46 +350,38 @@ const localLeftOption = [
]
// 三级编辑数据 - 底部
const localThridContData = [ // 底部产品内容
// 三级编辑数据 - 底部 耗材
const localThridContData_1 = [
{
"id": "0",
title: '规格:JS-CGO PE 10',
title: '耗材11111',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 20,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
quantity: 2
},
{
"id": "1",
title: '规格:JS-CGO PE 10 11',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
quantity: 1
},
{
"id": "2",
title: '规格:JS-CGO PE 10 22',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
quantity: 1
},
{
"id": "3",
title: '规格:JS-CGO PE 10 33',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
},
{
......@@ -397,9 +389,7 @@ const localThridContData = [ // 底部产品内容
title: '规格:JS-CGO PE 10 44',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
},
{
......@@ -407,9 +397,7 @@ const localThridContData = [ // 底部产品内容
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
},
{
......@@ -417,9 +405,7 @@ const localThridContData = [ // 底部产品内容
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
},
{
......@@ -427,9 +413,7 @@ const localThridContData = [ // 底部产品内容
title: '规格:JS-CGO PE 10 55',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
},
{
......@@ -437,38 +421,120 @@ const localThridContData = [ // 底部产品内容
title: '规格:JS-CGO PE 10 888',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
value: 0,
imgIcon: require('../../../../images/model_test.png'),
select: false,
quantity: 0
}
]
// 钉盒
const localThridContData_2 = [
{
"id": "0",
title: '钉盒11111',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 1
},
{
"id": "1",
title: '规格:JS-CGO PE 10 11',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
},
{
"id": "2",
title: '规格:JS-CGO PE 10 22',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
}
]
// 器械包
const localThridContData_3 = [
{
"id": "0",
title: '器械包11111',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
},
{
"id": "1",
title: '规格:JS-CGO PE 10 11',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 2
},
{
"id": "2",
title: '规格:JS-CGO PE 10 22',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
}
]
// 零散器械
const localThridContData_4 = [
{
"id": "0",
title: '零散器械1111',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
},
{
"id": "1",
title: '规格:JS-CGO PE 10 11',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 3
},
{
"id": "2",
title: '规格:JS-CGO PE 10 22',
tip1: '型号:10',
tip2: '物料代码:JUST00000104',
imgIcon: require('../../../../images/model_test.png'),
quantity: 0
}
]
// 三级编辑数据 - 顶部
const localThridOption = [
let localThridOption = [
{
title: '耗材',
iconImg: localTestImageUrls,
localThridContData
localThridContData: localThridContData_1
},
{
title: '钉盒',
iconImg: localTestImageUrls,
localThridContData
localThridContData: localThridContData_2
},
{
title: '器械包',
iconImg: localTestImageUrls,
localThridContData
localThridContData: localThridContData_3
},
{
title: '零散器械',
iconImg: localTestImageUrls,
localThridContData
localThridContData: localThridContData_4
}
]
// 已选数据 - 底部按钮
// 已选数据 - 底部按钮 测试
const localBottomOption = [
{
title: '模板',
......
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