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
59970bc2
authored
May 30, 2021
by
wong.peiyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
消耗确认
parent
17eac387
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
149 additions
and
16 deletions
src/components/form/index.styl
src/components/form/index.tsx
src/pages/consume/consume.tsx
src/pages/index/index.tsx
src/pages/success/success.styl
src/pages/success/success.tsx
src/router.tsx
src/services/request.ts
src/utils/utils.ts
src/components/form/index.styl
View file @
59970bc2
...
@@ -79,6 +79,9 @@
...
@@ -79,6 +79,9 @@
align-self center
align-self center
margin-bottom 30px
margin-bottom 30px
&__inner
@extend .row
&__disabled
&__disabled
background-color #BBBBBB
background-color #BBBBBB
...
@@ -89,3 +92,6 @@
...
@@ -89,3 +92,6 @@
&__disabled
&__disabled
color rgba(255, 255, 255, 0.5)
color rgba(255, 255, 255, 0.5)
.ml10
margin-left 10px
src/components/form/index.tsx
View file @
59970bc2
...
@@ -20,6 +20,7 @@ import ImageForm from './image'
...
@@ -20,6 +20,7 @@ import ImageForm from './image'
import
{
g
,
isBlank
,
show
,
debounce
}
from
'../../utils/utils'
import
{
g
,
isBlank
,
show
,
debounce
}
from
'../../utils/utils'
import
Consumables
from
'../../pages/consume/selected-consumables'
import
Consumables
from
'../../pages/consume/selected-consumables'
import
styles
from
'./index.styl'
import
styles
from
'./index.styl'
import
{
ActivityIndicator
}
from
'@ant-design/react-native'
type
IProps
=
{
type
IProps
=
{
fields
:
IFromField
[]
fields
:
IFromField
[]
...
@@ -104,7 +105,7 @@ export default class Form extends Component<IProps> {
...
@@ -104,7 +105,7 @@ export default class Form extends Component<IProps> {
render
()
{
render
()
{
const
{
fields
=
[],
data
=
{}
}
=
this
.
props
const
{
fields
=
[],
data
=
{}
}
=
this
.
props
const
{
scrollable
,
modal
,
canSubmit
}
=
this
.
state
const
{
scrollable
,
modal
,
canSubmit
,
submiting
}
=
this
.
state
return
(
return
(
<
View
style=
{
g
(
styles
,
'container'
)
}
>
<
View
style=
{
g
(
styles
,
'container'
)
}
>
...
@@ -131,19 +132,34 @@ export default class Form extends Component<IProps> {
...
@@ -131,19 +132,34 @@ export default class Form extends Component<IProps> {
})
}
})
}
<
TouchableOpacity
<
TouchableOpacity
style=
{
g
(
styles
,
{
'submit-btn'
:
true
,
'submit-btn__disabled'
:
!
canSubmit
})
}
style=
{
g
(
styles
,
{
disabled=
{
!
canSubmit
}
'submit-btn'
:
true
,
'submit-btn__disabled'
:
!
canSubmit
||
submiting
,
})
}
disabled=
{
!
canSubmit
||
submiting
}
activeOpacity=
{
0.8
}
activeOpacity=
{
0.8
}
onPress=
{
this
.
submitHandler
}
onPress=
{
this
.
submitHandler
}
>
>
<
Text
{
submiting
?
(
style=
{
g
(
styles
,
{
<
View
style=
{
g
(
styles
,
'submit-btn__inner'
)
}
>
'submit-btn__text'
:
true
,
<
ActivityIndicator
'btn-primary__text__disabled'
:
!
canSubmit
,
style=
{
g
(
styles
,
'submit-btn__loading'
)
}
})
}
color=
"rgba(255,255,255,0.5)"
>
/>
提交
<
Text
style=
{
g
(
styles
,
'submit-btn__text'
,
'submit-btn__text__disabled'
,
'ml10'
)
}
>
</
Text
>
提交中
</
Text
>
</
View
>
)
:
(
<
Text
style=
{
g
(
styles
,
{
'submit-btn__text'
:
true
,
'submit-btn__text__disabled'
:
!
canSubmit
,
})
}
>
提交
</
Text
>
)
}
</
TouchableOpacity
>
</
TouchableOpacity
>
</
View
>
</
View
>
</
ScrollView
>
</
ScrollView
>
...
...
src/pages/consume/consume.tsx
View file @
59970bc2
...
@@ -66,7 +66,6 @@ class Consume extends Component<IProps> {
...
@@ -66,7 +66,6 @@ class Consume extends Component<IProps> {
}
}
state
=
{
state
=
{
scrollable
:
true
,
data
:
{
data
:
{
sellerCode
:
this
.
props
.
userStore
.
userName
,
sellerCode
:
this
.
props
.
userStore
.
userName
,
},
},
...
@@ -211,6 +210,7 @@ class Consume extends Component<IProps> {
...
@@ -211,6 +210,7 @@ class Consume extends Component<IProps> {
componentWillUnmount
()
{
componentWillUnmount
()
{
this
.
props
.
consumeStore
.
resetOrderLines
()
this
.
props
.
consumeStore
.
resetOrderLines
()
this
.
props
.
consumeStore
.
setSelectedLines
([])
this
.
props
.
consumeStore
.
setSelectedLines
([])
console
.
log
(
'Consume page will unmount'
)
}
}
/**
/**
...
@@ -502,10 +502,19 @@ class Consume extends Component<IProps> {
...
@@ -502,10 +502,19 @@ class Consume extends Component<IProps> {
* @description: 提交
* @description: 提交
*/
*/
async
submitHandler
()
{
async
submitHandler
()
{
const
{
data
}
=
this
.
state
const
{
data
,
submitting
}
=
this
.
state
data
.
lines
=
R
.
map
(
R
.
assoc
(
'consumedQuantity'
,
1
))(
data
.
lines
)
data
.
lines
=
R
.
map
(
R
.
assoc
(
'consumedQuantity'
,
1
))(
data
.
lines
)
const
res
=
await
this
.
props
.
consumeStore
.
submit
(
data
)
const
res
=
await
this
.
props
.
consumeStore
.
submit
({
data
})
if
(
res
.
errorCode
===
0
)
{
this
.
props
.
navigation
.
navigate
(
'Success'
,
{
orderNumber
:
res
.
consumeOrderNumber
,
title
:
'器械消耗'
,
})
}
else
{
show
(
res
.
errorMsg
)
}
}
}
render
()
{
render
()
{
...
...
src/pages/index/index.tsx
View file @
59970bc2
...
@@ -73,7 +73,7 @@ class Index extends Component<IProps> {
...
@@ -73,7 +73,7 @@ class Index extends Component<IProps> {
navigateToBizPage
(
fun
:
IFunction
)
{
navigateToBizPage
(
fun
:
IFunction
)
{
const
pages
=
{
const
pages
=
{
MOBILE_BORROW_ORDER
:
''
,
MOBILE_BORROW_ORDER
:
''
,
MOBILE_SELF_HELP_ORDER
:
''
,
MOBILE_SELF_HELP_ORDER
:
'
Success
'
,
MOBILE_CONSUMP_CONFIRMA
:
'Consume'
,
MOBILE_CONSUMP_CONFIRMA
:
'Consume'
,
MOBILE_DEVICE_INFORMATION
:
''
,
MOBILE_DEVICE_INFORMATION
:
''
,
MOBILE_TRANSFER_APPLICATION
:
''
,
MOBILE_TRANSFER_APPLICATION
:
''
,
...
...
src/pages/success/success.styl
0 → 100644
View file @
59970bc2
@import '../../assets/styles/base.styl'
@import '../../assets/styles/variable.styl'
.body
flex 1
justify-content center
align-items center
.success
&-title
margin-top 10px
font-size 17px
color primary_text_color
font-family font_family_medium
&-text
margin-top 21px
font-size 14px
color second_text_color
font-family font_family_regular
.btn
width 333px
height 50px
border-radius 25px
background-color primary_color
justify-content center
align-items center
margin-top 38px
margin-bottom 100px
&-text
color btn_color
font-size 17px
font-family font_family_regular
src/pages/success/success.tsx
0 → 100644
View file @
59970bc2
import
React
,
{
Component
}
from
'react'
import
{
View
,
Text
,
ScrollView
,
Clipboard
,
Image
,
TouchableOpacity
}
from
'react-native'
import
{
IOrganization
,
ISurgeryCollectHeader
,
IFee
}
from
'bonehouse'
import
*
as
R
from
'ramda'
import
Header
from
'../../components/header/header'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
}
from
'../../utils/utils'
import
styles
from
'./success.styl'
type
IProps
=
{
navigation
:
any
}
export
default
({
navigation
})
=>
{
const
{
orderNumber
,
title
}
=
navigation
.
state
.
params
return
(
<
View
style=
{
g
(
styles
,
'container'
)
}
>
<
Header
title=
{
title
}
backCallback=
{
()
=>
navigation
.
navigate
(
'Main'
)
}
/>
<
View
style=
{
g
(
styles
,
'body'
)
}
>
<
Image
style=
{
g
(
styles
,
'success-icon'
)
}
source=
{
require
(
'../../assets/images/cor_green.png'
)
}
></
Image
>
<
Text
style=
{
g
(
styles
,
'success-title'
)
}
>
提交成功
</
Text
>
<
Text
style=
{
g
(
styles
,
'success-text'
)
}
>
订单号:
{
orderNumber
||
'未知订单号'
}
</
Text
>
<
TouchableOpacity
style=
{
g
(
styles
,
'btn'
)
}
activeOpacity=
{
0.8
}
onPress=
{
async
()
=>
{
let
hide
if
(
orderNumber
)
{
Clipboard
.
setString
(
orderNumber
)
await
Clipboard
.
getString
()
hide
=
show
(
'复制成功'
)
}
setTimeout
(
()
=>
{
hide
&&
hide
()
navigation
.
navigate
(
'Main'
)
},
hide
?
1000
:
0
,
)
}
}
>
<
Text
style=
{
g
(
styles
,
'btn-text'
)
}
>
复制订单号并返回主页
</
Text
>
</
TouchableOpacity
>
</
View
>
</
View
>
)
}
src/router.tsx
View file @
59970bc2
...
@@ -14,6 +14,7 @@ import Signin from './pages/signin/signin'
...
@@ -14,6 +14,7 @@ import Signin from './pages/signin/signin'
import
Consume
from
'./pages/consume/consume'
import
Consume
from
'./pages/consume/consume'
import
Consumables
from
'./pages/consume/consumables'
import
Consumables
from
'./pages/consume/consumables'
import
ConsumeFee
from
'./pages/consume/fee'
import
ConsumeFee
from
'./pages/consume/fee'
import
Success
from
'./pages/success/success'
function
createNavigator
()
{
function
createNavigator
()
{
const
options
=
{
const
options
=
{
...
@@ -88,6 +89,7 @@ function createNavigator() {
...
@@ -88,6 +89,7 @@ function createNavigator() {
Consume
:
{
screen
:
Consume
},
Consume
:
{
screen
:
Consume
},
Consumables
:
{
screen
:
Consumables
},
Consumables
:
{
screen
:
Consumables
},
ConsumeFee
:
{
screen
:
ConsumeFee
},
ConsumeFee
:
{
screen
:
ConsumeFee
},
Success
:
{
screen
:
Success
},
},
},
{
initialRouteName
:
'Main'
,
...
options
},
{
initialRouteName
:
'Main'
,
...
options
},
)
)
...
...
src/services/request.ts
View file @
59970bc2
...
@@ -56,8 +56,16 @@ export const request = (args: Partial<RequestConfig>) => {
...
@@ -56,8 +56,16 @@ export const request = (args: Partial<RequestConfig>) => {
...
args
,
...
args
,
}
}
if
(
options
.
needToken
)
{
if
(
options
.
needToken
&&
store
.
token
)
{
options
.
data
.
accessToken
=
store
.
token
options
.
data
.
accessToken
=
store
.
token
if
(
options
.
method
.
toUpperCase
()
===
'POST'
)
{
const
token
=
'access_token='
+
store
.
token
options
.
url
+=
R
.
ifElse
(
R
.
includes
(
'?'
),
R
.
always
(
'&'
+
token
),
R
.
always
(
'?'
+
token
),
)(
options
.
url
)
}
}
}
args
.
data
=
transformObject
(
options
.
data
,
'toLine'
)
args
.
data
=
transformObject
(
options
.
data
,
'toLine'
)
...
...
src/utils/utils.ts
View file @
59970bc2
...
@@ -105,6 +105,11 @@ export const show = (data: string, type = MsgType.INFO, position = Toast.positio
...
@@ -105,6 +105,11 @@ export const show = (data: string, type = MsgType.INFO, position = Toast.positio
toast
=
null
toast
=
null
},
},
})
})
return
()
=>
{
if
(
isNotBlank
(
toast
))
{
Toast
.
hide
(
toast
)
}
}
}
}
const
X_WIDTH
=
375
const
X_WIDTH
=
375
...
...
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