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
12a55f69
authored
Dec 11, 2020
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善 单选耗材(已选时,统一查看,取消已选仍按当前菜单查看),修改相关已选、清空操作
parent
0d182f54
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1230 additions
and
239 deletions
app/containers/common/ProductModel.js
app/containers/common/listDataComponent/PicTitDetaiCalcu.js
app/containers/selfOrder/module/ChooseProductPage.js
app/containers/selfOrder/module/EditThirdLevelPage.js
app/containers/selfOrder/module/ProductRightStyle.js
app/containers/selfOrder/module/mock/sen_mock.js
app/containers/common/ProductModel.js
View file @
12a55f69
...
...
@@ -31,13 +31,16 @@ import {
import
{
FooterBtnStyle
}
from
'../common/CellTextStyle'
;
import
ChooseCardList
from
'../common/listDataComponent/ChooseCardList'
;
import
PicTitDetaiCalcu
from
'../common/listDataComponent/PicTitDetaiCalcu'
;
import
_
from
"lodash"
;
import
localMockData
from
'../../containers/selfOrder/module/mock/sen_mock'
;
import
{
cloneObject
}
from
'../../utils/Utils'
;
const
PropTypes
=
require
(
'prop-types'
);
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
DEFAULT_SECOND_DATA
=
'localSecondData'
// 中类原本元素
const
DEFAULT_FIELD
=
'quantity'
// 计算的字段
const
DEFAULT_QUANTITY
=
'quantity'
// 计算的字段
const
CHILD_DATA_NAME
=
'childrenLineData'
// 显示的子类数组名称
class
ProductModel
extends
Component
{
...
...
@@ -55,6 +58,7 @@ class ProductModel extends Component {
isVisible
:
this
.
props
.
show
,
topProcOptionList
:
[],
topActiveIndex
:
0
,
orginOptionList
:
[],
// 原始数据
// SELECTED_QUQNTITY: 'selectedQuantity', // 中类数量
// SELECTED_DATA_ARR: 'selectedDataArr', // 中类已选元素
}
...
...
@@ -69,14 +73,174 @@ class ProductModel extends Component {
}
componentWillReceiveProps
(
nextProps
)
{
let
that
=
this
if
(
this
.
state
.
isVisible
!=
nextProps
.
show
)
{
this
.
setState
({
isVisible
:
nextProps
.
show
});
}
if
(
nextProps
.
modelOption
)
{
this
.
setState
({
topProcOptionList
:
nextProps
.
modelOption
});
that
.
setState
({
// topProcOptionList: nextProps.modelOption,
orginOptionList
:
nextProps
.
modelOption
},()
=>
{
that
.
getTopOptions
()
});
}
}
// 修改已选数据
getTopOptions
(){
let
{
orginOptionList
}
=
this
.
state
let
otherArr
=
[]
// let otherChildData = []
let
otherChildObj
=
{
title
:
'单选耗材'
,
[
SELECTED_QUQNTITY
]:
0
,
[
SELECTED_DATA_ARR
]:
[],
[
DEFAULT_SECOND_DATA
]:
[]
}
orginOptionList
.
forEach
((
orItem
,
orIndex
)
=>
{
if
(
orIndex
<
4
)
{
otherArr
.
push
(
orItem
)
}
else
{
otherChildObj
[
DEFAULT_SECOND_DATA
].
push
(
orItem
)
if
(
orItem
[
SELECTED_QUQNTITY
]){
otherChildObj
[
SELECTED_QUQNTITY
]
+=
Number
(
orItem
[
SELECTED_QUQNTITY
])
}
if
(
orItem
[
SELECTED_DATA_ARR
]){
otherChildObj
[
SELECTED_DATA_ARR
].
push
(...
orItem
[
SELECTED_DATA_ARR
])
}
}
})
otherArr
.
push
(
otherChildObj
)
console
.
log
(
'修改后的已选数据===='
,
otherArr
)
this
.
setState
({
topProcOptionList
:
otherArr
})
}
// 恢复其他所有数据
setTopOrginTopData
(
curOptions
){
let
{
orginOptionList
}
=
this
.
state
console
.
log
(
'回调之前的==原始已选数据=='
,
orginOptionList
)
console
.
log
(
'回调之前的===当前修改后的已选数据=='
,
curOptions
)
orginOptionList
.
map
(
function
(
orgItem
,
orgIndex
)
{
if
(
orgIndex
<
4
){
orgItem
=
curOptions
[
orgIndex
]
}
})
console
.
log
(
'当前修改后的原始数据=='
,
orginOptionList
)
this
.
props
.
modelCallBack
(
orginOptionList
)
// 调用
}
// 恢复已选数据
setTopOrginTopData_old
(
curOptions
){
let
{
orginOptionList
}
=
this
.
state
console
.
log
(
'回调之前的==原始已选数据=='
,
orginOptionList
)
console
.
log
(
'回调之前的===当前修改后的已选数据=='
,
curOptions
)
orginOptionList
.
map
(
function
(
orgItem
,
orgIndex
)
{
if
(
orgIndex
<
4
){
orgItem
=
curOptions
[
orgIndex
]
}
else
{
if
(
orgItem
[
SELECTED_DATA_ARR
]
&&
orgItem
[
SELECTED_DATA_ARR
].
length
>
0
&&
curOptions
[
SELECTED_DATA_ARR
]
&&
curOptions
[
SELECTED_DATA_ARR
].
length
>
0
){
let
delArr
=
[]
orgItem
[
SELECTED_DATA_ARR
].
map
(
function
(
seIt
,
seInd
)
{
console
.
log
(
'标题===='
,
curSeChild
[
'superTit'
],
seIt
[
CHILD_DATA_NAME
][
0
][
'superTit'
])
let
orgCurChild
=
seIt
[
CHILD_DATA_NAME
][
0
]
curOptions
[
SELECTED_DATA_ARR
].
forEach
(
function
(
curSeItem
,
curSeInd
){
let
curSeChild
=
curSeItem
[
CHILD_DATA_NAME
][
0
]
if
(
curSeChild
&&
orgCurChild
&&
curSeChild
[
'superTit'
]
===
orgCurChild
[
'superTit'
]
&&
curSeChild
[
'id'
]
===
orgCurChild
[
'id'
]
&&
curSeChild
[
'superIndex'
]
===
orgCurChild
[
'superIndex'
]
&&
curSeChild
[
'curTitle'
]
===
orgCurChild
[
'curTitle'
]){
// seIt[CHILD_DATA_NAME][0]['lineOptions'] = curSeChild['lineOptions']
seIt
=
curSeChild
}
})
// 是否在已选存在
let
isExitArr
=
curOptions
[
SELECTED_DATA_ARR
].
filter
(
item
=>
{
let
curSeChild
=
curSeItem
[
CHILD_DATA_NAME
][
0
]
return
curSeChild
&&
orgCurChild
&&
curSeChild
[
'superTit'
]
===
orgCurChild
[
'superTit'
]
&&
curSeChild
[
'id'
]
===
orgCurChild
[
'id'
]
&&
curSeChild
[
'superIndex'
]
===
orgCurChild
[
'superIndex'
]
&&
curSeChild
[
'curTitle'
]
===
orgCurChild
[
'curTitle'
]
})
if
(
isExitArr
.
length
>
0
){
// 存在,并且数量不为空
}
else
{
// 不存在,即数量为空
delArr
.
push
(
seInd
)
// 清空之前的
}
})
if
(
delArr
.
length
){
for
(
let
i
=
delArr
.
length
-
1
;
i
>=
0
;
i
--
){
let
seDelChild
=
orgItem
[
SELECTED_DATA_ARR
][
i
][
CHILD_DATA_NAME
][
0
]
if
(
orgItem
[
DEFAULT_SECOND_DATA
]
&&
orgItem
[
DEFAULT_SECOND_DATA
].
length
>
0
&&
seDelChild
){
// for(let deIt of orgItem[DEFAULT_SECOND_DATA]){
// let deItChild = deIt[CHILD_DATA_NAME][0]
// if(deItChild && seDelChild && deItChild['superTit'] === seDelChild['superTit'] && deItChild['id'] === seDelChild['id']
// && deItChild['index'] === seDelChild['index']){
// deIt[DEFAULT_QUANTITY] = 0
// delete deIt[CHILD_DATA_NAME]
// }
// }
orgItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
let
deItChild
=
deIt
[
CHILD_DATA_NAME
][
0
]
if
(
deItChild
&&
seDelChild
&&
deItChild
[
'superTit'
]
===
seDelChild
[
'superTit'
]
&&
deItChild
[
'id'
]
===
seDelChild
[
'id'
]
&&
deItChild
[
'index'
]
===
seDelChild
[
'index'
]){
deIt
[
DEFAULT_QUANTITY
]
=
0
delete
deIt
[
CHILD_DATA_NAME
]
}
})
}
orgItem
[
SELECTED_DATA_ARR
].
splice
(
i
,
1
)
}
}
}
else
{
// 清空所有已选
orgItem
[
SELECTED_DATA_ARR
]
=
[]
orgItem
[
DEFAULT_QUANTITY
]
=
0
if
(
orgItem
[
DEFAULT_SECOND_DATA
]
&&
orgItem
[
DEFAULT_SECOND_DATA
].
length
>
0
){
orgItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
DEFAULT_QUANTITY
]
=
0
// deIt[CHILD_DATA_NAME] = []
delete
deIt
[
CHILD_DATA_NAME
]
})
}
}
}
})
console
.
log
(
'修改后的原始数据========>'
,
orginOptionList
)
// this.props.modelCallBack(orginOptionList) // 调用
}
// 共计已选 点击
handleCloseSelected
()
{
console
.
log
(
'共计已选:666--model'
)
...
...
@@ -99,68 +263,290 @@ class ProductModel extends Component {
this
.
props
.
closeModal
(
false
);
}
// 清空图标回调
handleClearBack
(
item
,
index
){
console
.
log
(
'清空图标回调---'
,
item
,
index
)
let
{
orginOptionList
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
console
.
log
(
'原始已选数据==--===--'
,
orginOptionList
)
console
.
log
(
'当前已选数据==----'
,
topProcOptionList
,
topActiveIndex
)
// topProcOptionList
// 单选耗材当前清空项
let
deleOpts
=
cloneObject
(
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
][
index
])
let
allCountQuantity
=
0
// 初始化
orginOptionList
.
forEach
(
function
(
orgOpts
,
orgInd
)
{
if
(
orgInd
>=
4
){
// console.log('orgOpts[SELECTED_DATA_ARR]---', orgOpts[SELECTED_DATA_ARR], SELECTED_DATA_ARR)
// if(orgOpts[SELECTED_DATA_ARR] && orgOpts[SELECTED_DATA_ARR].length > 0){
// let deIndex = 0
// let deFlag = false
// orgOpts[SELECTED_DATA_ARR].forEach(function(selDa, selInde){
// if(selDa[CHILD_DATA_NAME] && deleOpts[CHILD_DATA_NAME]){
// let curLine = selDa[CHILD_DATA_NAME][0]
// console.log('curLine---', curLine)
// let deLi = deleOpts[CHILD_DATA_NAME][0]
// console.log('deLi---', deLi)
// if(curLine && deLi && curLine['superTit'] === deLi['superTit'] && curLine['id'] === deLi['id']
// && curLine['superIndex'] === deLi['superIndex']){
// console.log('---删除=!!!====-', curLine, deLi)
// deFlag = true
// deIndex = localInd
// // selDa[DEFAULT_QUANTITY] = 0
// // delete selDa[CHILD_DATA_NAME]
// }
// }
// })
// if(deFlag){
// console.log('---删除=====-', deFlag, deIndex)
// orgOpts[SELECTED_DATA_ARR].splice(deIndex, 1)
// }
// }
if
(
orgOpts
[
DEFAULT_SECOND_DATA
]
&&
orgOpts
[
DEFAULT_SECOND_DATA
].
length
>
0
){
orgOpts
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
localDa
,
localInd
)
{
// console.log('localDa--CHILD_DATA_NAME-', localDa, CHILD_DATA_NAME)
if
(
localDa
[
CHILD_DATA_NAME
]
&&
deleOpts
[
CHILD_DATA_NAME
]){
let
curLine
=
localDa
[
CHILD_DATA_NAME
][
0
]
// console.log('curLine---', curLine, deleOpts)
let
deLi
=
deleOpts
[
CHILD_DATA_NAME
][
0
]
// console.log('deLi--', deLi)
if
(
curLine
&&
deLi
&&
curLine
[
'superTit'
]
===
deLi
[
'superTit'
]
&&
curLine
[
'id'
]
===
deLi
[
'id'
]
&&
curLine
[
'superIndex'
]
===
deLi
[
'superIndex'
]
&&
curLine
[
'curTitle'
]
===
deLi
[
'curTitle'
]){
// deIndex = localInd
localDa
[
DEFAULT_QUANTITY
]
=
0
delete
localDa
[
CHILD_DATA_NAME
]
}
}
})
}
if
(
orgOpts
[
SELECTED_DATA_ARR
]
&&
orgOpts
[
SELECTED_DATA_ARR
].
length
>
0
){
let
delArr
=
[]
orgOpts
[
SELECTED_DATA_ARR
].
map
((
deIt
,
deIndex
)
=>
{
if
(
!
deIt
[
CHILD_DATA_NAME
]){
delArr
.
push
(
deIndex
)
}
})
console
.
log
(
'delArr----'
,
delArr
)
for
(
let
i
=
delArr
.
length
-
1
;
i
>=
0
;
i
--
){
console
.
log
(
'orgOpts--!!--'
,
i
,
delArr
[
i
],
orgOpts
[
SELECTED_DATA_ARR
])
orgOpts
[
SELECTED_DATA_ARR
].
splice
(
delArr
[
i
],
1
);
}
console
.
log
(
'orgOpts----'
,
orgOpts
[
SELECTED_DATA_ARR
])
}
// 初始化
orgOpts
[
SELECTED_QUQNTITY
]
=
0
if
(
orgOpts
[
SELECTED_DATA_ARR
].
length
>
0
){
orgOpts
[
SELECTED_DATA_ARR
].
map
(
itDa
=>
{
if
(
!
itDa
[
DEFAULT_QUANTITY
]){
itDa
[
DEFAULT_QUANTITY
]
=
0
}
orgOpts
[
SELECTED_QUQNTITY
]
+=
Number
(
itDa
[
DEFAULT_QUANTITY
])
})
}
// else {
// orgOpts[SELECTED_QUQNTITY] = 0
// }
}
if
(
!
orgOpts
[
SELECTED_QUQNTITY
]){
orgOpts
[
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
orgOpts
[
SELECTED_QUQNTITY
]
})
console
.
log
(
'修改后的已选=======---'
,
topProcOptionList
)
console
.
log
(
'修改后的数量---'
,
allCountQuantity
)
console
.
log
(
'修改后端所有数据---'
,
orginOptionList
)
this
.
props
.
modelCallBack
(
orginOptionList
)
// 调用
if
(
allCountQuantity
===
0
){
this
.
closeModal
()
}
}
// 修改列表计算后数据
handleCalCallBack
(
item
,
index
,
dataName
){
handleCalCallBack
(
item
,
index
,
SUB_LINE_NAME
){
console
.
log
(
'回调====='
,
item
,
index
,
SUB_LINE_NAME
)
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
// console.log('--已选===',item, topActiveIndex, index)
let
defauIndex
=
index
SUB_LINE_NAME
=
'childrenLineData'
// 测试 item.superIndex
// if(SUB_LINE_NAME){
// defauIndex = item.superIndex
// }
defauIndex
=
item
.
superIndex
// console.log('--当前已选数据 ===',topProcOptionList, topActiveIndex)
if
(
SELECTED_DATA_ARR
&&
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
])
{
let
allCountQuantity
=
0
// 初始化
topProcOptionList
.
map
(
function
(
listItem
,
listIndex
)
{
if
(
listIndex
===
topActiveIndex
){
listItem
[
SELECTED_DATA_ARR
][
index
]
=
item
// 本地测试 id为唯一值
let
curObj
=
listItem
[
SELECTED_DATA_ARR
][
index
]
if
(
curObj
.
id
){
listItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
if
(
deIt
.
id
===
curObj
.
id
){
deIt
=
curObj
let
deleFlag
=
false
let
deleInd
=
null
// 初始化 三级
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
DEFAULT_QUANTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
'childrenLineData'
].
forEach
(
function
(
chIt
,
chInd
)
{
if
(
_
.
isEqual
(
chIt
,
item
)){
chIt
=
item
if
(
chIt
[
DEFAULT_QUANTITY
]
===
0
){
deleFlag
=
true
deleInd
=
chInd
}
})
}
if
(
!
chIt
[
DEFAULT_QUANTITY
]){
chIt
[
DEFAULT_QUANTITY
]
=
0
}
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
DEFAULT_QUANTITY
]
+=
Number
(
chIt
[
DEFAULT_QUANTITY
])
})
if
(
deleFlag
)
{
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
'childrenLineData'
].
splice
(
deleInd
,
1
)
}
// 初始化 中类
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
].
forEach
(
function
(
seDa
)
{
if
(
!
seDa
[
DEFAULT_QUANTITY
]){
seDa
[
DEFAULT_QUANTITY
]
=
0
}
listItem
[
SELECTED_QUQNTITY
]
+=
Number
(
seDa
[
DEFAULT_QUANTITY
])
})
// 已选数量赋值之前默认数据
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'为唯一值
deIt
=
curObj
}
})
}
}
}
if
(
!
listItem
[
SELECTED_QUQNTITY
]){
listItem
[
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
listItem
[
SELECTED_QUQNTITY
]
})
// 恢复之后再调用
this
.
setTopOrginTopData
(
topProcOptionList
)
//
console.log('---item[DEFAULT_FIELD] ', item[DEFAULT_FIELD], index
)
//
this.props.modelCallBack(topProcOptionList
)
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])
if
(
allCountQuantity
===
0
){
this
.
closeModal
()
}
}
// 修改左侧分类汇总
// 本地测试
let
curCalField
=
'quantity'
let
allCountQuantity
=
0
// 初始化
if
(
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
].
length
>
0
)
{
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
].
map
((
selItem
)
=>
{
if
(
!
selItem
[
curCalField
]){
selItem
[
curCalField
]
=
0
}
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
+=
Number
(
selItem
[
curCalField
])
// if(SELECTED_DATA_ARR && topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]) {
// topProcOptionList.map(function(listItem, listIndex) {
// if(listIndex === topActiveIndex){
// if(SUB_LINE_NAME){
// listItem[SELECTED_DATA_ARR][item.superIndex][SUB_LINE_NAME].forEach(function(chIt) {
// if(_.isEqual(chIt, item)){
// chIt = item
// }
// })
// }else {
// // listItem[SELECTED_DATA_ARR][index] = item
// listItem[SELECTED_DATA_ARR][defauIndex] = item
// }
// // 本地测试 id为唯一值
// // let curObj = listItem[SELECTED_DATA_ARR][index]
// let curObj = listItem[SELECTED_DATA_ARR][defauIndex]
// if(curObj.id){
// listItem[DEFAULT_SECOND_DATA].forEach(function(deIt) {
// if(deIt.id === curObj.id){
// deIt = curObj
// }
// })
// }
// }
// })
// // console.log('---item[DEFAULT_QUANTITY] ', item[DEFAULT_QUANTITY], index)
// if(item[DEFAULT_QUANTITY] === 0) {
// topProcOptionList[topActiveIndex][SELECTED_DATA_ARR].splice(index, 1)
// // console.log('topProcOptionList[topActiveIndex][SELECTED_DATA_ARR]---', topProcOptionList[topActiveIndex][SELECTED_DATA_ARR])
// }
// // 修改左侧分类汇总
// // 本地测试
// let curCalField = 'quantity'
// let allCountQuantity = 0 // 初始化
// if(topProcOptionList[topActiveIndex][SELECTED_DATA_ARR].length > 0) {
// topProcOptionList[topActiveIndex][SELECTED_QUQNTITY] = 0
// topProcOptionList[topActiveIndex][SELECTED_DATA_ARR].map((selItem) => {
// if(!selItem[curCalField]){
// selItem[curCalField] = 0
// }
// topProcOptionList[topActiveIndex][SELECTED_QUQNTITY] += Number(selItem[curCalField])
})
}
else
{
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
0
}
//
})
//
} else{
//
topProcOptionList[topActiveIndex][SELECTED_QUQNTITY] = 0
//
}
topProcOptionList
.
map
(
proItem
=>
{
if
(
!
proItem
[
SELECTED_QUQNTITY
]){
proItem
[
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
proItem
[
SELECTED_QUQNTITY
]
})
//
topProcOptionList.map(proItem => {
//
if(!proItem[SELECTED_QUQNTITY]){
//
proItem[SELECTED_QUQNTITY] = 0
//
}
//
allCountQuantity += proItem[SELECTED_QUQNTITY]
//
})
// 回调函数
// console.log('---计算后 ', topProcOptionList, allCountQuantity)
this
.
props
.
modelCallBack
(
topProcOptionList
)
//
// 回调函数
//
// console.log('---计算后 ', topProcOptionList, allCountQuantity)
//
this.props.modelCallBack(topProcOptionList)
if
(
allCountQuantity
===
0
){
this
.
closeModal
()
}
}
//
if(allCountQuantity === 0){
//
this.closeModal()
//
}
//
}
}
...
...
@@ -173,24 +559,43 @@ class ProductModel extends Component {
// 清空
handleClearRubbish
()
{
// console.log('清空======')
let
{
topProcOptionList
}
=
this
.
state
// 本地测试
let
curCalField
=
'quantity'
topProcOptionList
.
map
(
function
(
listItem
)
{
let
{
topProcOptionList
,
orginOptionList
}
=
this
.
state
console
.
log
(
'清空======'
,
orginOptionList
)
orginOptionList
.
map
(
function
(
listItem
)
{
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
]
=
[]
listItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
curCalField
]
=
0
deIt
[
DEFAULT_QUANTITY
]
=
0
deIt
[
CHILD_DATA_NAME
]
=
[]
})
})
// 回调函数
// console.log('---清空之后===== ', topProcOptionList)
this
.
props
.
modelCallBack
(
topProcOptionList
)
console
.
log
(
'---清空之后===== '
,
orginOptionList
)
// this.setTopOrginTopData(topProcOptionList)
this
.
props
.
modelCallBack
(
orginOptionList
)
this
.
closeModal
()
// 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
// })
// })
// // 回调函数
// // console.log('---清空之后===== ', topProcOptionList)
// this.props.modelCallBack(topProcOptionList)
// this.closeModal()
}
// 返回清空
...
...
@@ -251,10 +656,20 @@ class ProductModel extends Component {
// console.log('已选展示信息 === curData---', topProcOptionList, topActiveIndex, curData)
let
localBottomContData
=
[]
if
(
curData
&&
curData
[
SELECTED_DATA_ARR
]){
localBottomContData
=
curData
[
SELECTED_DATA_ARR
]
// localBottomContData = curData[SELECTED_DATA_ARR]
curData
[
SELECTED_DATA_ARR
].
forEach
(
function
(
sedItem
)
{
if
(
sedItem
[
CHILD_DATA_NAME
]){
localBottomContData
.
push
(...
sedItem
[
CHILD_DATA_NAME
])
}
})
}
console
.
log
(
'已选展示信息---'
,
curData
,
topActiveIndex
,
localBottomContData
)
console
.
log
(
'已选当前模块数据---'
,
curData
,
topActiveIndex
)
console
.
log
(
'已选展示信息---'
,
localBottomContData
)
return
(
<
View
style
=
{
styles
.
edit_cont
}
>
...
...
@@ -276,6 +691,7 @@ class ProductModel extends Component {
// 返回每一列元素
renderContColumnItem
(
item
,
index
)
{
let
{
topActiveIndex
}
=
this
.
state
return
(
<
TouchableOpacity
activeOpacity
=
{
1
}
...
...
@@ -284,49 +700,33 @@ class ProductModel extends Component {
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
DEFAULT_FIELD
}
// subCalCallBack={(item,index) => this.handleCalCallBack(item,index,'localBottomContData')}
calField
=
{
DEFAULT_QUANTITY
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
)}
titText
=
{
'title'
}
listImgIcon
=
{
'imgIcon'
}
titText
=
{
'superTit'
}
tipTextOne
=
{
'superTip'
}
// listImgIcon={'superImg'}
listPicType
=
{
'SQUARE'
}
listStyleImg
=
{
styles
.
list_icon
}
listStyleTit
=
{
styles
.
list_tit
}
showClearIcon
=
{
true
}
showClearIndex
=
{
4
}
listCardActIndex
=
{
topActiveIndex
}
clearCallBack
=
{(
item
,
index
)
=>
this
.
handleClearBack
(
item
,
index
)}
/
>
{
/* <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> */
}
{
/* <PicTitDetaiCalcu
listItem={item}
listIndex={index}
calField={DEFAULT_QUANTITY}
subCalCallBack={(item,index) => this.handleCalCallBack(item,index)}
titText={'title'}
listImgIcon={'imgIcon'}
listPicType={'SQUARE'}
listStyleImg={styles.list_icon}
listStyleTit={styles.list_tit}
// listShowChildNum={CHILD_DATA_NAME}
/> */
}
<
/TouchableOpacity
>
)
...
...
@@ -346,20 +746,6 @@ class ProductModel extends Component {
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.handleCloseSelected()}
/>
<FooterBtnStyle
style={styles.sub_btn_rig}
activeOpacity={.8}
title={'选好了'}
textStyle= {[styles.sub_btn_tit, styles.sub_btn_rig_text]}
onPress={() => this.handleCloseSubmit()}
/> */
}
<
View
style
=
{
list_common_item
.
sub_two_btn
}
>
<
TouchableOpacity
activeOpacity
=
{.
8
}
...
...
app/containers/common/listDataComponent/PicTitDetaiCalcu.js
View file @
12a55f69
...
...
@@ -26,6 +26,13 @@ class PicTitDetaiCalcu extends Component {
listImgIcon
:
PropTypes
.
string
,
listStyleImg
:
PropTypes
.
objec
,
plusCallBack
:
PropTypes
.
func
,
// 加法的回调函数
reduceCallBack
:
PropTypes
.
func
,
// 减法的回调函数
// listShowChildNum: PropTypes.string, // 已选展示的子类数量,标题显示父级标题
showClearIcon
:
PropTypes
.
bool
,
// 展示减少x图标,不展示加减
showClearIndex
:
PropTypes
.
number
,
// 展示index
listCardActIndex
:
PropTypes
.
number
,
// 父级index = 展示index
listStyleClearBtn
:
PropTypes
.
object
,
clearCallBack
:
PropTypes
.
func
,
// 清空图标回调函数
}
constructor
(
props
)
{
...
...
@@ -35,6 +42,11 @@ class PicTitDetaiCalcu extends Component {
picStyleArr
:
[
'round_pic'
,
'square_pic'
,
'rectan_pic'
]
}
}
// // 清空图标
// handelClearCheck(item, index) {
// reduceCallBack(item, index)
// }
/**
* 点击加减
...
...
@@ -43,13 +55,18 @@ class PicTitDetaiCalcu extends Component {
* @param {boolean} isPlus 默认减法 false,加法 true,
*/
handelCalculation
(
item
,
index
,
isPlus
)
{
let
{
calField
,
plusCallBack
}
=
this
.
props
let
{
calField
,
plusCallBack
,
reduceCallBack
}
=
this
.
props
if
(
!
isPlus
&&
reduceCallBack
){
// console.log('减法回调======')
reduceCallBack
(
item
,
index
)
return
}
if
(
isPlus
&&
plusCallBack
){
console
.
log
(
'加法回调======'
,
item
,
index
)
//
console.log('加法回调======', item, index)
plusCallBack
(
item
,
index
)
return
}
console
.
log
(
'加法======'
)
// console.log('加减======', item, index, isPlus
)
item
[
calField
]
=
Number
(
item
[
calField
])
if
(
Number
.
isNaN
(
item
[
calField
])){
item
[
calField
]
=
0
...
...
@@ -63,7 +80,8 @@ class PicTitDetaiCalcu extends Component {
}
render
()
{
let
{
listItem
,
listIndex
,
calField
,
listStyleBox
,
listStyleTit
,
listStyleTip
,
listStyleCalBtn
,
listPicType
,
titCallBack
,
titText
,
tipTextStr
,
tipTextOne
,
tipTextTwo
,
listImgIcon
,
listStyleImg
}
=
this
.
props
let
{
listItem
,
listIndex
,
calField
,
listStyleBox
,
listStyleTit
,
listStyleTip
,
listStyleCalBtn
,
listPicType
,
titCallBack
,
titText
,
tipTextStr
,
tipTextOne
,
tipTextTwo
,
listImgIcon
,
listStyleImg
,
showClearIcon
,
showClearIndex
,
listCardActIndex
,
listStyleClearBtn
,
clearCallBack
}
=
this
.
props
let
{
listPicTypeArr
,
picStyleArr
}
=
this
.
state
let
picOthStyle
=
''
if
(
listPicTypeArr
.
indexOf
(
listPicType
)
>
-
1
){
...
...
@@ -75,9 +93,60 @@ class PicTitDetaiCalcu extends Component {
calIcon
=
require
(
'../../../images/plur_big_act.png'
)
}
// console.log('picOthStyle----', picOthStyle
)
console
.
log
(
'每一列----'
,
showClearIcon
,
listCardActIndex
,
showClearIndex
,
(
showClearIcon
&&
listIndex
===
showClearIndex
)
)
return
(
// <View>
// { curListArr.map((curListItem, curListIndex) => {
// <View style={[styles.ri_inner, listStyleBox]}>
// { listImgIcon ?
// <View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
// <Image style={icon_style} source={curListItem.imgIcon}/>
// </View> : null }
// <View style={styles.ri_text_box}>
// <TouchableOpacity
// activeOpacity={.8}
// onPress={() => {titCallBack ? titCallBack(curListItem, listIndex) : {}}}
// style={styles.oth_box}
// >
// <Text numberOfLines={1} style={[styles.thr_ot, listStyleTit]}>
// { curListItem[titText] }
// </Text>
// </TouchableOpacity>
// { curListItem[tipTextStr] ? <Text numberOfLines={1} style={[styles.ri_te_ot, styles.te_ot_str, listStyleTip]}>{curListItem[tipTextStr]}</Text> : null }
// { curListItem[tipTextOne] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>{curListItem[tipTextOne]}</Text> : null }
// { curListItem[tipTextTwo] ? <Text numberOfLines={1} style={[styles.ri_te_ot, listStyleTip]}>{curListItem[tipTextTwo]}</Text> : null }
// </View>
// <View style={styles.ri_num_box}>
// { curListItem[calField] !== 0 ?
// <TouchableOpacity
// activeOpacity={.9}
// style={[styles.btn_inner, listStyleCalBtn]}
// onPress={() => this.handelCalculation(curListItem, listIndex)}
// >
// <View style={[styles.thr_num_btn, styles.thr_btn_left]}>
// <Image source={require('../../../images/less_icon_big.png')} style={icon_style}></Image>
// </View>
// </TouchableOpacity> : null }
// { curListItem[calField] !== 0 ? <Text style={styles.thr_num}>{ curListItem[calField] }</Text> : null}
// <TouchableOpacity
// activeOpacity={.9}
// style={[styles.btn_inner, listStyleCalBtn]}
// onPress={() => this.handelCalculation(curListItem, listIndex, true)}
// >
// <View style={[styles.thr_num_btn, styles.thr_btn_right]}>
// <Image source={calIcon} style={icon_style}></Image>
// </View>
// </TouchableOpacity>
// </View>
// </View>
// })
// }
// </View>
<
View
style
=
{[
styles
.
ri_inner
,
listStyleBox
]}
>
{
listImgIcon
?
<
View
style
=
{[
styles
.
oth_img_box
,
styles
[
picOthStyle
],
listStyleImg
]}
>
...
...
@@ -97,29 +166,44 @@ class PicTitDetaiCalcu extends Component {
{
listItem
[
tipTextOne
]
?
<
Text
numberOfLines
=
{
1
}
style
=
{[
styles
.
ri_te_ot
,
listStyleTip
]}
>
{
listItem
[
tipTextOne
]}
<
/Text> : null
}
{
listItem
[
tipTextTwo
]
?
<
Text
numberOfLines
=
{
1
}
style
=
{[
styles
.
ri_te_ot
,
listStyleTip
]}
>
{
listItem
[
tipTextTwo
]}
<
/Text> : null
}
<
/View
>
<
View
style
=
{
styles
.
ri_num_box
}
>
{
listItem
[
calField
]
!==
0
?
<
TouchableOpacity
activeOpacity
=
{.
9
}
style
=
{[
styles
.
btn_inner
,
listStyleCalBtn
]}
onPress
=
{()
=>
this
.
handelCalculation
(
listItem
,
listIndex
)}
>
<
View
style
=
{[
styles
.
thr_num_btn
,
styles
.
thr_btn_left
]}
>
<
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
activeOpacity
=
{.
9
}
style
=
{[
styles
.
btn_inner
,
listStyleCalBtn
]}
onPress
=
{()
=>
this
.
handelCalculation
(
listItem
,
listIndex
,
true
)}
>
<
View
style
=
{[
styles
.
thr_num_btn
,
styles
.
thr_btn_right
]}
>
<
Image
source
=
{
calIcon
}
style
=
{
icon_style
}
><
/Image
>
{
(
showClearIcon
&&
listCardActIndex
===
showClearIndex
)
?
<
View
style
=
{
styles
.
btn_cle_box
}
>
<
TouchableOpacity
activeOpacity
=
{.
9
}
style
=
{[
styles
.
btn_clear_inner
,
listStyleClearBtn
]}
onPress
=
{()
=>
clearCallBack
(
listItem
,
listIndex
)}
>
<
View
style
=
{[
styles
.
icon_cle_btn
]}
>
<
Image
source
=
{
require
(
'../../../images/close_icon.png'
)}
style
=
{
icon_style
}
><
/Image
>
<
/View
>
<
/TouchableOpacity
>
<
/View> : <View style={styles.ri_num_box}
>
{
listItem
[
calField
]
!==
0
?
<
TouchableOpacity
activeOpacity
=
{.
9
}
style
=
{[
styles
.
btn_inner
,
listStyleCalBtn
]}
onPress
=
{()
=>
this
.
handelCalculation
(
listItem
,
listIndex
)}
>
<
View
style
=
{[
styles
.
thr_num_btn
,
styles
.
thr_btn_left
]}
>
<
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
activeOpacity
=
{.
9
}
style
=
{[
styles
.
btn_inner
,
listStyleCalBtn
]}
onPress
=
{()
=>
this
.
handelCalculation
(
listItem
,
listIndex
,
true
)}
>
<
View
style
=
{[
styles
.
thr_num_btn
,
styles
.
thr_btn_right
]}
>
<
Image
source
=
{
calIcon
}
style
=
{
icon_style
}
><
/Image
>
<
/View
>
<
/TouchableOpacity>
<
/View
>
<
/TouchableOpacity>
<
/View
>
}
<
/View
>
);
}
}
...
...
@@ -177,6 +261,19 @@ const styles = StyleSheet.create({
height
:
pxSize
(
30
)
},
btn_inner
:
{},
btn_cle_box
:{
marginRight
:
6
,
// backgroundColor: 'red',
paddingHorizontal
:
4
,
paddingVertical
:
4
},
btn_clear_inner
:{
},
icon_cle_btn
:{
width
:
pxSize
(
22
),
height
:
pxSize
(
22
)
},
ri_num_box
:
{
flexDirection
:
'row'
,
alignItems
:
'center'
,
...
...
app/containers/selfOrder/module/ChooseProductPage.js
View file @
12a55f69
...
...
@@ -37,11 +37,15 @@ import ProductRightStyle from './ProductRightStyle';
import
ProductModel
from
'../../common/ProductModel'
;
import
StatusBarView
from
'../../common/StatusBarView'
;
import
ChooseCardList
from
'../../common/listDataComponent/ChooseCardList'
;
import
{
cloneObject
}
from
'../../../utils/Utils'
;
import
localMockData
from
'./mock/sen_mock'
;
// import ScrollableTabView, { ScrollableTabBar } from 'react-native-scrollable-tab-view';
// import TopTabBar from './customTabbar/TopTabBar';
// import LeftTabBar from './customTabbar/LeftTabBar';
const
DEFAULT_FIELD
=
'quantity'
// 计算的字段
const
CHILD_DATA_NAME
=
'childrenLineData'
// 显示的子类数组名称
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
DEFAULT_SECOND_DATA
=
'localSecondData'
// 中类原本元素
...
...
@@ -66,11 +70,11 @@ class ChooseProductPage extends Component {
}
componentDidMount
()
{
console
.
log
(
'本地测试数据====localMockData==='
,
localMockData
)
//
console.log('本地测试数据====localMockData===', localMockData)
// 赋值测试数据
this
.
setState
({
topProcOptionList
:
localMockData
.
localTopProcOption
,
leftOptionList
:
localMockData
.
localLeftOption
topProcOptionList
:
cloneObject
(
localMockData
.
localTopProcOption
)
,
leftOptionList
:
cloneObject
(
localMockData
.
localLeftOption
)
})
}
...
...
@@ -101,10 +105,107 @@ class ChooseProductPage extends Component {
})
}
// 计算中级数量
// 计算三级回调函数
handleChangeThird
(
childData
,
superIndex
){
let
{
leftActiveIndex
,
leftOptionList
}
=
this
.
state
// console.log("计算三级的回调函数",childData, superIndex, leftActiveIndex)
// console.log(leftOptionList)
// 初始化
leftOptionList
[
leftActiveIndex
][
SELECTED_QUQNTITY
]
=
0
leftOptionList
[
leftActiveIndex
][
SELECTED_DATA_ARR
]
=
[]
leftOptionList
.
map
(
function
(
leItem
,
leIndex
)
{
if
(
!
leItem
[
SELECTED_QUQNTITY
]){
leItem
[
SELECTED_QUQNTITY
]
=
0
}
if
(
!
leItem
[
SELECTED_DATA_ARR
]){
leItem
[
SELECTED_DATA_ARR
]
=
[]
}
if
(
leIndex
===
leftActiveIndex
)
{
// console.log('外面 childData----', childData)
if
(
leItem
[
DEFAULT_SECOND_DATA
].
length
&&
leItem
[
DEFAULT_SECOND_DATA
][
superIndex
]
&&
childData
.
length
){
// leItem[DEFAULT_SECOND_DATA][superIndex]
// let superTip = ''
let
sumCount
=
0
// console.log('childData----', childData)
childData
.
map
((
chDa
,
chInd
)
=>
{
// let splitStr = ' / '
// if(chInd === childData.length - 1){
// splitStr = ''
// }
// superTip += `${chDa.title}x${chDa.selectedQuantity}${splitStr}`
if
(
!
chDa
[
DEFAULT_FIELD
]){
chDa
[
DEFAULT_FIELD
]
=
0
}
sumCount
+=
chDa
[
DEFAULT_FIELD
]
})
let
chDa
=
leItem
[
DEFAULT_SECOND_DATA
][
superIndex
]
let
curObj
=
{
superId
:
chDa
[
'id'
],
// 本地测试
superIndex
:
superIndex
,
// 本地测试
superTit
:
leItem
[
'title'
],
// 本地测试
superImg
:
chDa
[
'imgIcon'
],
// 本地测试
superTip
:
`
${
chDa
[
'title'
]
}
x
${
sumCount
}
`
,
// 本地测试
curTitle
:
chDa
[
'title'
],
// 本地测试
version
:
0
,
lineOptions
:
childData
,
[
DEFAULT_FIELD
]:
sumCount
}
// 初始化
leItem
[
DEFAULT_SECOND_DATA
][
superIndex
][
CHILD_DATA_NAME
]
=
[]
leItem
[
DEFAULT_SECOND_DATA
][
superIndex
][
CHILD_DATA_NAME
].
push
(
curObj
)
leItem
[
DEFAULT_SECOND_DATA
][
superIndex
][
DEFAULT_FIELD
]
=
sumCount
}
// 初始化
leItem
[
SELECTED_QUQNTITY
]
=
0
leItem
[
SELECTED_DATA_ARR
]
=
[]
if
(
leItem
[
DEFAULT_SECOND_DATA
].
length
){
// 本地测试 localSecondData DEFAULT_SECOND_DATA
leItem
[
DEFAULT_SECOND_DATA
].
forEach
(
function
(
chItem
)
{
if
(
chItem
[
DEFAULT_FIELD
]
>
0
){
leItem
[
SELECTED_QUQNTITY
]
+=
Number
(
chItem
[
DEFAULT_FIELD
])
leItem
[
SELECTED_DATA_ARR
].
push
(
chItem
)
}
})
}
// // 当前选择项
// leItem[SELECTED_QUQNTITY] = count
// if(leItem[DEFAULT_SECOND_DATA].length){ // 本地测试 localSecondData DEFAULT_SECOND_DATA
// leItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
// if(chItem[coutFieName]){
// leItem[SELECTED_DATA_ARR].push(chItem)
// }
// })
// }
}
})
// console.log('计算三级之后数据---', leftOptionList)
this
.
setState
({
leftOptionList
})
}
// 计算中级数量回调
handleChangeCount
(
count
,
coutFieName
)
{
let
{
leftActiveIndex
,
leftOptionList
,
defaultThridShow
,
rightSecondData
}
=
this
.
state
// console.log('计算中级数量
===', count, leftActiveIndex, defaultThridShow, rightSecondData, coutFieName)
console
.
log
(
'计算中级数量回调
==='
,
count
,
leftActiveIndex
,
defaultThridShow
,
rightSecondData
,
coutFieName
)
leftOptionList
[
leftActiveIndex
][
SELECTED_QUQNTITY
]
=
0
leftOptionList
[
leftActiveIndex
][
SELECTED_DATA_ARR
]
=
[]
...
...
@@ -156,10 +257,11 @@ class ChooseProductPage extends Component {
}
// 点击共计已选
handleSubSelected
(
show
)
{
handleSubSelected
()
{
// console.log('show-----', show)
let
{
selectShowPopup
}
=
this
.
state
if
(
this
.
getAllCountQuantity
()
!==
0
)
{
this
.
handleCloseSelectModal
(
!
s
how
)
this
.
handleCloseSelectModal
(
!
s
electShowPopup
)
}
}
...
...
@@ -265,6 +367,9 @@ class ChooseProductPage extends Component {
// superStencilData={rightSecondData}
superStencilData
=
{
curRigSecoOption
}
superCallBack
=
{(
count
,
coutFieName
)
=>
this
.
handleChangeCount
(
count
,
coutFieName
)}
superReduceBack
=
{()
=>
this
.
handleSubSelected
()}
thirdCallBack
=
{(
childData
,
superIndex
)
=>
this
.
handleChangeThird
(
childData
,
superIndex
)}
superLeftData
=
{
leftOptionList
[
leftActiveIndex
]}
/
>
<
/View
>
)
...
...
@@ -276,7 +381,7 @@ class ChooseProductPage extends Component {
let
allCountQuantity
=
this
.
getAllCountQuantity
()
// console.log('返回底部按钮----', selectShowPopup
)
console
.
log
(
'左侧数据----'
,
leftOptionList
)
return
(
<
View
style
=
{
list_common_item
.
sub_box
}
>
...
...
@@ -284,7 +389,7 @@ class ChooseProductPage extends Component {
<
TouchableOpacity
activeOpacity
=
{.
8
}
style
=
{
list_common_item
.
lef_btn
}
onPress
=
{()
=>
this
.
handleSubSelected
(
selectShowPopup
)}
onPress
=
{()
=>
this
.
handleSubSelected
()}
>
<
Text
style
=
{
list_common_item
.
lef_tip
}
>
{
'已选:'
}{
allCountQuantity
}
<
/Text
>
<
/TouchableOpacity
>
...
...
app/containers/selfOrder/module/EditThirdLevelPage.js
View file @
12a55f69
...
...
@@ -54,9 +54,8 @@ class EditThirdLevelPage extends Component {
componentDidMount
()
{
let
{
params
}
=
this
.
props
.
navigation
.
state
let
that
=
this
console
.
log
(
'本地测试数据====localMockData==='
,
localMockData
)
console
.
log
(
'本地测试数据====localMockData==='
,
localMockData
.
localThridOption
[
0
][
DEFAULT_SECOND_DATA
][
0
])
console
.
log
(
'父组件传递的值=='
,
params
)
// console.log('本地测试数据====localMockData===', localMockData)
// console.log('父组件传递的值==', params)
// 赋值测试数据
this
.
setState
({
...
...
@@ -120,9 +119,9 @@ class EditThirdLevelPage extends Component {
let
{
topProcOptionList
}
=
this
.
state
let
{
params
}
=
this
.
props
.
navigation
.
state
console
.
log
(
'编辑完成====>'
,
topProcOptionList
,
params
.
superData
.
superIndex
)
// console.log('编辑完成====>', topProcOptionList, params.superData
)
console
.
log
(
topProcOptionList
[
0
][
DEFAULT_SECOND_DATA
][
0
])
//
console.log(topProcOptionList[0][DEFAULT_SECOND_DATA][0])
params
.
childrenPageCallBack
(
topProcOptionList
,
params
.
superData
.
superIndex
)
this
.
props
.
navigation
.
goBack
()
...
...
app/containers/selfOrder/module/ProductRightStyle.js
View file @
12a55f69
...
...
@@ -25,13 +25,24 @@ import {
import
PicTitDetaiCalcu
from
'../../common/listDataComponent/PicTitDetaiCalcu'
;
import
PictureZoom
from
'../../common/listDataComponent/PictureZoom'
;
import
{
cloneObject
}
from
'../../../utils/Utils'
;
const
PropTypes
=
require
(
'prop-types'
)
;
import
_
from
"lodash"
;
import
localMockData
from
'./mock/sen_mock'
;
const
PropTypes
=
require
(
'prop-types'
);
const
DEFAULT_FIELD
=
'quantity'
// 计算的字段
const
CHILD_DATA_NAME
=
'childrenLineData'
// 显示的子类数组名称
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
DEFAULT_SECOND_DATA
=
'localSecondData'
// 中类原本元素
class
ProductRightStyle
extends
Component
{
static
propTypres
=
{
superCallBack
:
PropTypes
.
func
,
// 回调计算函数
superReduceBack
:
PropTypes
.
func
,
// 减法回调
thirdCallBack
:
PropTypes
.
func
,
// 三级小类的回调函数
superLeftData
:
PropTypes
.
object
,
// 三级大类数据
}
constructor
(
props
)
{
...
...
@@ -40,7 +51,7 @@ class ProductRightStyle extends Component {
rightSecondData
:
this
.
props
.
superStencilData
,
// 右侧分类数据-模块、螺钉盒、器械包、赋值工具
selectItem
:
[],
// 当前选中模板 -- 之前版本
toolShowPopup
:
false
,
// 螺钉盒等三个弹窗显示 -- 之前版本
singleHeadData
:
[],
// 人工髋关节假体等数据 -- 大类
//
singleHeadData: [], // 人工髋关节假体等数据 -- 大类
rowSingleData
:
[],
// 人工髋关节假体等数据 -- 小类
thridIsVisible
:
false
,
// 小类展示
curThridObj
:
{
...
...
@@ -54,8 +65,8 @@ class ProductRightStyle extends Component {
console
.
log
(
'本地测试数据====localMockData==='
,
localMockData
)
// 赋值测试数据
this
.
setState
({
singleHeadData
:
localMockData
.
localSingleSeleHead
,
rowSingleData
:
cloneObject
(
localMockData
.
localSingleRowData
)
// singleHeadData: cloneObject(localMockData.localSingleSeleHead)
,
//
rowSingleData: cloneObject(localMockData.localSingleRowData)
})
}
...
...
@@ -96,12 +107,12 @@ class ProductRightStyle extends Component {
// console.warn(`选中了${JSON.stringify(this.state.selectItem)}`)
// }
// 右侧标题点击事件
//
大类
右侧标题点击事件
TitleClickEvent
(
item
,
index
)
{
let
{
superIndex
}
=
this
.
props
let
{
rightSecondData
}
=
this
.
state
console
.
log
(
'右侧标题点击事件 '
,
superIndex
,
index
,
item
,
rightSecondData
[
index
])
//
console.log('右侧标题点击事件 ', superIndex, index, item, rightSecondData[index])
if
(
superIndex
>=
0
&&
superIndex
<
4
)
{
this
.
props
.
navigation
.
navigate
(
'EditThirdLevelPage'
,
{
...
...
@@ -116,7 +127,7 @@ class ProductRightStyle extends Component {
}
else
{
// 单选耗材中级标题点击之后
this
.
changeThrShow
(
true
,
item
.
title
)
this
.
changeThrShow
(
true
,
item
,
index
)
}
// else if ( superIndex > 0 && superIndex < 4) {
// this.handleIsShowDialog() // -- 之前版本
...
...
@@ -124,32 +135,197 @@ class ProductRightStyle extends Component {
}
// 大类加减,整理加一/减一
handleAllPlusReduce
(
curData
,
curIndex
,
isPlus
){
let
{
rightSecondData
}
=
this
.
state
let
{
superLeftData
}
=
this
.
props
// console.log('大类加减,整理加一/减一', curData, curIndex)
// console.log('右侧数据', rightSecondData, curData[CHILD_DATA_NAME])
let
rowData
=
[]
// if(!isPlus){
// 本地测试,获取接口数据(无数据时,加法)
rowData
=
cloneObject
(
localMockData
.
localSingleRowData
)
// 初始化数据
console
.
log
(
'curData[CHILD_DATA_NAME]--本地测试,获取接口数据--'
,
curData
)
if
((
!
curData
[
CHILD_DATA_NAME
]
||
!
curData
[
CHILD_DATA_NAME
].
length
)
&&
isPlus
){
// let chDa = leItem[DEFAULT_SECOND_DATA][superIndex]
let
curObj
=
{
superId
:
curData
[
'id'
],
// 本地测试
superIndex
:
curIndex
,
// 本地测试
superTit
:
superLeftData
[
'title'
],
// 本地测试
superImg
:
curData
[
'imgIcon'
],
// 本地测试
superTip
:
curData
[
'title'
]
,
// 本地测试
curTitle
:
curData
[
'title'
],
// 本地测试
version
:
0
,
lineOptions
:
rowData
,
[
DEFAULT_FIELD
]:
0
}
// 初始化
curData
[
CHILD_DATA_NAME
]
=
[]
curData
[
CHILD_DATA_NAME
].
push
(
curObj
)
curData
[
DEFAULT_FIELD
]
=
0
}
// 加法/减法
if
(
curData
[
CHILD_DATA_NAME
]
&&
curData
[
CHILD_DATA_NAME
].
length
>
0
){
// rowData = cloneObject(curData[CHILD_DATA_NAME][0].lineOptions)
// if(curData[CHILD_DATA_NAME][0].lineOptions){
let
sumCount
=
0
curData
[
CHILD_DATA_NAME
][
0
].
lineOptions
.
forEach
(
function
(
lineIt
,
lineInd
)
{
if
(
!
lineIt
[
DEFAULT_FIELD
]){
lineIt
[
DEFAULT_FIELD
]
=
0
}
if
(
!
isPlus
){
// 减法
if
(
lineIt
[
DEFAULT_FIELD
]){
lineIt
[
DEFAULT_FIELD
]
-=
1
}
else
{
lineIt
[
DEFAULT_FIELD
]
=
0
}
}
else
{
// 加法
lineIt
[
DEFAULT_FIELD
]
+=
1
}
sumCount
+=
lineIt
[
DEFAULT_FIELD
]
})
if
(
sumCount
){
curData
[
CHILD_DATA_NAME
][
0
][
DEFAULT_FIELD
]
=
sumCount
curData
[
DEFAULT_FIELD
]
=
sumCount
curData
[
CHILD_DATA_NAME
][
0
].
superTip
=
`
${
curData
[
'title'
]}
x
${
sumCount
}
`
}
else
{
curData
[
DEFAULT_FIELD
]
=
0
delete
curData
[
CHILD_DATA_NAME
]
}
// rowData = cloneObject(curData[CHILD_DATA_NAME][0].lineOptions)
// }
}
// }
// else {
// // 加法
// // 本地测试,获取接口数据
// rowData = cloneObject(localMockData.localSingleRowData)
// if(curData[CHILD_DATA_NAME] && curData[CHILD_DATA_NAME].length > 0 && curData[CHILD_DATA_NAME][0].lineOptions) {
// curData[CHILD_DATA_NAME][0].lineOptions.forEach(function(lineIt) {
// if(!lineIt[DEFAULT_FIELD]){
// lineIt[DEFAULT_FIELD] = 0
// }
// lineIt[DEFAULT_FIELD] += 1
// })
// rowData = cloneObject(curData[CHILD_DATA_NAME][0].lineOptions)
// }
// // if(!curData[CHILD_DATA_NAME]){
// // // 加法需要调用接口
// // // let childData = leItem[DEFAULT_SECOND_DATA][superIndex]
// // // let curObj = {
// // // superId: childData['id'], // 本地测试
// // // superIndex: superIndex, // 本地测试
// // // superTit: leItem['title'], // 本地测试
// // // superImg: childData['imgIcon'], // 本地测试
// // // superTip: childData['title'] , // 本地测试
// // // version: 0,
// // // lineOptions: childData,
// // // [DEFAULT_FIELD]: sumCount
// // // }
// // // curData[CHILD_DATA_NAME]
// // }
// }
// console.log('修改后的数据', curData, rowData, curIndex)
// this.props.thirdCallBack(rowData, curIndex)
this
.
handleCalCallBack
(
curData
,
curIndex
,
'rightSecondData'
,
DEFAULT_FIELD
)
this
.
setState
({
rightSecondData
})
}
// 编辑页面的回调
childrenPageCallBack
(
childData
,
index
)
{
let
{
rightSecondData
}
=
this
.
state
console
.
log
(
'编辑页面的回调----'
,
childData
,
index
)
// 本地测试
let
childDataName
=
'childrenLineData'
let
curCalField
=
'quantity'
// let curCalField = 'quantity'
let
that
=
this
rightSecondData
.
forEach
(
function
(
rsdItem
,
rsdIndex
)
{
if
(
!
rsdItem
[
childDataName
])
{
rsdItem
[
childDataName
]
=
[]
if
(
!
rsdItem
[
CHILD_DATA_NAME
])
{
rsdItem
[
CHILD_DATA_NAME
]
=
[]
// rsdItem[CHILD_DATA_NAME] = {}
}
if
(
!
rsdItem
[
curCalField
])
{
rsdItem
[
curCalField
]
=
0
if
(
!
rsdItem
[
DEFAULT_FIELD
])
{
rsdItem
[
DEFAULT_FIELD
]
=
0
}
// if(!rsdItem[versionName]) {
// rsdItem[versionName] = 0
// }
if
(
rsdIndex
===
index
)
{
rsdItem
[
childDataName
]
=
childData
rsdItem
[
curCalField
]
=
Number
(
rsdItem
[
curCalField
])
+
1
let
superTip
=
''
childData
.
map
((
chDa
,
chInd
)
=>
{
let
splitStr
=
' / '
if
(
chInd
===
childData
.
length
-
1
){
splitStr
=
''
}
superTip
+=
`
${
chDa
.
title
}
x
${
chDa
.
selectedQuantity
}${
splitStr
}
`
})
let
curObj
=
{
superId
:
rsdItem
[
'id'
],
// 本地测试
superIndex
:
rsdIndex
,
// 本地测试
superTit
:
rsdItem
[
'title'
],
// 本地测试
superImg
:
rsdItem
[
'imgIcon'
],
// 本地测试
superTip
:
superTip
,
// 本地测试
version
:
0
,
lineOptions
:
childData
,
[
DEFAULT_FIELD
]:
1
}
if
(
rsdItem
[
CHILD_DATA_NAME
].
length
!==
0
){
curObj
.
version
=
rsdItem
[
CHILD_DATA_NAME
].
length
}
let
filEquArr
=
rsdItem
[
CHILD_DATA_NAME
].
filter
(
function
(
lineItem
)
{
if
(
_
.
isEqual
(
lineItem
.
lineOptions
,
childData
)){
lineItem
[
DEFAULT_FIELD
]
+=
1
return
lineItem
}
})
console
.
log
(
'回调后的rsdItem===='
,
rsdItem
)
that
.
handleCalCallBack
(
rsdItem
,
rsdIndex
,
'rightSecondData'
,
curCalField
)
// 本地测试
if
(
filEquArr
.
length
===
0
)
{
rsdItem
[
CHILD_DATA_NAME
].
push
(
curObj
)
}
rsdItem
[
DEFAULT_FIELD
]
=
Number
(
rsdItem
[
DEFAULT_FIELD
])
+
1
// console.log('回调后的rsdItem====', rsdItem)
that
.
handleCalCallBack
(
rsdItem
,
rsdIndex
,
'rightSecondData'
,
DEFAULT_FIELD
)
}
})
console
.
log
(
'回调后的数组===='
,
rightSecondData
)
//
console.log('回调后的数组====', rightSecondData)
this
.
setState
({
rightSecondData
...
...
@@ -173,62 +349,193 @@ class ProductRightStyle extends Component {
// }
// 修改当前小类是否展示
changeThrShow
(
show
,
curTitle
)
{
let
{
curThridObj
}
=
this
.
state
if
(
curTitle
)
{
curThridObj
.
title
=
curTitle
changeThrShow
(
show
,
superItem
,
superIndex
)
{
let
{
curThridObj
,
rowSingleData
}
=
this
.
state
console
.
log
(
'修改当前小类是否展示----'
,
show
,
superItem
,
superIndex
)
let
localTestImageUrls
=
localMockData
.
localTestImageUrls
// 本地测试数据
let
curRowData
=
cloneObject
(
localMockData
.
localSingleRowData
)
// if(superItem){
// }else {
// curRowData = cloneObject(localMockData.localSingleRowData)
// }
if
(
superItem
)
{
// curThridObj.title = curItem.title
curThridObj
=
{
superItem
:
superItem
,
superIndex
:
superIndex
,
image
:
localTestImageUrls
,
title
:
superItem
.
title
}
if
(
superItem
[
CHILD_DATA_NAME
]
&&
superItem
[
CHILD_DATA_NAME
].
length
>
0
&&
superItem
[
CHILD_DATA_NAME
][
0
].
lineOptions
)
{
curRowData
=
cloneObject
(
superItem
[
CHILD_DATA_NAME
][
0
].
lineOptions
)
}
// curThridObj = [{
// ...curItem,
// localThridOption:
// }]
// 此处应该要请求接口,获取小类数据
}
this
.
setState
({
thridIsVisible
:
show
,
curThridObj
curThridObj
,
rowSingleData
:
curRowData
})
if
(
!
show
){
// 点击标题时回调函数修改左侧数据
this
.
props
.
thirdCallBack
(
rowSingleData
,
curThridObj
.
superIndex
)
}
// this.props.changeThrShow(show) ============????
}
// 单选耗材 - 头数据
handleHeadCalCallBack
(
item
,
index
)
{
let
{
singleHeadData
}
=
this
.
state
singleHeadData
[
index
]
=
item
this
.
setState
({
singleHeadData
})
//
let { singleHeadData } = this.state
//
singleHeadData[index] = item
//
this.setState({
//
singleHeadData
//
})
console
.
log
(
'计算==单选耗材行数据==='
,
item
,
index
,
rowSingleData
)
//
console.log('计算==单选耗材行数据===', item, index, rowSingleData)
}
// 单选耗材 - 行数据
handleRowCalCallBack
(
item
,
index
)
{
let
{
rowSingleData
}
=
this
.
state
rowSingleData
[
index
]
=
item
this
.
setState
({
rowSingleData
})
//
let { rowSingleData } = this.state
//
rowSingleData[index] = item
//
this.setState({
//
rowSingleData
//
})
console
.
log
(
'计算==单选耗材行数据==='
,
item
,
index
,
rowSingleData
)
//
console.log('计算==单选耗材行数据===', item, index, rowSingleData)
}
// 修改列表计算后数据 - 头/行
handleCalCallBack
(
item
,
index
,
dataName
,
coutFieName
){
console
.
log
(
'修改列表计=='
,
item
,
index
,
dataName
,
coutFieName
)
let
{
rightSecondData
,
rowSingleData
,
curThridObj
}
=
this
.
state
// rowSingleData.localThridContData = item
// if(!dataName){
// }
if
(
dataName
&&
this
.
state
[
dataName
])
{
let
curDataName
=
this
.
state
[
dataName
]
curDataName
[
index
]
=
item
this
.
setState
({
[
dataName
]:
curDataName
})
console
.
log
(
'计算==头/行==='
,
index
,
dataName
,
curDataName
)
//
console.log('计算==头/行===', index, dataName, curDataName)
if
(
coutFieName
)
{
// console.log('修改列表计算参数==',item, index, dataName, coutFieName)
// 计算==头
let
sumCount
=
0
curDataName
.
map
(
item
=>
{
if
(
item
[
coutFieName
]){
sumCount
+=
Number
(
item
[
coutFieName
])
}
})
console
.
log
(
'计算==数量汇总=字段='
,
coutFieName
,
sumCount
)
// console.log('计算==数量汇总=字段=', sumCount, coutFieName
)
this
.
props
.
superCallBack
(
sumCount
,
coutFieName
)
}
else
{
// console.log('修改【单选耗材小类】参数==',item, index, dataName, coutFieName)
// console.log('修改【单选耗材小类】计算后数据==',curDataName)
// console.log('修改【单选耗材小类】计算后父数据==',curThridObj)
// console.log('修改【单选耗材小类】计算后=显示=',this.state.thridIsVisible)
// this.props.thirdCallBack(curDataName, curThridObj.superIndex)
// 计算耗材行, 行数据加起来是头数据
// rightSecondData
// let sumCount = 0
// console.log('中类---', rightSecondData)
// console.log('小类---', curDataName)
// let listItem = rightSecondData[curThridObj.superIndex]
// listItem[CHILD_DATA_NAME]
// listItem[SELECTED_QUQNTITY] = 0
// listItem[SELECTED_DATA_ARR] = []
// listItem[DEFAULT_SECOND_DATA] = curDataName
// listItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
// if(chItem[DEFAULT_FIELD]){
// listItem[SELECTED_QUQNTITY] += Number(chItem[DEFAULT_FIELD])
// listItem[SELECTED_DATA_ARR].push(chItem)
// }
// })
// let seNum = 0, seArr = []
// curDataName.map(cuDa => {
// if(!cuDa[DEFAULT_FIELD]){
// cuDa[DEFAULT_FIELD] = 0
// }
// seNum += Number(cuDa[DEFAULT_FIELD])
// seArr.push(cuDa)
// })
// let curTempArr = [
// {
// title: '单选耗材',
// iconImg: localMockData.localTestImageUrls,
// localThridContData: curDataName, // push所有
// [SELECTED_QUQNTITY]: seNum,
// [SELECTED_DATA_ARR]: seArr
// }
// ]
// console.log('修改后的中类----', rightSecondData)
// console.log('修改后的小类 curDataName----', curDataName)
// this.childrenPageCallBack(curTempArr, curThridObj.superIndex)
// this.props.superCallBack(listItem[SELECTED_QUQNTITY], DEFAULT_FIELD)
// this.setState({
// rightSecondData
// })
// rightSecondData.map(function(listItem) {
// listItem[SELECTED_QUQNTITY] = 0
// listItem[SELECTED_DATA_ARR] = []
// if(listItem[DEFAULT_SECOND_DATA].length){
// listItem[DEFAULT_SECOND_DATA].forEach(function(chItem) {
// if(chItem[DEFAULT_FIELD]){
// listItem[SELECTED_QUQNTITY] += Number(chItem[DEFAULT_FIELD])
// listItem[SELECTED_DATA_ARR].push(chItem)
// }
// })
// }
// })
// rightSecondData.map(item => {
// if(!item[DEFAULT_FIELD]){
// item[DEFAULT_FIELD] = 0
// }
// // curDataName
// if(item[DEFAULT_FIELD]){
// sumCount += Number(item[DEFAULT_FIELD])
// }
// })
// console.log('计算==数量汇总=字段=', coutFieName, sumCount)
// this.props.superCallBack(sumCount, DEFAULT_FIELD)
}
}
}
...
...
@@ -236,14 +543,14 @@ class ProductRightStyle extends Component {
// 返回右侧二级每一列(单选耗材以上)
renderSecondtem
(
item
,
index
)
{
// let { toolShowPopup } = this.state
let
curCalField
=
'quantity'
//
let curCalField = 'quantity'
return
(
<
SafeAreaView
style
=
{
styles
.
ri_container
}
>
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
curCalField
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
curCalField
)}
calField
=
{
DEFAULT_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
DEFAULT_FIELD
)}
titCallBack
=
{(
item
,
index
)
=>
this
.
TitleClickEvent
(
item
,
index
)}
titText
=
{
'title'
}
tipTextOne
=
{
'tip1'
}
...
...
@@ -251,6 +558,7 @@ class ProductRightStyle extends Component {
listImgIcon
=
{
'imgIcon'
}
listPicType
=
{
'SQUARE'
}
plusCallBack
=
{(
item
,
index
)
=>
this
.
TitleClickEvent
(
item
,
index
)}
reduceCallBack
=
{()
=>
this
.
props
.
superReduceBack
()}
/
>
<
/SafeAreaView
>
)
...
...
@@ -273,14 +581,14 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 小类每一列
renderThridItem
(
item
,
index
)
{
let
curCalField
=
'quantity'
//
let curCalField = 'quantity'
return
(
<
SafeAreaView
style
=
{
styles
.
thr_container
}
>
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
curCalField
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rowSingleData'
)}
calField
=
{
DEFAULT_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rowSingleData'
)}
titText
=
{
'title'
}
tipTextOne
=
{
'tip1'
}
tipTextTwo
=
{
'tip2'
}
...
...
@@ -291,12 +599,13 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 小类
renderThridStyle
()
{
let
{
rowSingleData
}
=
this
.
state
return
(
<
View
style
=
{
styles
.
stencil_cont
}
>
<
FlatList
style
=
{
styles
.
cont_thr_list
}
keyExtractor
=
{
item
=>
item
.
id
}
data
=
{
this
.
state
.
rowSingleData
}
data
=
{
rowSingleData
}
extraData
=
{
this
.
state
}
renderItem
=
{({
item
,
index
})
=>
this
.
renderThridItem
(
item
,
index
)}
/
>
...
...
@@ -306,19 +615,21 @@ class ProductRightStyle extends Component {
// 单选耗材 -- 大类每一列
renderOtherListItem
(
item
,
index
)
{
let
curCalField
=
'quantity'
//
let curCalField = 'quantity'
return
(
<
SafeAreaView
style
=
{
styles
.
oth_container
}
>
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
curCalField
}
calField
=
{
DEFAULT_FIELD
}
listPicType
=
{
'ROUND'
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'singleHeadData'
,
curCalField
)}
// subCalCallBack={(item,index) => this.handleCalCallBack(item, index, 'singleHeadData', DEFAULT_FIELD)}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
DEFAULT_FIELD
)}
titCallBack
=
{(
item
,
index
)
=>
this
.
TitleClickEvent
(
item
,
index
)}
titText
=
{
'title'
}
listImgIcon
=
{
'imgIcon'
}
plusCallBack
=
{(
item
,
index
)
=>
this
.
TitleClickEvent
(
item
,
index
)}
plusCallBack
=
{(
item
,
index
)
=>
this
.
handleAllPlusReduce
(
item
,
index
,
true
)}
reduceCallBack
=
{(
item
,
index
)
=>
this
.
handleAllPlusReduce
(
item
,
index
)}
/
>
<
/SafeAreaView
>
)
...
...
@@ -331,7 +642,8 @@ class ProductRightStyle extends Component {
<
FlatList
style
=
{
styles
.
cont_other_list
}
keyExtractor
=
{
item
=>
item
.
id
}
data
=
{
this
.
state
.
singleHeadData
}
// data={this.state.singleHeadData}
data
=
{
this
.
state
.
rightSecondData
}
extraData
=
{
this
.
state
}
renderItem
=
{({
item
,
index
})
=>
this
.
renderOtherListItem
(
item
,
index
)}
/
>
...
...
@@ -357,12 +669,12 @@ class ProductRightStyle extends Component {
// 返回右侧单选耗材 -- 三级顶部标题和图片
renderThrHeadStyle
()
{
let
{
thridIsVisible
,
curThridObj
}
=
this
.
state
let
localTestImageUrls
=
localMockData
.
localTestImageUrls
// 本地测试数据
// let testObj = {
// title: '测试标题__',
// image: localTestImageUrls
// }
curThridObj
.
image
=
localTestImageUrls
//
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
//
//
let testObj = {
//
//
title: '测试标题__',
//
//
image: localTestImageUrls
//
//
}
//
curThridObj.image = localTestImageUrls
if
(
thridIsVisible
)
{
return
(
...
...
app/containers/selfOrder/module/mock/sen_mock.js
View file @
12a55f69
...
...
@@ -165,7 +165,7 @@ const localSingleSeleHead_4 = [{
}]
// 人工髋关节假体等数据 -- 大类
const
localSingleSeleHead
=
[{
const
localSingleSeleHead
_5
=
[{
"id"
:
"0"
,
title
:
'中置器(PE)'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
...
...
@@ -176,7 +176,7 @@ const localSingleSeleHead = [{
},
{
"id"
:
"1"
,
title
:
'内衬Harmony
28/10°OD(P 2
'
,
title
:
'内衬Harmony
---
'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
...
...
@@ -185,7 +185,7 @@ const localSingleSeleHead = [{
},
{
"id"
:
"2"
,
title
:
'内衬Harmony 28/10°OD
(P
'
,
title
:
'内衬Harmony 28/10°OD'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
...
...
@@ -239,6 +239,110 @@ const localSingleSeleHead = [{
}
]
const
localSingleSeleHead_6
=
[{
"id"
:
"0"
,
title
:
'6-中置器(PE)11'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
},
{
"id"
:
"1"
,
title
:
'6-中置器(PE)22'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
},
{
"id"
:
"2"
,
title
:
'6-中置器(PE)33'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
const
localSingleSeleHead_7
=
[{
"id"
:
"0"
,
title
:
'h7-中置器(PE)1111'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
},
{
"id"
:
"1"
,
title
:
'h7-中置器(PE)2222'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
},
{
"id"
:
"2"
,
title
:
'h7-中置器(PE)3333'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
const
localSingleSeleHead_8
=
[{
"id"
:
"0"
,
title
:
'h8-中置器(PE)11'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
const
localSingleSeleHead_9
=
[{
"id"
:
"0"
,
title
:
'h9-中置器(PE)'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
const
localSingleSeleHead_10
=
[{
"id"
:
"0"
,
title
:
'h10-中置器(PE)11'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
const
localSingleSeleHead_11
=
[{
"id"
:
"0"
,
title
:
'h11-中置器'
,
imgIcon
:
require
(
'../../../../images/model_test.png'
),
tip1
:
'创建人:金城武'
,
tip2
:
'创建时间:2020.03.01'
,
select
:
false
,
quantity
:
0
}
]
// 人工髋关节假体等数据 -- 小类
const
localSingleRowData
=
[
{
...
...
@@ -246,53 +350,41 @@ const localSingleRowData = [
title
:
'规格:JS-CGO PE 10'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
20
,
select
:
false
,
quantity
:
0
},
{
"id"
:
"1"
,
title
:
'规格:JS-CGO PE 1
0 1
1'
,
title
:
'规格:JS-CGO PE 11'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
0
,
select
:
false
,
tip2
:
'物料代码:JUST00000102'
,
quantity
:
0
},
{
"id"
:
"2"
,
title
:
'规格:JS-CGO PE 1
0 2
2'
,
title
:
'规格:JS-CGO PE 12'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
0
,
select
:
false
,
tip2
:
'物料代码:JUST00000107'
,
quantity
:
0
},
{
"id"
:
"3"
,
title
:
'规格:JS-CGO PE 1
0 3
3'
,
title
:
'规格:JS-CGO PE 13'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
0
,
select
:
false
,
tip2
:
'物料代码:JUST00000108'
,
quantity
:
0
},
{
"id"
:
"4"
,
title
:
'规格:JS-CGO PE 1
0 4
4'
,
title
:
'规格:JS-CGO PE 14'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
0
,
select
:
false
,
tip2
:
'物料代码:JUST00000109'
,
quantity
:
0
},
{
"id"
:
"5"
,
title
:
'规格:JS-CGO PE 1
0 5
5'
,
title
:
'规格:JS-CGO PE 15'
,
tip1
:
'型号:10'
,
tip2
:
'物料代码:JUST00000104'
,
value
:
0
,
select
:
false
,
tip2
:
'物料代码:JUST00000110'
,
quantity
:
0
}
]
...
...
@@ -321,31 +413,31 @@ const localLeftOption = [
},
{
title
:
'人工髋关节假体'
,
localSecondData
:
localSingleSeleHead
localSecondData
:
localSingleSeleHead
_5
},
{
title
:
'膝关节假体备份'
,
localSecondData
:
localSingleSeleHead
localSecondData
:
localSingleSeleHead
_6
},
{
title
:
'骨小梁髋关节假体'
,
localSecondData
:
localSingleSeleHead
localSecondData
:
localSingleSeleHead
_7
},
{
title
:
'骨小梁髋
关节假体
22'
,
localSecondData
:
localSingleSeleHead
title
:
'骨小梁髋22'
,
localSecondData
:
localSingleSeleHead
_8
},
{
title
:
'骨小梁
髋关节假体
33'
,
localSecondData
:
localSingleSeleHead
title
:
'骨小梁33'
,
localSecondData
:
localSingleSeleHead
_9
},
{
title
:
'骨小
梁髋关节假体
44'
,
localSecondData
:
localSingleSeleHead
title
:
'骨小44'
,
localSecondData
:
localSingleSeleHead
_10
},
{
title
:
'
骨小梁髋
关节假体55'
,
localSecondData
:
localSingleSeleHead
title
:
'关节假体55'
,
localSecondData
:
localSingleSeleHead
_11
},
]
...
...
@@ -622,7 +714,7 @@ const localBottomOption = [
export
default
{
localTopProcOption
,
localLeftOption
,
localSingleSeleHead
,
//
localSingleSeleHead,
localSingleRowData
,
localTestImageUrls
,
localThridOption
,
...
...
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