Commit a6f6cbe7 by Denglingling

完善自助下单的已选模块

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