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
846d9366
Commit
846d9366
authored
Mar 30, 2022
by
rex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
送货单 手动添加功能
parent
ed06dd7f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
30 deletions
+98
-30
AddressDrawer.tsx
src/components/AddressDrawer/AddressDrawer.tsx
+18
-9
AddressRaio.tsx
src/components/AddressDrawer/AddressRaio.tsx
+4
-6
DatePickerSelect.tsx
src/components/DatePickerSelect/DatePickerSelect.tsx
+1
-1
harver-material.tsx
src/pages/order/assets/context/harver-material.tsx
+1
-1
DeliveryGoodTableSelect.tsx
...nents/DeliveryGoodTableSelect/DeliveryGoodTableSelect.tsx
+3
-1
add.tsx
src/pages/order/deliveryNotice/manageSRM/add.tsx
+66
-12
form.ts
src/utils/form.ts
+5
-0
No files found.
src/components/AddressDrawer/AddressDrawer.tsx
View file @
846d9366
...
...
@@ -23,21 +23,24 @@ interface AddressDrawerProps {
renderForm
?:
React
.
ReactNode
sumbitRequest
?:
SumbitRequest
addressListRequest
?:
(
values
?:
any
)
=>
Promise
<
any
>
value
?:
any
}
function
AddressDrawer
(
props
:
AddressDrawerProps
)
{
const
{
onChange
,
formInstance
,
renderForm
,
sumbitRequest
,
addressListRequest
}
=
props
;
const
{
onChange
,
formInstance
,
renderForm
,
sumbitRequest
,
addressListRequest
,
value
:
addr
}
=
props
;
const
[
visible
,
setVisible
]
=
useState
<
boolean
>
(
false
);
const
[
showForm
,
setShowForm
]
=
useState
<
boolean
>
(
false
);
const
[
value
,
setValue
]
=
useState
();
const
[
value
,
setValue
]
=
useState
(
addr
);
const
[
addrForm
]
=
Form
.
useForm
(
formInstance
);
const
[
addrList
,
setAddrList
]
=
useState
([]);
useEffect
(()
=>
{
renderAddressList
();
},
[])
// props 更新 内部状态更新 用于FormItem 的操作
addr
&&
setValue
(
addr
);
},
[
addr
])
//地址提交
function
sumbitAddressForm
()
{
...
...
@@ -73,11 +76,19 @@ function AddressDrawer(props: AddressDrawerProps) {
form=
{
addrForm
}
/>
}
function
renderAddressFormBtnGroup
()
{
if
(
showForm
)
{
return
<
Button
type=
'primary'
onClick=
{
sumbitAddressForm
}
>
提交
</
Button
>
}
else
{
return
<
Button
type=
'primary'
onClick=
{
()
=>
{
setVisible
(
false
)
}
}
>
确认
</
Button
>
}
}
return
(
<
AddressRaioContextProvider
value=
{
addrList
}
>
<
Row
gutter=
{
10
}
>
<
Col
span=
{
20
}
>
<
Input
.
TextArea
value=
{
value
}
/>
<
Input
.
TextArea
value=
{
`${value?.fullAddress} ${value?.shipperName} ${value?.phone}`
}
/>
</
Col
>
<
Col
span=
{
4
}
>
...
...
@@ -92,21 +103,19 @@ function AddressDrawer(props: AddressDrawerProps) {
title=
"地址管理"
footer=
{
<
Button
.
Group
>
<
Button
type=
'primary'
onClick=
{
sumbitAddressForm
}
>
提交
</
Button
>
{
renderAddressFormBtnGroup
()
}
</
Button
.
Group
>
}
>
<
Radio
.
Group
className=
'w-full'
onChange=
{
(
e
)
=>
{
const
value
=
e
.
target
.
value
;
const
inputV
:
any
=
Object
.
values
(
value
).
filter
((
v
,
index
)
=>
index
>
0
&&
index
<
4
).
join
(
' '
)
setValue
(
inputV
);
onChange
(
value
)
setValue
(
JSON
.
parse
(
value
));
onChange
(
JSON
.
parse
(
value
));
}
}
>
<
Space
className=
'w-full'
direction=
"vertical"
>
<
AddressRaio
servicePromise=
{
props
.
addressListRequest
}
onEdit=
{
(
addr
)
=>
{
setShowForm
(
true
)
addrForm
.
setFieldsValue
(
addr
);
...
...
src/components/AddressDrawer/AddressRaio.tsx
View file @
846d9366
...
...
@@ -13,12 +13,10 @@ export const AddressRaioContextProvider = AddressRaioContext.Provider;
interface
AddressRaioProps
{
onChange
?:
(
value
)
=>
void
onEdit
?:
(
address
)
=>
void
servicePromise
:
(
params
?:
any
)
=>
Promise
<
any
>
}
function
AddressRaio
(
props
:
AddressRaioProps
)
{
const
{
onChange
,
onEdit
,
servicePromise
}
=
props
;
const
{
onEdit
}
=
props
;
const
addrList
=
useContext
(
AddressRaioContext
);
...
...
@@ -27,12 +25,12 @@ function AddressRaio(props: AddressRaioProps) {
{
addrList
.
map
(
addr
=>
(
<
div
className=
'flex mb-14'
key=
{
addr
.
id
}
>
<
div
className=
'_left felx-auto'
>
<
Radio
className=
{
styles
[
'antRadioWrapperItems'
]
}
value=
{
addr
}
>
<
Radio
className=
{
styles
[
'antRadioWrapperItems'
]
}
value=
{
JSON
.
stringify
(
addr
)
}
>
<
div
className=
'address_base ml-10'
>
<
span
>
{
addr
.
shipperName
}
</
span
>
<
span
>
{
addr
.
phone
}
</
span
>
{
addr
.
isDefault
===
1
&&
<
span
>
默认地址
</
span
>
}
</
div
>
<
div
className=
'address_decs ml-10'
>
{
addr
.
fullAddress
}
...
...
@@ -43,7 +41,7 @@ function AddressRaio(props: AddressRaioProps) {
<
Button
.
Group
size=
'small'
>
<
Button
onClick=
{
()
=>
{
if
(
onEdit
)
{
getLogisticsShipperAddressGet
({
id
:
addr
.
id
}).
then
(
res
=>
{
getLogisticsShipperAddressGet
({
id
:
addr
.
id
}).
then
(
res
=>
{
onEdit
(
res
.
data
)
})
}
...
...
src/components/DatePickerSelect/DatePickerSelect.tsx
View file @
846d9366
...
...
@@ -7,7 +7,7 @@ function DatePickerSelect(props) {
const
{
}
=
props
;
const
disabledDate
=
(
current
)
=>
{
return
current
&&
current
<
moment
().
end
Of
(
'day'
);
return
current
&&
current
<
moment
().
start
Of
(
'day'
);
}
return
(
...
...
src/pages/order/assets/context/harver-material.tsx
View file @
846d9366
...
...
@@ -6,7 +6,7 @@ import { HarvestMaterialMock } from '../mock/HarvestMaterialMock';
* HarvestMaterial table dataSource context,只限制使用HarvestMaterial Context
*/
export
const
HarvestMaterialContext
=
React
.
createContext
({
dataSource
:
HarvestMaterialMock
dataSource
:
[]
})
export
const
HarvestMaterialContextProvider
=
HarvestMaterialContext
.
Provider
...
...
src/pages/order/components/DeliveryGoodTableSelect/DeliveryGoodTableSelect.tsx
View file @
846d9366
...
...
@@ -45,10 +45,12 @@ function DeliveryGoodTableModal(props: DeliveryGoodTableModalProps) {
let
data
=
record
;
let
combination
=
(
record
.
orders
as
any
[]).
map
(
v
=>
{
return
{
let
result
=
{
...
record
,
...
v
,
}
delete
result
[
'orders'
]
return
result
})
return
(
...
...
src/pages/order/deliveryNotice/manageSRM/add.tsx
View file @
846d9366
...
...
@@ -4,7 +4,7 @@
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import
AnchorPage
,
{
AnchorsItem
}
from
'@/components/AnchorPage'
import
React
,
{
useCallback
,
use
State
}
from
'react'
import
React
,
{
useCallback
,
use
Effect
,
useState
,
useContext
}
from
'react'
import
{
BillsInfo
,
BuyerLabel
,
ConsigneeLabel
,
ConsigneePhoneLabel
,
ConsigneeTimeLabel
,
DeliveryAbstractLabel
,
DeliveryAddrLabel
,
DeliveryDateLabel
,
DeliveryGood
,
DeliveryInfo
,
DeliveryNameLabel
,
DeliveryNoLabel
,
DeliveryPhoneLabel
,
DeliverySlefAddrLabel
,
DeliveryTimeLabel
,
DeliveryTypeLabel
,
Distribution
,
LogisticsCarNoLabel
,
LogisticsCompanyLabel
,
LogisticsInfo
,
LogisticsNoLabel
,
NoteLabel
,
OutStatusLabel
}
from
'../../constants'
import
{
BaseInfo
as
ContentBox
}
from
'@/components/BaseInfo'
import
{
Input
,
Table
,
Row
,
Col
,
Select
,
Radio
,
Form
,
Button
}
from
'antd'
;
...
...
@@ -15,13 +15,41 @@ import DatePicker from '@/components/DatePicker';
import
{
AddressDrawer
}
from
'@/components/AddressDrawer'
;
import
{
getLogisticsSelectListShipperAddress
,
postLogisticsShipperAddressAdd
,
postLogisticsShipperAddressUpdate
}
from
'@/services/LogisticsV2Api'
;
import
DeliveryGoodTableSelect
from
'../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelect'
;
import
{
HarvestMaterialContextProvider
}
from
'../../assets/context'
;
import
{
HarvestMaterialContextProvider
,
HarvestMaterialContext
}
from
'../../assets/context'
;
import
moment
from
'moment'
;
const
ContentBoxItem
=
ContentBox
.
BaseInfoItem
;
const
DeliveryNoticeManageSRMDetails
:
React
.
FC
=
()
=>
{
const
[
tableDataSource
,
setTableDataSource
]
=
useState
([]);
const
[
tableDataSource
,
setTableDataSource
]
=
useState
([
{
"skuId"
:
"demoData"
,
"productNo"
:
"demoData"
,
"orderProductId"
:
2
,
"productName"
:
"demoData"
,
"spec"
:
"demoData"
,
"category"
:
"demoData"
,
"brand"
:
"demoData"
,
"unit"
:
"demoData"
,
"purchaseCount"
:
1
,
"receiveCount"
:
1
,
"transitCount"
:
1
,
"leftCount"
:
1
,
"planCount"
:
1
,
"orderNo"
:
"demoData2"
,
"orderDigest"
:
"demoData"
,
"consigneeId"
:
1
,
"consignee"
:
"demoData"
,
"provinceName"
:
"demoData"
,
"cityName"
:
"demoData"
,
"districtName"
:
"demoData"
,
"streetName"
:
"demoData"
,
"address"
:
"demoData"
,
"phone"
:
"demoData"
}
]);
const
dataSource$
=
useContext
(
HarvestMaterialContext
)
const
[
form
]
=
Form
.
useForm
()
const
[
anchors
,
setAnchors
]
=
useState
<
AnchorsItem
[]
>
([
...
...
@@ -32,16 +60,46 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
DeliveryGood
,
])
const
handleSubmit
=
useCallback
(()
=>
{
console
.
log
(
form
.
getFieldsValue
())
const
initData
=
{
"digest"
:
"11"
,
"remark"
:
"22"
,
"buyerMemberId"
:
"333"
,
"deliveryTime"
:
moment
(
'2015-01-14'
),
"executorVO.consignee"
:
"莫雷 "
,
"deliveryRangeTime"
:
[
moment
(
'2015-01-15'
),
moment
(
'2015-01-16'
)
],
"executorVO.phone"
:
"13286326255"
,
"sendTime"
:
moment
(
'2015-01-14 08:25:21'
),
"receiveVO"
:
{
"id"
:
5
,
"shipperName"
:
"李工"
,
"fullAddress"
:
"天津市天津市河东区和平路"
,
"phone"
:
"18800000000"
,
"isDefault"
:
1
},
"deliveryType"
:
1
,
"executorVO.carNumbers"
:
"11234"
,
"logisticsCompanyId"
:
null
,
"logisticsNo"
:
"112334"
}
useEffect
(()
=>
{
form
.
setFieldsValue
(
initData
)
},
[])
const
handleSubmit
=
useCallback
(()
=>
{
// console.log(form.getFieldsValue())
console
.
log
(
tableDataSource
)
},
[
form
,
tableDataSource
])
return
(
<
AnchorPage
title=
"送货单管理详情(SRM)"
anchors=
{
anchors
}
extra=
{
<
Button
.
Group
>
<
Button
onClick=
{
handleSubmit
}
>
提交
</
Button
>
<
Button
onClick=
{
handleSubmit
}
type=
'primary'
>
提交
</
Button
>
</
Button
.
Group
>
}
>
...
...
@@ -72,7 +130,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<
Input
/>
</
FormItem
>
<
FormItem
label=
{
DeliveryTimeLabel
}
name=
"deliveryTime"
>
<
FormItem
label=
{
DeliveryTimeLabel
}
name=
"delivery
Range
Time"
>
<
DatePickerSelect
.
RangePicker
className=
"w-full"
picker=
'time'
/>
</
FormItem
>
...
...
@@ -87,10 +145,6 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
</
FormItem
>
<
FormItem
label=
{
DeliveryAddrLabel
}
name=
"receiveVO"
>
<
Input
/>
</
FormItem
>
<
FormItem
name=
"receiveVO"
label=
{
DeliverySlefAddrLabel
}
>
<
AddressDrawer
addressListRequest=
{
(
val
)
=>
{
return
getLogisticsSelectListShipperAddress
(
val
)
...
...
@@ -114,7 +168,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<
Radio
.
Group
>
<
Radio
.
Button
value=
{
1
}
>
物流
</
Radio
.
Button
>
<
Radio
.
Button
value=
{
2
}
>
自提
</
Radio
.
Button
>
<
Radio
.
Button
value=
{
3
}
>
无效配送
</
Radio
.
Button
>
{
/* <Radio.Button value={3}>无效配送</Radio.Button> */
}
</
Radio
.
Group
>
</
FormItem
>
...
...
src/utils/form.ts
0 → 100644
View file @
846d9366
function
HandelFormFieldsKeyValue
()
{
}
\ 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