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
1b7cd0b6
Commit
1b7cd0b6
authored
May 13, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复 合同订单 退款金额为0的问题
parent
1f578402
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
85 additions
and
48 deletions
+85
-48
index.ts
...afterService/components/ReturnInfoDrawer/effects/index.ts
+0
-5
useBusinessEffects.ts
...components/ReturnInfoDrawer/effects/useBusinessEffects.ts
+31
-14
index.less
...pages/afterService/components/ReturnInfoDrawer/index.less
+0
-16
index.tsx
src/pages/afterService/components/ReturnInfoDrawer/index.tsx
+38
-4
index.ts
.../afterService/components/ReturnInfoDrawer/schema/index.ts
+9
-5
index.tsx
...cation/exchangePrSubmit/components/ExchangeForm/index.tsx
+1
-1
index.tsx
...pplication/repairPrSubmit/components/RepairForm/index.tsx
+1
-1
index.tsx
...Service/returnApplication/components/DetailInfo/index.tsx
+1
-0
index.tsx
...pplication/returnPrSubmit/components/ReturnForm/index.tsx
+3
-2
index.tsx
...afterService/returnManage/components/DetailInfo/index.tsx
+1
-0
No files found.
src/pages/afterService/components/ReturnInfoDrawer/effects/index.ts
View file @
1b7cd0b6
...
...
@@ -6,11 +6,7 @@
* @Description:
*/
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
{
PublicApi
}
from
'@/services/api'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
}
=
actions
;
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/afterService/components/ReturnInfoDrawer/effects/useBusinessEffects.ts
View file @
1b7cd0b6
...
...
@@ -2,12 +2,16 @@
* @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-0
2-24 17:25:15
* @LastEditTime: 2021-0
5-13 11:43:00
* @Description: 联动逻辑相关
*/
import
BigNumber
from
'bignumber.js'
;
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
FormEffectHooks
}
from
'@formily/antd'
;
import
{
ORDER_TYPE_INQUIRY_CONTRACT
,
ORDER_TYPE_BIDDING_CONTRACT
,
ORDER_TYPE_TENDER_CONTRACT
,
}
from
'@/constants/order'
;
const
{
onFieldInputChange$
,
...
...
@@ -18,36 +22,49 @@ export const useBusinessEffects = (context, actions) => {
const
{
getFieldValue
,
setFieldValue
,
getFieldState
,
setFieldState
,
}
=
actions
;
const
linkage
=
useLinkageUtils
();
// 联动退款金额
onFieldValueChange$
(
'payList.*.refundAmount'
).
subscribe
(
fieldState
=>
{
const
payListValue
=
getFieldValue
(
'payList'
);
onFieldValueChange$
(
'payList.*.refundAmount'
).
subscribe
(
async
()
=>
{
const
payListValue
=
await
getFieldValue
(
'payList'
);
const
amount
=
payListValue
.
reduce
((
pre
,
now
)
=>
new
BigNumber
(
+
now
.
refundAmount
).
plus
(
pre
).
toNumber
(),
0
);
setFieldValue
(
'refundAmount'
,
amount
);
});
// 退款数量 联动,支付信息里边的 退款金额
onFieldInputChange$
(
'returnCount'
).
subscribe
(
fieldState
=>
{
onFieldInputChange$
(
'returnCount'
).
subscribe
(
async
(
fieldState
)
=>
{
const
{
value
}
=
fieldState
;
const
purchasePriceValue
=
getFieldValue
(
'purchasePrice'
);
const
newData
=
[...
getFieldValue
(
'payList'
)].
map
(
item
=>
{
const
purchasePriceValue
=
await
getFieldValue
(
'purchasePrice'
);
const
orderTypeValue
=
await
getFieldValue
(
'orderType'
);
const
payListValue
=
await
getFieldValue
(
'payList'
);
const
isMateriel
=
(
orderTypeValue
===
ORDER_TYPE_INQUIRY_CONTRACT
||
orderTypeValue
===
ORDER_TYPE_BIDDING_CONTRACT
||
orderTypeValue
===
ORDER_TYPE_TENDER_CONTRACT
);
const
newData
=
[...
payListValue
].
map
(
item
=>
{
const
refundAmount
=
item
.
payTime
?
+
(
new
BigNumber
(
+
value
).
multipliedBy
(
purchasePriceValue
).
multipliedBy
(
new
BigNumber
(
item
.
payRatio
).
dividedBy
(
100
))).
toFixed
(
2
)
:
0
;
return
{
...
item
,
refundAmount
:
item
.
payTime
?
+
(
new
BigNumber
(
+
value
).
multipliedBy
(
purchasePriceValue
).
multipliedBy
(
new
BigNumber
(
item
.
payRatio
).
dividedBy
(
100
))).
toFixed
(
2
)
:
0
,
refundAmount
,
};
});
setFieldValue
(
'payList'
,
newData
);
if
(
isMateriel
)
{
const
refundAmount
=
+
(
new
BigNumber
(
+
value
).
multipliedBy
(
purchasePriceValue
).
toFixed
(
2
));
setFieldValue
(
'refundAmount'
,
refundAmount
);
}
});
// 校验退货数量
onFieldInputChange$
(
'returnCount'
).
subscribe
(
fieldState
=>
{
onFieldInputChange$
(
'returnCount'
).
subscribe
(
async
(
fieldState
)
=>
{
const
{
name
,
value
}
=
fieldState
;
//
采购
数量
const
remainingValue
=
getFieldValue
(
'remaining'
);
//
剩余
数量
const
remainingValue
=
await
getFieldValue
(
'remaining'
);
setFieldState
(
'returnCount'
,
...
...
src/pages/afterService/components/ReturnInfoDrawer/index.less
View file @
1b7cd0b6
.paneTitle {
padding-left: 6px;
margin-bottom: 24px;
line-height: 14px;
font-size: 14px;
font-weight: 400;
color: #606266;
border-left: 2px solid #00B37A;
}
.payInfo {
&-item {
margin-bottom: 16px;
}
}
\ No newline at end of file
src/pages/afterService/components/ReturnInfoDrawer/index.tsx
View file @
1b7cd0b6
...
...
@@ -2,20 +2,25 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 17:36:45
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-0
1-22 11:07:42
* @LastEditTime: 2021-0
5-13 11:46:56
* @Description: 查看退货数量与退款金额 抽屉
*/
import
React
from
'react'
;
import
{
Drawer
,
Button
}
from
'antd'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
createFormActions
}
from
'@formily/antd'
;
import
{
createAsyncFormActions
}
from
'@formily/antd'
;
import
{
ORDER_TYPE_INQUIRY_CONTRACT
,
ORDER_TYPE_BIDDING_CONTRACT
,
ORDER_TYPE_TENDER_CONTRACT
,
}
from
'@/constants/order'
;
import
schema
from
'./schema'
;
import
{
createEffects
}
from
'./effects'
;
import
Stamp
from
'../Stamp'
;
import
SteamerTicket
from
'./components/SteamerTicket'
;
import
styles
from
'./index.less'
;
const
schemaAction
=
createFormActions
();
const
schemaAction
=
create
Async
FormActions
();
export
interface
PayListItem
{
/**
...
...
@@ -62,6 +67,10 @@ export interface OrderInfo {
*/
orderNo
:
string
;
/**
* 订单类型
*/
orderType
:
number
;
/**
* 商品名称
*/
productName
:
string
;
...
...
@@ -108,9 +117,21 @@ export interface OrderInfo {
};
interface
ReturnInfoDrawerProps
{
/**
* 是否可见
*/
visible
:
boolean
;
/**
* 订单信息
*/
orderInfo
:
OrderInfo
;
/**
* 关闭触发事件
*/
onClose
:
()
=>
void
;
/**
* form 提交触发事件
*/
onSubmit
?:
(
values
:
{
[
key
:
string
]:
any
})
=>
void
;
/**
* 是否是编辑的
...
...
@@ -134,7 +155,7 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
const
handleSubmit
=
values
=>
{
if
(
onSubmit
)
{
const
{
remaining
,
...
rest
}
=
values
;
const
{
remaining
,
orderType
,
...
rest
}
=
values
;
onSubmit
(
rest
);
}
else
{
onClose
();
...
...
@@ -182,7 +203,20 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
}
}
editable=
{
isEdit
}
effects=
{
(
$
,
actions
)
=>
{
const
{
setFieldState
}
=
actions
;
const
{
orderType
}
=
orderInfo
;
const
isMateriel
=
(
orderType
===
ORDER_TYPE_INQUIRY_CONTRACT
||
orderType
===
ORDER_TYPE_BIDDING_CONTRACT
||
orderType
===
ORDER_TYPE_TENDER_CONTRACT
);
createEffects
(
$
,
actions
);
if
(
isMateriel
)
{
setFieldState
(
'REPOSIT_TABS'
,
state
=>
{
state
.
props
[
'x-component-props'
].
hiddenKeys
=
[
'tab-2'
]
});
}
}
}
onSubmit=
{
handleSubmit
}
actions=
{
schemaAction
}
...
...
src/pages/afterService/components/ReturnInfoDrawer/schema/index.ts
View file @
1b7cd0b6
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 14:20:17
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-
07 16:44:47
* @LastEditTime: 2021-05-
13 11:23:45
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
...
...
@@ -79,10 +79,6 @@ const schema: ISchema = {
addonBefore
:
'¥ '
},
},
remaining
:
{
type
:
'string'
,
display
:
false
,
},
returnCount
:
{
type
:
'string'
,
title
:
'退货数量'
,
...
...
@@ -103,6 +99,14 @@ const schema: ISchema = {
},
],
},
remaining
:
{
type
:
'string'
,
display
:
false
,
},
orderType
:
{
type
:
'string'
,
display
:
false
,
},
},
},
},
...
...
src/pages/afterService/exchangeApplication/exchangePrSubmit/components/ExchangeForm/index.tsx
View file @
1b7cd0b6
...
...
@@ -269,6 +269,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
}
);
setOrderTypeValue
(
rest
.
orderType
);
setDetailInfo
({
proofFileList
:
faultFileList
.
map
(
item
=>
normalizeFiledata
(
item
.
filePath
)),
deliveryAddress
:
{
...
...
@@ -315,7 +316,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
})),
...
rest
,
});
setOrderTypeValue
(
rest
.
orderType
);
setGoodsValue
(
goodsDetailList
.
map
(
item
=>
item
.
orderRecordId
));
}
}).
finally
(()
=>
{
...
...
src/pages/afterService/repairApplication/repairPrSubmit/components/RepairForm/index.tsx
View file @
1b7cd0b6
...
...
@@ -254,6 +254,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
}
);
setOrderTypeValue
(
rest
.
orderType
);
setDetailInfo
({
...
detailInfo
,
faultFileList
:
faultFileList
.
map
(
item
=>
normalizeFiledata
(
item
.
filePath
)),
...
...
@@ -271,7 +272,6 @@ const RepairForm: React.FC<BillsFormProps> = ({
,
...
rest
,
});
setOrderTypeValue
(
rest
.
orderType
);
}
}).
finally
(()
=>
{
setInfoLoading
(
false
);
...
...
src/pages/afterService/returnApplication/components/DetailInfo/index.tsx
View file @
1b7cd0b6
...
...
@@ -118,6 +118,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
payWayTxt
:
item
.
payWayName
,
channelTxt
:
item
.
channelName
,
})),
orderType
:
detailInfo
?.
orderType
,
});
setVisibleReturnInfo
(
true
);
};
...
...
src/pages/afterService/returnApplication/returnPrSubmit/components/ReturnForm/index.tsx
View file @
1b7cd0b6
...
...
@@ -262,6 +262,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
returnBatch
,
returnId
,
roleId
,
refundList
,
...
rest
}
=
res
.
data
;
...
...
@@ -303,6 +304,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
...
rest
,
});
setOrderTypeValue
(
rest
.
orderType
);
setReturnGoodsList
(
goodsDetailList
.
map
(
item
=>
({
...
item
,
remaining
:
item
.
purchaseCount
||
0
,
// 可退货数量,这里取 采购数量判断即可
...
...
@@ -315,7 +317,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
associated
:
!
item
.
materielId
?
''
:
`
${
item
.
productId
}
/
${
item
.
productName
}
/
${
item
.
category
}
/
${
item
.
brand
}
`
,
materielNameAndType
:
`
${
item
.
materielName
||
''
}${
item
.
materielType
?
'/'
+
item
.
materielType
:
''
}
`
,
})));
setOrderTypeValue
(
rest
.
orderType
);
setGoodsValue
(
goodsDetailList
.
map
(
item
=>
item
.
orderRecordId
));
}
}).
finally
(()
=>
{
...
...
@@ -473,7 +474,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
extraData
,
needReturnName
,
isNeedReturn
,
refundAmount
,
associated
,
materielNameAndType
,
...
rest
...
...
@@ -623,6 +623,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
payList
:
item
.
extraData
.
payList
,
remaining
:
item
.
extraData
.
remaining
,
returnReason
:
item
.
extraData
.
returnReason
,
orderType
:
orderTypeValue
,
});
setVisibleReturnInfoDrawer
(
true
)
};
...
...
src/pages/afterService/returnManage/components/DetailInfo/index.tsx
View file @
1b7cd0b6
...
...
@@ -123,6 +123,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
payWayTxt
:
item
.
payWayName
,
channelTxt
:
item
.
channelName
,
})),
orderType
:
detailInfo
?.
orderType
,
});
setVisibleReturnInfo
(
true
);
};
...
...
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