Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8c00faca
authored
Dec 09, 2020
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加已选弹窗,清空当前所有选择,以及增加可打开已选弹窗的判断
parent
54a17ed6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
110 deletions
app/containers/common/ProductModel.js
app/containers/selfOrder/module/ChooseProductPage.js
app/containers/selfOrder/module/ProductRightStyle.js
app/containers/common/ProductModel.js
View file @
8c00faca
...
...
@@ -69,7 +69,7 @@ class ProductModel extends Component {
// }
// ],
topActiveIndex
:
0
,
allCountQuantity
:
0
,
//
allCountQuantity: 0,
// SELECTED_QUQNTITY: 'selectedQuantity', // 中类数量
// SELECTED_DATA_ARR: 'selectedDataArr', // 中类已选元素
...
...
@@ -195,7 +195,7 @@ class ProductModel extends Component {
// 修改列表计算后数据
handleCalCallBack
(
item
,
index
,
dataName
){
let
{
topProcOptionList
,
topActiveIndex
,
allCountQuantity
}
=
this
.
state
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
{
modelOption
}
=
this
.
props
console
.
log
(
'--已选==='
,
item
,
topActiveIndex
,
index
)
...
...
@@ -238,7 +238,7 @@ class ProductModel extends Component {
// 修改左侧分类汇总
// 本地测试
let
curCalField
=
'quantity'
allCountQuantity
=
0
// 初始化
let
allCountQuantity
=
0
// 初始化
if
(
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
].
length
>
0
)
{
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
].
map
((
selItem
)
=>
{
...
...
@@ -258,22 +258,16 @@ class ProductModel extends Component {
}
allCountQuantity
+=
proItem
[
SELECTED_QUQNTITY
]
})
this
.
setState
({
allCountQuantity
})
// this.setState({
// allCountQuantity
// })
// 回调函数
console
.
log
(
'---计算后 '
,
topProcOptionList
,
allCountQuantity
)
this
.
props
.
modelCallBack
(
topProcOptionList
)
// this.setState({
// topProcOptionList
// })
if
(
allCountQuantity
===
0
){
this
.
closeModal
()
}
}
}
...
...
@@ -288,6 +282,27 @@ class ProductModel extends Component {
// 清空
handleClearRubbish
()
{
console
.
log
(
'清空======'
)
let
{
topProcOptionList
}
=
this
.
state
// 本地测试
let
curCalField
=
'quantity'
topProcOptionList
.
map
(
function
(
listItem
)
{
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
]
=
[]
listItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
curCalField
]
=
0
})
})
// this.setState({
// allCountQuantity: 0
// })
// 回调函数
console
.
log
(
'---清空之后===== '
,
topProcOptionList
)
this
.
props
.
modelCallBack
(
topProcOptionList
)
this
.
closeModal
()
}
// 返回清空
...
...
@@ -311,7 +326,7 @@ class ProductModel extends Component {
// 返回顶部编辑选项
renderTopProItem
()
{
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
{
modelOption
}
=
this
.
props
//
let {modelOption} = this.props
return
(
<
ChooseCardList
...
...
@@ -374,7 +389,8 @@ class ProductModel extends Component {
// }
let
{
modelOption
}
=
this
.
props
// let {modelOption} = this.props
let
curData
=
topProcOptionList
[
topActiveIndex
]
console
.
log
(
'已选展示信息 === curData---'
,
topProcOptionList
,
topActiveIndex
,
curData
)
let
localBottomContData
=
[]
...
...
@@ -410,7 +426,6 @@ class ProductModel extends Component {
activeOpacity
=
{
1
}
style
=
{
styles
.
column_container
}
>
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
...
...
@@ -418,15 +433,12 @@ class ProductModel extends Component {
// subCalCallBack={(item,index) => this.handleCalCallBack(item,index,'localBottomContData')}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
)}
titText
=
{
'title'
}
// tipTextOne={'tip1'}
// tipTextTwo={'tip2'}
listImgIcon
=
{
'imgIcon'
}
listPicType
=
{
'SQUARE'
}
listStyleImg
=
{
styles
.
list_icon
}
listStyleTit
=
{
styles
.
list_tit
}
/
>
{
/* <View style={styles.ri_inner}>
<View style={styles.oth_img_box}>
<Image style={styles.oth_img} source={item.imgIcon}/>
...
...
@@ -467,7 +479,7 @@ class ProductModel extends Component {
// 返回底部按钮
renderFooterBtnItem
()
{
let
{
topProcOptionList
,
selectShowPopup
}
=
this
.
state
let
{
topProcOptionList
}
=
this
.
state
let
allCountQuantity
=
0
topProcOptionList
.
map
(
proItem
=>
{
...
...
app/containers/selfOrder/module/ChooseProductPage.js
View file @
8c00faca
...
...
@@ -61,7 +61,7 @@ class ChooseProductPage extends Component {
// SELECTED_QUQNTITY: 'selectedQuantity', // 中类数量
// SELECTED_DATA_ARR: 'selectedDataArr', // 中类已选元素
// DEFAULT_SECOND_DATA: 'localSecondData', // 中类原本元素
allCountQuantity
:
0
//
allCountQuantity: 0
}
}
...
...
@@ -76,7 +76,7 @@ class ChooseProductPage extends Component {
// 顶部产品点击
handleTopNav
(
item
,
index
)
{
console
.
warn
(
'top产品--'
,
item
,
index
)
console
.
log
(
'top产品--'
,
item
,
index
)
this
.
setState
({
topActiveIndex
:
index
})
...
...
@@ -84,12 +84,12 @@ class ChooseProductPage extends Component {
// 左侧标题点击
handleLeftNav
(
item
,
index
)
{
console
.
warn
(
'左侧标题--'
,
index
,
item
)
console
.
log
(
'左侧标题--'
,
index
,
item
)
let
{
leftOptionList
}
=
this
.
state
this
.
setState
({
leftActiveIndex
:
index
,
rightSecondData
:
leftOptionList
[
index
][
DEFAULT_SECOND_DATA
]
// 本地数据
// rightSecondData: leftOptionList[index].localSecondData // 本地数据
})
}
...
...
@@ -103,11 +103,10 @@ class ChooseProductPage extends Component {
// 计算中级数量
handleChangeCount
(
count
,
coutFieName
)
{
let
{
leftActiveIndex
,
leftOptionList
,
allCountQuantity
,
defaultThridShow
,
rightSecondData
}
=
this
.
state
let
{
leftActiveIndex
,
leftOptionList
,
defaultThridShow
,
rightSecondData
}
=
this
.
state
console
.
log
(
'计算中级数量==='
,
count
,
leftActiveIndex
,
defaultThridShow
,
rightSecondData
,
coutFieName
)
// leftOptionList[leftActiveIndex][SELECTED_QUQNTITY] = count
allCountQuantity
=
0
// 初始化
// let
allCountQuantity = 0 // 初始化
leftOptionList
[
leftActiveIndex
][
SELECTED_DATA_ARR
]
=
[]
leftOptionList
.
map
(
function
(
leItem
,
leIndex
)
{
...
...
@@ -128,35 +127,49 @@ class ChooseProductPage extends Component {
})
}
}
allCountQuantity
+=
leItem
[
SELECTED_QUQNTITY
]
// allCountQuantity += leItem[SELECTED_DATA_ARR].length
// allCountQuantity += leItem[SELECTED_QUQNTITY]
})
console
.
log
(
'
allCountQuantity---'
,
allCountQuantity
,
leftOptionList
)
console
.
log
(
'
计算中级之后---'
,
leftOptionList
)
this
.
setState
({
leftOptionList
,
allCountQuantity
//
allCountQuantity
})
}
// 共计已选弹窗
handleCloseSelectModal
(
show
)
{
console
.
warn
(
'修改共计已选'
,
show
)
console
.
log
(
'修改共计已选'
,
show
)
this
.
setState
({
selectShowPopup
:
show
})
}
// 计算所有已选数量
getAllCountQuantity
()
{
let
{
leftOptionList
}
=
this
.
state
let
allCountQuantity
=
0
leftOptionList
.
map
(
leItem
=>
{
if
(
!
leItem
[
SELECTED_QUQNTITY
]){
leItem
[
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
leItem
[
SELECTED_QUQNTITY
]
})
return
allCountQuantity
}
// 点击共计已选
handleSubSelected
(
show
)
{
// console.log('show-----', show)
this
.
handleCloseSelectModal
(
!
show
)
if
(
this
.
getAllCountQuantity
()
!==
0
)
{
this
.
handleCloseSelectModal
(
!
show
)
}
}
// 点击选好了
handleSubmit
()
{
console
.
warn
(
'选好了'
,
this
.
props
.
navigation
.
navigate
)
console
.
log
(
'选好了'
,
this
.
props
.
navigation
.
navigate
)
this
.
handleCloseSelectModal
(
false
)
console
.
warn
(
'携带数据,返回到自助下单'
)
console
.
log
(
'携带数据,返回到自助下单'
)
}
// 已选修改回调
...
...
@@ -326,33 +339,20 @@ 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 = 0
// leftOptionList.map(leItem => {
// if(!leItem[SELECTED_QUQNTITY]){
// leItem[SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += leItem[SELECTED_QUQNTITY]
// })
let
allCountQuantity
=
this
.
getAllCountQuantity
()
// console.log('返回底部按钮----', selectShowPopup)
return
(
<
View
style
=
{
list_common_item
.
sub_box
}
>
{
/* <FooterBtnStyle
style={styles.sub_btn_left}
activeOpacity={.8}
title={'共计已选:666'}
textStyle= {[styles.sub_btn_tit, styles.sub_btn_left_text]}
onPress={() => this.handleSubSelected(selectShowPopup)}
/>
<FooterBtnStyle
style={styles.sub_btn_rig}
activeOpacity={.8}
title={'选好了'}
textStyle= {[styles.sub_btn_tit, styles.sub_btn_rig_text]}
onPress={() => this.handleSubmit(selectShowPopup)}
/> */
}
<
View
style
=
{
list_common_item
.
sub_two_btn
}
>
<
TouchableOpacity
activeOpacity
=
{.
8
}
...
...
@@ -374,7 +374,6 @@ class ChooseProductPage extends Component {
// modelShow={selectShowPopup}
show
=
{
selectShowPopup
}
closeModal
=
{(
show
)
=>
this
.
handleCloseSelectModal
(
show
)}
// closeSelected={(show) => this.handleSubSelected(show)}
closeSubmit
=
{()
=>
this
.
handleSubmit
()}
modelOption
=
{
leftOptionList
}
modelCallBack
=
{(
options
)
=>
this
.
handleSelectCallBack
(
options
)}
...
...
app/containers/selfOrder/module/ProductRightStyle.js
View file @
8c00faca
...
...
@@ -300,7 +300,7 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 大类
renderOtherStyle
()
{
return
(
<
View
style
=
{
styles
.
stencil
_cont
}
>
<
View
style
=
{
styles
.
cont_other
_cont
}
>
<
FlatList
style
=
{
styles
.
cont_other_list
}
keyExtractor
=
{
item
=>
item
.
id
}
...
...
@@ -448,12 +448,15 @@ const styles = StyleSheet.create({
height
:
'100%'
},
// other right
cont_other_cont
:
{},
cont_other_list
:
{
paddingTop
:
14
//
paddingTop: 14
},
oth_container
:
{
flex
:
1
,
marginBottom
:
14
// flex: 1,
// marginBottom: 14
// paddingTop: 0,
// marginTop: 0
},
oth_inner
:
{},
oth_box
:
{},
...
...
@@ -509,52 +512,52 @@ const styles = StyleSheet.create({
},
cont_thr_list
:
{},
thr_container
:
{},
thr_inner
:
{
paddingVertical
:
0
,
paddingBottom
:
26
},
thr_ot
:
{
fontFamily
:
font_family_regular
,
fontSize
:
second_text_size
,
color
:
first_text_color
},
ri_num_box
:
{
flexDirection
:
'row'
,
alignItems
:
'center'
},
thr_num_btn
:
{
width
:
pxSize
(
24
),
height
:
pxSize
(
24
),
// justifyContent: 'center',
// alignItems: 'center',
// borderRadius: 50,
// borderWidth: 1
},
thr_btn_left
:
{
// borderColor: '#E6E6E6'
marginRight
:
4
},
thr_btn_right
:
{
// borderColor: foundation_color,
// backgroundColor: promary_color
marginLeft
:
4
},
thr_num_icon
:
{
// fontSize: 16
width
:
'100%'
,
height
:
'100%'
},
thr_icon_left
:
{
// color: third_text_color
},
thr_icon_right
:
{
// color: title_text_color
},
btn_inner
:
{},
thr_num
:
{
minWidth
:
pxSize
(
20
),
textAlign
:
'center'
},
//
thr_inner: {
//
paddingVertical: 0,
//
paddingBottom: 26
//
},
//
thr_ot: {
//
fontFamily: font_family_regular,
//
fontSize: second_text_size,
//
color: first_text_color
//
},
//
ri_num_box: {
//
flexDirection: 'row',
//
alignItems: 'center'
//
},
//
thr_num_btn: {
//
width: pxSize(24),
//
height: pxSize(24),
//
// justifyContent: 'center',
//
// alignItems: 'center',
//
// borderRadius: 50,
//
// borderWidth: 1
//
},
//
thr_btn_left: {
//
// borderColor: '#E6E6E6'
//
marginRight: 4
//
},
//
thr_btn_right: {
//
// borderColor: foundation_color,
//
// backgroundColor: promary_color
//
marginLeft: 4
//
},
//
thr_num_icon: {
//
// fontSize: 16
//
width: '100%',
//
height: '100%'
//
},
//
thr_icon_left: {
//
// color: third_text_color
//
},
//
thr_icon_right: {
//
// color: title_text_color
//
},
//
btn_inner: {},
//
thr_num: {
//
minWidth: pxSize(20),
//
textAlign: 'center'
//
},
})
export
default
ProductRightStyle
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment