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
19c6ae6b
Commit
19c6ae6b
authored
Apr 07, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-220418' of…
Merge branch 'v2-220418' of
ssh://gitlab.shushangyun.com:8122/linkseeks-design/pro-platform
into fix-v2-220418
parents
e6e2ab7a
a49715dd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
555 additions
and
43 deletions
+555
-43
index.ts
config/routes/index.ts
+1
-1
RoleSelect.tsx
src/components/RoleSelect/RoleSelect.tsx
+16
-11
label.ts
src/pages/order/constants/label.ts
+2
-1
details copy.tsx
...iveryPlanManagement/deliveryPlanAwaitB2B/details copy.tsx
+305
-0
details.tsx
...r/deliveryPlanManagement/deliveryPlanAwaitB2B/details.tsx
+169
-26
assemblyTools.ts
src/pages/order/utils/assemblyTools.ts
+20
-0
date.ts
src/pages/order/utils/date.ts
+38
-2
index.ts
src/pages/order/utils/index.ts
+4
-2
No files found.
config/routes/index.ts
View file @
19c6ae6b
...
...
@@ -27,7 +27,7 @@ import MaterialRoute from './materialRoute';
// import contracRoute from './contracRoute';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
const
isDev
=
false
;
const
isDev
=
process
.
env
.
NODE_ENV
===
"development"
;
const
homeRoute
=
{
path
:
`/memberCenter/home`
,
name
:
'home'
,
...
...
src/components/RoleSelect/RoleSelect.tsx
View file @
19c6ae6b
...
...
@@ -10,6 +10,7 @@ import {
interface
RoleSelectProps
{
request
?:
(
payload
:
any
)
=>
Promise
<
any
>
params
?:
object
onChange
?:
(
e
)
=>
void
}
...
...
@@ -20,7 +21,7 @@ interface RoleSelectProps {
*/
function
RoleSelect
(
props
:
RoleSelectProps
)
{
const
{
onChange
}
=
props
const
{
request
,
params
,
onChange
}
=
props
const
[
visible
,
setVisible
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
()
...
...
@@ -38,7 +39,10 @@ function RoleSelect(props: RoleSelectProps) {
useEffect
(()
=>
{
getMemberManageLowerConsumerMemberPage
(
form
.
getFieldsValue
()).
then
(
res
=>
{
request
({
...
params
,
...
form
.
getFieldsValue
()
}).
then
(
res
=>
{
setDataSource
(
res
.
data
.
data
)
})
...
...
@@ -48,7 +52,7 @@ function RoleSelect(props: RoleSelectProps) {
<>
<
Row
gutter=
{
4
}
>
<
Col
span=
{
18
}
>
<
Input
value=
{
intV
?.
name
}
/>
<
Input
value=
{
intV
?.
name
}
disabled
/>
</
Col
>
<
Col
span=
{
6
}
>
<
Button
onClick=
{
showDrawer
}
>
选择采购会员
</
Button
>
...
...
@@ -75,16 +79,12 @@ function RoleSelect(props: RoleSelectProps) {
</
Form
>
<
Radio
.
Group
className=
"block w-full"
onChange=
{
(
e
)
=>
{
const
value
=
e
.
target
.
value
let
target
=
{
buyerMemberId
:
value
.
memberId
,
buyerRoleId
:
value
.
roleId
,
roleType
:
2
}
setIntV
(
target
)
onChange
(
target
)
setIntV
(
value
)
onChange
(
value
)
}
}
>
<
Table
className=
"w-full"
rowKey=
{
'id'
}
columns=
{
TableMemberColumn
}
dataSource=
{
dataSource
}
/>
...
...
@@ -94,5 +94,9 @@ function RoleSelect(props: RoleSelectProps) {
</>
);
}
RoleSelect
.
defaultProps
=
{
request
:
getMemberManageLowerConsumerMemberPage
,
params
:
{},
onChange
:
(
e
)
=>
{}
}
export
default
RoleSelect
;
\ No newline at end of file
src/pages/order/constants/label.ts
View file @
19c6ae6b
...
...
@@ -51,7 +51,8 @@ export const ReceivingAddress = '收货地址';
export
const
SubmitDeliveryNotice
=
'提交送货通知单'
;
export
const
ConfirmDeliveryNotice
=
'确认送货通知单'
;
export
const
DeliveryPlanText
=
'送货计划'
export
const
DeliveryPlanRemark
=
'最长600个字符,300个汉字'
...
...
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitB2B/details copy.tsx
0 → 100644
View file @
19c6ae6b
/**
* 订单能力 - 送货计划管理 - 待提交送货计划 B2B 详情
* @author: Gavin
* @description: 与SRM内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
AnchorPage
,
{
AnchorsItem
}
from
'@/components/AnchorPage'
import
{
history
}
from
'umi'
import
{
Circulation
,
ConfirmDeliveryPlan
,
Purchaser
,
SubmitDeliveryPlan
,
BaseInfo
as
base_Info
,
Supplier
,
PlanningCycle
,
SupplyMembersLabel
,
PlanSummary
,
ExternalState
,
Remarks
,
ExternalRoamRecord
,
PlannedDelivery
}
from
'../../constants'
import
{
Button
,
Calendar
,
DatePicker
,
Form
,
Input
,
InputNumber
,
Modal
,
Space
,
Steps
,
Table
}
from
'antd'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
{
ExternalRoamRecordTableColumn
}
from
'../../constants/page-table-column'
import
_
from
'lodash'
import
{
getDayAll
,
getDayAll2
}
from
'../../utils/date'
import
{
BrandColumn
,
ClassColumn
,
CommodityNoColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OredrNumColumn
,
PlannedDeliveryNumColumn
,
TradeNameColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
RoleSelect
}
from
'@/components/RoleSelect'
import
{
getMemberManageLowerMerchantProviderPage
}
from
'@/services/MemberV2Api'
import
{
getOrderDeliveryPlanOrderProductPage
}
from
'@/services/OrderNewV2Api'
const
formItemLayout
=
{
labelCol
:
{
span
:
3
},
wrapperCol
:
{
span
:
18
}
}
// 1:查询供应商角色,2:查询采购商角色
const
ROLE_TYPE
=
'1'
// 1:b2b,2:srm
const
OEDER_TYPE
=
'2'
const
testObj
=
{
"2022-04-01"
:
0
,
"2022-04-02"
:
1
,
"2022-04-03"
:
2
,
"2022-04-04"
:
3
,
"2022-04-05"
:
4
,
"2022-04-06"
:
5
,
"2022-04-07"
:
6
,
"2022-04-08"
:
7
,
"2022-04-09"
:
8
,
"2022-04-10"
:
9
,
"2022-04-11"
:
10
,
"2022-04-12"
:
11
,
"2022-04-13"
:
12
,
"2022-04-14"
:
13
,
"2022-04-15"
:
14
,
"2022-04-16"
:
15
}
const
DeliveryPlanAwaitB2BDetails
:
React
.
FC
=
()
=>
{
const
[
form
]
=
Form
.
useForm
()
// 锚点标题
const
[
iAnchors
,
setiAnchors
]
=
useState
<
AnchorsItem
[]
>
([
Circulation
,
base_Info
,
PlannedDelivery
,
Remarks
,
ExternalRoamRecord
,
])
// 动态 TableColumn
const
[
goodsTableColumn
,
setGoodsTableColumn
]
=
useState
<
any
>
([
{
...
CommodityNoColumn
,
dataIndex
:
'skuId'
,
width
:
80
,
},
{
...
TradeNameColumn
,
dataIndex
:
'productName'
,
width
:
192
,
},
{
...
ClassColumn
,
dataIndex
:
'category'
,
width
:
96
,
},
{
...
BrandColumn
,
dataIndex
:
'brand'
,
width
:
96
,
},
{
...
UntilColumn
,
dataIndex
:
'unit'
,
width
:
64
,
},
{
...
OredrNumColumn
,
dataIndex
:
'purchaseCountSum'
,
width
:
96
,
},
{
...
ConsigneeNumColumn
,
dataIndex
:
'receiveCountSum'
,
width
:
96
,
},
{
...
TransitNumColumn
,
dataIndex
:
'transitCountSum'
,
width
:
96
,
},
{
...
DeliveredNumColumn
,
dataIndex
:
'leftCountSum'
,
width
:
96
,
},
{
...
PlannedDeliveryNumColumn
,
dataIndex
:
'planCountSum'
,
width
:
128
,
},
])
// 动态 expandIconColumn
const
[
expandIconColumn
,
setExpandIconColumn
]
=
useState
<
any
>
([
{
...
OrderNoColumn
,
dataIndex
:
'orderNo'
,
width
:
80
,
},
{
...
OrderSummaryColumn
,
dataIndex
:
'orderDigest'
,
width
:
400
,
},
{
...
OrderCreatedAtColumn
,
dataIndex
:
'createTime'
,
width
:
160
,
},
{
...
OredrNumColumn
,
dataIndex
:
'purchaseCount'
,
width
:
96
,
},
{
...
ConsigneeNumColumn
,
dataIndex
:
'receiveCount'
,
width
:
96
,
},
{
...
TransitNumColumn
,
dataIndex
:
'transitCount'
,
width
:
96
,
},
{
...
DeliveredNumColumn
,
dataIndex
:
'leftCount'
,
width
:
96
,
},
{
...
PlannedDeliveryNumColumn
,
dataIndex
:
'planCount'
,
width
:
128
,
},
])
const
expandedRowRender
=
(
record
,
index
)
=>
{
return
<
Table
rowKey=
{
'id'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
}
// 选中 开始时间,结束时间
const
[
selectedDate
,
setSelectedDate
]
=
useState
<
Array
<
string
>>
([])
// 选中 会员信息
const
[
selectedMember
,
setSelectedMember
]
=
useState
<
any
>
({})
// 计划摘要
const
[
planSummaryText
,
setPlanSummaryText
]
=
useState
<
string
>
(
null
)
const
[
goodsTableData
,
setGoodsTableData
]
=
useState
<
any
>
(
null
)
const
[
details
,
setDetails
]
=
useState
<
any
>
({})
// 保存
const
save
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
console
.
log
(
'values :>> '
,
values
)
})
}
// 根据选择日期动态添加 tableColumn
const
handleDateAssembleColumn
=
(
dates
)
=>
{
if
(
_
.
isArray
(
dates
))
{
const
startDate
=
dates
[
0
].
format
(
'YYYY-MM-DD'
)
const
endDate
=
dates
[
1
].
format
(
'YYYY-MM-DD'
)
const
datas
=
getDayAll
(
startDate
,
endDate
)
const
datesColumn
=
datas
.
map
((
item
,
i
)
=>
({
title
:
item
,
dataIndex
:
'date'
+
i
,
width
:
120
,
align
:
'center'
,
}))
const
datesExpandIconColumn
=
datas
.
map
((
item
,
i
)
=>
({
title
:
item
,
dataIndex
:
'date'
+
i
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
any
)
=>
(<
InputNumber
bordered
/>)
}))
setSelectedDate
([
startDate
,
endDate
])
setGoodsTableColumn
([...
goodsTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
expandIconColumn
,
...
datesExpandIconColumn
])
const
dates2
=
getDayAll2
(
startDate
,
endDate
)
// dates2.map(item => ({ [item]: 0}))
let
obj
=
{}
for
(
let
i
=
0
;
i
<
dates2
.
length
;
i
++
)
{
obj
[
dates2
[
i
]]
=
i
console
.
log
(
'999 :>> '
,
i
)
}
console
.
log
(
'obj :>> '
,
obj
)
}
else
{
// 清空组装
console
.
log
(
' 需要清空组装 -------:>> '
,)
}
}
// 选中的会员信息
const
handleMemberInfo
=
(
info
)
=>
{
console
.
log
(
'info :>> '
,
info
)
setSelectedMember
(
info
)
}
// 获取计划送货
const
getPlannedDelivery
=
()
=>
{
getOrderDeliveryPlanOrderProductPage
({
startDate
:
selectedDate
[
0
],
endDate
:
selectedDate
[
1
],
memberId
:
selectedMember
.
memberId
,
roleId
:
selectedMember
.
roleId
,
roleType
:
ROLE_TYPE
,
orderType
:
OEDER_TYPE
,
current
:
'1'
,
pageSize
:
'10'
}).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
setGoodsTableData
(
res
.
data
.
data
)
}
})
}
// 监听 选择日期 and 选择会员
useEffect
(()
=>
{
// 双条件满足 请求 获取计划送货
if
(
!
_
.
isEmpty
(
selectedDate
)
&&
!
_
.
isEmpty
(
selectedMember
))
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 B2B -----------:>> '
,
'双条件满足 请求 获取计划送货'
)
getPlannedDelivery
()
}
else
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 B2B -----------:>> '
,
'条件暂未满足不调取接口获取'
)
}
},
[
selectedDate
,
selectedMember
])
const
getListData
=
(
value
)
=>
{
console
.
log
(
'getListData -> value :>> '
,
value
.
date
())
}
const
dateCellRender
=
(
value
)
=>
{
const
listData
=
getListData
(
value
)
console
.
log
(
'listData :>> '
,
value
.
format
(
'YYYY-MM-DD'
),
listData
)
const
date
=
value
.
format
(
'YYYY-MM-DD'
)
return
(<>
{
testObj
[
date
]
?
<
p
>
计划送货量:
{
testObj
[
date
]
}
</
p
>
:
null
}
</>)
}
const
monthCellRender
=
(
value
)
=>
{
console
.
log
(
'monthCellRender -> value :>> '
,
value
)
return
(
null
)
}
return
(<>
<
AnchorPage
title=
{
details
?.
name
||
'没有title'
}
onBack=
{
()
=>
history
.
goBack
()
}
anchors=
{
iAnchors
}
extra=
{
<
Space
>
<
Button
>
保存并提交
</
Button
>
<
Button
type=
'primary'
icon=
{
<
SaveOutlined
/>
}
onClick=
{
save
}
>
保存
</
Button
>
</
Space
>
}
>
<
Form
labelAlign=
'left'
form=
{
form
}
>
<
BaseInfo
className=
'mt-0'
title=
{
Circulation
.
name
}
id=
{
Circulation
.
key
}
cols=
{
1
}
>
<
Steps
progressDot
current=
{
0
}
>
<
Steps
.
Step
title=
{
Purchaser
}
description=
{
SubmitDeliveryPlan
}
/>
<
Steps
.
Step
title=
{
Supplier
}
description=
{
ConfirmDeliveryPlan
}
/>
</
Steps
>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
base_Info
.
name
}
id=
{
base_Info
.
key
}
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
PlanningCycle
}
name=
'dates'
>
<
DatePicker
.
RangePicker
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handleDateAssembleColumn
(
dates
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
SupplyMembersLabel
}
name=
'memberId'
>
{
/* 临时调用SRM会员列表 */
}
<
RoleSelect
request=
{
getMemberManageLowerMerchantProviderPage
}
onChange=
{
handleMemberInfo
}
params=
{
{
current
:
'1'
,
pageSize
:
'100'
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
PlanSummary
}
name=
'planSummary'
>
<
Input
value=
{
planSummaryText
}
onBlur=
{
e
=>
console
.
log
(
'e :>> '
,
e
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
ExternalState
}
>
待提交
</
Form
.
Item
>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
PlannedDelivery
.
name
}
id=
{
PlannedDelivery
.
key
}
cols=
{
1
}
>
<
Table
// defaultExpandAllRows
rowKey=
{
'id'
}
columns=
{
goodsTableColumn
}
expandedRowRender=
{
expandedRowRender
}
dataSource=
{
goodsTableData
}
tableLayout=
"fixed"
scroll=
{
{
x
:
2022
}
}
/>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
Remarks
.
name
}
id=
{
Remarks
.
key
}
cols=
{
1
}
>
<
Input
.
TextArea
rows=
{
4
}
maxLength=
{
300
}
placeholder=
'最长600个字符,300个汉字。'
/>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
ExternalRoamRecord
.
name
}
id=
{
ExternalRoamRecord
.
key
}
cols=
{
1
}
>
<
Table
rowKey=
{
'id'
}
dataSource=
{
[{
id
:
'1'
,
'name1'
:
'1'
,
'name2'
:
'操作角色'
,
'name3'
:
'状态'
,
'name4'
:
'操作'
,
'name5'
:
'操作时间'
,
'name6'
:
'备注'
,
},]
}
columns=
{
ExternalRoamRecordTableColumn
}
/>
</
BaseInfo
>
</
Form
>
</
AnchorPage
>
<
Modal
title=
'测试'
visible=
{
!
true
}
width=
{
1200
}
>
{
/* dateCellRender={dateCellRender} monthCellRender={monthCellRender} */
}
{
/* headerRender={({value, onChange}) => {
return (<span>999</span>)
}} */
}
<
Calendar
dateCellRender=
{
dateCellRender
}
monthCellRender=
{
monthCellRender
}
/>
</
Modal
>
</>)
}
export
default
DeliveryPlanAwaitB2BDetails
\ No newline at end of file
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitB2B/details.tsx
View file @
19c6ae6b
...
...
@@ -3,23 +3,36 @@
* @author: Gavin
* @description: 与SRM内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import
React
,
{
useRef
,
useState
}
from
'react'
import
React
,
{
use
Effect
,
use
Ref
,
useState
}
from
'react'
import
AnchorPage
,
{
AnchorsItem
}
from
'@/components/AnchorPage'
import
{
history
}
from
'umi'
import
{
Circulation
,
ConfirmDeliveryPlan
,
Purchaser
,
SubmitDeliveryPlan
,
BaseInfo
as
base_Info
,
Supplier
,
PlanningCycle
,
SupplyMembersLabel
,
PlanSummary
,
ExternalState
,
Remarks
,
ExternalRoamRecord
,
PlannedDelivery
}
from
'../../constants'
import
{
Button
,
DatePicker
,
Form
,
Input
,
Space
,
Steps
,
Table
}
from
'antd'
import
{
Circulation
,
ConfirmDeliveryPlan
,
Purchaser
,
SubmitDeliveryPlan
,
BaseInfo
as
base_Info
,
Supplier
,
PlanningCycle
,
SupplyMembersLabel
,
PlanSummary
,
ExternalState
,
Remarks
,
ExternalRoamRecord
,
PlannedDelivery
,
DeliveryPlanText
,
DeliveryPlanRemark
}
from
'../../constants'
import
{
Button
,
DatePicker
,
Form
,
Input
,
InputNumber
,
Space
,
Steps
,
Table
}
from
'antd'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
{
ExternalRoamRecordTableColumn
}
from
'../../constants/page-table-column'
import
_
from
'lodash'
import
{
getDayAll
}
from
'../../utils/date'
import
{
BrandColumn
,
ClassColumn
,
CommodityNoColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
OredrNumColumn
,
PlannedDeliveryNumColumn
,
TradeNameColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
convertArrtoObj
,
getDayAll
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
CommodityNoColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OredrNumColumn
,
PlannedDeliveryNumColumn
,
TradeNameColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
RoleSelect
}
from
'@/components/RoleSelect'
import
{
getMemberManageLowerMerchantProviderPage
}
from
'@/services/MemberV2Api'
import
{
getOrderDeliveryPlanOrderProductPage
,
postOrderDeliveryPlanB2bCreate
}
from
'@/services/OrderNewV2Api'
const
formItemLayout
=
{
labelCol
:
{
span
:
3
},
wrapperCol
:
{
span
:
18
}
}
// 1:查询供应商角色,2:查询采购商角色
const
ROLE_TYPE
=
'1'
// 1:b2b,2:srm
const
OEDER_TYPE
=
'1'
const
DeliveryPlanAwaitB2BDetails
:
React
.
FC
=
()
=>
{
const
[
form
]
=
Form
.
useForm
()
const
datesRef
=
useRef
<
any
>
(
null
)
const
goodsTableDataRef
=
useRef
(
null
)
// 锚点标题
const
[
iAnchors
,
setiAnchors
]
=
useState
<
AnchorsItem
[]
>
([
Circulation
,
base_Info
,
...
...
@@ -27,50 +40,170 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
Remarks
,
ExternalRoamRecord
,
])
// 动态 TableColumn
const
[
goodsTableColumn
,
setGoodsTableColumn
]
=
useState
<
any
>
([
{
...
CommodityNoColumn
,
dataIndex
:
'skuId'
,
width
:
80
,
},
{
...
TradeNameColumn
,
dataIndex
:
'productName'
,
width
:
192
,
},
{
...
ClassColumn
,
dataIndex
:
'category'
,
width
:
96
,
},
{
...
BrandColumn
,
dataIndex
:
'brand'
,
width
:
96
,
},
{
...
UntilColumn
,
dataIndex
:
'unit'
,
width
:
64
,
},
{
...
OredrNumColumn
,
dataIndex
:
'purchaseCountSum'
,
width
:
96
,
},
{
...
ConsigneeNumColumn
,
dataIndex
:
'receiveCountSum'
,
width
:
96
,
},
{
...
TransitNumColumn
,
dataIndex
:
'transitCountSum'
,
width
:
96
,
},
{
...
DeliveredNumColumn
,
dataIndex
:
'leftCountSum'
,
width
:
96
,
},
{
...
PlannedDeliveryNumColumn
,
dataIndex
:
'planCountSum'
,
width
:
128
,
},
])
// 动态 expandIconColumn
const
[
expandIconColumn
,
setExpandIconColumn
]
=
useState
<
any
>
([
{
...
OrderNoColumn
,
dataIndex
:
'orderNo'
,
width
:
80
,
},
{
...
OrderSummaryColumn
,
dataIndex
:
'orderDigest'
,
width
:
200
,
},
{
...
OrderCreatedAtColumn
,
dataIndex
:
'createTime'
,
width
:
160
,
},
{
...
OredrNumColumn
,
dataIndex
:
'purchaseCount'
,
width
:
96
,
},
{
...
ConsigneeNumColumn
,
dataIndex
:
'receiveCount'
,
width
:
96
,
},
{
...
TransitNumColumn
,
dataIndex
:
'transitCount'
,
width
:
96
,
},
{
...
DeliveredNumColumn
,
dataIndex
:
'leftCount'
,
width
:
96
,
},
{
...
PlannedDeliveryNumColumn
,
dataIndex
:
'planCount'
,
width
:
128
,
},
])
const
[
form
]
=
Form
.
useForm
()
const
expandedRowRender
=
(
record
,
index
)
=>
{
return
<
Table
rowKey=
{
'orderProductId'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
}
// 选中 开始时间,结束时间
const
[
selectedDate
,
setSelectedDate
]
=
useState
<
Array
<
string
>>
([])
// 选中 会员信息
const
[
selectedMember
,
setSelectedMember
]
=
useState
<
any
>
({})
//
const
[
goodsTableData
,
setGoodsTableData
]
=
useState
<
any
>
(
null
)
const
[
details
,
setDetails
]
=
useState
<
any
>
({})
// 保存
const
save
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
console
.
log
(
'values :>> '
,
values
)
const
productList
=
goodsTableDataRef
.
current
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
orders
:
item
.
orders
.
map
((
o
:
any
)
=>
{
const
planDays
=
Object
.
keys
(
o
).
filter
((
f
:
any
)
=>
f
.
startsWith
(
'$'
)).
map
((
p
:
any
)
=>
o
[
p
])
return
{
...
o
,
planDays
}
})
}
})
postOrderDeliveryPlanB2bCreate
({
vendorMemberId
:
selectedMember
.
memberId
,
vendorRoleId
:
selectedMember
.
roleId
,
vendorMemberName
:
selectedMember
.
name
,
digest
:
values
.
planSummaryText
,
planStartTime
:
values
.
dates
[
0
].
format
(
'YYYY-MM-DD'
),
planEndTime
:
values
.
dates
[
1
].
format
(
'YYYY-MM-DD'
),
remark
:
values
.
remark
,
productList
}).
then
((
res
:
any
)
=>
{
console
.
log
(
'保存 :>> '
,
res
)
})
})
}
const
getDateAssembleColumn
=
(
dates
)
=>
{
// console.log(_.isArray(dates))
if
(
_
.
isArray
(
dates
))
{
const
startDate
=
dates
[
0
].
format
(
'YYYY-MM-DD'
)
const
endDate
=
dates
[
1
].
format
(
'YYYY-MM-DD'
)
const
datas
=
getDayAll
(
startDate
,
endDate
)
const
datesColumn
=
datas
.
map
((
item
,
i
)
=>
({
title
:
item
,
dataIndex
:
'date'
+
i
,
width
:
'80px'
,
align
:
'center'
}))
console
.
log
(
'allDates :>> '
,
getDayAll
(
startDate
,
endDate
))
console
.
log
(
'datesColumn :>> '
,
datesColumn
)
// 对应日期填入的送货数量
const
inputChange
=
(
val
:
any
,
text
:
any
,
record
:
any
)
=>
{
let
{
day
}
=
text
let
dataArr
=
JSON
.
parse
(
JSON
.
stringify
(
goodsTableDataRef
.
current
))
let
index
=
dataArr
.
findIndex
(
f
=>
f
.
skuId
===
record
.
skuId
)
let
childIndex
=
dataArr
[
index
].
orders
.
findIndex
(
f
=>
f
.
orderProductId
===
record
.
orderProductId
)
dataArr
[
index
].
orders
[
childIndex
][
`$
${
day
}
`
].
planCount
=
val
// console.log('goodsTableDataRef.current 2222:>> ', goodsTableDataRef.current)
goodsTableDataRef
.
current
=
dataArr
setGoodsTableData
(
dataArr
)
}
// 计划周期 选择日期
const
handleDateAssembleColumn
=
(
dateGroup
)
=>
{
if
(
_
.
isArray
(
dateGroup
))
{
const
startDate
=
dateGroup
[
0
].
format
(
'YYYY-MM-DD'
)
const
endDate
=
dateGroup
[
1
].
format
(
'YYYY-MM-DD'
)
const
dates
=
getDayAll
(
startDate
,
endDate
)
datesRef
.
current
=
dates
setSelectedDate
([
startDate
,
endDate
])
const
datesColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
2
),
dataIndex
:
item
,
key
:
item
,
width
:
120
,
align
:
'center'
,
}))
const
datesExpandIconColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
2
),
dataIndex
:
item
,
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
}))
setGoodsTableColumn
([...
goodsTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
expandIconColumn
,
...
datesExpandIconColumn
])
}
else
{
// 清空组装
// 清空
datesRef
.
current
=
null
goodsTableDataRef
.
current
=
null
setSelectedDate
([])
setGoodsTableData
([])
}
}
return
(
// 选中的会员信息
const
handleMemberInfo
=
(
info
)
=>
{
console
.
log
(
'info :>> '
,
info
)
setSelectedMember
(
info
)
}
// 获取计划送货
const
getPlannedDelivery
=
()
=>
{
getOrderDeliveryPlanOrderProductPage
({
startDate
:
selectedDate
[
0
],
endDate
:
selectedDate
[
1
],
memberId
:
selectedMember
.
memberId
,
roleId
:
selectedMember
.
roleId
,
roleType
:
ROLE_TYPE
,
orderType
:
OEDER_TYPE
,
current
:
'1'
,
pageSize
:
'10'
}).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
const
assemble
=
res
.
data
.
data
.
map
((
item
=>
{
return
{
...
item
,
...
convertArrtoObj
(
datesRef
.
current
),
orders
:
item
.
orders
.
map
(
o
=>
({
...
o
,
...
convertArrtoObj
(
datesRef
.
current
),
}))
}
}))
console
.
log
(
'assemble ------------- :>> '
,
assemble
)
goodsTableDataRef
.
current
=
assemble
setGoodsTableData
(
assemble
)
}
})
}
// 监听 选择日期 and 选择会员
useEffect
(()
=>
{
// 双条件满足 请求
if
(
!
_
.
isEmpty
(
selectedDate
)
&&
!
_
.
isEmpty
(
selectedMember
))
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 B2B -----------:>> '
,
'双条件满足 请求 获取计划送货'
)
getPlannedDelivery
()
const
planSummaryText
=
`
${
selectedDate
[
0
]}
~
${
selectedDate
[
1
]}
${
selectedMember
.
name
}
${
DeliveryPlanText
}
`
form
.
setFieldsValue
({
planSummaryText
})
}
else
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 B2B -----------:>> '
,
'条件暂未满足不调取接口获取'
)
}
},
[
selectedDate
,
selectedMember
])
return
(<>
<
AnchorPage
title=
{
details
?.
name
||
'没有title'
}
onBack=
{
()
=>
history
.
goBack
()
}
anchors=
{
iAnchors
}
extra=
{
<
Space
>
<
Button
>
保存并
新增
</
Button
>
<
Button
>
保存并
提交
</
Button
>
<
Button
type=
'primary'
icon=
{
<
SaveOutlined
/>
}
onClick=
{
save
}
>
保存
</
Button
>
</
Space
>
}
...
...
@@ -91,7 +224,7 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
label=
{
PlanningCycle
}
name=
'dates'
>
<
DatePicker
.
RangePicker
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
get
DateAssembleColumn
(
dates
)
}
/>
<
DatePicker
.
RangePicker
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handle
DateAssembleColumn
(
dates
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
...
...
@@ -99,13 +232,18 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
label=
{
SupplyMembersLabel
}
name=
'memberId'
>
<
Input
/>
{
/* 临时调用SRM会员列表 */
}
<
RoleSelect
request=
{
getMemberManageLowerMerchantProviderPage
}
onChange=
{
handleMemberInfo
}
params=
{
{
current
:
'1'
,
pageSize
:
'100'
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
PlanSummary
}
name=
'planSummary'
name=
'planSummary
Text
'
>
<
Input
/>
</
Form
.
Item
>
...
...
@@ -120,16 +258,20 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
<
BaseInfo
className=
'mt-16'
title=
{
PlannedDelivery
.
name
}
id=
{
PlannedDelivery
.
key
}
cols=
{
1
}
>
<
Table
// defaultExpandAllRows
rowKey=
{
'
i
d'
}
rowKey=
{
'
skuI
d'
}
columns=
{
goodsTableColumn
}
// expandable={{ expandedRowRender }
}
dataSource=
{
[{
id
:
1
}]
}
expandedRowRender=
{
expandedRowRender
}
dataSource=
{
goodsTableData
}
tableLayout=
"fixed"
scroll=
{
{
x
:
2022
}
}
/>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
Remarks
.
name
}
id=
{
Remarks
.
key
}
cols=
{
1
}
>
<
Input
.
TextArea
rows=
{
6
}
maxLength=
{
300
}
placeholder=
'最长600个字符,300个汉字。'
/>
<
Form
.
Item
name=
'remark'
>
<
Input
.
TextArea
rows=
{
4
}
maxLength=
{
300
}
placeholder=
{
DeliveryPlanRemark
}
/>
</
Form
.
Item
>
</
BaseInfo
>
<
BaseInfo
className=
'mt-16'
title=
{
ExternalRoamRecord
.
name
}
id=
{
ExternalRoamRecord
.
key
}
cols=
{
1
}
>
<
Table
...
...
@@ -148,7 +290,7 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
</
BaseInfo
>
</
Form
>
</
AnchorPage
>
)
</>
)
}
export
default
DeliveryPlanAwaitB2BDetails
\ No newline at end of file
src/pages/order/utils/assemblyTools.ts
0 → 100644
View file @
19c6ae6b
// 公共组装类工具
/**
* 数组转对象 默认赋值 0 (示例:['$04-01','$04-02'] = { '$04-01': {}, '$04-02': {} })
* @param arr
* @returns
*/
const
convertArrtoObj
=
(
arr
)
=>
{
return
arr
.
reduce
((
obj
,
currVal
)
=>
{
return
{
...
obj
,
[
currVal
]:
{
day
:
currVal
.
substr
(
1
),
planCount
:
0
,
createNotice
:
false
,
createDelivery
:
false
}
}
},
{})
}
export
{
convertArrtoObj
}
\ No newline at end of file
src/pages/order/utils/date.ts
View file @
19c6ae6b
// 公共日期类工具
const
getDayAll
=
(
starDay
:
string
,
endDay
:
string
)
=>
{
let
arr
=
[]
let
dates
=
[]
...
...
@@ -24,13 +26,46 @@ const getDayAll = (starDay: string, endDay: string) => {
let
day
=
time
.
getDate
()
>=
10
?
time
.
getDate
()
:
'0'
+
time
.
getDate
()
// year + '-' +
// let YYMMDD = year + '-' + mouth + '-' + day
let
MMDD
=
mouth
+
'-'
+
day
let
MMDD
=
'$'
+
mouth
+
'-'
+
day
dates
.
push
(
MMDD
)
}
// dates.pop()
return
dates
}
// deliveryPlanManagement - deliveryPlanAwaitB2B - details copy.ts 测试使用,上线前需要删除
const
getDayAll2
=
(
starDay
:
string
,
endDay
:
string
)
=>
{
let
arr
=
[]
let
dates
=
[]
// 设置两个日期UTC时间
let
db
=
new
Date
(
starDay
)
let
de
=
new
Date
(
endDay
)
// 获取两个日期GTM时间
let
s
=
db
.
getTime
()
-
24
*
60
*
60
*
1000
let
d
=
de
.
getTime
()
-
24
*
60
*
60
*
1000
// 获取到两个日期之间的每一天的毫秒数
for
(
let
i
=
s
;
i
<=
d
;
)
{
i
=
i
+
24
*
60
*
60
*
1000
arr
.
push
(
parseInt
(
String
(
i
)))
}
// 获取每一天的时间 YY-MM-DD
for
(
let
j
in
arr
)
{
let
time
=
new
Date
(
arr
[
j
])
let
year
=
time
.
getFullYear
()
let
mouth
=
time
.
getMonth
()
+
1
>=
10
?
time
.
getMonth
()
+
1
:
'0'
+
(
time
.
getMonth
()
+
1
)
let
day
=
time
.
getDate
()
>=
10
?
time
.
getDate
()
:
'0'
+
time
.
getDate
()
// year + '-' +
let
YYMMDD
=
year
+
'-'
+
mouth
+
'-'
+
day
dates
.
push
(
YYMMDD
)
}
dates
.
pop
()
return
dates
}
export
{
getDayAll
getDayAll
,
getDayAll2
,
}
\ No newline at end of file
src/pages/order/utils/index.ts
View file @
19c6ae6b
export
*
from
'./status'
\ No newline at end of file
export
*
from
'./status'
export
*
from
'./date'
export
*
from
'./assemblyTools'
\ 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