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
e7557312
authored
Nov 07, 2022
by
peii
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
actions
parent
7a156482
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
21 deletions
src/actions/action-types.ts
src/actions/userAction.ts
src/actions/utils.ts
src/pages/order/self.tsx
src/reducers/user.ts
src/services/api.ts
types/global.ts
src/actions/action-types.ts
View file @
e7557312
...
...
@@ -2,11 +2,13 @@
* @FilePath: /BoneHouse_Business_APP/src/actions/action-types.ts
* @Author: PEII
* @Date: 2022-11-02 16:41:21
* @LastEditTime: 2022-11-0
2 16:52:16
* @LastEditTime: 2022-11-0
4 18:00:41
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
export
const
GET_ORGANIZATIONS
=
'GET_ORGANIZATIONS'
export
const
GET_CUSTOMERS
=
'GET_CUSTOMERS'
\ No newline at end of file
export
const
GET_CUSTOMERS
=
'GET_CUSTOMERS'
export
const
GET_COLLECT_SETTING
=
'GET_COLLECT_SETTING'
\ No newline at end of file
src/actions/userAction.ts
View file @
e7557312
...
...
@@ -2,15 +2,17 @@
* @FilePath: /BoneHouse_Business_APP/src/actions/userAction.ts
* @Author: PEII
* @Date: 2022-11-02 16:09:29
* @LastEditTime: 2022-11-0
2 16:56:49
* @LastEditTime: 2022-11-0
4 18:51:56
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
import
{
createApiAction
}
from
'./utils'
import
{
GET_ORGANIZATIONS
,
GET_CUSTOMERS
}
from
'./action-types'
import
{
GET_ORGANIZATIONS
,
GET_CUSTOMERS
,
GET_COLLECT_SETTING
}
from
'./action-types'
import
api
from
'../services/api'
export
const
getOrganizations
=
createApiAction
(
GET_ORGANIZATIONS
,
api
.
getOrganizations
)
export
const
getCustomers
=
createApiAction
(
GET_CUSTOMERS
,
(
params
:
any
)
=>
api
.
getCustomers
(
params
))
export
const
getCustomers
=
createApiAction
(
GET_CUSTOMERS
,
api
.
getCustomers
)
export
const
getCollectSetting
=
createApiAction
(
GET_COLLECT_SETTING
,
api
.
getCollectSetting
)
src/actions/utils.ts
View file @
e7557312
import
{
IApiAction
}
from
'action'
import
{
curry
,
compose
,
reject
,
isNil
,
applySpec
,
always
,
__
,
Dictionary
,
identity
,
type
}
from
'ramda'
import
{
request
}
from
'../services/baseApi'
...
...
@@ -31,9 +32,9 @@ export const createSimpleAction: (string, any?) => Dictionary<any> = createActio
* @param type {string} 类型
* @return
*/
export
const
createConstantAction
:
(
string
)
=>
Dictionary
<
any
>
=
createAction
(
__
,
always
(
null
),
always
(
null
))
export
const
createConstantAction
:
(
key
:
string
)
=>
Dictionary
<
any
>
=
createAction
(
__
,
always
(
null
),
always
(
null
))
export
const
createApiAction
=
curry
(
(
actionType
:
string
,
fn
:
Function
)
=>
{
export
const
createApiAction
:
IApiAction
=
(
actionType
:
string
,
fn
:
Function
)
=>
{
return
(
params
=
{},
callback
=
{
success
:
<
U
>
(
p
:
U
)
=>
{},
fail
:
<
R
>
(
p
:
R
)
=>
{}
},
customActionType
=
actionType
)
=>
async
(
dispatch
:
Function
)
=>
{
try
{
...
...
@@ -56,6 +57,6 @@ export const createApiAction = curry((actionType: string, fn: Function) => {
callback
.
fail
&&
callback
.
fail
(
error
)
}
}
}
)
}
export
const
createSimpleApiAction
=
createApiAction
(
__
,
request
)
//
export const createSimpleApiAction = createApiAction(__, request)
src/pages/order/self.tsx
View file @
e7557312
...
...
@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/pages/order/self.tsx
* @Author: peii
* @Date: 2021-07-13 22:40:12
* @LastEditTime: 2022-11-04 1
5:16:13
* @LastEditTime: 2022-11-04 1
8:56:41
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 自助下单
...
...
@@ -21,7 +21,7 @@ import { FieldType, SelectMode } from '../../enums'
import
Header
from
'../../components/header/header'
import
{
g
,
getFormItem
,
isBlank
,
isNotBlank
,
show
,
getOrderSysProfile
}
from
'../../utils/utils'
import
{
getSelfFormItems
}
from
'./self.formItem'
import
{
getCustomers
}
from
'../../actions/userAction'
import
{
getCustomers
,
getCollectSetting
}
from
'../../actions/userAction'
import
styles
from
'./self.styl'
type
IProps
=
{
...
...
@@ -29,7 +29,8 @@ type IProps = {
userInfo
:
any
organizations
:
IOrganization
[]
allCustomers
:
{}
getCustomers
:
Function
getCustomers
:
(
sellerCode
:
string
,
orgCode
:
string
)
=>
Promise
<
any
>
getCollectSetting
:
(
orgCode
,
customerCode
,
billToSiteCode
,
shipToSiteCode
)
=>
Promise
<
any
>
}
type
IState
=
{
...
...
@@ -330,8 +331,11 @@ class SelfOrder extends Component<IProps, IState> {
const
{
formItems
,
data
}
=
this
.
state
const
{
orgCode
,
customerCode
,
billToSiteCode
,
shipToSiteCode
}
=
data
// const item = getFormItem(formItems, 'collectSrcInvCode')
// let invs = this.props.orderStore.invs(orgCode, customerCode, billToSiteCode, shipToSiteCode)
const
item
=
getFormItem
(
formItems
,
'collectSrcInvCode'
)
let
invRes
=
await
this
.
props
.
getCollectSetting
(
orgCode
,
customerCode
,
billToSiteCode
,
shipToSiteCode
)
console
.
log
(
invRes
)
// if (isBlank(invs)) {
// item.loading = true
// await this.props.orderStore.getInventories(orgCode, customerCode, billToSiteCode, shipToSiteCode)
...
...
@@ -411,6 +415,21 @@ const mapDispatchToProps = dispatch => ({
dispatch
(
getCustomers
({
seller_code
,
org_code
},
{
success
:
()
=>
resolve
(),
fail
:
()
=>
resolve
()
}))
})
},
getCollectSetting
(
orgCode
,
customerCode
,
billToSiteCode
,
shipToSiteCode
)
{
return
new
Promise
(
resolve
=>
{
dispatch
(
getCollectSetting
(
{
orgCode
,
customerCode
,
billToSiteCode
,
shipToSiteCode
,
processCode
:
'COLLECT'
},
{
success
:
res
=>
{
resolve
(
res
)
},
},
),
)
})
},
})
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
SelfOrder
)
src/reducers/user.ts
View file @
e7557312
...
...
@@ -2,19 +2,20 @@
* @FilePath: /BoneHouse_Business_APP/src/reducers/user.ts
* @Author: PEII
* @Date: 2022-11-02 16:02:14
* @LastEditTime: 2022-11-0
2 17:19:0
1
* @LastEditTime: 2022-11-0
4 18:39:3
1
* @LastEditors: PEII
* @Vision: 1.0
* @Description:
*/
import
*
as
R
from
'ramda'
import
{
createReducer
}
from
'./utils'
import
{
GET_ORGANIZATIONS
,
GET_CUSTOMERS
}
from
'../actions/action-types'
import
{
GET_ORGANIZATIONS
,
GET_CUSTOMERS
,
GET_COLLECT_SETTING
}
from
'../actions/action-types'
const
initState
=
{
organizations
:
[],
inventories
:
[],
customers
:
{},
srcInvs
:
{},
}
type
IAction
=
{
...
...
@@ -23,16 +24,21 @@ type IAction = {
}
export
const
user
=
createReducer
(
initState
,
{
[
GET_ORGANIZATIONS
]
:
(
state
:
any
,
action
:
IAction
)
=>
{
[
GET_ORGANIZATIONS
]
(
state
:
any
,
action
:
IAction
)
{
const
organizations
=
R
.
compose
(
R
.
uniqBy
(
R
.
prop
(
'org_code'
)),
R
.
propOr
([],
'organizations'
))(
action
.
payload
)
const
inventories
=
R
.
compose
(
R
.
uniqBy
(
R
.
prop
(
'inv_code'
)),
R
.
propOr
([],
'inventories'
))(
action
.
payload
)
return
{
...
state
,
organizations
,
inventories
}
},
[
GET_CUSTOMERS
]
:
(
state
:
any
,
action
:
IAction
)
=>
{
[
GET_CUSTOMERS
]
(
state
:
any
,
action
:
IAction
)
{
const
data
=
action
.
payload
let
customers
=
{...
state
.
customers
}
let
customers
=
{
...
state
.
customers
}
customers
[
data
.
org_code
]
=
data
.
customers
return
{
...
state
,
customers
}
},
[
GET_COLLECT_SETTING
](
state
:
any
,
action
:
IAction
)
{
console
.
log
(
action
)
return
state
},
})
src/services/api.ts
View file @
e7557312
...
...
@@ -2,7 +2,7 @@
* @FilePath: /BoneHouse_Business_APP/src/services/api.ts
* @Author: peii
* @Date: 2021-12-19 16:06:26
* @LastEditTime: 2022-1
0-27 11:20:09
* @LastEditTime: 2022-1
1-04 18:11:25
* @LastEditors: PEII
* @Vision: 1.0
* @Description: 未重构完全暂用的所有请求
...
...
@@ -189,4 +189,18 @@ export default {
createGroupComsumeOrder
(
data
:
any
)
{
return
request
({
url
:
`
${
v
}
/surgery/consume_group_order/create`
,
data
,
method
:
'POST'
})
},
/**
* @description: 获取客户对应的出库仓库
* @return {*}
*/
getCollectSetting
(
data
:
{
orgCode
:
string
customerCode
:
string
billToSiteCode
:
string
shipToSiteCode
:
string
processCode
:
'COLLECT'
})
{
return
request
({
url
:
`
${
v
}
/surgery/collect_setting/search`
,
data
})
},
}
types/global.ts
View file @
e7557312
...
...
@@ -11,6 +11,12 @@
/// <reference types="react" />
/// <reference types="react-native" />
declare
module
'action'
{
export
interface
IApiAction
{
<
T
extends
(...
args
:
any
)
=>
any
>
(
actionType
:
string
,
fn
:
T
):
(...
args
:
Parameters
<
T
>
)
=>
(
dispatch
:
Function
)
=>
Promise
<
any
>
}
}
declare
module
'bonehouse'
{
export
type
EnumType
=
{
[
s
:
string
]:
any
}
...
...
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