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
7b253d59
authored
Jan 05, 2021
by
Denglingling
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整APP耗材计数问题
parent
a6f6cbe7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
104 deletions
app/containers/selfOrder/SelfOrderPage.js
app/containers/selfOrder/module/ChooseProductPage.js
app/containers/selfOrder/SelfOrderPage.js
View file @
7b253d59
...
...
@@ -952,7 +952,7 @@ class SelfOrderPage extends Component {
title
:
`选择产品`
,
selfData
:
{
org_code
:
listOptionData
[
1
].
value
,
doctor_name
:
(
listOptionData
[
5
].
name
==
'其他'
||
listOptionData
[
5
].
name
==
'请选择'
)
?
listOptionData
[
5
].
inputValue
:
listOptionData
[
5
].
name
doctor_name
:
(
listOptionData
[
5
].
name
==
'其他'
||
listOptionData
[
5
].
name
==
'请选择'
)
?
listOptionData
[
5
].
inputValue
:
listOptionData
[
5
].
name
},
productCallBack
:
that
.
productCallBack
.
bind
(
that
)
})
...
...
@@ -1033,25 +1033,25 @@ class SelfOrderPage extends Component {
}
else
if
(
res
.
error
)
{
console
.
log
(
'ImagePicker Error: '
,
res
.
error
);
if
(
res
.
error
.
indexOf
(
'Camera permissions not granted'
)
>
-
1
)
{
if
(
res
.
error
.
indexOf
(
'Camera permissions not granted'
)
>
-
1
)
{
Alert
.
alert
((
'提示信息'
,
'APP需要使用相机,请打开相机权限允许APP使用'
),
[{
text
:
'设置'
,
onPress
:
()
=>
{
Linking
.
openURL
(
'app-settings:'
)
.
catch
(
err
=>
console
.
log
(
'error'
,
err
))
}
},{
},
{
text
:
'取消'
}])
}
if
(
res
.
error
.
indexOf
(
'Photo library permissions not granted'
)
>
-
1
)
{
if
(
res
.
error
.
indexOf
(
'Photo library permissions not granted'
)
>
-
1
)
{
Alert
.
alert
(
'提示信息'
,
'APP需要使用相册,请打开相册权限允许APP使用'
,
[{
text
:
'设置'
,
onPress
:
()
=>
{
Linking
.
openURL
(
'app-settings:'
)
.
catch
(
err
=>
console
.
log
(
'error'
,
err
))
}
},{
},
{
text
:
'取消'
}]);
}
...
...
@@ -1064,24 +1064,24 @@ class SelfOrderPage extends Component {
if
(
Platform
.
OS
===
'android'
)
{
source
=
res
.
uri
;
}
else
{
source
=
res
.
uri
.
replace
(
'file://'
,
''
);
source
=
res
.
uri
.
replace
(
'file://'
,
''
);
}
const
formData
=
new
FormData
();
let
file
=
{
uri
:
source
,
type
:
'multipart/form-data'
,
name
:
res
.
fileName
};
formData
.
append
(
'file'
,
file
);
formData
.
append
(
'file'
,
file
);
let
params
=
{
access_token
:
props
.
token
,
formData
}
let
{
global_domain_config
}
=
props
let
{
global_domain_config
}
=
props
//上传图片接口
let
imgResult
=
await
uploadTransImg
(
global_domain_config
,
params
);
console
.
log
(
'res='
,
imgResult
)
if
(
imgResult
.
error_code
==
0
)
{
if
(
imgResult
.
error_code
==
0
)
{
that
.
changeSubLoding
(
false
)
// 提交订单
show
(
'上传成功'
);
let
{
url
}
=
imgResult
.
data
let
{
url
}
=
imgResult
.
data
localPhoOption
.
push
(
source
);
// 本地图片地址
listOptionData
[
13
].
uploadImgArr
.
push
(
url
)
// 服务器图片地址
...
...
@@ -1089,7 +1089,7 @@ class SelfOrderPage extends Component {
localPhoOption
,
listOptionData
});
}
else
if
(
imgResult
.
error_code
==
41006
)
{
}
else
if
(
imgResult
.
error_code
==
41006
)
{
that
.
changeSubLoding
(
false
)
show
(
'登录过期,请重新登录'
);
props
.
exitLoginStatus
();
...
...
@@ -1105,7 +1105,7 @@ class SelfOrderPage extends Component {
// 删除单个照片 点击
handleDelPickCheck
(
item
,
index
)
{
let
{
listOptionData
,
localPhoOption
}
=
this
.
state
let
{
listOptionData
,
localPhoOption
}
=
this
.
state
localPhoOption
.
splice
(
index
,
1
)
// 删除本地地址
listOptionData
[
7
].
uploadImgArr
.
splice
(
index
,
1
)
// 删除服务器地址
this
.
setState
({
...
...
@@ -1227,9 +1227,11 @@ class SelfOrderPage extends Component {
chi_item
[
LocalVariable
.
LINE_OPTIONS
].
forEach
(
lin_item
=>
{
if
(
lin_item
[
LocalVariable
.
SELECTED_DATA_ARR
]
&&
lin_item
[
LocalVariable
.
SELECTED_DATA_ARR
].
length
>
0
)
{
lin_item
[
LocalVariable
.
SELECTED_DATA_ARR
].
forEach
(
sel_item
=>
{
if
(
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
)
{
// sel_item['template_number'] = template_number // 暂时不用
sel_item
[
LocalVariable
.
PLAN_QUANTITY
]
=
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
res_lines
.
push
(
sel_item
)
}
})
}
})
...
...
@@ -1243,17 +1245,21 @@ class SelfOrderPage extends Component {
showPackageTip
=
true
}
select_arr
.
forEach
(
sel_item
=>
{
if
(
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
)
{
// sel_item['prefer_serial_number'] = sel_item.serial_number // 暂时不用
sel_item
[
'line_remark'
]
=
sel_item
.
serial_number
sel_item
[
LocalVariable
.
PLAN_QUANTITY
]
=
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
res_lines
.
push
(
sel_item
)
}
})
}
else
if
(
lef_item
.
category_code
===
LocalVariable
.
SCATTERED_EQUIPMENT
)
{
// 零散器械
select_arr
.
forEach
(
sel_item
=>
{
if
(
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
){
sel_item
[
LocalVariable
.
PLAN_QUANTITY
]
=
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
res_lines
.
push
(
sel_item
)
}
})
}
else
{
...
...
@@ -1271,8 +1277,10 @@ class SelfOrderPage extends Component {
}
else
{
// 大类-小类
select_arr
.
forEach
(
sel_item
=>
{
if
(
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
>
0
){
sel_item
[
LocalVariable
.
PLAN_QUANTITY
]
=
sel_item
[
LocalVariable
.
QUANTITY_FIELD
]
res_lines
.
push
(
sel_item
)
}
})
}
}
...
...
@@ -1285,13 +1293,13 @@ class SelfOrderPage extends Component {
let
end_lines
=
[]
// 汇总同类物料
res_lines
.
map
(
line_it
=>
{
if
(
!
line_obj
[
line_it
.
item_code
])
{
if
(
!
line_obj
[
line_it
.
item_code
])
{
line_obj
[
line_it
.
item_code
]
=
line_it
.
item_code
end_lines
.
push
(
line_it
)
}
else
{
}
else
{
end_lines
.
forEach
(
function
(
fil_li
)
{
if
(
fil_li
.
item_code
===
line_it
.
item_code
)
{
if
(
line_it
[
'line_remark'
])
{
if
(
fil_li
.
item_code
===
line_it
.
item_code
)
{
if
(
line_it
[
'line_remark'
])
{
fil_li
.
line_remark
=
line_it
.
line_remark
}
fil_li
[
LocalVariable
.
QUANTITY_FIELD
]
+=
line_it
[
LocalVariable
.
QUANTITY_FIELD
]
...
...
@@ -1309,7 +1317,7 @@ class SelfOrderPage extends Component {
that
.
setState
({
listOptionData
:
listOptionData
},()
=>
{
},
()
=>
{
that
.
submitSelfOrder
()
})
...
...
@@ -1682,7 +1690,7 @@ class SelfOrderPage extends Component {
<
View
style
=
{
list_common_item
.
addpic_cont
}
>
{
state
.
localPhoOption
.
length
?
state
.
localPhoOption
.
map
((
item
,
index
)
=>
this
.
renderPicItem
(
item
,
index
)
)
?
state
.
localPhoOption
.
map
((
item
,
index
)
=>
this
.
renderPicItem
(
item
,
index
))
:
null
}
<
TouchableOpacity
...
...
@@ -1706,9 +1714,9 @@ class SelfOrderPage extends Component {
<
TouchableOpacity
activeOpacity
=
{.
8
}
style
=
{
list_common_item
.
show_pic_btn
}
onPress
=
{()
=>
this
.
handleZoomPicture
(
true
,
index
)}
onPress
=
{()
=>
this
.
handleZoomPicture
(
true
,
index
)}
>
<
Image
style
=
{
icon_style
}
source
=
{{
uri
:
item
}}
/
>
<
Image
style
=
{
icon_style
}
source
=
{{
uri
:
item
}}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{.
8
}
...
...
@@ -1832,7 +1840,7 @@ class SelfOrderPage extends Component {
{
this
.
renderLodingItem
()}
{
this
.
renderLodingItemNew
()}
{
this
.
renderNotEnoughModel
()
}
{
this
.
renderNotEnoughModel
()
}
<
/SafeAreaView
>
<
/View
>
...
...
app/containers/selfOrder/module/ChooseProductPage.js
View file @
7b253d59
...
...
@@ -39,7 +39,34 @@ class ChooseProductPage extends Component {
"category_code"
:
LocalVariable
.
SCATTERED_EQUIPMENT
,
"category_name"
:
"零散器械"
,
"cate_local_icon"
:
require
(
'../../../images/auxili_tool.png'
)
}]
}],
local_sel_options
:
[{
category_name
:
'手术套包'
,
category_code
:
LocalVariable
.
SURGICAL_TEMPLATE
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'钉盒'
,
category_code
:
LocalVariable
.
NAIL_BOX
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'器械包'
,
category_code
:
LocalVariable
.
EQUIPMENT_BAG
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'零散器械'
,
category_code
:
LocalVariable
.
SCATTERED_EQUIPMENT
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'耗材'
,
category_code
:
LocalVariable
.
SIGN_SELECT_CONSUMABLES
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
}],
local_cur_options
:
[]
}
}
...
...
@@ -343,6 +370,8 @@ class ChooseProductPage extends Component {
top_sel_sum
+=
leItem
[
LocalVariable
.
SELECTED_QUQNTITY
]
})
topProcOptionList
[
topActiveIndex
][
LocalVariable
.
SELECTED_QUQNTITY
]
=
top_sel_sum
console
.
log
(
'topProcOptionList---'
,
topProcOptionList
)
this
.
setState
({
topProcOptionList
})
...
...
@@ -696,72 +725,22 @@ class ChooseProductPage extends Component {
// 返回底部按钮
renderFooterBtnItem
()
{
let
{
selectShowPopup
,
topProcOptionList
,
topActiveIndex
}
=
this
.
state
let
{
selectShowPopup
,
topProcOptionList
,
topActiveIndex
,
local_sel_options
,
local_cur_options
}
=
this
.
state
let
allCountQuantity
=
this
.
getAllCountQuantity
()
let
cur_sel_options
=
[]
let
sel_tip
=
this
.
getAllCountQuantity
(
true
)
// if (topProcOptionList.length > 0) {
// cur_sel_options = topProcOptionList[topActiveIndex].leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
// }
cur_sel_options
=
[{
category_name
:
'手术套包'
,
category_code
:
LocalVariable
.
SURGICAL_TEMPLATE
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'钉盒'
,
category_code
:
LocalVariable
.
NAIL_BOX
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'器械包'
,
category_code
:
LocalVariable
.
EQUIPMENT_BAG
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'零散器械'
,
category_code
:
LocalVariable
.
SCATTERED_EQUIPMENT
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
},
{
category_name
:
'耗材'
,
category_code
:
LocalVariable
.
SIGN_SELECT_CONSUMABLES
,
[
LocalVariable
.
SELECTED_DATA_ARR
]:
[],
[
LocalVariable
.
SELECTED_QUQNTITY
]:
0
}]
local_cur_options
=
cloneObject
(
local_sel_options
)
cur_sel_options
=
local_cur_options
if
(
topProcOptionList
.
length
>
0
)
{
topProcOptionList
.
map
(
top_item
=>
{
// if(top_item.category_code === LocalVariable.SURGICAL_TEMPLATE || top_item.category_code === LocalVariable.NAIL_BOX || top_item.category_code === LocalVariable.EQUIPMENT_BAG || orItem.category_code === LocalVariable.SCATTERED_EQUIPMENT){
if
(
top_item
.
leftOptionList
&&
top_item
.
leftOptionList
.
length
>
0
)
{
let
leftOptionList
=
top_item
.
leftOptionList
leftOptionList
.
map
(
left_item
=>
{
// let category_name = '耗材'
// let category_code = LocalVariable.SIGN_SELECT_CONSUMABLES
// if(left_item.category_code === LocalVariable.SURGICAL_TEMPLATE || left_item.category_code === LocalVariable.NAIL_BOX || left_item.category_code === LocalVariable.EQUIPMENT_BAG || left_item.category_code === LocalVariable.SCATTERED_EQUIPMENT){
// category_name = left_item.category_name
// category_code = left_item.category_code
// }
// let cur_obj = {
// category_name: category_name,
// category_code: category_code,
// [LocalVariable.SELECTED_DATA_ARR]: [{
// supplier_code: top_item.category_code,
// supplier_short_name: top_item.supplier_short_name,
// supplier_name: top_item.supplier_name,
// [LocalVariable.CHILDREN_LINE_NAME]:top_item.leftOptionList.filter(fi_item => fi_item[LocalVariable.SELECTED_QUQNTITY] > 0)
// }]
// }
if
(
left_item
[
LocalVariable
.
SELECTED_QUQNTITY
]
>
0
)
{
// console.log('left_item[LocalVariable.SELECTED_DATA_ARR]---', left_item[LocalVariable.SELECTED_DATA_ARR])
// console.log('left_item[LocalVariable.SELECTED_DATA_ARR]---', left_item[LocalVariable.SELECTED_QUQNTITY])
// console.log('left_item[LocalVariable.SELECTED_DATA_ARR]---', left_item)
let
cur_line_obj
=
{
supplier_code
:
top_item
.
supplier_code
,
supplier_name
:
top_item
.
supplier_name
,
...
...
@@ -780,12 +759,11 @@ class ChooseProductPage extends Component {
break
}
}
// console.log('cur_sel_options---', cur_sel_options)
if
(
!
localNotSign
)
{
// 耗材
cur_line_obj
.
category_code
=
cur_sel_options
[
cur_sel_options
.
length
-
1
].
category_code
cur_line_obj
.
category_name
=
cur_sel_options
[
cur_sel_options
.
length
-
1
].
category_name
// cur_line_obj.left_category_code = left_item.category_code
// cur_line_obj.left_category_name = left_item.category_name
cur_sel_options
[
cur_sel_options
.
length
-
1
][
LocalVariable
.
SELECTED_QUQNTITY
]
+=
cur_line_obj
[
LocalVariable
.
SELECTED_QUQNTITY
]
if
(
cur_line_obj
[
LocalVariable
.
CHILDREN_LINE_NAME
]
&&
cur_line_obj
[
LocalVariable
.
CHILDREN_LINE_NAME
].
length
>
0
)
{
...
...
@@ -795,31 +773,91 @@ class ChooseProductPage extends Component {
})
}
let
cur_has_sign
=
[]
cur_has_sign
=
cur_sel_options
[
cur_sel_options
.
length
-
1
][
LocalVariable
.
SELECTED_DATA_ARR
].
filter
(
filt_obj
=>
filt_obj
.
supplier_code
===
cur_line_obj
.
supplier_code
)
if
(
cur_has_sign
.
length
>
0
)
{
cur_sel_options
[
cur_sel_options
.
length
-
1
][
LocalVariable
.
SELECTED_DATA_ARR
].
forEach
(
function
(
sel_arr
)
{
if
(
sel_arr
.
supplier_code
===
cur_line_obj
.
supplier_code
)
{
sel_arr
[
LocalVariable
.
SELECTED_QUQNTITY
]
+=
cur_line_obj
[
LocalVariable
.
SELECTED_QUQNTITY
]
let
has_line_sign
=
[]
has_line_sign
=
sel_arr
[
LocalVariable
.
CHILDREN_LINE_NAME
].
filter
((
line_item
)
=>
{
if
(
line_item
.
details
)
{
return
line_item
.
category_code
===
cur_line_obj
[
LocalVariable
.
CHILDREN_LINE_NAME
][
0
].
category_code
}
else
{
return
line_item
.
item_code
===
cur_line_obj
[
LocalVariable
.
CHILDREN_LINE_NAME
][
0
].
item_code
}
})
if
(
has_line_sign
.
length
===
0
)
{
// console.log('add➕🏠=====',has_line_sign, has_line_sign.length)
// console.log('add➕🏠=====',sel_arr[LocalVariable.CHILDREN_LINE_NAME])
// console.log('add➕🏠=====',cur_line_obj.supplier_name,cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
sel_arr
[
LocalVariable
.
CHILDREN_LINE_NAME
].
push
(...
cur_line_obj
[
LocalVariable
.
CHILDREN_LINE_NAME
])
}
}
})
}
else
{
cur_sel_options
[
cur_sel_options
.
length
-
1
][
LocalVariable
.
SELECTED_DATA_ARR
].
push
(
cur_line_obj
)
}
// let cur_has_sign = []
// cur_has_sign = cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].filter(filt_obj => filt_obj.supplier_code === cur_line_obj.supplier_code)
// console.log('🏠==cur_has_sign===',cur_has_sign)
// console.log('🏠==cur_has_sign===',cur_line_obj)
// if (cur_has_sign.length > 0) {
// cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].forEach(function (sel_arr) {
// if (sel_arr.supplier_code === cur_line_obj.supplier_code) {
// sel_arr[LocalVariable.SELECTED_QUQNTITY] += cur_line_obj[LocalVariable.SELECTED_QUQNTITY]
// let has_line_sign = []
// let hasDetails = false
// let hasItemCode = false
// let curHasInd = []
// has_line_sign = sel_arr[LocalVariable.CHILDREN_LINE_NAME].filter((line_item, line_ind) => {
// if (line_item.details) {
// // if (line_item.details && line_item.category_code === cur_line_obj[LocalVariable.CHILDREN_LINE_NAME][0].category_code) {
// let cur_fil_arr = cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].filter(fi_obj => fi_obj.category_code === line_item.category_code)
// if(cur_fil_arr && cur_fil_arr.length > 0){
// hasDetails = true
// curHasInd.push(line_ind)
// return line_item
// }
// // hasDetails = true
// // curHasInd.push(line_ind)
// // return line_item
// } else if(!line_item.details){
// // } else if(!line_item.details && line_item.item_code === cur_line_obj[LocalVariable.CHILDREN_LINE_NAME][0].item_code){
// let cur_fil_arr = cur_line_obj[LocalVariable.CHILDREN_LINE_NAME].filter(fi_obj => fi_obj.item_code === line_item.item_code)
// if(cur_fil_arr && cur_fil_arr.length > 0){
// hasItemCode = true
// curHasInd.push(line_ind)
// return line_item
// }
// // hasItemCode = true
// // curHasInd.push(line_ind)
// // return line_item
// }
// })
// if (has_line_sign.length === 0) {
// // console.log('add➕🏠=====',has_line_sign, has_line_sign.length)
// // console.log('add➕🏠=====',sel_arr[LocalVariable.CHILDREN_LINE_NAME])
// // console.log('add➕🏠=====',cur_line_obj.supplier_name,cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// }
// else {
// console.log('add➕🏠=====',curHasInd)
// console.log('add➕🏠=====',hasDetails)
// console.log('add➕🏠=====',hasItemCode)
// // let deIndArr = []
// // sel_arr[LocalVariable.CHILDREN_LINE_NAME].forEach((ch_line, ch_ind) => {
// // if(hasDetails && ch_line){
// // }
// // })
// // if(hasDetails || hasItemCode){
// // for(let i of curHasInd){
// // sel_arr[LocalVariable.CHILDREN_LINE_NAME].splice(i, 1)
// // }
// // sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// // // sel_arr[LocalVariable.CHILDREN_LINE_NAME].splice(curHasInd, 1)
// // // sel_arr[LocalVariable.CHILDREN_LINE_NAME].push(...cur_line_obj[LocalVariable.CHILDREN_LINE_NAME])
// // // sel_arr[LocalVariable.CHILDREN_LINE_NAME][curHasInd] = cur_line_obj[LocalVariable.CHILDREN_LINE_NAME]
// // }
// }
// console.log('🏠=====',has_line_sign)
// console.log('🏠=====',cur_line_obj)
// console.log('🏠=====',sel_arr)
// }
// })
// } else {
// cur_sel_options[cur_sel_options.length - 1][LocalVariable.SELECTED_DATA_ARR].push(cur_line_obj)
// }
}
}
...
...
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