Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
e9f5383b
Commit
e9f5383b
authored
Sep 26, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改转单接口参数、添加切换角色重新调取预览转单接口逻辑
parent
7f7072bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
index.tsx
src/pages/transaction/saleOrder/index.tsx
+28
-7
No files found.
src/pages/transaction/saleOrder/index.tsx
View file @
e9f5383b
...
...
@@ -11,11 +11,12 @@ import { FORM_FILTER_PATH } from '@/formSchema/const'
import
DateRangePickerUnix
from
'@/components/NiceForm/components/DateRangePickerUnix'
import
Submit
from
'@/components/NiceForm/components/Submit'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
,
registerVirtualBox
}
from
'@formily/antd'
import
{
createFormActions
,
registerVirtualBox
,
FormPath
}
from
'@formily/antd'
import
ModalForm
from
'@/components/ModalForm'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
TableOperation
from
'@/components/TableOperation'
import
{
getAuth
}
from
'@/utils/auth'
import
{
MEMBER_ROLE_TYPE_SERVICE_CONSUMER
}
from
'@/constants/member'
;
// 销售订单查询
...
...
@@ -40,7 +41,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const
{
transformRef
,
orderColumns
}
=
useTransformOrderTable
(
transformActions
)
// const [transformLoading, setTransformLoading] = useState<boolean>(false)
const
{
roles
}
=
getAuth
()
||
{}
const
serversRoles
=
roles
.
filter
(
item
=>
item
[
'roleType'
]
===
2
)
const
serversRoles
=
roles
.
filter
(
item
=>
item
[
'roleType'
]
===
MEMBER_ROLE_TYPE_SERVICE_CONSUMER
)
// 提交取消
const
handleSubmit
=
()
=>
{
...
...
@@ -103,8 +104,9 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
if
(
!
serversRoles
.
length
)
{
return
message
.
error
(
'当前登录会员,无服务消费者角色,无法进行转单'
)
}
const
firstRole
=
serversRoles
[
0
];
if
(
orderId
)
{
const
{
code
,
data
}
=
await
PublicApi
.
postOrderVendorTransferPreview
(
[{
orderId
}]
,
{
ctlType
:
'none'
})
const
{
code
,
data
}
=
await
PublicApi
.
postOrderVendorTransferPreview
(
{
roleId
:
firstRole
.
memberRoleId
,
orderIds
:
[
orderId
]
}
,
{
ctlType
:
'none'
})
if
(
code
===
1000
)
{
transformRef
.
current
.
setVisible
(
true
)
transformActions
.
setFieldValue
(
'orders'
,
data
)
...
...
@@ -114,13 +116,13 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
value
:
item
.
memberRoleId
,
}))
})
transformActions
.
setFieldValue
(
'roleId'
,
serversRoles
[
0
][
'memberRoleId'
]
)
transformActions
.
setFieldValue
(
'roleId'
,
firstRole
.
memberRoleId
)
transformActions
.
setFieldState
(
'NOT_SUBMIT_TITLE'
,
prevState
=>
{
prevState
.
props
[
'x-component-props'
].
number
=
1
})
}
}
else
if
(
selectRef
.
current
.
length
)
{
const
{
code
,
data
}
=
await
PublicApi
.
postOrderVendorTransferPreview
(
selectRef
.
current
.
map
(
item
=>
({
orderId
:
item
}))
,
{
ctlType
:
'none'
})
const
{
code
,
data
}
=
await
PublicApi
.
postOrderVendorTransferPreview
(
{
roleId
:
firstRole
.
memberRoleId
,
orderIds
:
selectRef
.
current
.
map
(
item
=>
item
)
}
,
{
ctlType
:
'none'
})
if
(
code
===
1000
)
{
transformRef
.
current
.
setVisible
(
true
)
transformActions
.
setFieldValue
(
'orders'
,
data
)
...
...
@@ -130,7 +132,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
value
:
item
.
memberRoleId
,
}))
})
transformActions
.
setFieldValue
(
'roleId'
,
serversRoles
[
0
][
'memberRoleId'
]
)
transformActions
.
setFieldValue
(
'roleId'
,
firstRole
.
memberRoleId
)
transformActions
.
setFieldState
(
'NOT_SUBMIT_TITLE'
,
prevState
=>
{
prevState
.
props
[
'x-component-props'
].
number
=
selectRef
.
current
.
length
})
...
...
@@ -371,7 +373,26 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}
}
}
effects=
{
(
$
,
actions
)
=>
{
$
(
'onFieldInputChange'
,
'roleId'
).
subscribe
(
state
=>
{
$
(
'onFieldInputChange'
,
'roleId'
).
subscribe
(
async
(
state
)
=>
{
const
ordersValue
=
actions
.
getFieldValue
(
'orders'
);
actions
.
setFieldState
(
'roleId'
,
(
fieldState
)
=>
{
FormPath
.
setIn
(
fieldState
,
'props.x-props.hasFeedback'
,
true
);
FormPath
.
setIn
(
fieldState
,
'loading'
,
true
);
});
const
{
code
,
data
}
=
await
PublicApi
.
postOrderVendorTransferPreview
({
roleId
:
state
.
value
,
orderIds
:
ordersValue
.
map
((
item
)
=>
item
.
orderId
)
},
{
ctlType
:
'none'
})
if
(
code
===
1000
)
{
actions
.
setFieldValue
(
'orders'
,
data
)
actions
.
setFieldState
(
'NOT_SUBMIT_TITLE'
,
prevState
=>
{
prevState
.
props
[
'x-component-props'
].
number
=
ordersValue
.
length
})
}
actions
.
setFieldState
(
'roleId'
,
(
fieldState
)
=>
{
FormPath
.
setIn
(
fieldState
,
'loading'
,
false
);
});
actions
.
setFieldState
actions
.
setFieldState
(
'NOT_SUBMIT_TITLE'
,
prevState
=>
{
prevState
.
props
[
'x-component-props'
].
roleName
=
state
.
values
[
1
].
title
...
...
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