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
黄庭坚
jinfa-platform
Commits
2294e27c
Commit
2294e27c
authored
Oct 20, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
确认手工发货
parent
1501fed2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
153 additions
and
0 deletions
+153
-0
index.tsx
src/pages/transaction/components/orderHandDeleved/index.tsx
+153
-0
No files found.
src/pages/transaction/components/orderHandDeleved/index.tsx
0 → 100644
View file @
2294e27c
import
React
,
{
useContext
,
useRef
,
useEffect
}
from
'react'
import
{
Modal
,
Button
}
from
'antd'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
,
ISchema
}
from
'@formily/antd'
import
ModalForm
from
'@/components/ModalForm'
import
{
history
}
from
'umi'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
PublicApi
}
from
'@/services/api'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
{
OrderDetailContext
}
from
'../_public/order/context'
import
moment
from
'moment'
export
interface
OrderHandDeleveModalProps
{
currentRef
:
any
}
const
schemaActions
=
createFormActions
()
const
schema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
labelAlign
:
'left'
,
labelCol
:
6
},
properties
:
{
addresId
:
{
type
:
'string'
,
enum
:
[],
title
:
'发货地址'
,
"x-rules"
:
[
{
message
:
'请选择发货地址'
,
required
:
true
}
]
},
deliverTime
:
{
type
:
'string'
,
"x-component"
:
'date'
,
title
:
'发货日期'
,
"x-rules"
:
[
{
message
:
'请选择发货日期'
,
required
:
true
}
],
"x-mega-props"
:
{
full
:
true
}
},
deliverNo
:
{
type
:
'string'
,
title
:
'发货单号'
,
"x-rules"
:
[
{
required
:
true
,
message
:
'请输入发货单号'
},
{
limitByte
:
true
,
maxByte
:
20
},
]
},
logisticsCompanyId
:
{
type
:
'string'
,
enum
:
[],
title
:
'物流公司'
,
"x-rules"
:
[
{
message
:
'请选择物流公司'
,
required
:
true
}
]
},
name
:
{
type
:
'string'
,
display
:
false
},
logisticsCompany
:
{
type
:
'string'
,
display
:
false
}
}
}
}
}
const
OrderHandDeleveModal
:
React
.
FC
<
OrderHandDeleveModalProps
>
=
(
props
)
=>
{
const
{
data
}
=
useContext
(
OrderDetailContext
)
const
dataRef
=
useRef
<
any
>
({})
const
handleSubmit
=
async
(
value
)
=>
{
const
params
=
{
...
value
,
orderId
:
data
.
id
,
deliverTime
:
moment
(
value
.
deliverTime
).
valueOf
()
}
const
{
code
}
=
await
PublicApi
.
postOrderManualDelivery
(
params
)
if
(
code
===
1000
)
{
history
.
goBack
()
}
}
const
handleConfirm
=
()
=>
{
schemaActions
.
submit
()
}
return
(
<
ModalForm
modalTitle=
'手工发货'
previewPlaceholder=
' '
currentRef=
{
props
.
currentRef
}
schema=
{
schema
}
actions=
{
schemaActions
}
onSubmit=
{
handleSubmit
}
confirm=
{
handleConfirm
}
initialValues=
{
{
deliverTime
:
moment
().
format
(
'YYYY-MM-DD'
)
}
}
effects=
{
(
$
,
actions
)
=>
{
useAsyncSelect
(
'addresId'
,
async
()
=>
(
await
PublicApi
.
getLogisticsSelectListShipperAddress
()).
data
,
[
'fullAddress'
,
'id'
])
useAsyncSelect
(
'logisticsCompanyId'
,
async
()
=>
(
await
PublicApi
.
getLogisticsSelectListCompany
()).
data
,
[
'name'
,
'id'
])
// 获取联动的select后续事件, 为了设置对应的name值
$
(
'requestAsyncSelect'
).
subscribe
(({
name
,
payload
})
=>
{
if
(
name
===
'addresId'
)
{
dataRef
.
current
.
addresId
=
payload
}
if
(
name
===
'logisticsCompanyId'
)
{
dataRef
.
current
.
logisticsCompanyId
=
payload
}
})
$
(
'onFieldInputChange'
,
'addresId'
).
subscribe
(({
value
})
=>
{
actions
.
setFieldValue
(
'name'
,
dataRef
.
current
.
addresId
.
find
(
v
=>
v
.
value
===
value
)?.
label
||
''
)
})
$
(
'onFieldInputChange'
,
'logisticsCompanyId'
).
subscribe
(({
value
})
=>
{
actions
.
setFieldValue
(
'logisticsCompany'
,
dataRef
.
current
.
logisticsCompanyId
.
find
(
v
=>
v
.
value
===
value
)?.
label
||
''
)
})
}
}
/>
)
}
OrderHandDeleveModal
.
defaultProps
=
{}
export
default
OrderHandDeleveModal
\ No newline at end of file
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