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
linweijiong
jinfa-platform
Commits
3f6242e8
Commit
3f6242e8
authored
Oct 22, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 代客下单操作采购商发票信息,采购订单列表调整配送时间
parent
9b46a3c5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
36 deletions
+39
-36
index.tsx
src/pages/transaction/purchaseOrder/index.tsx
+2
-4
index.ts
src/pages/transaction/saleOrder/agentOrder/apis/index.ts
+2
-2
index.tsx
...on/saleOrder/agentOrder/components/invoiceModal/index.tsx
+8
-2
index.tsx
.../saleOrder/agentOrder/components/theInvoiceList/index.tsx
+12
-14
index.ts
src/pages/transaction/saleOrder/agentOrder/effects/index.ts
+15
-14
No files found.
src/pages/transaction/purchaseOrder/index.tsx
View file @
3f6242e8
...
...
@@ -218,7 +218,7 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
return
current
&&
current
<
moment
().
startOf
(
'day'
)
}
}
if
(
!
_data
.
deliveryTime
)
{
// 有时间段 时间控件不显示时分
if
(
_data
.
deliveryTime
)
{
// 有时间段 时间控件不显示时分
state
.
props
[
'x-component-props'
].
showTime
=
false
state
.
props
[
'x-component-props'
].
format
=
'YYYY-MM-DD'
}
else
{
...
...
@@ -244,9 +244,7 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
adjustActions
.
submit
().
then
(
async
({
values
}:
any
)
=>
{
let
params
=
{...
values
}
if
(
values
?.
timeLine
)
{
const
timeLineArray
=
values
.
timeLine
.
split
(
'-'
)
params
.
startTime
=
timeLineArray
[
0
]
params
.
endTime
=
timeLineArray
[
1
]
params
.
deliverPeriod
=
`
${
params
.
deliverDate
}
${
params
.
timeLine
}
`
}
const
result
=
await
PublicApi
.
postOrderBuyerUpdateDeliveryTime
(
params
)
if
(
result
.
code
===
1000
)
{
...
...
src/pages/transaction/saleOrder/agentOrder/apis/index.ts
View file @
3f6242e8
...
...
@@ -31,8 +31,8 @@ export const fetchOrderApi = {
return
data
},
/** 获取发票列表 */
async
getInvoicesList
()
{
const
{
data
}
=
await
PublicApi
.
getSettleAccounts
InvoiceMessageList
(
)
async
getInvoicesList
(
params
)
{
const
{
data
}
=
await
PublicApi
.
getSettleAccounts
AgentInvoiceMessageList
(
params
)
return
data
},
/** 获取支付信息列表 */
...
...
src/pages/transaction/saleOrder/agentOrder/components/invoiceModal/index.tsx
View file @
3f6242e8
...
...
@@ -9,7 +9,8 @@ export interface InvoiceModalProps {
mode
:
'add'
|
'edit'
|
'preview'
|
'default'
|
'delete'
,
currentRef
?:
any
,
formInitValue
?:
any
,
reload
?()
reload
?(),
ctx
:
any
,
}
const
schemaActions
=
createFormActions
()
...
...
@@ -20,7 +21,7 @@ const modelTitle = {
}
const
InvoiceModal
:
React
.
FC
<
InvoiceModalProps
>
=
(
props
)
=>
{
const
{
mode
,
formInitValue
}
=
props
const
{
mode
,
formInitValue
,
ctx
}
=
props
const
selfInitValue
=
useMemo
(()
=>
mode
===
'add'
?
null
:
formInitValue
,
[
mode
,
formInitValue
])
// 由于默认是number类型, 但switch组件只接收boolean
...
...
@@ -40,8 +41,12 @@ const InvoiceModal:React.FC<InvoiceModalProps> = (props) => {
}
const
handleSubmit
=
async
(
value
)
=>
{
const
subMemberId
=
ctx
.
getFieldValue
(
'buyerMemberId'
)
const
subRoleId
=
ctx
.
getFieldValue
(
'buyerRoleId'
)
const
params
=
{
...
value
,
subMemberId
,
subRoleId
,
isDefault
:
value
?.
isDefault
?
1
:
0
}
const
fn
=
mode
===
'edit'
?
PublicApi
.
postSettleAccountsInvoiceMessageUpdate
:
PublicApi
.
postSettleAccountsInvoiceMessageAdd
...
...
@@ -61,6 +66,7 @@ const InvoiceModal:React.FC<InvoiceModalProps> = (props) => {
editable=
{
mode
!==
'preview'
}
effects=
{
(
$
,
{
setFieldState
})
=>
{
$
(
'onFormMount'
).
subscribe
(()
=>
{
})
}
}
currentRef=
{
props
.
currentRef
}
...
...
src/pages/transaction/saleOrder/agentOrder/components/theInvoiceList/index.tsx
View file @
3f6242e8
import
React
,
{
useState
,
useRef
,
useMemo
}
from
'react'
import
{
ISchemaFieldComponentProps
,
useFieldState
,
FormEffectHooks
,
createFormActions
}
from
'@formily/antd'
import
React
,
{
useState
,
useRef
}
from
'react'
import
{
ISchemaFieldComponentProps
,
useFieldState
}
from
'@formily/antd'
import
{
Button
,
Radio
}
from
'antd'
import
{
PlusOutlined
,
CaretUpOutlined
,
CaretDownOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
...
...
@@ -37,8 +37,6 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
})
}
}
else
if
(
pageStatus
===
PageStatus
.
EDIT
){
// @bug todo 编辑情况下 默认显示有问题 固定第一个
// console.log(value, mode, dataSource, 'EDIT')
if
(
typeof
value
===
'object'
)
{
// let target = (mode === 'add' || mode === 'delete') ? dataSource[0] : value
let
target
=
value
;
...
...
@@ -52,7 +50,6 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
showMore
,
useValue
:
target
})
// console.log('isObject', target)
mutators
.
change
(
target
)
}
else
{
let
target
=
dataSource
.
length
?
dataSource
.
find
(
v
=>
v
.
id
===
value
)
:
value
...
...
@@ -61,7 +58,6 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
showMore
,
useValue
:
target
})
// console.log('notObject', target)
mutators
.
change
(
target
)
}
}
...
...
@@ -91,7 +87,9 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
}
const
reload
=
()
=>
{
fetchOrderApi
.
getInvoicesList
().
then
(
data
=>
{
const
subMemberId
=
form
.
getFieldValue
(
'buyerMemberId'
)
const
subRoleId
=
form
.
getFieldValue
(
'buyerRoleId'
)
fetchOrderApi
.
getInvoicesList
({
subMemberId
,
subRoleId
}).
then
(
data
=>
{
if
(
!
data
.
length
)
{
form
.
setFieldValue
(
"needTheInvoice"
,
0
)
}
...
...
@@ -125,7 +123,9 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
const
handleDelete
=
async
(
id
,
e
)
=>
{
// 选中当前的删除
e
.
stopPropagation
()
try
{
const
result
=
await
PublicApi
.
postSettleAccountsInvoiceMessageDelete
({
id
})
const
subMemberId
=
form
.
getFieldValue
(
'buyerMemberId'
)
const
subRoleId
=
form
.
getFieldValue
(
'buyerRoleId'
)
const
result
=
await
PublicApi
.
postSettleAccountsAgentInvoiceMessageDelete
({
id
,
subMemberId
,
subRoleId
})
if
(
result
.
code
===
1000
)
{
reload
()
setMode
(
'delete'
)
...
...
@@ -145,14 +145,12 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
const
handleSetDefault
=
async
(
item
,
e
)
=>
{
e
.
stopPropagation
()
const
{
data
}
=
await
PublicApi
.
postSettleAccountsInvoiceMessageUpdate
({...
item
,
isDefault
:
item
.
isDefault
?
0
:
1
})
const
subMemberId
=
form
.
getFieldValue
(
'buyerMemberId'
)
const
subRoleId
=
form
.
getFieldValue
(
'buyerRoleId'
)
const
{
data
}
=
await
PublicApi
.
postSettleAccountsAgentInvoiceMessageUpdate
({...
item
,
subMemberId
,
subRoleId
,
isDefault
:
item
.
isDefault
?
0
:
1
})
reload
()
}
// @tofix bug 添加或删除发票后 useValue Radio默认值是操作的数据 导致无法选中
// console.log(useValue, 'useValue', dataSource, 'dataSource', mode, value, 'value')
return
(
<
div
style=
{
{
width
:
'100%'
}
}
className=
{
styles
.
invoice
}
>
{
editable
&&
<
Button
block
onClick=
{
handleAdd
}
icon=
{
<
PlusOutlined
/>
}
>
新增发票
</
Button
>
}
...
...
@@ -199,7 +197,7 @@ const TheInvoiceList = (props: ISchemaFieldComponentProps) => {
</
div
>
}
<
InvoiceModal
mode=
{
mode
}
formInitValue=
{
formInitValue
}
currentRef=
{
modalRef
}
reload=
{
reload
}
/>
<
InvoiceModal
mode=
{
mode
}
formInitValue=
{
formInitValue
}
currentRef=
{
modalRef
}
reload=
{
reload
}
ctx=
{
form
}
/>
</
div
>
)
...
...
src/pages/transaction/saleOrder/agentOrder/effects/index.ts
View file @
3f6242e8
...
...
@@ -145,20 +145,17 @@ export const useOrderDeliverTimeEffect = async (ctx: ISchemaFormActions | ISchem
// 表单初始化时,对应操作
export
const
useOrderFormInitEffect
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
// FormEffectHooks.onFormMount$().subscribe(async () => {
// // 写入收货地址数据
// useProductAddress(ctx)
// })
FormEffectHooks
.
onFieldValueChange$
(
'hasInvoice'
).
subscribe
(
state
=>
{
if
(
state
.
value
)
{
useInvoiceList
(
ctx
)
}
})
// 采购会员变动 获取收货地址
// 采购会员变动 获取收货地址
和发票
FormEffectHooks
.
onFieldValueChange$
(
'buyerMemberMajorId'
).
subscribe
(
state
=>
{
if
(
state
.
value
)
{
const
member
=
state
.
values
[
1
]
useProductAddress
(
ctx
,
member
[
'memberId'
],
member
[
'roleId'
])
// useInvoiceList(ctx)
}
})
}
...
...
@@ -178,16 +175,20 @@ export const useProductAddress = (ctx: ISchemaFormActions | ISchemaFormAsyncActi
// 获取发票信息
export
const
useInvoiceList
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
fetchOrderApi
.
getInvoicesList
().
then
(
data
=>
{
ctx
.
setFieldState
(
'theInvoiceId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
const
subMemberId
=
ctx
.
getFieldValue
(
'buyerMemberId'
)
const
subRoleId
=
ctx
.
getFieldValue
(
'buyerRoleId'
)
if
(
subMemberId
&&
subRoleId
)
{
fetchOrderApi
.
getInvoicesList
({
subMemberId
,
subRoleId
}).
then
(
data
=>
{
ctx
.
setFieldState
(
'theInvoiceId'
,
state
=>
{
if
(
data
.
length
>
0
&&
!
state
.
value
)
{
// 初始化时存在数据, 默认帮用户选中第一个
state
.
value
=
data
[
0
]
}
state
.
dataSource
=
data
state
.
showMore
=
data
.
length
>
3
})
})
}
)
}
}
// 高级筛选schema中用于输入搜索商品品类的Effect
...
...
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