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
691c8f14
Commit
691c8f14
authored
Aug 17, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对接新增售后换货简单流程
parent
424ede16
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
89 deletions
+154
-89
index.tsx
...cation/exchangePrSubmit/components/ExchangeForm/index.tsx
+142
-68
index.ts
.../exchangePrSubmit/components/ExchangeForm/schema/index.ts
+12
-21
No files found.
src/pages/afterService/exchangeApplication/exchangePrSubmit/components/ExchangeForm/index.tsx
View file @
691c8f14
...
@@ -7,7 +7,7 @@ import moment from 'moment';
...
@@ -7,7 +7,7 @@ import moment from 'moment';
import
{
findLastIndex
}
from
'lodash'
;
import
{
findLastIndex
}
from
'lodash'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
SaveOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
SaveOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetAsReplaceGoodsPageReturnedGoodsResponseDetail
}
from
'@/services/AfterServiceV2Api'
;
import
{
GetAsReplaceGoodsPageReturnedGoodsResponseDetail
}
from
'@/services/AfterServiceV2Api'
;
import
{
normalizeFiledata
,
FileData
}
from
'@/utils'
;
import
{
normalizeFiledata
,
FileData
}
from
'@/utils'
;
...
@@ -49,7 +49,82 @@ interface BillsFormProps {
...
@@ -49,7 +49,82 @@ interface BillsFormProps {
* 订单id,从订单列表跳转过来的
* 订单id,从订单列表跳转过来的
*/
*/
orderId
?:
number
,
orderId
?:
number
,
};
}
type
ReplaceGoodsListItemType
=
{
/**
* 订单号
*/
orderNo
:
string
,
/**
* 商品id
*/
productId
:
string
,
/**
* 商品名称
*/
productName
:
string
,
/**
* 品类
*/
category
:
string
,
/**
* 品牌
*/
brand
:
string
,
/**
* 单位
*/
unit
:
string
,
/**
* 采购数量
*/
purchaseCount
:
number
,
/**
* 物料编号
*/
associatedProductId
:
string
,
/**
* 物料名称、规格
*/
associatedProductName
:
string
,
/**
* 物料品类
*/
associatedCategory
:
string
,
/**
* 物料品牌
*/
associatedBrand
:
string
,
/**
* 物料单位
*/
associatedUnit
:
string
,
/**
* 关联报价商品ID、名称、规格、品类、品牌
*/
associated
:
string
,
/**
* 采购单价
*/
purchasePrice
:
number
,
/**
* 采购金额
*/
purchaseAmount
:
number
,
/**
* 换货数量
*/
replaceCount
:
number
,
/**
* 换货理由
*/
replaceReason
:
string
,
/**
* 额外的数据
*/
extraData
:
{
[
key
:
string
]:
any
},
}
interface
DetailInfo
{
interface
DetailInfo
{
applyTime
:
string
;
applyTime
:
string
;
...
@@ -63,22 +138,29 @@ interface DetailInfo {
...
@@ -63,22 +138,29 @@ interface DetailInfo {
innerStatus
?:
number
,
innerStatus
?:
number
,
innerStatusName
?:
string
,
innerStatusName
?:
string
,
deliveryType
?:
number
,
deliveryType
?:
number
,
replaceGoodsList
?:
GetAsReplaceGoodsPageReturnedGoodsResponseDetail
[],
/**
/**
* 订单编号
* 订单编号
*/
*/
orderNo
?:
string
,
orderNo
?:
string
,
/**
* 商品数据
*/
replaceGoodsList
?:
ReplaceGoodsListItemType
[],
}
}
interface
OrderNoProps
{
interface
OrderNoProps
{
value
:
any
,
value
:
any
,
name
:
string
,
}
}
const
OrderNo
=
(
props
:
OrderNoProps
)
=>
{
const
OrderNo
=
(
props
:
OrderNoProps
)
=>
{
const
{
value
}
=
props
;
const
{
value
,
name
}
=
props
;
const
extraData
=
addSchemaAction
.
getFieldValue
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`replaceGoodsList.
${
$1
}
.extraData`
;
}));
return
(
return
(
<
a
<
a
href=
{
`/memberCenter/afterService/
exchangeApplication/exchangePrSubmit/orderDetail?orderNo=${value
}`
}
href=
{
`/memberCenter/afterService/
returnApplication/returnPrSubmit/orderDetail?id=${extraData?.orderId
}`
}
target=
"_blank"
target=
"_blank"
>
>
{
value
}
{
value
}
...
@@ -113,10 +195,9 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -113,10 +195,9 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
{
{
title
:
'订单号'
,
title
:
'订单号'
,
dataIndex
:
'orderNo'
,
dataIndex
:
'orderNo'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
render
:
(
text
,
record
)
=>
(
<
a
<
a
href=
{
`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/orderDetail?id=${record.
i
d}`
}
href=
{
`/memberCenter/afterService/exchangeApplication/exchangePrSubmit/orderDetail?id=${record.
orderI
d}`
}
target=
"_blank"
target=
"_blank"
>
>
{
text
}
{
text
}
...
@@ -125,30 +206,24 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -125,30 +206,24 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
},
},
{
{
title
:
'订单摘要'
,
title
:
'订单摘要'
,
dataIndex
:
'
orderThe'
,
dataIndex
:
'
digest'
,
align
:
'center'
,
ellipsis
:
true
,
},
},
{
{
title
:
'供应会员'
,
title
:
'供应会员'
,
dataIndex
:
'supplyMembersName'
,
dataIndex
:
'vendorMemberName'
,
align
:
'center'
,
},
},
{
{
title
:
'下单时间'
,
title
:
'下单时间'
,
dataIndex
:
'createTime'
,
dataIndex
:
'createTime'
,
align
:
'center'
,
render
:
text
=>
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
),
},
},
{
{
title
:
'订单状态'
,
title
:
'订单状态'
,
dataIndex
:
'outerStatusName'
,
dataIndex
:
'outerStatusName'
,
align
:
'center'
,
},
},
{
{
title
:
'订单类型'
,
title
:
'订单类型'
,
dataIndex
:
'type'
,
dataIndex
:
'orderTypeName'
,
align
:
'center'
,
render
:
text
=>
ORDER_TYPE2
[
text
],
},
},
isMateriel
?
{
isMateriel
?
{
title
:
'合同编号'
,
title
:
'合同编号'
,
...
@@ -166,74 +241,73 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -166,74 +241,73 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
].
filter
(
Boolean
)
as
ColumnType
<
any
>
[];
].
filter
(
Boolean
)
as
ColumnType
<
any
>
[];
const
childTableColumn
:
ColumnType
<
any
>
[]
=
([
const
childTableColumn
:
ColumnType
<
any
>
[]
=
([
!
isMateriel
?{
!
isMateriel
?
{
title
:
'商品ID'
,
title
:
'商品ID'
,
dataIndex
:
'productId'
,
dataIndex
:
'productNo'
,
align
:
'center'
,
}
:
{
}
:
{
title
:
'物料编号'
,
title
:
'物料编号'
,
dataIndex
:
'materialCode'
,
dataIndex
:
'productNo'
,
align
:
'center'
,
},
},
!
isMateriel
?
{
!
isMateriel
?
{
title
:
'商品名称'
,
title
:
'商品名称'
,
dataIndex
:
'
productN
ame'
,
dataIndex
:
'
n
ame'
,
align
:
'center'
,
ellipsis
:
true
,
}
:
{
}
:
{
title
:
'物料名称、规格'
,
title
:
'物料名称、规格'
,
dataIndex
:
'materialName'
,
dataIndex
:
'name'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
`
${
text
}
/
${
record
.
quotedSpec
}
`
,
render
:
(
text
,
record
)
=>
`
${
text
}
/
${
record
.
materialType
}
`
,
},
},
{
{
title
:
'品类'
,
title
:
'品类'
,
dataIndex
:
!
isMateriel
?
'category'
:
'materialCategory'
,
dataIndex
:
!
isMateriel
?
'category'
:
'quotedCategory'
,
align
:
'center'
,
},
},
{
{
title
:
'品牌'
,
title
:
'品牌'
,
dataIndex
:
!
isMateriel
?
'brand'
:
'materialBrand'
,
dataIndex
:
!
isMateriel
?
'brand'
:
'quotedBrand'
,
align
:
'center'
,
},
},
{
{
title
:
'单位'
,
title
:
'单位'
,
dataIndex
:
'unit'
,
dataIndex
:
'unit'
,
align
:
'center'
,
},
},
{
{
title
:
!
isPointsOrder
?
'订单数量'
:
'兑换数量'
,
title
:
!
isPointsOrder
?
'订单数量'
:
'兑换数量'
,
dataIndex
:
'purchaseCount'
,
dataIndex
:
'quantity'
,
align
:
'center'
,
},
},
{
{
title
:
!
isPointsOrder
?
'单价'
:
'所需积分'
,
title
:
!
isPointsOrder
?
'单价'
:
'所需积分'
,
dataIndex
:
'price'
,
dataIndex
:
'price'
,
align
:
'center'
,
},
},
{
{
title
:
!
isPointsOrder
?
'采购金额'
:
'所需积分小计'
,
title
:
!
isPointsOrder
?
'采购金额'
:
'所需积分小计'
,
dataIndex
:
'amount'
,
dataIndex
:
'paidAmount'
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
(
record
.
purchaseCount
*
record
.
price
).
toFixed
(
2
),
},
},
{
{
title
:
'已换货数量'
,
title
:
'已换货数量'
,
dataIndex
:
'replaceCount'
,
dataIndex
:
'exchangeCount'
,
align
:
'center'
,
},
},
]);
]);
// 根据供应会员获取订单列表
// 根据供应会员获取订单列表
const
getOrderList
=
(
params
):
Promise
<
OrderListRes
>
=>
{
const
getOrderList
=
(
params
):
Promise
<
OrderListRes
>
=>
{
const
supplierMemberValue
=
addSchemaAction
.
getFieldValue
(
'supplierMember'
);
const
supplierMemberValue
=
addSchemaAction
.
getFieldValue
(
'supplierMember'
);
const
{
startDate
=
null
,
endDate
=
null
}
=
params
;
const
payload
=
{
...
params
};
if
(
startDate
)
{
payload
.
startDate
=
moment
(
+
startDate
).
format
(
'YYYY-MM-DD'
);
}
if
(
endDate
)
{
payload
.
endDate
=
moment
(
+
endDate
).
format
(
'YYYY-MM-DD'
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getOrderOneBatchOrderList
({
PublicApi
.
getOrderCommonAfterSalePage
({
orderNo
:
detailInfo
.
orderNo
,
...
params
,
...
params
,
supplyMembersId
:
supplierMemberValue
[
0
].
memberId
,
vendorMemberId
:
supplierMemberValue
[
0
].
memberId
,
supplyMembersRoleId
:
supplierMemberValue
[
0
].
roleId
,
vendorRoleId
:
supplierMemberValue
[
0
].
roleId
,
type
:
orderTypeValue
,
orderType
:
orderTypeValue
,
afterSalesType
:
2
,
// 退货
orderNo
:
detailInfo
.
orderNo
?
detailInfo
.
orderNo
:
params
.
orderNo
||
undefined
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
);
resolve
(
res
.
data
);
...
@@ -269,7 +343,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -269,7 +343,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
manualReturnGoodsAddress
,
manualReturnGoodsAddress
,
replaceDeliveryGoodsList
,
replaceDeliveryGoodsList
,
replaceStatisticsList
,
replaceStatisticsList
,
taskType
,
taskType
Key
,
consumerName
,
consumerName
,
outerTaskList
,
outerTaskList
,
replaceBatch
,
replaceBatch
,
...
@@ -326,10 +400,9 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -326,10 +400,9 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
extraData
:
{
extraData
:
{
remaining
:
item
.
purchaseCount
||
0
,
// 已换货数量,这里取 采购数量判断即可
remaining
:
item
.
purchaseCount
||
0
,
// 已换货数量,这里取 采购数量判断即可
id
:
item
.
orderRecordId
,
id
:
item
.
orderRecordId
,
taskType
,
taskType
Key
,
},
},
associated
:
!
item
.
materielId
?
''
:
`
${
item
.
productId
}
/
${
item
.
productName
}
/
${
item
.
category
}
/
${
item
.
brand
}
`
,
associated
:
!
item
.
associatedProductId
?
''
:
`
${
item
.
associatedProductName
}
/
${
item
.
associatedType
}
/
${
item
.
associatedCategory
}
/
${
item
.
associatedBrand
}
`
,
materielNameAndType
:
`
${
item
.
materielName
||
''
}${
item
.
materielType
?
'/'
+
item
.
materielType
:
''
}
`
,
})),
})),
...
rest
,
...
rest
,
});
});
...
@@ -503,13 +576,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -503,13 +576,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
materielNameAndType
,
materielNameAndType
,
...
rest
...
rest
})
=>
({
})
=>
({
orderRecordId
:
extraData
.
id
,
...
rest
,
replaceCount
:
+
replaceCount
,
brand
:
brand
||
''
,
brand
:
brand
||
''
,
unit
:
unit
||
''
,
unit
:
unit
||
''
,
...
rest
,
orderRecordId
:
extraData
.
id
,
replaceCount
:
+
replaceCount
,
})),
})),
taskType
:
replaceGoodsList
[
0
].
extraData
.
taskType
,
taskType
Key
:
replaceGoodsList
[
0
].
extraData
.
taskTypeKey
,
};
};
PublicApi
.
postAsReplaceGoodsSave
(
payload
)
PublicApi
.
postAsReplaceGoodsSave
(
payload
)
...
@@ -566,34 +639,35 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...
@@ -566,34 +639,35 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
values
.
forEach
(
item
=>
{
values
.
forEach
(
item
=>
{
const
atom
=
{
const
atom
=
{
orderId
:
item
.
orderId
,
orderNo
:
item
.
orderNo
,
orderNo
:
item
.
orderNo
,
productId
:
item
.
product
Id
,
productId
:
item
.
product
No
,
productName
:
item
.
productName
,
productName
:
item
.
name
,
category
:
item
.
category
,
category
:
item
.
category
,
brand
:
item
.
brand
,
brand
:
item
.
brand
,
unit
:
item
.
unit
,
unit
:
item
.
unit
,
purchasePrice
:
item
.
price
,
purchasePrice
:
item
.
price
,
purchaseCount
:
item
.
purchaseCount
,
purchaseCount
:
item
.
quantity
,
purchaseAmount
:
+
(
item
.
price
*
item
.
purchaseCount
).
toFixed
(
2
),
purchaseAmount
:
+
(
item
.
price
*
item
.
quantity
).
toFixed
(
2
),
replaceCount
:
''
,
replaceReason
:
''
,
replaceReason
:
''
,
extraData
:
{
extraData
:
{
remaining
:
item
.
purchaseCount
-
(
item
.
replaceCount
||
0
),
// 可换货数量
remaining
:
item
.
quantity
-
(
item
.
exchangeCount
||
0
),
// 可换货数量
id
:
item
.
id
,
id
:
item
.
id
,
taskType
:
item
.
processEnum
,
taskTypeKey
:
item
.
processKey
,
orderId
:
item
.
orderId
,
},
},
isHasTax
:
item
.
tax
,
isHasTax
:
item
.
tax
,
taxRate
:
item
.
taxRate
,
taxRate
:
item
.
taxRate
,
contractId
:
item
.
contractId
,
contractId
:
item
.
contractId
,
contractNo
:
item
.
contractNo
,
contractNo
:
item
.
contractNo
,
associated
:
!
isMateriel
?
''
:
`
${
item
.
productId
}
/
${
item
.
productName
}
/
${
item
.
category
}
/
${
item
.
brand
}
`
,
associated
:
!
isMateriel
?
''
:
`
${
item
.
quotedProductNo
}
/
${
item
.
quotedName
}
/
${
item
.
quotedSpec
}
/
${
item
.
quotedCategory
}
/
${
item
.
quotedBrand
}
`
,
materielId
:
item
.
materialId
,
associatedProductId
:
item
.
quotedProductNo
||
''
,
materielNo
:
item
.
materialCode
,
associatedProductName
:
`
${
item
.
quotedName
||
''
}
`
,
materielNameAndType
:
`
${
item
.
materialName
||
''
}${
item
.
materialType
?
'/'
+
item
.
materialType
:
''
}
`
,
associatedType
:
`
${
item
.
quotedSpec
||
''
}
`
,
materielName
:
item
.
materialName
,
associatedCategory
:
item
.
quotedCategory
||
''
,
materielType
:
item
.
materialType
,
associatedBrand
:
item
.
quotedBrand
||
''
,
materielCategory
:
item
.
materialCategory
,
associatedUnit
:
item
.
unit
||
''
,
materielBrand
:
item
.
materialBrand
,
materielUnit
:
item
.
materialUnit
,
};
};
value
.
push
(
atom
);
value
.
push
(
atom
);
});
});
...
...
src/pages/afterService/exchangeApplication/exchangePrSubmit/components/ExchangeForm/schema/index.ts
View file @
691c8f14
...
@@ -305,32 +305,27 @@ export const addSchema = (orderType: number): ISchema => {
...
@@ -305,32 +305,27 @@ export const addSchema = (orderType: number): ISchema => {
title
:
'订单号'
,
title
:
'订单号'
,
'x-component'
:
'OrderNo'
,
'x-component'
:
'OrderNo'
,
},
},
materielNo
:
{
associatedProductId
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'物料编号'
,
title
:
'物料编号'
,
'x-component'
:
'Text'
,
'x-component'
:
'Text'
,
},
},
materielNameAndTyp
e
:
{
associatedProductNam
e
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'物料名称、规格'
,
title
:
'物料名称、规格'
,
'x-component'
:
'Text'
,
'x-component'
:
'Text'
,
},
},
materielType
:
{
associatedCategory
:
{
type
:
'string'
,
title
:
'规格'
,
'x-component'
:
'Text'
,
},
materielCategory
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'品类'
,
title
:
'品类'
,
'x-component'
:
'Text'
,
'x-component'
:
'Text'
,
},
},
materiel
Brand
:
{
associated
Brand
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'品牌'
,
title
:
'品牌'
,
'x-component'
:
'Text'
,
'x-component'
:
'Text'
,
},
},
materiel
Unit
:
{
associated
Unit
:
{
type
:
'string'
,
type
:
'string'
,
title
:
'单位'
,
title
:
'单位'
,
'x-component'
:
'Text'
,
'x-component'
:
'Text'
,
...
@@ -397,11 +392,6 @@ export const addSchema = (orderType: number): ISchema => {
...
@@ -397,11 +392,6 @@ export const addSchema = (orderType: number): ISchema => {
}
}
],
],
},
},
// 不用于展示,只用于收集值
id
:
{
type
:
'string'
,
display
:
false
,
},
// 其他数据,不用于展示,只用于收集值
// 其他数据,不用于展示,只用于收集值
extraData
:
{
extraData
:
{
type
:
'string'
,
type
:
'string'
,
...
@@ -488,9 +478,9 @@ export const addSchema = (orderType: number): ISchema => {
...
@@ -488,9 +478,9 @@ export const addSchema = (orderType: number): ISchema => {
title
:
'退货发货地址'
,
title
:
'退货发货地址'
,
type
:
'string'
,
type
:
'string'
,
visible
:
false
,
visible
:
false
,
'x-component'
:
'
AddressFormItem
'
,
'x-component'
:
'
CustomAddressSelect
'
,
'x-component-props'
:
{
'x-component-props'
:
{
dataSource
:
[]
,
isDefaultAddress
:
true
,
},
},
'x-rules'
:
[
'x-rules'
:
[
{
{
...
@@ -504,9 +494,9 @@ export const addSchema = (orderType: number): ISchema => {
...
@@ -504,9 +494,9 @@ export const addSchema = (orderType: number): ISchema => {
title
:
'退货自提地址'
,
title
:
'退货自提地址'
,
type
:
'string'
,
type
:
'string'
,
visible
:
false
,
visible
:
false
,
'x-component'
:
'
AddressFormItem
'
,
'x-component'
:
'
CustomAddressSelect
'
,
'x-component-props'
:
{
'x-component-props'
:
{
dataSource
:
[]
,
isDefaultAddress
:
true
,
},
},
'x-rules'
:
[
'x-rules'
:
[
{
{
...
@@ -519,9 +509,10 @@ export const addSchema = (orderType: number): ISchema => {
...
@@ -519,9 +509,10 @@ export const addSchema = (orderType: number): ISchema => {
deliveryAddress
:
{
deliveryAddress
:
{
title
:
'换货收货地址'
,
title
:
'换货收货地址'
,
type
:
'string'
,
type
:
'string'
,
'x-component'
:
'
AddressFormItem
'
,
'x-component'
:
'
CustomAddressSelect
'
,
'x-component-props'
:
{
'x-component-props'
:
{
dataSource
:
[],
isDefaultAddress
:
true
,
addressType
:
1
,
},
},
'x-rules'
:
[
'x-rules'
:
[
{
{
...
...
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