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
b4b348ea
authored
Dec 25, 2020
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整自助下单功能
parent
46259d8e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
366 additions
and
872 deletions
app/containers/common/ProductModel.js
app/containers/common/listDataComponent/ChooseCardList.js
app/containers/common/listDataComponent/PicTitDetaiCalcu.js
app/containers/common/listDataComponent/PictureZoom.js
app/containers/common/listDataComponent/TipInfoNeedSelect.js
app/containers/selfOrder/SelfOrderPage.js
app/containers/selfOrder/module/ChooseProductPage.js
app/containers/selfOrder/module/EditThirdLevelPage.js
app/containers/selfOrder/module/ProductRightStyle.js
app/containers/common/ProductModel.js
View file @
b4b348ea
import
React
,
{
Component
}
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
SafeAreaView
,
Modal
,
ScrollView
,
TouchableOpacity
,
FlatList
,
Image
}
from
'react-native'
;
import
{
pxHeight
,
foundation_color
,
promary_color
,
second_text_color
,
third_text_color
,
first_text_color
,
second_text_size
,
Width
,
pxSize
,
safe_view
,
font_family_medium
,
font_family_light
,
list_common_item
,
third_text_size
,
icon_style
,
point_color
,
title_text_color
}
from
'../../base/BaseStyle'
;
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'
;
import
LocalVariable
from
'./LocalVariable'
;
const
PropTypes
=
require
(
'prop-types'
);
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
LOCAL_SECOND_DATA
=
'localSecondData'
// 中类原本元素
const
QUANTITY_FIELD
=
'quantity'
// 计算的字段
const
CHILDREN_LINE_NAME
=
'childrenLineData'
// 显示的子类数组名称
const
SUPER_TITLE_NAME
=
'super_title_name'
const
SUPER_TITLE_TIP
=
'super_title_tip'
const
ONLY_TWO_LEVELS
=
'onlyTwoLevels'
// 只有两级的耗材
//
const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
//
const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
//
const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
//
const QUANTITY_FIELD = 'quantity' // 计算的字段
//
const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
//
const SUPER_TITLE_NAME = 'super_title_name'
//
const SUPER_TITLE_TIP = 'super_title_tip'
//
const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class
ProductModel
extends
Component
{
...
...
@@ -26,6 +26,7 @@ class ProductModel extends Component {
show
:
PropTypes
.
bool
,
modelOption
:
PropTypes
.
array
,
// 已选左侧数据
modelCallBack
:
PropTypes
.
func
,
// 修改选择的回调函数
clearRubbish
:
PropTypes
.
func
,
// 清空所有
}
constructor
(
props
)
{
...
...
@@ -67,45 +68,28 @@ class ProductModel extends Component {
let
otherChildObj
=
{
category_code
:
'local_sign_items'
,
category_name
:
'单选耗材'
,
[
SELECTED_QUQNTITY
]:
0
,
[
SELECTED_DATA_ARR
]:
[],
[
LOCAL_SECOND_DATA
]:
[]
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
]:
[]
}
orginOptionList
.
forEach
((
orItem
,
orIndex
)
=>
{
if
(
orIndex
<
4
)
{
otherArr
.
push
(
orItem
)
}
else
{
otherChildObj
[
LOCAL_SECOND_DATA
].
push
(
orItem
)
if
(
orItem
[
SELECTED_QUQNTITY
]){
otherChildObj
[
SELECTED_QUQNTITY
]
+=
Number
(
orItem
[
SELECTED_QUQNTITY
])
otherChildObj
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
].
push
(
orItem
)
if
(
orItem
[
LocalVariable
.
SELECTED_QUQNTITY
]){
otherChildObj
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
Number
(
orItem
[
LocalVariable
.
SELECTED_QUQNTITY
])
}
if
(
orItem
[
SELECTED_DATA_ARR
]){
// orItem[SUPER_TITLE_NAME] = orItem.category_name
// let end_str = ''
// if(sedInd < curData[SELECTED_DATA_ARR].length - 1){
// end_str = ' / '
// }
// if(!sedItem[SUPER_TITLE_TIP]){
// sedItem[SUPER_TITLE_TIP]=`${sedItem.category_name}x${sedItem[QUANTITY_FIELD]}${end_str}`
// }
// console.log('orItem---', orItem)
// if(!otherChildObj[SUPER_TITLE_TIP]){
// otherChildObj[SUPER_TITLE_TIP] = ''
// }
orItem
[
SELECTED_DATA_ARR
].
forEach
(
function
(
sign_it
,
si_ind
)
{
sign_it
[
SUPER_TITLE_NAME
]
=
orItem
.
category_name
// let end_str = ''
// if(si_ind < orItem[SELECTED_DATA_ARR].length - 1){
// end_str = ' / '
// }
// otherChildObj[SUPER_TITLE_TIP] += `${sign_it.category_name}x${sign_it[QUANTITY_FIELD]}${end_str}`
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
[
SELECTED_DATA_ARR
].
push
(...
orItem
[
SELECTED_DATA_ARR
])
otherChildObj
[
LocalVariable
.
SELECTED_DATA_ARR
].
push
(...
orItem
[
LocalVariable
.
SELECTED_DATA_ARR
])
}
}
})
otherArr
.
push
(
otherChildObj
)
// console.log('修改后的已选数据
====', otherArr)
console
.
log
(
'修改后的已选数据😁
===='
,
otherArr
)
this
.
setState
({
topProcOptionList
:
otherArr
})
...
...
@@ -125,100 +109,6 @@ class ProductModel extends Component {
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[CHILDREN_LINE_NAME][0]['superTit'])
// let orgCurChild = seIt[CHILDREN_LINE_NAME][0]
// curOptions[SELECTED_DATA_ARR].forEach(function(curSeItem, curSeInd){
// let curSeChild = curSeItem[CHILDREN_LINE_NAME][0]
// if(curSeChild && orgCurChild && curSeChild['superTit'] === orgCurChild['superTit'] && curSeChild['id'] === orgCurChild['id']
// && curSeChild['superIndex'] === orgCurChild['superIndex'] && curSeChild['curTitle'] === orgCurChild['curTitle']){
// // seIt[CHILDREN_LINE_NAME][0]['lineOptions'] = curSeChild['lineOptions']
// seIt = curSeChild
// }
// })
// // 是否在已选存在
// let isExitArr = curOptions[SELECTED_DATA_ARR].filter(item => {
// let curSeChild = curSeItem[CHILDREN_LINE_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][CHILDREN_LINE_NAME][0]
// if(orgItem[LOCAL_SECOND_DATA] && orgItem[LOCAL_SECOND_DATA].length > 0 && seDelChild){
// // for(let deIt of orgItem[LOCAL_SECOND_DATA]){
// // let deItChild = deIt[CHILDREN_LINE_NAME][0]
// // if(deItChild && seDelChild && deItChild['superTit'] === seDelChild['superTit'] && deItChild['id'] === seDelChild['id']
// // && deItChild['index'] === seDelChild['index']){
// // deIt[QUANTITY_FIELD] = 0
// // delete deIt[CHILDREN_LINE_NAME]
// // }
// // }
// orgItem[LOCAL_SECOND_DATA].forEach(function(deIt) {
// let deItChild = deIt[CHILDREN_LINE_NAME][0]
// if(deItChild && seDelChild && deItChild['superTit'] === seDelChild['superTit'] && deItChild['id'] === seDelChild['id']
// && deItChild['index'] === seDelChild['index']){
// deIt[QUANTITY_FIELD] = 0
// delete deIt[CHILDREN_LINE_NAME]
// }
// })
// }
// orgItem[SELECTED_DATA_ARR].splice(i, 1)
// }
// }
// }else {
// // 清空所有已选
// orgItem[SELECTED_DATA_ARR] = []
// orgItem[QUANTITY_FIELD] = 0
// if(orgItem[LOCAL_SECOND_DATA] && orgItem[LOCAL_SECOND_DATA].length > 0){
// orgItem[LOCAL_SECOND_DATA].forEach(function(deIt) {
// deIt[QUANTITY_FIELD] = 0
// // deIt[CHILDREN_LINE_NAME] = []
// delete deIt[CHILDREN_LINE_NAME]
// })
// }
// }
// }
// })
// console.log('修改后的原始数据========>', orginOptionList)
// // this.props.modelCallBack(orginOptionList) // 调用
}
// 共计已选 点击
handleCloseSelected
()
{
console
.
log
(
'已选:handleCloseSelected'
)
...
...
@@ -247,73 +137,54 @@ class ProductModel extends Component {
// console.log('当前已选数据==----', topProcOptionList, topActiveIndex)
// 单选耗材当前清空项
// let deleOpts = cloneObject(topProcOptionList[topActiveIndex][SELECTED_DATA_ARR][index])
let
allCountQuantity
=
0
// 初始化
orginOptionList
.
forEach
(
function
(
orgOpts
,
orgInd
)
{
if
(
orgInd
>=
4
){
if
(
orgOpts
[
LOCAL_SECOND_DATA
]
&&
orgOpts
[
LOCAL_SECOND_DATA
].
length
>
0
){
orgOpts
[
LOCAL_SECOND_DATA
].
forEach
(
function
(
localDa
,
localInd
)
{
// if(localDa[CHILDREN_LINE_NAME] && deleOpts[CHILDREN_LINE_NAME]){
// let curLine = localDa[CHILDREN_LINE_NAME][0]
// // console.log('curLine---', curLine, deleOpts)
// let deLi = deleOpts[CHILDREN_LINE_NAME][0]
// if(curLine && deLi && curLine['superTit'] === deLi['superTit'] && curLine['id'] === deLi['id']
// && curLine['superIndex'] === deLi['superIndex'] && curLine['curTitle'] === deLi['curTitle']){
// localDa[QUANTITY_FIELD] = 0
// delete localDa[CHILDREN_LINE_NAME]
// }
// }
if
(
localDa
[
ONLY_TWO_LEVELS
]
&&
localDa
[
'item_code'
]
===
item
[
'item_code'
]){
if
(
orgOpts
[
LocalVariable
.
LOCAL_SECOND_DATA
]
&&
orgOpts
[
LocalVariable
.
LOCAL_SECOND_DATA
].
length
>
0
){
orgOpts
[
LocalVariable
.
LOCAL_SECOND_DATA
].
forEach
(
function
(
localDa
,
localInd
)
{
if
(
localDa
[
LocalVariable
.
ONLY_TWO_LEVELS
]
&&
localDa
[
'item_code'
]
===
item
[
'item_code'
]){
// 二级
localDa
[
QUANTITY_FIELD
]
=
0
}
else
if
(
!
localDa
[
ONLY_TWO_LEVELS
]
&&
localDa
[
'category_code'
]
===
item
[
'category_code'
]){
localDa
[
QUANTITY_FIELD
]
=
0
localDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
else
if
(
!
localDa
[
LocalVariable
.
ONLY_TWO_LEVELS
]
&&
localDa
[
'category_code'
]
===
item
[
'category_code'
]){
localDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
if
(
localDa
.
details
&&
localDa
.
details
.
length
>
0
){
// 三级
localDa
.
details
.
forEach
(
function
(
da_it
){
da_it
[
QUANTITY_FIELD
]
=
0
da_it
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
})
}
}
})
}
if
(
orgOpts
[
SELECTED_DATA_ARR
]
&&
orgOpts
[
SELECTED_DATA_ARR
].
length
>
0
){
if
(
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
]
&&
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
].
length
>
0
){
let
delArr
=
[]
orgOpts
[
SELECTED_DATA_ARR
].
map
((
deIt
,
deIndex
)
=>
{
// if(!deIt[CHILDREN_LINE_NAME]){
// delArr.push(deIndex)
// }
if
(
deIt
[
ONLY_TWO_LEVELS
]
&&
deIt
[
'item_code'
]
===
item
[
'item_code'
]){
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
].
map
((
deIt
,
deIndex
)
=>
{
if
(
deIt
[
LocalVariable
.
ONLY_TWO_LEVELS
]
&&
deIt
[
'item_code'
]
===
item
[
'item_code'
]){
delArr
.
push
(
deIndex
)
}
else
if
(
!
deIt
[
ONLY_TWO_LEVELS
]
&&
deIt
[
'category_code'
]
===
item
[
'category_code'
]){
}
else
if
(
!
deIt
[
LocalVariable
.
ONLY_TWO_LEVELS
]
&&
deIt
[
'category_code'
]
===
item
[
'category_code'
]){
delArr
.
push
(
deIndex
)
}
})
for
(
let
i
=
delArr
.
length
-
1
;
i
>=
0
;
i
--
){
orgOpts
[
SELECTED_DATA_ARR
].
splice
(
delArr
[
i
],
1
);
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
].
splice
(
delArr
[
i
],
1
);
}
}
// 初始化
orgOpts
[
SELECTED_QUQNTITY
]
=
0
if
(
orgOpts
[
SELECTED_DATA_ARR
]
&&
orgOpts
[
SELECTED_DATA_ARR
].
length
>
0
){
orgOpts
[
SELECTED_DATA_ARR
].
map
(
function
(
itDa
){
if
(
!
itDa
[
QUANTITY_FIELD
]){
itDa
[
QUANTITY_FIELD
]
=
0
orgOpts
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
if
(
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
]
&&
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
].
length
>
0
){
orgOpts
[
LocalVariable
.
SELECTED_DATA_ARR
].
map
(
function
(
itDa
){
if
(
!
itDa
[
LocalVariable
.
QUANTITY_FIELD
]){
itDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
orgOpts
[
SELECTED_QUQNTITY
]
+=
Number
(
itDa
[
QUANTITY_FIELD
])
orgOpts
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
Number
(
itDa
[
LocalVariable
.
QUANTITY_FIELD
])
})
}
}
if
(
!
orgOpts
[
SELECTED_QUQNTITY
]){
orgOpts
[
SELECTED_QUQNTITY
]
=
0
if
(
!
orgOpts
[
LocalVariable
.
SELECTED_QUQNTITY
]){
orgOpts
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
orgOpts
[
SELECTED_QUQNTITY
]
allCountQuantity
+=
orgOpts
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
// console.log('修改后的已选=======---', topProcOptionList)
// console.log('修改后的数量---', allCountQuantity)
...
...
@@ -329,11 +200,10 @@ class ProductModel extends Component {
console
.
log
(
'回调====='
,
item
,
index
)
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
defauIndex
=
index
// SUB_LINE_NAME = 'childrenLineData' // 测试 item.superIndex
defauIndex
=
item
.
superIndex
console
.
log
(
'--当前已选数据 ==='
,
topProcOptionList
,
topActiveIndex
)
if
(
SELECTED_DATA_ARR
&&
topProcOptionList
[
topActiveIndex
][
SELECTED_DATA_ARR
])
{
if
(
LocalVariable
.
SELECTED_DATA_ARR
&&
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_DATA_ARR
])
{
let
allCountQuantity
=
0
// 初始化
topProcOptionList
.
map
(
function
(
listItem
,
listIndex
)
{
if
(
listIndex
===
topActiveIndex
){
...
...
@@ -343,56 +213,56 @@ class ProductModel extends Component {
//初始化 中类
let
deleFlag
=
false
let
deleInd
=
null
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
].
forEach
(
function
(
seDa
,
seInd
)
{
if
(
!
seDa
[
QUANTITY_FIELD
]){
seDa
[
QUANTITY_FIELD
]
=
0
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
].
forEach
(
function
(
seDa
,
seInd
)
{
if
(
!
seDa
[
LocalVariable
.
QUANTITY_FIELD
]){
seDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
if
(
seDa
[
QUANTITY_FIELD
]
===
0
){
if
(
seDa
[
LocalVariable
.
QUANTITY_FIELD
]
===
0
){
deleFlag
=
true
deleInd
=
seInd
}
listItem
[
SELECTED_QUQNTITY
]
+=
Number
(
seDa
[
QUANTITY_FIELD
])
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
Number
(
seDa
[
LocalVariable
.
QUANTITY_FIELD
])
})
if
(
deleFlag
)
{
listItem
[
SELECTED_DATA_ARR
].
splice
(
deleInd
,
1
)
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
].
splice
(
deleInd
,
1
)
}
}
else
{
let
deleFlag
=
false
let
deleInd
=
null
// 初始化 三级
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
QUANTITY_FIELD
]
=
0
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
'childrenLineData'
].
forEach
(
function
(
chIt
,
chInd
)
{
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
][
defauIndex
][
LocalVariable
.
QUANTITY_FIELD
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
][
defauIndex
][
LocalVariable
.
CHILDREN_LINE_NAME
].
forEach
(
function
(
chIt
,
chInd
)
{
if
(
_
.
isEqual
(
chIt
,
item
)){
chIt
=
item
if
(
chIt
[
QUANTITY_FIELD
]
===
0
){
if
(
chIt
[
LocalVariable
.
QUANTITY_FIELD
]
===
0
){
deleFlag
=
true
deleInd
=
chInd
}
}
if
(
!
chIt
[
QUANTITY_FIELD
]){
chIt
[
QUANTITY_FIELD
]
=
0
if
(
!
chIt
[
LocalVariable
.
QUANTITY_FIELD
]){
chIt
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
QUANTITY_FIELD
]
+=
Number
(
chIt
[
QUANTITY_FIELD
])
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
][
defauIndex
][
LocalVariable
.
QUANTITY_FIELD
]
+=
Number
(
chIt
[
LocalVariable
.
QUANTITY_FIELD
])
})
if
(
deleFlag
)
{
listItem
[
SELECTED_DATA_ARR
][
defauIndex
][
'childrenLineData'
].
splice
(
deleInd
,
1
)
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
][
defauIndex
][
LocalVariable
.
CHILDREN_LINE_NAME
].
splice
(
deleInd
,
1
)
}
// 初始化 中类
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
].
forEach
(
function
(
seDa
)
{
if
(
!
seDa
[
QUANTITY_FIELD
]){
seDa
[
QUANTITY_FIELD
]
=
0
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
].
forEach
(
function
(
seDa
)
{
if
(
!
seDa
[
LocalVariable
.
QUANTITY_FIELD
]){
seDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
listItem
[
SELECTED_QUQNTITY
]
+=
Number
(
seDa
[
QUANTITY_FIELD
])
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
Number
(
seDa
[
LocalVariable
.
QUANTITY_FIELD
])
})
// 已选数量赋值之前默认数据
let
curObj
=
listItem
[
SELECTED_DATA_ARR
][
defauIndex
]
let
curObj
=
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
][
defauIndex
]
// console.log('curObj----', curObj)
if
(
listIndex
<
4
){
if
(
curObj
.
id
){
listItem
[
LOCAL_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
listItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
if
(
deIt
.
id
===
curObj
.
id
){
// 本地测试'id'为唯一值
deIt
=
curObj
}
...
...
@@ -402,10 +272,10 @@ class ProductModel extends Component {
}
}
if
(
!
listItem
[
SELECTED_QUQNTITY
]){
listItem
[
SELECTED_QUQNTITY
]
=
0
if
(
!
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]){
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
listItem
[
SELECTED_QUQNTITY
]
allCountQuantity
+=
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
// 恢复之后再调用
this
.
setTopOrginTopData
(
topProcOptionList
)
...
...
@@ -427,16 +297,17 @@ class ProductModel extends Component {
let
{
orginOptionList
}
=
this
.
state
// console.log('清空======', orginOptionList)
orginOptionList
.
map
(
function
(
listItem
)
{
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
]
=
[]
listItem
[
LOCAL_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
QUANTITY_FIELD
]
=
0
deIt
[
CHILDREN_LINE_NAME
]
=
[]
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
listItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
deIt
[
LocalVariable
.
CHILDREN_LINE_NAME
]
=
[]
})
})
// 回调函数
// console.log('---清空之后===== ', orginOptionList)
this
.
props
.
modelCallBack
(
orginOptionList
)
// this.props.modelCallBack(orginOptionList)
this
.
props
.
clearRubbish
()
this
.
closeModal
()
}
...
...
@@ -476,7 +347,7 @@ class ProductModel extends Component {
cardItemTitle
=
{
'category_name'
}
curActIndex
=
{
topActiveIndex
}
cardCallBack
=
{(
item
,
index
)
=>
this
.
handleTopNav
(
item
,
index
)}
cardCountName
=
{
SELECTED_QUQNTITY
}
cardCountName
=
{
LocalVariable
.
SELECTED_QUQNTITY
}
cardStyleType
=
{
'DEFAULT'
}
/
>
)
...
...
@@ -491,37 +362,23 @@ class ProductModel extends Component {
// console.log('已选展示信息 === curData---', curData)
let
localBottomContData
=
[]
if
(
curData
&&
curData
[
SELECTED_DATA_ARR
]){
// localBottomContData = curData[SELECTED_DATA_ARR]
curData
[
SELECTED_DATA_ARR
].
forEach
(
function
(
sedItem
,
sedInd
)
{
if
(
curData
&&
curData
[
LocalVariable
.
SELECTED_DATA_ARR
]){
curData
[
LocalVariable
.
SELECTED_DATA_ARR
].
forEach
(
function
(
sedItem
,
sedInd
)
{
if
(
topActiveIndex
===
0
){
// 手术模板
localBottomContData
.
push
(...
sedItem
[
CHILDREN_LINE_NAME
])
localBottomContData
.
push
(...
sedItem
[
LocalVariable
.
CHILDREN_LINE_NAME
])
}
else
{
if
(
topActiveIndex
>
3
){
// sedItem[SUPER_TITLE_NAME] = curData.category_name
// let end_str = ''
// if(sedInd < curData[SELECTED_DATA_ARR].length - 1){
// end_str = ' / '
// }
if
(
sedItem
[
ONLY_TWO_LEVELS
]){
if
(
sedItem
[
LocalVariable
.
ONLY_TWO_LEVELS
]){
// 二级
sedItem
[
SUPER_TITLE_TIP
]
=
`
${
sedItem
.
general_name
}
(
${
sedItem
.
item_code
}
) x
${
sedItem
[
QUANTITY_FIELD
]}
`
sedItem
[
LocalVariable
.
SUPER_TITLE_TIP
]
=
`
${
sedItem
.
general_name
}
(
${
sedItem
.
item_code
}
) x
${
sedItem
[
LocalVariable
.
QUANTITY_FIELD
]}
`
}
else
{
// 三级
sedItem
[
SUPER_TITLE_TIP
]
=
`
${
sedItem
.
category_name
}
(
${
sedItem
.
category_code
}
) x
${
sedItem
[
QUANTITY_FIELD
]}
`
sedItem
[
LocalVariable
.
SUPER_TITLE_TIP
]
=
`
${
sedItem
.
category_name
}
(
${
sedItem
.
category_code
}
) x
${
sedItem
[
LocalVariable
.
QUANTITY_FIELD
]}
`
}
}
localBottomContData
.
push
(
sedItem
)
}
// if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
// //钉盒 零散器械
// localBottomContData.push(sedItem)
// }else if(sedItem[CHILDREN_LINE_NAME]){
// localBottomContData.push(...sedItem[CHILDREN_LINE_NAME])
// }
})
}
// console.log('已选当前模块数据---',curData,topActiveIndex)
...
...
@@ -565,8 +422,8 @@ class ProductModel extends Component {
curListMaxNum
=
1
}
}
else
{
curTit
=
SUPER_TITLE_NAME
curTipOne
=
SUPER_TITLE_TIP
curTit
=
LocalVariable
.
SUPER_TITLE_NAME
curTipOne
=
LocalVariable
.
SUPER_TITLE_TIP
}
// if(topActiveIndex === 1 || topActiveIndex === 2 || topActiveIndex === 3){
// //钉盒 零散器械
...
...
@@ -596,7 +453,7 @@ class ProductModel extends Component {
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
QUANTITY_FIELD
}
calField
=
{
LocalVariable
.
QUANTITY_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
)}
titText
=
{
curTit
}
tipTextOne
=
{
curTipOne
}
...
...
@@ -623,12 +480,12 @@ class ProductModel extends Component {
let
allCountQuantity
=
0
let
sel_tip
=
''
topProcOptionList
.
map
(
proItem
=>
{
if
(
!
proItem
[
SELECTED_QUQNTITY
]){
proItem
[
SELECTED_QUQNTITY
]
=
0
if
(
!
proItem
[
LocalVariable
.
SELECTED_QUQNTITY
]){
proItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
proItem
[
SELECTED_QUQNTITY
]
if
(
proItem
[
SELECTED_QUQNTITY
]
>
0
)
{
sel_tip
+=
`
${
proItem
.
category_name
}
x
${
proItem
[
SELECTED_QUQNTITY
]}
`
allCountQuantity
+=
proItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
if
(
proItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
)
{
sel_tip
+=
`
${
proItem
.
category_name
}
x
${
proItem
[
LocalVariable
.
SELECTED_QUQNTITY
]}
`
}
})
console
.
log
(
'弹窗==='
,
topProcOptionList
,
sel_tip
)
...
...
@@ -641,10 +498,8 @@ class ProductModel extends Component {
onPress
=
{()
=>
this
.
handleCloseSelected
()}
>
<
Text
style
=
{
list_common_item
.
lef_tip
}
numberOfLines
=
{
1
}
>
{
/* {'已选:'} */
}
{
allCountQuantity
===
0
?
<
Text
>
{
'未选'
}
<
/Text> : <Text>{'已选: '}</
Text
>
}
{
allCountQuantity
===
0
?
<
Text
>
{
'未选'
}
<
/Text> : <Text>{'当前已选: '}</
Text
>
}
{
allCountQuantity
===
0
?
null
:
<
Text
style
=
{
styles
.
lef_tip_txt
}
>
{
sel_tip
}
<
/Text>
}
{
/* <Text style={allCountQuantity!==0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text> */
}
<
/Text
>
{
allCountQuantity
===
0
?
null
:
<
View
style
=
{
styles
.
lef_btn_num
}
>
<
Text
style
=
{
styles
.
lef_num_txt
}
>
{
allCountQuantity
}
<
/Text
>
...
...
@@ -808,7 +663,7 @@ const styles = StyleSheet.create({
},
lef_btn_num
:
{
position
:
'absolute'
,
left
:
5
0
,
left
:
8
0
,
top
:
4
,
backgroundColor
:
point_color
,
borderRadius
:
50
,
...
...
app/containers/common/listDataComponent/ChooseCardList.js
View file @
b4b348ea
...
...
@@ -44,77 +44,81 @@ class ChooseCardList extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
this
.
state
=
{
countStyleType
:
[
'DEFAULT'
,
'GRAPHICS'
],
countStyleName
:
[
'card_default'
,
'card_graphice'
]
}
}
render
()
{
let
{
cardScrollEnabled
,
cardHorizontal
,
cardShowsHorizontalScrollIndicator
,
cardShowsVerticalScrollIndicator
,
cardStyleBox
,
cardStyleScroll
,
cardListOptions
,
cardItemTitle
,
cardItemIcon
,
cardImgName
,
render
()
{
let
{
cardScrollEnabled
,
cardHorizontal
,
cardShowsHorizontalScrollIndicator
,
cardShowsVerticalScrollIndicator
,
cardStyleBox
,
cardStyleScroll
,
cardListOptions
,
cardItemTitle
,
cardItemIcon
,
cardImgName
,
cardStyleListItem
,
cardStyleListItemAct
,
cardStyleItemIcon
,
cardStyleItemTit
,
cardStyleNotIconTit
,
cardStyleItemTitAct
,
cardCallBack
,
curActIndex
,
cardCountName
,
cardStyleType
,
cardCouStyle
,
global_domain_config
,
cardShowDefIcon
,
cardKeyName
}
=
this
.
props
let
{
countStyleType
}
=
this
.
state
let
{
countStyleType
}
=
this
.
state
let
localTestImageUrls
=
localMockData
.
localTestImageUrls
// 本地测试数据
cardListOptions
[
cardImgName
]
=
localTestImageUrls
// 本地测试
//
let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
//
cardListOptions[cardImgName] = localTestImageUrls // 本地测试
return
(
return
(
<
View
style
=
{[
styles
.
card_container
,
cardStyleBox
]}
>
<
ScrollView
scrollEnabled
=
{
!!
cardScrollEnabled
}
horizontal
=
{
!!
cardHorizontal
}
showsHorizontalScrollIndicator
=
{
!!
cardShowsHorizontalScrollIndicator
}
showsVerticalScrollIndicator
=
{
!!
cardShowsVerticalScrollIndicator
}
style
=
{[
styles
.
card_scroll_box
,
cardStyleScroll
]}
>
{
cardListOptions
.
map
((
item
,
index
)
=>
{
if
(
typeof
item
[
cardItemIcon
]
===
'string'
){
style
=
{[
styles
.
card_scroll_box
,
cardStyleScroll
]}
>
{
cardListOptions
.
map
((
item
,
index
)
=>
{
let
cur_icon
=
item
[
cardItemIcon
]
if
(
typeof
cur_icon
===
'string'
)
{
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试
//
item[cardItemIcon] = {uri: global_domain_config+item[cardItemIcon]
} // 测试
//
cur_icon = {uri: global_domain_config+cur_icon
} // 测试
item
[
cardItemIcon
]
=
{
uri
:
global_domain_config
+
'/jeecg-boot/sys/common/view/'
+
item
[
cardItemIcon
]
}
// 正式
}
else
if
(
item
[
cardItemIcon
]
instanceof
Array
)
{
cur_icon
=
{
uri
:
global_domain_config
+
'/jeecg-boot/sys/common/view/'
+
cur_icon
}
// 正式
}
else
if
(
cur_icon
instanceof
Array
)
{
// global_domain_config = 'https://obs-dev.gyjtsx.com' // 本地测试
// item[cardItemIcon] = {uri: global_domain_config+item[cardItemIcon][0]} // 测试
item
[
cardItemIcon
]
=
{
uri
:
global_domain_config
+
'/jeecg-boot/sys/common/view/'
+
item
[
cardItemIcon
][
0
]}
// 正式
// cur_icon = {uri: global_domain_config+cur_icon[0]} // 测试
if
(
cur_icon
.
length
===
0
)
{
cur_icon
=
require
(
'../../../images/not_img.png'
)
}
else
{
cur_icon
=
{
uri
:
global_domain_config
+
'/jeecg-boot/sys/common/view/'
+
cur_icon
[
0
]
}
// 正式
}
}
return
<
View
style
=
{
styles
.
card_list_box
}
key
=
{
'choose_card'
+
index
}
>
return
<
View
style
=
{
styles
.
card_list_box
}
key
=
{
'choose_card'
+
index
}
>
<
TouchableOpacity
activeOpacity
=
{.
8
}
style
=
{
styles
.
list_touch_cont
}
onPress
=
{()
=>
cardCallBack
(
item
,
index
)}
>
>
<
View
style
=
{[
styles
.
list_item_inner
,
cardStyleListItem
,
index
==
curActIndex
?
[
styles
.
list_inner_act
,
cardStyleListItemAct
]
:
''
]}
>
{
item
[
cardItemIcon
]
?
<
View
style
=
{[
styles
.
item_icon_def
,
cardStyleItemIcon
]}
>
{
cardShowDefIcon
?
<
Image
defaultSource
=
{
require
(
'../../../images/not_img.png'
)}
source
=
{
item
[
cardItemIcon
]
}
style
=
{
icon_style
}
resizeMode
=
"cover"
/>
:
<
Image
source
=
{
item
[
cardItemIcon
]}
style
=
{
icon_style
}
resizeMode
=
"cover"
/>
{
cur_icon
?
<
View
style
=
{[
styles
.
item_icon_def
,
cardStyleItemIcon
]}
>
{
cardShowDefIcon
?
<
Image
defaultSource
=
{
require
(
'../../../images/not_img.png'
)}
source
=
{
cur_icon
}
style
=
{
icon_style
}
resizeMode
=
"cover"
/>
:
<
Image
source
=
{
cur_icon
}
style
=
{
icon_style
}
resizeMode
=
"cover"
/>
}
<
/View> : null
}
<
Text
numberOfLines
=
{
2
}
style
=
{[
styles
.
list_item_tit
,
cardStyleItemTit
,
item
[
cardItemIcon
]
?
''
:
cardStyleNotIconTit
,
index
==
curActIndex
?
[
styles
.
list_tit_act
,
cardStyleItemTitAct
]
:
''
]}
>
<
/View> : null
}
<
Text
numberOfLines
=
{
2
}
style
=
{[
styles
.
list_item_tit
,
cardStyleItemTit
,
cur_icon
?
''
:
cardStyleNotIconTit
,
index
==
curActIndex
?
[
styles
.
list_tit_act
,
cardStyleItemTitAct
]
:
''
]}
>
{
item
[
cardItemTitle
]}
{
(
item
[
cardCountName
]
&&
countStyleType
[
0
]
===
cardStyleType
)
?
<
Text
style
=
{[
styles
.
sum_def
,
cardCouStyle
]}
>
({
item
[
cardCountName
]})
<
/Text> : null
}
{
(
item
[
cardCountName
]
&&
countStyleType
[
0
]
===
cardStyleType
)
?
<
Text
style
=
{[
styles
.
sum_def
,
cardCouStyle
]}
>
({
item
[
cardCountName
]})
<
/Text> : null
}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
{
(
item
[
cardCountName
]
&&
countStyleType
[
1
]
===
cardStyleType
)
?
<
View
style
=
{[
styles
.
card_def_count
,
cardCouStyle
]}
>
{(
item
[
cardCountName
]
&&
countStyleType
[
1
]
===
cardStyleType
)
?
<
View
style
=
{[
styles
.
card_def_count
,
cardCouStyle
]}
>
<
Text
style
=
{
styles
.
def_count_txt
}
>
{
item
[
cardCountName
]}
<
/Text
>
<
/View> : null
}
<
/View
>
})
})
}
<
/ScrollView
>
<
/View
>
);
);
}
}
...
...
app/containers/common/listDataComponent/PicTitDetaiCalcu.js
View file @
b4b348ea
...
...
@@ -131,10 +131,6 @@ class PicTitDetaiCalcu extends Component {
{
listShowNoData
?
<
Text
>
暂无数据
<
/Text>
:
<
View
style
=
{[
styles
.
ri_inner
,
listStyleBox
]}
>
{
/* { listImgIcon ?
<View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
<Image style={icon_style} source={listItem[listImgIcon]}/>
</View> : null } */
}
{(
listImgIcon
&&
cur_photos
.
length
>
0
)
?
<
PictureZoom
listImageIndex
=
{
0
}
...
...
@@ -142,9 +138,6 @@ class PicTitDetaiCalcu extends Component {
listStyleImage
=
{[
styles
.
oth_img_box
,
styles
[
picOthStyle
],
listStyleImg
]}
listPicType
=
{
listPicType
}
/
>
// : listImgIcon ? <View style={[styles.oth_img_box, styles[picOthStyle], listStyleImg]}>
// <Image style={icon_style} source={listItem[listImgIcon]} />
// </View>
:
null
}
<
View
style
=
{
styles
.
ri_text_box
}
>
<
TouchableOpacity
...
...
app/containers/common/listDataComponent/PictureZoom.js
View file @
b4b348ea
...
...
@@ -66,8 +66,6 @@ class PictureZoom extends Component {
picOthStyle
=
picStyleArr
[
listPicTypeArr
.
indexOf
(
listPicType
)]
}
// console.log('图片放大----', listImageUrls, typeof listImageUrls)
return
(
<
View
style
=
{[
styles
.
container
]}
>
<
TouchableOpacity
...
...
@@ -78,7 +76,7 @@ class PictureZoom extends Component {
<
Image
defaultSource
=
{
require
(
'../../../images/not_img.png'
)}
source
=
{{
uri
:
listImageUrls
[
listImageIndex
].
url
}}
style
=
{
icon_style
}
style
=
{
[
icon_style
,
styles
.
list_item_img
]
}
resizeMode
=
"cover"
/>
<
/TouchableOpacity
>
<
Modal
...
...
app/containers/common/listDataComponent/TipInfoNeedSelect.js
View file @
b4b348ea
...
...
@@ -4,21 +4,14 @@ import {
Text
,
StyleSheet
,
Modal
,
ScrollView
,
TouchableOpacity
,
Image
}
from
'react-native'
;
import
{
Width
,
pxHeight
,
third_text_color
,
second_text_color
,
first_text_color
,
safe_view
,
pxSize
,
font_family_medium
,
icon_style
,
font_family_regular
,
font_family_semibold
,
title_text_color
,
promary_color
...
...
@@ -70,15 +63,8 @@ class TipInfoNeedSelect extends Component {
<
View
style
=
{
styles
.
modal_head
}
>
<
View
style
=
{
styles
.
modal_tit
}
>
<
Image
style
=
{
styles
.
err_icon
}
source
=
{
require
(
'../../../images/err_tit.png'
)}
/
>
<
Text
style
=
{
styles
.
inner_tit
}
>
{
title
}
<
/Text
>
<
Text
numberOfLines
=
{
2
}
style
=
{
styles
.
inner_tit
}
>
{
title
}
<
/Text
>
<
/View
>
{
/* <TouchableOpacity
activeOpacity={.8}
onPress={() => this.closeModal()}
style={styles.head_tou_clo}
>
<Image style={icon_style} source={require('../../../images/close_icon.png')}></Image>
</TouchableOpacity> */
}
<
/View
>
<
View
style
=
{
styles
.
model_footer
}
>
<
TouchableOpacity
...
...
@@ -127,12 +113,6 @@ const styles = StyleSheet.create({
dia_container
:
{
flex
:
1
,
},
// dis_cont: {
// width: '80%',
// maxHeight: '80%',
// backgroundColor: '#FFF',
// borderRadius: 8
// },
container
:
{
flex
:
1
,
backgroundColor
:
'rgba(0, 0, 0, 0.5)'
,
...
...
@@ -154,20 +134,10 @@ const styles = StyleSheet.create({
minHeight
:
pxHeight
(
200
),
borderRadius
:
8
,
marginHorizontal
:
22
,
paddingHorizontal
:
18
,
paddingTop
:
32
paddingHorizontal
:
20
,
paddingVertical
:
32
,
paddingBottom
:
42
},
// scro_box: {
// marginTop: 18,
// maxHeight: pxHeight(310),
// minHeight: pxHeight(220),
// borderWidth: 1,
// borderColor: '#eaeaea',
// paddingLeft: 6,
// borderRadius: 2,
// paddingBottom: 6
// },
// item_scroll: {},
modal_head
:
{
flexDirection
:
'row'
,
justifyContent
:
'center'
,
...
...
@@ -183,38 +153,9 @@ const styles = StyleSheet.create({
marginRight
:
6
},
inner_tit
:
{
fontSize
:
20
,
fontSize
:
18
,
fontFamily
:
font_family_semibold
},
head_tou_clo
:
{
width
:
pxSize
(
26
),
height
:
pxSize
(
26
),
marginBottom
:
10
},
// cont_list: {},
// co_li: {
// lineHeight: 20,
// fontSize: 12,
// fontFamily: font_family_regular,
// color: second_text_color
// },
// co_str: {
// fontFamily: font_family_semibold,
// fontWeight: '500',
// fontSize: 14,
// paddingTop: 6,
// paddingBottom: 2,
// color: first_text_color
// },
// plan_num: {
// fontSize: 14,
// fontFamily: font_family_semibold
// },
// sto_num: {
// fontSize: 14,
// fontFamily: font_family_semibold,
// color: 'red'
// },
model_footer
:
{
paddingTop
:
30
,
flexDirection
:
'row'
,
...
...
app/containers/selfOrder/SelfOrderPage.js
View file @
b4b348ea
...
...
@@ -2,16 +2,8 @@ import React, { Component } from 'react';
import
{
View
,
Text
,
SafeAreaView
,
StyleSheet
,
TouchableOpacity
,
Image
,
ScrollView
,
TextInput
,
Alert
,
Linking
,
NativeModules
,
Platform
,
DeviceEventEmitter
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
home_background_color
,
placehold_text_color
,
promary_color
,
safe_view
,
icon_style
,
list_common_item
}
from
'../../base/BaseStyle'
;
import
{
AsteriskTextStyle
,
TitleTextStyle
,
ContTextStyle
,
ImageTextStyle
,
CellTextStyle
,
ContInputTextStyle
,
FooterBtnStyle
}
from
'../common/CellTextStyle'
;
import
{
show
,
isEmpty
,
formatStrForDate
,
cloneObject
,
dedupQuoteArray
,
changeDateFormat
}
from
'../../utils/Utils'
;
import
{
ImageTextStyle
,
CellTextStyle
,
FooterBtnStyle
}
from
'../common/CellTextStyle'
;
import
{
show
,
formatStrForDate
,
cloneObject
,
dedupQuoteArray
}
from
'../../utils/Utils'
;
import
HeadBackItem
from
'../common/HeadBackItem'
;
import
StatusBarView
from
'../common/StatusBarView'
;
import
DialogModel
from
'../common/DialogModel'
;
...
...
@@ -28,9 +20,9 @@ import TipInfoNeedSelect from '../common/listDataComponent/TipInfoNeedSelect';
import
LocalVariable
from
'../common/LocalVariable'
;
import
LoadingModel
from
'../common/listDataComponent/LoadingModel'
;
const
SELECTED_QUQNTITY
=
'selectedQuantity'
const
SELECTED_DATA_ARR
=
'selectedDataArr'
const
QUANTITY_FIELD
=
'quantity'
// 计算的字段
//
const SELECTED_QUQNTITY = 'selectedQuantity'
//
const SELECTED_DATA_ARR = 'selectedDataArr'
//
const QUANTITY_FIELD = 'quantity' // 计算的字段
class
SelfOrderPage
extends
Component
{
constructor
(
props
)
{
...
...
@@ -151,12 +143,7 @@ class SelfOrderPage extends Component {
showTypePop
:
false
,
// 选择器弹窗
isSubLoding
:
false
,
// 加载中弹窗
lodingTitle
:
'加载中'
,
listCurrentOption
:
[
// 当前选择器数据
{
name
:
'男'
,
value
:
'boy'
}
],
listCurrentOption
:
[],
// 当前选择器数据
dateModelPop
:
false
,
// 日期选择器
hasPermission
:
undefined
,
//录音 授权状态
audioPath
:
AudioUtils
.
DocumentDirectoryPath
+
`/self_audio_
${
new
Date
().
getTime
()}
.aac`
,
// 文件路径
...
...
@@ -177,12 +164,12 @@ class SelfOrderPage extends Component {
componentDidMount
()
{
this
.
getSellerName
()
this
.
getAudioAuthorize
()
this
.
subscription
=
DeviceEventEmitter
.
addListener
(
EmitterEvents
.
BACK_TO_SELF_PAGE
,
(
params
)
=>
this
.
productCallBack
(
params
))
//
this.subscription = DeviceEventEmitter.addListener(EmitterEvents.BACK_TO_SELF_PAGE, (params) => this.productCallBack(params))
}
componentWillUnmount
()
{
this
.
props
.
setSelectProductOpts
([])
this
.
subscription
.
remove
()
//
this.subscription.remove()
}
// 赋值销售员 初始化数据
...
...
@@ -376,15 +363,6 @@ class SelfOrderPage extends Component {
// })
}
// 停止播放录音 -- 安卓不能停止、ios可以
// _stopPlay = async () => {
// console.log('tingzhi bofang')
// let self = this
// self.whoosh.stop(() => {
// console.log('success - 停止成功')
// })
// }
// 删除录音
_del
=
async
()
=>
{
// 初始化录音
...
...
@@ -399,7 +377,7 @@ class SelfOrderPage extends Component {
}
componentWillReceiveProps
(
nextProps
)
{
let
{
self_list_status
,
loginState
,
navigation
,
submit_self_order_status
}
=
this
.
props
let
{
self_list_status
,
loginState
,
navigation
,
submit_self_order_status
,
local_sele_pro_options
}
=
this
.
props
let
that
=
this
if
(
self_list_status
!=
nextProps
.
self_list_status
)
{
switch
(
nextProps
.
self_list_status
)
{
...
...
@@ -431,19 +409,19 @@ class SelfOrderPage extends Component {
}
}
if
(
submit_self_order_status
!=
nextProps
.
submit_self_order_status
)
{
console
.
log
(
'SELF_ORDER_LIST_SUCCESS====='
,
nextProps
.
submit_self_order_status
)
switch
(
nextProps
.
submit_self_order_status
)
{
case
SELF_SUBMIT_DOING
:
that
.
changeSubLoding
(
true
,
'提交中'
)
break
;
case
SELF_SUBMIT_SUCCESS
:
// that.setState({
// isSubLoding: false,
// lodingTitle: '提交中'
// }, () => {
// that.processReturnData()
// })
that
.
processReturnData
()
that
.
setState
({
isSubLoding
:
false
,
lodingTitle
:
'提交中'
},
()
=>
{
console
.
log
(
'SELF_SUBMIT_SUCCESS==='
,
that
.
state
.
isSubLoding
)
that
.
processReturnData
()
})
// that.processReturnData()
break
;
case
SELF_SUBMIT_FAILURE
:
that
.
changeSubLoding
(
false
,
'提交中'
)
...
...
@@ -452,25 +430,11 @@ class SelfOrderPage extends Component {
break
;
}
}
// let self = this
// if(self_list_status != nextProps.self_list_status) {
// // console.log('-222------', nextProps.self_list_status)
// // console.log('--222---self_list_status--', self_list_status)
// switch (nextProps.self_list_status) {
// case SELF_ORDER_LIST_DOING:
// this.changeSubLoding(true)
// break;
// case SELF_ORDER_LIST_SUCCESS:
// self.changeSubLoding()
// setTimeout(() => {
// self.changeCurrentOption()
// }, 500)
// break;
// case SELF_ORDER_LIST_FAILURE:
// this.changeSubLoding()
// break;
// }
// console.log('哈哈哈哈😄=====', nextProps.local_sele_pro_options)
// console.log('哈哈哈哈😄=====', local_sele_pro_options)
// if(nextProps.local_sele_pro_options){
// that.productCallBack(nextProps.local_sele_pro_options)
// }
}
...
...
@@ -980,11 +944,13 @@ class SelfOrderPage extends Component {
handleProductCheck
()
{
if
(
this
.
judgeOrgIsNull
())
{
let
{
listOptionData
}
=
this
.
state
let
that
=
this
this
.
props
.
navigation
.
navigate
(
'ChooseProductPage'
,
{
title
:
`选择产品`
,
selfData
:
{
org_code
:
listOptionData
[
1
].
value
}
},
productCallBack
:
that
.
productCallBack
.
bind
(
that
)
})
}
}
...
...
@@ -992,21 +958,22 @@ class SelfOrderPage extends Component {
// 选择产品 回调
productCallBack
(
params
)
{
let
{
listOptionData
}
=
this
.
state
console
.
log
(
'哈哈哈哈😄====='
)
console
.
log
(
'选择产品返回=!!!!='
,
params
)
console
.
log
(
'选择产品返回=!!!!='
,
this
)
console
.
log
(
'选择产品返回=!!!!='
,
this
.
state
)
listOptionData
[
10
].
name
=
'请选择'
listOptionData
[
10
].
value
=
''
listOptionData
[
10
].
lines
=
[]
if
(
params
&&
params
.
local_lines
)
{
params
.
local_lines
.
forEach
(
loc_item
=>
{
if
(
loc_item
[
SELECTED_QUQNTITY
]
>
0
)
{
listOptionData
[
10
].
value
+=
`已选【
${
loc_item
.
supplier_short_name
}
】物料 `
// let cur_params = params.local_lines
let
cur_params
=
params
if
(
params
&&
cur_params
)
{
cur_params
.
forEach
(
loc_item
=>
{
if
(
loc_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
)
{
listOptionData
[
10
].
value
+=
`【
${
loc_item
.
supplier_short_name
}
】`
}
})
if
(
!!
listOptionData
[
10
].
value
)
{
listOptionData
[
10
].
name
=
listOptionData
[
10
].
value
listOptionData
[
10
].
lines
=
cloneObject
(
params
.
local_line
s
)
listOptionData
[
10
].
lines
=
cloneObject
(
cur_param
s
)
}
}
...
...
@@ -1125,16 +1092,16 @@ class SelfOrderPage extends Component {
let
showPackageTip
=
false
local_lines
.
forEach
(
sup_item
=>
{
if
(
sup_item
[
SELECTED_QUQNTITY
]
>
0
&&
sup_item
.
leftOptionList
&&
sup_item
.
leftOptionList
.
length
>
0
)
{
if
(
sup_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
&&
sup_item
.
leftOptionList
&&
sup_item
.
leftOptionList
.
length
>
0
)
{
sup_item
.
leftOptionList
.
map
(
lef_item
=>
{
let
select_arr
=
lef_item
[
SELECTED_DATA_ARR
]
if
(
lef_item
[
SELECTED_QUQNTITY
]
>
0
&&
select_arr
&&
select_arr
.
length
>
0
)
{
let
select_arr
=
lef_item
[
LocalVariable
.
SELECTED_DATA_ARR
]
if
(
lef_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
&&
select_arr
&&
select_arr
.
length
>
0
)
{
// console.log('lef_item.category_code--', lef_item.category_code)
if
(
lef_item
.
category_code
===
LocalVariable
.
SURGICAL_TEMPLATE
)
{
// 手术模板
select_arr
.
forEach
(
sel_item
=>
{
let
template_number
=
sel_item
.
template_number
// sel_item.childrenLineData[0].lineOptions[0][SELECTED_DATA_ARR]
// sel_item.childrenLineData[0].lineOptions[0][
LocalVariable.
SELECTED_DATA_ARR]
if
(
sel_item
[
LocalVariable
.
CHILDREN_LINE_NAME
]
&&
sel_item
[
LocalVariable
.
CHILDREN_LINE_NAME
].
length
>
0
)
{
sel_item
[
LocalVariable
.
CHILDREN_LINE_NAME
].
forEach
(
chi_item
=>
{
...
...
@@ -1182,7 +1149,7 @@ class SelfOrderPage extends Component {
// 大-中-小类
select_arr
.
forEach
(
sel_item
=>
{
sel_item
.
details
.
forEach
(
end_item
=>
{
if
(
end_item
[
QUANTITY_FIELD
]
>
0
)
{
if
(
end_item
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
)
{
end_item
[
LocalVariable
.
PLAN_QUANTITY
]
=
end_item
[
LocalVariable
.
QUANTITY_FIELD
]
res_lines
.
push
(
end_item
)
}
...
...
@@ -1247,7 +1214,7 @@ class SelfOrderPage extends Component {
processReturnData
()
{
let
{
selfOrderOption
}
=
this
.
props
let
that
=
this
console
.
log
(
'selfOrderOption----'
,
selfOrderOption
)
console
.
log
(
'selfOrderOption----
!!!!
'
,
selfOrderOption
)
that
.
setState
({
isSubLoding
:
false
})
...
...
app/containers/selfOrder/module/ChooseProductPage.js
View file @
b4b348ea
...
...
@@ -7,20 +7,19 @@ import ProductRightStyle from './ProductRightStyle';
import
ProductModel
from
'../../common/ProductModel'
;
import
StatusBarView
from
'../../common/StatusBarView'
;
import
ChooseCardList
from
'../../common/listDataComponent/ChooseCardList'
;
import
{
cloneObject
,
dedupQuoteArray
,
show
}
from
'../../../utils/Utils'
;
import
{
cloneObject
,
show
}
from
'../../../utils/Utils'
;
import
{
reqPurSupplierSearch
,
reqProCategorySearch
,
reqSurTempHeadSearch
,
reqNailEquipHeadSearch
,
reqScatEquipmentSearch
,
reqSingleConsumSearch
,
setSelectProductOpts
}
from
'../../../action/SelfAction'
;
import
EmitterEvents
from
'../../common/EmitterEvents'
;
import
LoadingModel
from
'../../common/listDataComponent/LoadingModel'
;
import
localMockData
from
'./mock/sen_mock'
;
import
LocalVariable
from
'../../common/LocalVariable'
;
const
QUANTITY_FIELD
=
'quantity'
// 计算的字段
const
CHILDREN_LINE_NAME
=
'childrenLineData'
// 显示的子类数组名称
//
const QUANTITY_FIELD = 'quantity' // 计算的字段
//
const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
LOCAL_SECOND_DATA
=
'localSecondData'
// 中类原本元素
const
ONLY_TWO_LEVELS
=
'onlyTwoLevels'
// 只有两级的耗材
//
const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
//
const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
//
const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
//
const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
class
ChooseProductPage
extends
Component
{
constructor
(
props
)
{
...
...
@@ -55,22 +54,6 @@ class ChooseProductPage extends Component {
}
componentDidMount
()
{
// // console.log('本地测试数据====localMockData===', localMockData)
// let {topProcOptionList} = this.state
// topProcOptionList = cloneObject(localMockData.localTopProcOption)
// topProcOptionList.forEach(function (topObj) {
// topObj[SELECTED_QUQNTITY] = 0
// topObj['leftOptionList'] = cloneObject(localMockData.localLeftOption)
// })
// // 赋值本地测试数据
// this.setState({
// topProcOptionList: topProcOptionList,
// leftOptionList: cloneObject(localMockData.localLeftOption)
// })
this
.
initGetData
()
}
...
...
@@ -80,7 +63,8 @@ class ChooseProductPage extends Component {
let
{
setSelectProductOpts
}
=
this
.
props
setSelectProductOpts
(
topProcOptionList
)
// 并且=======调用返回
DeviceEventEmitter
.
emit
(
EmitterEvents
.
BACK_TO_SELF_PAGE
,
{
local_lines
:
topProcOptionList
})
// DeviceEventEmitter.emit(EmitterEvents.BACK_TO_SELF_PAGE, { local_lines: topProcOptionList })
this
.
props
.
navigation
.
state
.
params
.
productCallBack
(
topProcOptionList
)
this
.
props
.
navigation
.
goBack
()
}
...
...
@@ -120,7 +104,7 @@ class ChooseProductPage extends Component {
let
{
topProcOptionList
}
=
that
.
state
topProcOptionList
=
cloneObject
(
data
)
topProcOptionList
.
forEach
(
function
(
topObj
)
{
topObj
[
'selectedQuantity'
]
=
0
topObj
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
topObj
[
'leftOptionList'
]
=
[]
if
(
!
topObj
[
'supplier_short_name'
])
{
topObj
.
supplier_short_name
=
topObj
.
supplier_name
.
substring
(
0
,
3
)
...
...
@@ -153,12 +137,12 @@ class ChooseProductPage extends Component {
console
.
log
(
'res_2 : '
,
pro_scate_search
)
if
(
pro_scate_search
.
error_code
===
0
)
{
if
(
topItem
[
SELECTED_QUQNTITY
]
===
0
)
{
if
(
topItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
===
0
)
{
let
{
data
}
=
pro_scate_search
topItem
.
leftOptionList
=
defalutLeftItem
.
concat
(
data
.
item
)
topItem
.
leftOptionList
.
forEach
(
function
(
leftObj
)
{
leftObj
[
'selectedQuantity'
]
=
0
leftObj
[
'localSecondData'
]
=
[]
leftObj
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
leftObj
[
LocalVariable
.
LOCAL_SECOND_DATA
]
=
[]
})
topProcOptionList
[
topIndex
]
=
topItem
}
...
...
@@ -195,7 +179,7 @@ class ChooseProductPage extends Component {
let
{
topProcOptionList
,
topActiveIndex
}
=
that
.
state
let
{
token
,
global_domain_config
,
navigation
}
=
that
.
props
console
.
log
(
'左侧标题--'
,
topActiveIndex
,
leftItem
,
leftIndex
)
if
(
leftItem
[
SELECTED_QUQNTITY
]
!==
0
)
{
if
(
leftItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
!==
0
)
{
that
.
setState
({
leftActiveIndex
:
leftIndex
})
...
...
@@ -245,9 +229,9 @@ class ChooseProductPage extends Component {
let
nail_equip_head_search
=
await
reqNailEquipHeadSearch
(
global_domain_config
,
params
)
console
.
log
(
'res_3 : '
,
nail_equip_head_search
)
if
(
nail_equip_head_search
.
error_code
===
0
)
{
if
(
nail_equip_head_search
.
data
&&
nail_equip_head_search
.
data
.
items
)
{
if
(
nail_equip_head_search
.
data
&&
nail_equip_head_search
.
data
.
items
)
{
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftIndex
]
=
that
.
getInitLocalSecondData
(
leftItem
,
nail_equip_head_search
.
data
.
items
)
}
else
{
}
else
{
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftIndex
]
=
[]
}
that
.
setState
({
...
...
@@ -266,9 +250,9 @@ class ChooseProductPage extends Component {
let
scat_head_search
=
await
reqScatEquipmentSearch
(
global_domain_config
,
params
)
console
.
log
(
'res_3 : '
,
scat_head_search
)
if
(
scat_head_search
.
error_code
===
0
)
{
if
(
scat_head_search
.
data
&&
scat_head_search
.
data
.
tools
)
{
if
(
scat_head_search
.
data
&&
scat_head_search
.
data
.
tools
)
{
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftIndex
]
=
that
.
getInitLocalSecondData
(
leftItem
,
scat_head_search
.
data
.
tools
)
}
else
{
}
else
{
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftIndex
]
=
[]
}
that
.
setState
({
...
...
@@ -370,195 +354,39 @@ class ChooseProductPage extends Component {
})
}
// 计算三级回调函数 -- 未使用
handleChangeThird
(
childData
,
superIndex
)
{
let
{
leftActiveIndex
,
leftOptionList
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
// console.log("计算三级的回调函数",childData, superIndex, leftActiveIndex)
// console.log(leftOptionList)
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
SELECTED_DATA_ARR
]
=
[]
let
top_sel_sum
=
0
// 初始化
// leftOptionList[leftActiveIndex][SELECTED_QUQNTITY] = 0
// leftOptionList[leftActiveIndex][SELECTED_DATA_ARR] = []
// let top_sel_sum = 0
// 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) {
// if (leItem[LOCAL_SECOND_DATA].length && leItem[LOCAL_SECOND_DATA][superIndex] && childData.length) {
// let sumCount = 0
// childData.map((chDa, chInd) => {
// if (!chDa[QUANTITY_FIELD]) {
// chDa[QUANTITY_FIELD] = 0
// }
// sumCount += chDa[QUANTITY_FIELD]
// })
// let chDa = leItem[LOCAL_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,
// [QUANTITY_FIELD]: sumCount
// }
// // 初始化
// leItem[LOCAL_SECOND_DATA][superIndex][CHILDREN_LINE_NAME] = []
// leItem[LOCAL_SECOND_DATA][superIndex][CHILDREN_LINE_NAME].push(curObj)
// leItem[LOCAL_SECOND_DATA][superIndex][QUANTITY_FIELD] = sumCount
// }
// // 初始化
// leItem[SELECTED_QUQNTITY] = 0
// leItem[SELECTED_DATA_ARR] = []
// if (leItem[LOCAL_SECOND_DATA].length) { // 本地测试 localSecondData LOCAL_SECOND_DATA
// leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
// if (chItem[QUANTITY_FIELD] > 0) {
// leItem[SELECTED_QUQNTITY] += Number(chItem[QUANTITY_FIELD])
// leItem[SELECTED_DATA_ARR].push(chItem)
// }
// })
// }
// }
// // top_sel_sum += leItem[SELECTED_QUQNTITY]
// })
// // topProcOptionList[topActiveIndex] = top_sel_sum
topProcOptionList
[
topActiveIndex
].
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
)
{
// if (leItem[LOCAL_SECOND_DATA].length && leItem[LOCAL_SECOND_DATA][superIndex] && childData.length) {
// let sumCount = 0
// childData.map((chDa, chInd) => {
// if (!chDa[QUANTITY_FIELD]) {
// chDa[QUANTITY_FIELD] = 0
// }
// sumCount += chDa[QUANTITY_FIELD]
// })
// let chDa = leItem[LOCAL_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,
// [QUANTITY_FIELD]: sumCount
// }
// // 初始化
// leItem[LOCAL_SECOND_DATA][superIndex][CHILDREN_LINE_NAME] = []
// leItem[LOCAL_SECOND_DATA][superIndex][CHILDREN_LINE_NAME].push(curObj)
// leItem[LOCAL_SECOND_DATA][superIndex][QUANTITY_FIELD] = sumCount
// }
// 初始化
leItem
[
SELECTED_QUQNTITY
]
=
0
leItem
[
SELECTED_DATA_ARR
]
=
[]
if
(
leItem
[
LOCAL_SECOND_DATA
].
length
)
{
// 本地测试 localSecondData LOCAL_SECOND_DATA
leItem
[
LOCAL_SECOND_DATA
].
forEach
(
function
(
chItem
)
{
if
(
chItem
[
QUANTITY_FIELD
]
>
0
)
{
leItem
[
SELECTED_QUQNTITY
]
+=
Number
(
chItem
[
QUANTITY_FIELD
])
leItem
[
SELECTED_DATA_ARR
].
push
(
chItem
)
}
})
}
}
top_sel_sum
+=
leItem
[
SELECTED_QUQNTITY
]
})
topProcOptionList
[
topActiveIndex
]
=
top_sel_sum
console
.
log
(
'计算三级之后数据---'
,
topProcOptionList
)
this
.
setState
({
// leftOptionList,
topProcOptionList
})
}
// 计算中级数量回调
handleChangeCount
(
count
,
coutFieName
)
{
let
{
leftActiveIndex
,
leftOptionList
,
topProcOptionList
,
topActiveIndex
,
defaultThridShow
}
=
this
.
state
console
.
log
(
'计算中级数量回调==='
,
count
,
leftActiveIndex
,
defaultThridShow
,
coutFieName
)
// 初始化
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
SELECTED_DATA_ARR
]
=
[]
// 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) {
// // 当前选择项
// leItem[SELECTED_QUQNTITY] = count
// if (leItem[LOCAL_SECOND_DATA].length) { // 本地测试 localSecondData LOCAL_SECOND_DATA
// leItem[LOCAL_SECOND_DATA].forEach(function (chItem) {
// if (chItem[coutFieName]) {
// leItem[SELECTED_DATA_ARR].push(chItem)
// }
// })
// }
// }
// })
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
[
leftActiveIndex
][
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
let
top_sel_sum
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
.
map
(
function
(
leItem
,
leIndex
)
{
if
(
!
leItem
[
SELECTED_QUQNTITY
])
{
leItem
[
SELECTED_QUQNTITY
]
=
0
if
(
!
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
])
{
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
if
(
!
leItem
[
SELECTED_DATA_ARR
])
{
leItem
[
SELECTED_DATA_ARR
]
=
[]
if
(
!
leItem
[
LocalVariable
.
SELECTED_DATA_ARR
])
{
leItem
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
}
if
(
leIndex
===
leftActiveIndex
)
{
// 当前选择项
leItem
[
SELECTED_QUQNTITY
]
=
count
if
(
leItem
[
LOCAL_SECOND_DATA
].
length
>
0
)
{
leItem
[
SELECTED_DATA_ARR
]
=
[]
leItem
[
LOCAL_SECOND_DATA
].
forEach
(
function
(
chItem
)
{
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
count
if
(
leItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
].
length
>
0
)
{
leItem
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
leItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
].
forEach
(
function
(
chItem
)
{
if
(
chItem
[
coutFieName
])
{
leItem
[
SELECTED_DATA_ARR
].
push
(
chItem
)
leItem
[
LocalVariable
.
SELECTED_DATA_ARR
].
push
(
chItem
)
}
})
}
}
top_sel_sum
+=
leItem
[
SELECTED_QUQNTITY
]
top_sel_sum
+=
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
top_sel_sum
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
=
top_sel_sum
// console.log('计算中级之后---', leftOptionList)
console
.
log
(
'计算中级之后---'
,
topProcOptionList
)
this
.
setState
({
...
...
@@ -576,28 +404,57 @@ class ChooseProductPage extends Component {
}
// 计算所有已选数量
getAllCountQuantity
()
{
let
{
leftOptionList
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
getAllCountQuantity
(
tipFlag
)
{
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
allCountQuantity
=
0
let
allTip
=
''
if
(
!
topProcOptionList
.
length
)
{
return
allCountQuantity
}
topProcOptionList
[
topActiveIndex
].
leftOptionList
.
map
(
leItem
=>
{
// leftOptionList.map(leItem => {
if
(
!
leItem
[
SELECTED_QUQNTITY
])
{
leItem
[
SELECTED_QUQNTITY
]
=
0
topProcOptionList
.
forEach
(
top_item
=>
{
if
(
top_item
.
leftOptionList
&&
top_item
.
leftOptionList
.
length
>
0
)
{
top_item
.
leftOptionList
.
map
(
leItem
=>
{
if
(
!
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
])
{
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
allCountQuantity
+=
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
}
if
(
top_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
)
{
allTip
+=
`
${
top_item
.
supplier_short_name
}
x
${
top_item
[
LocalVariable
.
SELECTED_QUQNTITY
]}
`
}
allCountQuantity
+=
leItem
[
SELECTED_QUQNTITY
]
})
console
.
log
(
'allCountQuantity---'
,
allCountQuantity
)
// topProcOptionList[topActiveIndex].leftOptionList.map(leItem => {
// if (!leItem[LocalVariable.SELECTED_QUQNTITY]) {
// leItem[LocalVariable.SELECTED_QUQNTITY] = 0
// }
// allCountQuantity += leItem[LocalVariable.SELECTED_QUQNTITY]
// })
console
.
log
(
'allCountQuantity---'
,
allCountQuantity
,
allTip
)
if
(
tipFlag
)
{
return
allTip
}
return
allCountQuantity
}
// 计算当前已选值
getCurCountSum
()
{
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
curCountQuantity
=
0
topProcOptionList
[
topActiveIndex
].
leftOptionList
.
map
(
leItem
=>
{
if
(
!
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
])
{
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
}
curCountQuantity
+=
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
return
curCountQuantity
}
// 点击共计已选
handleSubSelected
()
{
// console.log('show-----', show)
let
{
selectShowPopup
}
=
this
.
state
if
(
this
.
getAllCountQuantity
()
!==
0
)
{
if
(
this
.
getAllCountQuantity
()
!==
0
&&
this
.
getCurCountSum
()
!==
0
)
{
this
.
handleCloseSelectModal
(
!
selectShowPopup
)
}
}
...
...
@@ -615,15 +472,40 @@ class ChooseProductPage extends Component {
// console.log('--已选修改回调--', options)
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
topProcOptionList
[
topActiveIndex
].
leftOptionList
=
options
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
options
.
forEach
(
cur_ops
=>
{
if
(
cur_ops
[
SELECTED_QUQNTITY
]
>
0
)
{
topProcOptionList
[
topActiveIndex
][
SELECTED_QUQNTITY
]
+=
cur_ops
[
SELECTED_QUQNTITY
]
if
(
cur_ops
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
)
{
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
+=
cur_ops
[
LocalVariable
.
SELECTED_QUQNTITY
]
}
})
this
.
setState
({
topProcOptionList
// leftOptionList: options,
})
}
// 已选清空所有回调
handleClearRubbish
()
{
let
{
topProcOptionList
}
=
this
.
state
topProcOptionList
.
forEach
(
function
(
top_item
)
{
top_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
if
(
top_item
.
leftOptionList
&&
top_item
.
leftOptionList
.
length
>
0
)
{
top_item
.
leftOptionList
.
map
(
function
(
listItem
)
{
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
listItem
[
LocalVariable
.
LOCAL_SECOND_DATA
].
forEach
(
function
(
deIt
)
{
deIt
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
deIt
[
LocalVariable
.
CHILDREN_LINE_NAME
]
=
[]
if
(
deIt
.
details
&&
deIt
.
details
.
length
>
0
)
{
deIt
.
details
.
forEach
(
function
(
det_item
)
{
det_item
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
})
}
})
})
}
})
this
.
setState
({
topProcOptionList
:
topProcOptionList
})
}
...
...
@@ -658,9 +540,6 @@ class ChooseProductPage extends Component {
// 返回顶部产品元素
renderTopProItem
()
{
let
{
topProcOptionList
,
topActiveIndex
}
=
this
.
state
// if(topProcOptionList.length > 0){
// topProcOptionList[topActiveIndex][SELECTED_QUQNTITY]= this.getAllCountQuantity()
// }
console
.
log
(
'返回顶部产品元素---'
,
topProcOptionList
)
let
cur_title
=
'title'
,
cur_icon
=
'iconImg'
cur_title
=
'supplier_short_name'
...
...
@@ -682,7 +561,7 @@ class ChooseProductPage extends Component {
cardItemIcon
=
{
cur_icon
}
curActIndex
=
{
topActiveIndex
}
cardCallBack
=
{(
item
,
index
)
=>
this
.
handleTopNav
(
item
,
index
)}
cardCountName
=
{
SELECTED_QUQNTITY
}
cardCountName
=
{
LocalVariable
.
SELECTED_QUQNTITY
}
cardStyleType
=
{
'GRAPHICS'
}
cardCouStyle
=
{
styles
.
top_cot_num
}
cardShowDefIcon
=
{
true
}
...
...
@@ -722,7 +601,7 @@ class ChooseProductPage extends Component {
cardItemIcon
=
{
cur_icon
}
curActIndex
=
{
leftActiveIndex
}
cardCallBack
=
{(
item
,
index
)
=>
this
.
handleLeftNav
(
item
,
index
)}
cardCountName
=
{
SELECTED_QUQNTITY
}
cardCountName
=
{
LocalVariable
.
SELECTED_QUQNTITY
}
cardStyleType
=
{
'GRAPHICS'
}
/
>
)
...
...
@@ -735,7 +614,7 @@ class ChooseProductPage extends Component {
let
curRigSecoOption
=
[]
let
curSuperLeftOption
=
[]
// if(leftOptionList[leftActiveIndex]){
// curRigSecoOption = leftOptionList[leftActiveIndex][LOCAL_SECOND_DATA] // 本地数据
// curRigSecoOption = leftOptionList[leftActiveIndex][L
ocalVariable.L
OCAL_SECOND_DATA] // 本地数据
// curSuperLeftOption = leftOptionList[leftActiveIndex]
// }
...
...
@@ -743,8 +622,8 @@ class ChooseProductPage extends Component {
if
(
topItem
&&
topItem
.
leftOptionList
)
{
let
leftItem
=
topItem
.
leftOptionList
[
leftActiveIndex
]
if
(
leftItem
&&
leftItem
[
LOCAL_SECOND_DATA
])
{
curRigSecoOption
=
leftItem
[
LOCAL_SECOND_DATA
]
if
(
leftItem
&&
leftItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
])
{
curRigSecoOption
=
leftItem
[
L
ocalVariable
.
L
OCAL_SECOND_DATA
]
curSuperLeftOption
=
leftItem
}
}
...
...
@@ -772,21 +651,28 @@ class ChooseProductPage extends Component {
// 返回底部按钮
renderFooterBtnItem
()
{
let
{
selectShowPopup
,
leftOptionList
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
{
selectShowPopup
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
allCountQuantity
=
this
.
getAllCountQuantity
()
let
cur_sel_options
=
[]
let
sel_tip
=
''
// cur_sel_options = leftOptionList
if
(
topProcOptionList
.
length
>
0
)
{
// topProcOptionList.forEach(top_item => {
// if(top_item[LocalVariable.SELECTED_QUQNTITY] > 0){
// cur_sel_options.push(...top_item.leftOptionList)
// }
// })
cur_sel_options
=
topProcOptionList
[
topActiveIndex
].
leftOptionList
cur_sel_options
.
forEach
(
cur_item
=>
{
if
(
cur_item
[
SELECTED_QUQNTITY
]
>
0
)
{
sel_tip
+=
`
${
cur_item
.
category_name
}
x
${
cur_item
[
SELECTED_QUQNTITY
]}
`
}
})
// cur_sel_options.forEach(cur_item => {
// if (cur_item[LocalVariable.SELECTED_QUQNTITY] > 0) {
// sel_tip += `${cur_item.category_name}x${cur_item[LocalVariable.SELECTED_QUQNTITY]} `
// }
// })
}
console
.
log
(
'返回底部按钮----'
,
cur_sel_options
,
sel_tip
)
console
.
log
(
'返回底部按钮😂----'
,
cur_sel_options
,
sel_tip
)
sel_tip
=
this
.
getAllCountQuantity
(
true
)
return
(
<
View
style
=
{
list_common_item
.
sub_box
}
>
<
View
style
=
{
list_common_item
.
sub_two_btn
}
>
...
...
@@ -796,11 +682,8 @@ class ChooseProductPage extends Component {
onPress
=
{()
=>
this
.
handleSubSelected
()}
>
<
Text
style
=
{
list_common_item
.
lef_tip
}
numberOfLines
=
{
1
}
>
{
/* {'已选'} */
}
{
allCountQuantity
===
0
?
<
Text
>
{
'未选'
}
<
/Text> : <Text>{'已选: '}</
Text
>
}
{
allCountQuantity
===
0
?
<
Text
>
{
'未选'
}
<
/Text> : <Text>{'所有已选: '}</
Text
>
}
{
allCountQuantity
===
0
?
null
:
<
Text
style
=
{
styles
.
lef_tip_txt
}
>
{
sel_tip
}
<
/Text>
}
{
/* <Text style={allCountQuantity !== 0 ? list_common_item.lef_tip_num : ''}>{allCountQuantity}</Text> */
}
<
/Text
>
{
allCountQuantity
===
0
?
null
:
<
View
style
=
{
styles
.
lef_btn_num
}
>
<
Text
style
=
{
styles
.
lef_num_txt
}
>
{
allCountQuantity
}
<
/Text
>
...
...
@@ -820,8 +703,8 @@ class ChooseProductPage extends Component {
closeModal
=
{(
show
)
=>
this
.
handleCloseSelectModal
(
show
)}
closeSubmit
=
{()
=>
this
.
handleSubmit
()}
modelOption
=
{
cur_sel_options
}
// modelOption={leftOptionList}
modelCallBack
=
{(
options
)
=>
this
.
handleSelectCallBack
(
options
)}
clearRubbish
=
{()
=>
this
.
handleClearRubbish
()}
/
>
{
this
.
renderLodingItem
()}
...
...
@@ -983,7 +866,7 @@ const styles = StyleSheet.create({
},
lef_btn_num
:
{
position
:
'absolute'
,
left
:
5
0
,
left
:
8
0
,
top
:
4
,
backgroundColor
:
point_color
,
borderRadius
:
50
,
...
...
app/containers/selfOrder/module/EditThirdLevelPage.js
View file @
b4b348ea
...
...
@@ -14,11 +14,12 @@ import { cloneObject, show } from '../../../utils/Utils';
import
{
reqSurTempLineSearch
,
reqNailBoxLineSearch
,
reqEquipPackageLineSearch
}
from
'../../../action/SelfAction'
;
import
LoadingModel
from
'../../common/listDataComponent/LoadingModel'
;
import
localMockData
from
'./mock/sen_mock'
;
import
LocalVariable
from
'../../common/LocalVariable'
;
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 三级数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 三级已选元素
const
LOCAL_THRID_CONT_DATA
=
'localThridContData'
// 三级原本元素
const
QUANTITY_FIELD
=
'quantity'
// 计算的字段
//
const SELECTED_QUQNTITY = 'selectedQuantity' // 三级数量
//
const SELECTED_DATA_ARR = 'selectedDataArr' // 三级已选元素
//
const LOCAL_THRID_CONT_DATA = 'localThridContData' // 三级原本元素
//
const QUANTITY_FIELD = 'quantity' // 计算的字段
class
EditThirdLevelPage
extends
Component
{
...
...
@@ -107,9 +108,9 @@ class EditThirdLevelPage extends Component {
let
{
data
}
=
sur_line_search
topProcOptionList
=
cloneObject
(
defalutTopItem
)
topProcOptionList
.
forEach
(
function
(
topIt
)
{
topIt
[
'localThridContData'
]
=
[]
topIt
[
'selectedDataArr'
]
=
[]
topIt
[
'selectedQuantity'
]
=
0
topIt
[
LocalVariable
.
LOCAL_THRID_CONT_DATA
]
=
[]
topIt
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
topIt
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
})
if
(
data
.
items
)
{
topProcOptionList
[
0
].
localThridContData
=
data
.
items
...
...
@@ -145,9 +146,9 @@ class EditThirdLevelPage extends Component {
let
{
data
}
=
nail_line_search
topProcOptionList
=
cloneObject
(
data
.
segemt
)
topProcOptionList
.
forEach
(
function
(
topIt
)
{
topIt
[
'localThridContData'
]
=
topIt
[
'details'
]
topIt
[
'selectedDataArr'
]
=
[]
topIt
[
'selectedQuantity'
]
=
0
topIt
[
LocalVariable
.
LOCAL_THRID_CONT_DATA
]
=
topIt
[
'details'
]
topIt
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
topIt
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
})
that
.
setState
({
topProcOptionList
:
topProcOptionList
,
...
...
@@ -172,9 +173,9 @@ class EditThirdLevelPage extends Component {
console
.
log
(
'res_line_1 : '
,
equip_line_search
)
if
(
equip_line_search
.
error_code
===
0
)
{
let
{
data
}
=
equip_line_search
data
[
'localThridContData'
]
=
data
[
'package_components'
]
data
[
'selectedDataArr'
]
=
[]
data
[
'selectedQuantity'
]
=
0
data
[
LocalVariable
.
LOCAL_THRID_CONT_DATA
]
=
data
[
'package_components'
]
data
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
data
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
topProcOptionList
[
0
]
=
cloneObject
(
data
)
that
.
setState
({
topProcOptionList
:
topProcOptionList
,
...
...
@@ -232,13 +233,13 @@ class EditThirdLevelPage extends Component {
setAllSelectData
()
{
let
{
topProcOptionList
}
=
this
.
state
topProcOptionList
.
map
(
function
(
listItem
)
{
listItem
[
SELECTED_QUQNTITY
]
=
0
listItem
[
SELECTED_DATA_ARR
]
=
[]
if
(
listItem
[
LOCAL_THRID_CONT_DATA
].
length
)
{
listItem
[
LOCAL_THRID_CONT_DATA
].
forEach
(
function
(
chItem
)
{
if
(
chItem
[
QUANTITY_FIELD
])
{
listItem
[
SELECTED_QUQNTITY
]
+=
Number
(
chItem
[
QUANTITY_FIELD
])
listItem
[
SELECTED_DATA_ARR
].
push
(
chItem
)
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
=
0
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
]
=
[]
if
(
listItem
[
L
ocalVariable
.
L
OCAL_THRID_CONT_DATA
].
length
)
{
listItem
[
L
ocalVariable
.
L
OCAL_THRID_CONT_DATA
].
forEach
(
function
(
chItem
)
{
if
(
chItem
[
LocalVariable
.
QUANTITY_FIELD
])
{
listItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
Number
(
chItem
[
LocalVariable
.
QUANTITY_FIELD
])
listItem
[
LocalVariable
.
SELECTED_DATA_ARR
].
push
(
chItem
)
}
})
}
...
...
@@ -263,7 +264,7 @@ class EditThirdLevelPage extends Component {
let
{
topProcOptionList
,
superData
}
=
this
.
state
let
{
params
}
=
this
.
props
.
navigation
.
state
// console.log('编辑完成====>', topProcOptionList, params.superData)
// console.log(topProcOptionList[0][LOCAL_THRID_CONT_DATA][0])
// console.log(topProcOptionList[0][L
ocalVariable.L
OCAL_THRID_CONT_DATA][0])
params
.
childrenPageCallBack
(
topProcOptionList
,
superData
.
superIndex
)
this
.
props
.
navigation
.
goBack
()
}
...
...
@@ -313,7 +314,7 @@ class EditThirdLevelPage extends Component {
cardItemTitle
=
{
curTit
}
curActIndex
=
{
topActiveIndex
}
cardCallBack
=
{(
item
,
index
)
=>
this
.
handleTopNav
(
item
,
index
)}
cardCountName
=
{
SELECTED_QUQNTITY
}
cardCountName
=
{
LocalVariable
.
SELECTED_QUQNTITY
}
cardStyleType
=
{
'DEFAULT'
}
/
>
)
...
...
@@ -339,8 +340,8 @@ class EditThirdLevelPage extends Component {
// } else {
// curData = topProcOptionList[topActiveIndex]
// }
// if (curData && curData[LOCAL_THRID_CONT_DATA]) {
// localThridContData = curData[LOCAL_THRID_CONT_DATA]
// if (curData && curData[L
ocalVariable.L
OCAL_THRID_CONT_DATA]) {
// localThridContData = curData[L
ocalVariable.L
OCAL_THRID_CONT_DATA]
// }
// if (curData && curData.imgIconArr) {
// imgIconArr = curData.imgIconArr
...
...
@@ -356,7 +357,7 @@ class EditThirdLevelPage extends Component {
let
imgIconArr
=
''
let
topItem
=
topProcOptionList
[
topActiveIndex
]
if
(
topItem
)
{
localThridContData
=
topItem
[
LOCAL_THRID_CONT_DATA
]
localThridContData
=
topItem
[
L
ocalVariable
.
L
OCAL_THRID_CONT_DATA
]
}
console
.
log
(
'底部数据=='
,
topItem
,
localThridContData
)
...
...
@@ -397,25 +398,6 @@ class EditThirdLevelPage extends Component {
let
curTit
=
''
,
curTipStr
=
''
,
curTipOne
=
''
,
curTipTwo
=
''
,
curCalField
=
''
,
curImgIcon
=
''
let
curTipStrTit
=
''
,
curTipOneTit
=
''
,
curTipTwoTit
=
''
// if (!onlyShow) {
// curImgIcon = 'imgIconArr'
// }
// if (params.superData.leftIndex === 2) {
// // 器械包
// curTit = 'item_name'
// curTipStr = 'category_name'
// curTipOne = 'category_desc'
// curCalField = 'quantity'
// curImgIcon = ''
// // 物料名称、分类名称、分类说明
// } else {
// curTit = 'title'
// curTipStr = 'tip1'
// curTipOne = 'tip2'
// curCalField = 'quantity'
// // curImgIcon = ''
// }
curTit
=
'item_name'
curTipStr
=
'item_code'
...
...
@@ -424,7 +406,7 @@ class EditThirdLevelPage extends Component {
curTipStrTit
=
'物料代码'
curTipOneTit
=
'规格型号'
curTipTwoTit
=
'通用名称'
curCalField
=
'quantity'
curCalField
=
LocalVariable
.
QUANTITY_FIELD
curImgIcon
=
'photos'
return
(
...
...
@@ -433,7 +415,7 @@ class EditThirdLevelPage extends Component {
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
curCalField
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
LOCAL_THRID_CONT_DATA
)}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
L
ocalVariable
.
L
OCAL_THRID_CONT_DATA
)}
titText
=
{
curTit
}
tipTextStr
=
{
curTipStr
}
tipTextOne
=
{
curTipOne
}
...
...
app/containers/selfOrder/module/ProductRightStyle.js
View file @
b4b348ea
...
...
@@ -8,15 +8,16 @@ import { PicListNoData } from '../../common/CellTextStyle';
import
_
from
"lodash"
;
import
{
connect
}
from
'react-redux'
;
import
localMockData
from
'./mock/sen_mock'
;
import
LocalVariable
from
'../../common/LocalVariable'
;
const
PropTypes
=
require
(
'prop-types'
);
const
QUANTITY_FIELD
=
'quantity'
// 计算的字段
const
CHILDREN_LINE_NAME
=
'childrenLineData'
// 显示的子类数组名称
const
ONLY_TWO_LEVELS
=
'onlyTwoLevels'
// 只有两级的耗材
//
const QUANTITY_FIELD = 'quantity' // 计算的字段
//
const CHILDREN_LINE_NAME = 'childrenLineData' // 显示的子类数组名称
//
const ONLY_TWO_LEVELS = 'onlyTwoLevels' // 只有两级的耗材
const
SELECTED_QUQNTITY
=
'selectedQuantity'
// 中类数量
const
SELECTED_DATA_ARR
=
'selectedDataArr'
// 中类已选元素
const
LOCAL_SECOND_DATA
=
'localSecondData'
// 中类原本元素
//
const SELECTED_QUQNTITY = 'selectedQuantity' // 中类数量
//
const SELECTED_DATA_ARR = 'selectedDataArr' // 中类已选元素
//
const LOCAL_SECOND_DATA = 'localSecondData' // 中类原本元素
class
ProductRightStyle
extends
Component
{
...
...
@@ -71,7 +72,6 @@ class ProductRightStyle extends Component {
curTit
=
'钉盒明细'
}
else
if
(
leftIndex
===
2
)
{
curThirdShow
=
true
// curThirdSign = true
curTit
=
'器械包明细'
}
this
.
props
.
navigation
.
navigate
(
'EditThirdLevelPage'
,
{
...
...
@@ -80,18 +80,13 @@ class ProductRightStyle extends Component {
superItem
:
item
,
superIndex
:
index
,
leftIndex
:
leftIndex
,
thirdShow
:
curThirdShow
,
// thirdSign: curThirdSign,
thirdShow
:
curThirdShow
},
childrenPageCallBack
:
this
.
childrenPageCallBack
.
bind
(
this
)
// 传递函数,编辑完成时调用
})
}
else
if
(
leftIndex
===
3
)
{
// 零散器械
this
.
canPlusOrdReduceOne
(
item
,
index
)
// this.handleCalCallBack(curData, curIndex, 'rightSecondData', QUANTITY_FIELD)
// this.setState({
// rightSecondData
// })
}
else
{
// 单选耗材 中级标题点击之后
this
.
changeThrShow
(
true
,
item
,
index
)
...
...
@@ -113,7 +108,7 @@ class ProductRightStyle extends Component {
let
{
rightSecondData
}
=
this
.
state
let
{
superLeftData
}
=
this
.
props
console
.
log
(
'大类加减,整理加一/减一'
,
curData
,
curIndex
,
isPlus
)
// console.log('右侧数据', rightSecondData, curData[CHILDREN_LINE_NAME])
// console.log('右侧数据', rightSecondData, curData[
LocalVariable.
CHILDREN_LINE_NAME])
// let rowData = [] // 本地测试,需要获取接口数据(无数据时,加法)
// rowData = cloneObject(localMockData.localSingleRowData) // 初始化数据
...
...
@@ -127,92 +122,25 @@ class ProductRightStyle extends Component {
if
(
curData
.
details
&&
curData
.
details
.
length
>
0
)
{
let
sumCount
=
0
curData
[
QUANTITY_FIELD
]
=
0
// 初始化
curData
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
// 初始化
curData
.
details
.
forEach
(
function
(
line_val
)
{
if
(
!
line_val
[
QUANTITY_FIELD
])
{
line_val
[
QUANTITY_FIELD
]
=
0
if
(
!
line_val
[
LocalVariable
.
QUANTITY_FIELD
])
{
line_val
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
if
(
isPlus
)
{
line_val
[
QUANTITY_FIELD
]
+=
1
}
else
if
(
line_val
[
QUANTITY_FIELD
]
>
0
)
{
line_val
[
QUANTITY_FIELD
]
-=
1
line_val
[
LocalVariable
.
QUANTITY_FIELD
]
+=
1
}
else
if
(
line_val
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
)
{
line_val
[
LocalVariable
.
QUANTITY_FIELD
]
-=
1
}
sumCount
+=
line_val
[
QUANTITY_FIELD
]
sumCount
+=
line_val
[
LocalVariable
.
QUANTITY_FIELD
]
})
curData
[
QUANTITY_FIELD
]
=
sumCount
curData
[
LocalVariable
.
QUANTITY_FIELD
]
=
sumCount
this
.
handleCalCallBack
(
curData
,
curIndex
,
'rightSecondData'
,
QUANTITY_FIELD
)
this
.
handleCalCallBack
(
curData
,
curIndex
,
'rightSecondData'
,
LocalVariable
.
QUANTITY_FIELD
)
}
// if ((!curData[CHILDREN_LINE_NAME] || !curData[CHILDREN_LINE_NAME].length) && isPlus) {
// let curObj = {
// superId: curData['category_code'],
// superIndex: curIndex,
// superTit: superLeftData['category_name'],
// superImg: curData['photos'],
// superTip: curData['category_name'],
// curTitle: curData['category_name'],
// version: 0,
// lineOptions: rowData,
// [QUANTITY_FIELD]: 0
// }
// // let curObj = {
// // superId: curData['id'], // 本地测试
// // superIndex: curIndex, // 本地测试
// // superTit: superLeftData['title'], // 本地测试
// // superImg: curData['imgIcon'], // 本地测试
// // superTip: curData['title'], // 本地测试
// // curTitle: curData['title'], // 本地测试
// // version: 0,
// // lineOptions: rowData,
// // [QUANTITY_FIELD]: 0
// // }
// // 初始化
// curData[CHILDREN_LINE_NAME] = []
// curData[CHILDREN_LINE_NAME].push(curObj)
// curData[QUANTITY_FIELD] = 0
// }
// // 加法/减法
// if (curData[CHILDREN_LINE_NAME] && curData[CHILDREN_LINE_NAME].length > 0) {
// let sumCount = 0
// curData[CHILDREN_LINE_NAME][0].lineOptions.forEach(function (lineIt) {
// if (!lineIt[QUANTITY_FIELD]) {
// lineIt[QUANTITY_FIELD] = 0
// }
// if (!isPlus) {
// // 减法
// if (lineIt[QUANTITY_FIELD]) {
// lineIt[QUANTITY_FIELD] -= 1
// } else {
// lineIt[QUANTITY_FIELD] = 0
// }
// } else {
// // 加法
// lineIt[QUANTITY_FIELD] += 1
// }
// sumCount += lineIt[QUANTITY_FIELD]
// })
// if (sumCount) {
// curData[CHILDREN_LINE_NAME][0][QUANTITY_FIELD] = sumCount
// curData[QUANTITY_FIELD] = sumCount
// curData[CHILDREN_LINE_NAME][0].superTip = `${curData['category_name']}x${sumCount}`
// } else {
// curData[QUANTITY_FIELD] = 0
// delete curData[CHILDREN_LINE_NAME]
// }
// }
console
.
log
(
'修改后的数据'
,
curData
,
curIndex
)
// this.handleCalCallBack(curData, curIndex, 'rightSecondData', QUANTITY_FIELD)
// this.setState({
// rightSecondData
// })
}
// 手术模板-编辑页面的回调
...
...
@@ -221,52 +149,13 @@ class ProductRightStyle extends Component {
let
{
leftIndex
}
=
this
.
props
console
.
log
(
'编辑页面的回调----'
,
childData
,
index
,
leftIndex
)
let
that
=
this
if
(
leftIndex
===
8
)
{
// leftIndex === 2 器械包有问题
// rightSecondData.forEach(function(rsdItem, rsdIndex) {
// if(!rsdItem[CHILDREN_LINE_NAME]) {
// rsdItem[CHILDREN_LINE_NAME] = []
// }
// if(!rsdItem[QUANTITY_FIELD]) {
// rsdItem[QUANTITY_FIELD] = 0
// }
// if(rsdIndex === index) {
// rsdItem[CHILDREN_LINE_NAME].push(childData)
// rsdItem.lineOptions = childData
// let superTip = '', tipObj = {}
// // childData.map((chDa) => {
// // if(chDa.select) {
// // superTip += `${chDa.title}`
// // }
// // })
// rsdItem[CHILDREN_LINE_NAME].map(chItem => {
// chItem.forEach(childDa => {
// if(childDa.select){
// if(!tipObj[childDa.title]) {
// tipObj[childDa.title] = 1
// }else {
// tipObj[childDa.title] += 1
// }
// }
// })
// })
// console.log('tipObj',tipObj)
// for(let obj of Object.keys(tipObj)) {
// superTip += `${obj}x${tipObj[obj]}`
// }
// if(superTip){
// rsdItem.lineTip = superTip
// rsdItem[QUANTITY_FIELD] += 1
// }
// that.handleCalCallBack(rsdItem, rsdIndex, 'rightSecondData', QUANTITY_FIELD)
// }
// })
}
else
{
if
(
rightSecondData
.
length
>
0
)
{
rightSecondData
.
forEach
(
function
(
rsdItem
,
rsdIndex
)
{
if
(
!
rsdItem
[
CHILDREN_LINE_NAME
])
{
rsdItem
[
CHILDREN_LINE_NAME
]
=
[]
if
(
!
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
])
{
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
]
=
[]
}
if
(
!
rsdItem
[
QUANTITY_FIELD
])
{
rsdItem
[
QUANTITY_FIELD
]
=
0
if
(
!
rsdItem
[
LocalVariable
.
QUANTITY_FIELD
])
{
rsdItem
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
}
if
(
rsdIndex
===
index
&&
leftIndex
===
0
)
{
let
superTip
=
''
...
...
@@ -275,8 +164,7 @@ class ProductRightStyle extends Component {
if
(
chInd
===
childData
.
length
-
1
)
{
splitStr
=
''
}
superTip
+=
`
${
chDa
.
category_name
}
x
${
chDa
.
selectedQuantity
}${
splitStr
}
`
// superTip += `${chDa.title}x${chDa.selectedQuantity}${splitStr}`
superTip
+=
`
${
chDa
.
category_name
}
x
${
chDa
[
LocalVariable
.
SELECTED_QUQNTITY
]}${
splitStr
}
`
})
let
curObj
=
{
superId
:
rsdItem
[
'template_number'
],
...
...
@@ -286,38 +174,28 @@ class ProductRightStyle extends Component {
superTip
:
superTip
,
version
:
0
,
lineOptions
:
childData
,
[
QUANTITY_FIELD
]:
1
[
LocalVariable
.
QUANTITY_FIELD
]:
1
}
// let curObj = {
// superId: rsdItem['id'], // 本地测试
// superIndex: rsdIndex, // 本地测试
// superTit: rsdItem['title'], // 本地测试
// superImg: rsdItem['imgIcon'], // 本地测试
// superTip: superTip, // 本地测试
// version: 0,
// lineOptions: childData,
// [QUANTITY_FIELD]: 1
// }
if
(
rsdItem
[
CHILDREN_LINE_NAME
].
length
!==
0
)
{
curObj
.
version
=
rsdItem
[
CHILDREN_LINE_NAME
].
length
if
(
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
].
length
!==
0
)
{
curObj
.
version
=
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
].
length
}
let
filEquArr
=
rsdItem
[
CHILDREN_LINE_NAME
].
filter
(
function
(
lineItem
)
{
let
filEquArr
=
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
].
filter
(
function
(
lineItem
)
{
if
(
_
.
isEqual
(
lineItem
.
lineOptions
,
childData
))
{
lineItem
[
QUANTITY_FIELD
]
+=
1
lineItem
[
LocalVariable
.
QUANTITY_FIELD
]
+=
1
return
lineItem
}
})
// 本地测试
if
(
filEquArr
.
length
===
0
)
{
rsdItem
[
CHILDREN_LINE_NAME
].
push
(
curObj
)
rsdItem
[
LocalVariable
.
CHILDREN_LINE_NAME
].
push
(
curObj
)
}
rsdItem
[
QUANTITY_FIELD
]
=
Number
(
rsdItem
[
QUANTITY_FIELD
])
+
1
rsdItem
[
LocalVariable
.
QUANTITY_FIELD
]
=
Number
(
rsdItem
[
LocalVariable
.
QUANTITY_FIELD
])
+
1
// console.log('回调后的rsdItem====', rsdItem)
that
.
handleCalCallBack
(
rsdItem
,
rsdIndex
,
'rightSecondData'
,
QUANTITY_FIELD
)
that
.
handleCalCallBack
(
rsdItem
,
rsdIndex
,
'rightSecondData'
,
LocalVariable
.
QUANTITY_FIELD
)
}
})
}
}
// console.log('回调后的数组====', rightSecondData)
this
.
setState
({
...
...
@@ -335,10 +213,6 @@ class ProductRightStyle extends Component {
// console.log('修改当前小类是否展示----', curThridObj)
// console.log('修改当前小类是否展示----', leftIndex)
// let localTestImageUrls = localMockData.localTestImageUrls // 本地测试数据
// let curRowData = cloneObject(localMockData.localSingleRowData) // 本地测试数据 此处应该要请求接口,获取小类数据
if
(
show
&&
superItem
)
{
// 大类点击标题时
let
curRowData
=
cloneObject
(
superItem
[
'details'
])
...
...
@@ -348,9 +222,6 @@ class ProductRightStyle extends Component {
// image: localTestImageUrls,
title
:
superItem
.
category_name
}
// if (superItem[CHILDREN_LINE_NAME] && superItem[CHILDREN_LINE_NAME].length > 0 && superItem[CHILDREN_LINE_NAME][0].lineOptions) {
// curRowData = cloneObject(superItem[CHILDREN_LINE_NAME][0].lineOptions)
// }
that
.
setState
({
thridIsVisible
:
show
,
curThridObj
:
curThridObj
,
...
...
@@ -363,14 +234,14 @@ class ProductRightStyle extends Component {
let
curDa
=
curThridObj
.
superItem
let
curInd
=
curThridObj
.
superIndex
curDa
.
details
=
cloneObject
(
rowSingleData
)
curDa
[
QUANTITY_FIELD
]
=
0
curDa
[
LocalVariable
.
QUANTITY_FIELD
]
=
0
curDa
.
details
.
forEach
(
itVal
=>
{
if
(
itVal
[
QUANTITY_FIELD
]
>
0
)
{
curDa
[
QUANTITY_FIELD
]
+=
itVal
[
QUANTITY_FIELD
]
if
(
itVal
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
)
{
curDa
[
LocalVariable
.
QUANTITY_FIELD
]
+=
itVal
[
LocalVariable
.
QUANTITY_FIELD
]
}
})
that
.
handleCalCallBack
(
curDa
,
curInd
,
'rightSecondData'
,
QUANTITY_FIELD
)
that
.
handleCalCallBack
(
curDa
,
curInd
,
'rightSecondData'
,
LocalVariable
.
QUANTITY_FIELD
)
that
.
setState
({
thridIsVisible
:
show
...
...
@@ -473,8 +344,8 @@ class ProductRightStyle extends Component {
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
QUANTITY_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
QUANTITY_FIELD
)}
calField
=
{
LocalVariable
.
QUANTITY_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
LocalVariable
.
QUANTITY_FIELD
)}
titCallBack
=
{
curTitCallBack
}
titText
=
{
curTit
}
tipTextStr
=
{
curTipStr
}
...
...
@@ -520,7 +391,7 @@ class ProductRightStyle extends Component {
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
QUANTITY_FIELD
}
calField
=
{
LocalVariable
.
QUANTITY_FIELD
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rowSingleData'
)}
titText
=
{
'item_name'
}
tipTextOne
=
{
'general_name'
}
...
...
@@ -553,7 +424,7 @@ class ProductRightStyle extends Component {
renderOtherListItem
(
item
,
index
)
{
let
curTit
=
''
,
curTipOne
=
''
,
curTipTwo
=
''
,
curTipOneTit
=
''
,
curTipTwoTit
=
''
,
curIcon
=
''
let
curSubCalCallBack
=
''
,
curTitCallBack
=
''
,
curPlusCallBack
=
''
,
curReduceCallBack
=
''
if
(
item
[
ONLY_TWO_LEVELS
])
{
if
(
item
[
LocalVariable
.
ONLY_TWO_LEVELS
])
{
// 两级
curTit
=
'item_name'
curTipOne
=
'item_code'
...
...
@@ -577,10 +448,10 @@ class ProductRightStyle extends Component {
<
PicTitDetaiCalcu
listItem
=
{
item
}
listIndex
=
{
index
}
calField
=
{
QUANTITY_FIELD
}
calField
=
{
LocalVariable
.
QUANTITY_FIELD
}
listImgIcon
=
{
curIcon
}
listPicType
=
{
'ROUND'
}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
QUANTITY_FIELD
)}
subCalCallBack
=
{(
item
,
index
)
=>
this
.
handleCalCallBack
(
item
,
index
,
'rightSecondData'
,
LocalVariable
.
QUANTITY_FIELD
)}
titCallBack
=
{
curTitCallBack
}
titText
=
{
curTit
}
tipTextOne
=
{
curTipOne
}
...
...
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