Commit a6f6cbe7 by Denglingling

完善自助下单的已选模块

parent 744e4c61
Showing with 50 additions and 79 deletions
......@@ -51,87 +51,50 @@ class ProductModel extends Component {
// 修改已选数据
getTopOptions() {
let { orginOptionList } = this.state
let otherArr = []
let otherChildObj = {
category_code: 'local_sign_items',
category_name: '耗材',
[LocalVariable.SELECTED_QUQNTITY]: 0,
[LocalVariable.SELECTED_DATA_ARR]: [],
[LocalVariable.LOCAL_SECOND_DATA]: []
}
orginOptionList.forEach((orItem, orIndex) => {
// if (orIndex < 4) {
if (orItem.category_code === LocalVariable.SURGICAL_TEMPLATE || orItem.category_code === LocalVariable.NAIL_BOX || orItem.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
otherArr.push(orItem)
} else {
otherChildObj[LocalVariable.LOCAL_SECOND_DATA].push(orItem)
if (orItem[LocalVariable.SELECTED_QUQNTITY]) {
otherChildObj[LocalVariable.SELECTED_QUQNTITY] += Number(orItem[LocalVariable.SELECTED_QUQNTITY])
}
if (orItem[LocalVariable.SELECTED_DATA_ARR]) {
orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (sign_it) {
sign_it[LocalVariable.SUPER_TITLE_NAME] = orItem.category_name
})
otherChildObj[LocalVariable.SELECTED_DATA_ARR].push(...orItem[LocalVariable.SELECTED_DATA_ARR])
}
}
})
// otherArr.push(otherChildObj)
if (otherChildObj[LocalVariable.SELECTED_QUQNTITY] > 0) {
otherArr.push(otherChildObj)
}
this.setState({
topProcOptionList: otherArr
})
// let shppArr = []
// orginOptionList.map((top_item) => {
// if (top_item.leftOptionList && top_item.leftOptionList.length > 0) {
// let otherArr = []
// let otherChildObj = {
// category_code: 'local_sign_items',
// category_name: '耗材',
// [LocalVariable.SELECTED_QUQNTITY]: 0,
// [LocalVariable.SELECTED_DATA_ARR]: [],
// [LocalVariable.LOCAL_SECOND_DATA]: []
// let { orginOptionList } = this.state
// let otherArr = []
// let otherChildObj = {
// category_code: 'local_sign_items',
// category_name: '耗材',
// [LocalVariable.SELECTED_QUQNTITY]: 0,
// [LocalVariable.SELECTED_DATA_ARR]: [],
// [LocalVariable.LOCAL_SECOND_DATA]: []
// }
// orginOptionList.forEach((orItem, orIndex) => {
// // if (orIndex < 4) {
// if (orItem.category_code === LocalVariable.SURGICAL_TEMPLATE || orItem.category_code === LocalVariable.NAIL_BOX || orItem.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT) {
// otherArr.push(orItem)
// } else {
// otherChildObj[LocalVariable.LOCAL_SECOND_DATA].push(orItem)
// if (orItem[LocalVariable.SELECTED_QUQNTITY]) {
// otherChildObj[LocalVariable.SELECTED_QUQNTITY] += Number(orItem[LocalVariable.SELECTED_QUQNTITY])
// }
// if (orItem[LocalVariable.SELECTED_DATA_ARR]) {
// orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (sign_it) {
// sign_it[LocalVariable.SUPER_TITLE_NAME] = orItem.category_name
// })
// otherChildObj[LocalVariable.SELECTED_DATA_ARR].push(...orItem[LocalVariable.SELECTED_DATA_ARR])
// }
// top_item.leftOptionList.forEach((orItem, orIndex) => {
// if (orIndex < 4) {
// otherArr.push(orItem)
// } else {
// otherChildObj[LocalVariable.LOCAL_SECOND_DATA].push(orItem)
// if (orItem[LocalVariable.SELECTED_QUQNTITY]) {
// otherChildObj[LocalVariable.SELECTED_QUQNTITY] += Number(orItem[LocalVariable.SELECTED_QUQNTITY])
// }
// if (orItem[LocalVariable.SELECTED_DATA_ARR]) {
// orItem[LocalVariable.SELECTED_DATA_ARR].forEach(function (sign_it) {
// sign_it[LocalVariable.SUPER_TITLE_NAME] = orItem.category_name
// })
// otherChildObj[LocalVariable.SELECTED_DATA_ARR].push(...orItem[LocalVariable.SELECTED_DATA_ARR])
// }
// }
// })
// otherArr.push(otherChildObj)
// top_item.selectLeftOptionList = otherArr
// shppArr.push(top_item)
// }
// })
// // otherArr.push(otherChildObj)
// if (otherChildObj[LocalVariable.SELECTED_QUQNTITY] > 0) {
// otherArr.push(otherChildObj)
// }
// this.setState({
// topProcOptionList: shppArr
// topProcOptionList: otherArr
// })
}
// 恢复耗材以外的数据
setTopOrginTopData(curOptions) {
let { orginOptionList } = this.state
orginOptionList.map(function (orgItem, orgIndex) {
if (orgIndex < 4) {
orgItem = curOptions[orgIndex]
}
})
this.props.modelCallBack(orginOptionList)
// let { orginOptionList } = this.state
// orginOptionList.map(function (orgItem, orgIndex) {
// if (orgIndex < 4) {
// orgItem = curOptions[orgIndex]
// }
// })
// this.props.modelCallBack(orginOptionList)
}
// 选好了 点击
......@@ -554,7 +517,9 @@ class ProductModel extends Component {
handleClearRubbish() {
let { orginOptionList, topProcOptionList } = this.state
// this.refs.ClearAllModel.show('清空当前所有数据')
console.log('this--', this)
console.log('清空🎹所有==--', this)
// this.modelClearAllCB(true)
let that = this
......@@ -562,14 +527,19 @@ class ProductModel extends Component {
top_item[LocalVariable.SELECTED_QUQNTITY] = 0
top_item[LocalVariable.SELECTED_DATA_ARR] = []
})
that.props.changeCallBack(topProcOptionList)
// that.props.changeCallBack(topProcOptionList)
that.setState({
topProcOptionList: topProcOptionList
})
setTimeout(() => {
}, () => {
that.props.changeCallBack(topProcOptionList)
that.closeModal()
}, 300)
})
// setTimeout(() => {
// that.closeModal()
// }, 300)
}
// 清空当前
......@@ -975,7 +945,7 @@ class ProductModel extends Component {
<View style={styles.opt_area}>
<View style={styles.modal_style}>
<View style={styles.scro_box}>
{this.renderRubbish()}
{/* {this.renderRubbish()} */}
{/* {this.renderTopSuppItem()} */}
......@@ -1042,7 +1012,8 @@ const styles = StyleSheet.create({
},
top_box: {
width: Width(),
paddingHorizontal: 20
paddingHorizontal: 20,
paddingTop: 10
},
top_scroll_cont: {
paddingBottom: 4,
......
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