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
2b9b2be2
Commit
2b9b2be2
authored
Jul 14, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改新增加工
parent
d4ebbe8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
131 deletions
+171
-131
schema.tsx
...andling/assign/create/components/ProductDrawer/schema.tsx
+3
-1
index.tsx
src/pages/handling/assign/create/index.tsx
+55
-130
types.ts
src/pages/handling/assign/create/types.ts
+113
-0
No files found.
src/pages/handling/assign/create/components/ProductDrawer/schema.tsx
View file @
2b9b2be2
...
...
@@ -88,10 +88,12 @@ const schema: ISchema = {
processNum
:
{
type
:
'string'
,
title
:
'加工数量'
,
required
:
true
},
processUnitPrice
:
{
title
:
"单价"
,
type
:
'string'
type
:
'string'
,
required
:
true
},
isHasTax
:
{
title
:
"是否含税"
,
...
...
src/pages/handling/assign/create/index.tsx
View file @
2b9b2be2
...
...
@@ -30,6 +30,7 @@ import { orderColumns, orderProductColumns } from './common/columns/orderColumn'
import
{
orderSchema
}
from
'./common/schemas/orderSchema'
import
{
filterExternalStateLabelList
}
from
'@/pages/transaction/common/statusList'
;
import
{
GetOrderProcessingOrderListResponseDetail
}
from
'@/services/OrderV2Api'
;
import
{
EnterpriceType
,
FileType
,
submitDataType
}
from
'./types'
const
formActions
=
createFormActions
();
const
{
onFieldInit$
,
onFieldValueChange$
}
=
FormEffectHooks
...
...
@@ -46,120 +47,6 @@ registerVirtualBox('MellowCardBox', (_props) => {
)
})
type
EnterpriceType
=
{
name
:
string
,
memberId
:
number
|
string
,
roleId
:
number
|
string
}
type
FileType
=
{
name
:
string
,
url
:
string
,
}
type
submitDataType
=
{
/** 物流地址id, 显示用,不提交 */
receivefullAddress
:
number
,
receiveAddress
:
string
receiveUserName
:
string
receiveUserTel
:
string
receiverAddressId
:
number
deliveryDate
:
string
,
/**配送方式 */
deliveryType
:
1
|
2
|
number
&
{},
/* 加工企业id */
processMemberId
:
number
,
processName
:
string
processRoleId
:
number
,
/** 来源 1 加工订单, 2 加工商品 */
source
:
1
|
2
|
number
&
{},
/** 通知单摘要 */
summary
:
string
,
orderList
?:
{
/** 品牌 */
brand
:
string
,
category
:
string
/** skuid */
commodityId
:
number
,
/** 附件 */
enclosure
:
FileType
[],
/** 订单商品,即下单的商品 唯一id */
id
:
string
,
/** 是否是 */
isHasTax
:
0
|
1
|
number
|
{},
/** 是否含税、税率,显示用 */
isHasTaxAndTaxRate
:
string
,
/** 商品图片 */
mainPic
:
string
,
/** 商品名 */
name
:
string
,
/** 订单id, 跟上面id 不一样 */
orderId
:
number
,
orderNo
:
string
,
/** 加工数量 */
processNum
:
string
,
/** 加工总价 = 加工数量 * 加工单价 */
processTotalPrice
:
string
,
/** 加工单价 */
processUnitPrice
:
string
,
/** 采购数量 或者叫订单数量 */
purchaseCount
:
number
/** 采购数量 跟 单位,只做显示用 */
purchaseCountAndUnit
:
string
,
/** skuid, 这里跟commodityId yizhi */
skuid
:
number
/** 加工剩余数量 */
surplusAndProcessNum
:
number
,
/** 税率 */
taxRate
:
string
,
/** 单位 */
unitName
:
string
,
/** 商品属性 */
productProps
:
{
name
:
string
,
value
:
string
,
}[]
}[],
/** 加工商品 */
productList
:
{
brand
:
string
,
category
:
string
,
/** 商品id */
commodityId
:
number
,
enclosure
:
FileType
[],
isHasTax
:
0
|
1
|
number
&
{}
isHasTaxAndTaxRate
:
string
,
mainPic
:
string
,
name
:
string
,
processNum
:
string
,
processTotalPrice
:
string
,
processUnitPrice
:
string
,
productProps
:
{
name
:
string
,
value
:
string
,
}[],
/** skuid */
skuid
:
number
,
taxRate
:
string
,
unitName
:
string
,
}[],
/** 其他说明 */
otherDesc
:
string
,
/** 包装说明 */
packingDesc
:
string
,
/** 付款说明 */
payDesc
:
string
,
/** 税费说明 */
taxDesc
:
string
,
/** 交付说明 */
deliveryDesc
:
string
,
/** 物资说明 */
materialDesc
:
string
,
enclosure
:
FileType
[]
}
/** @tofix 临时的,因为后端不返回只能值么临时搞着 */
const
MALL_NAME
=
{
"1"
:
"企业商城"
,
...
...
@@ -211,9 +98,11 @@ const Create = () => {
const
{
visible
:
processOrderVisible
,
toggle
:
processOrderToggle
}
=
useModal
();
const
[
orderProductSelectRowKeys
,
setOrderProductSelectRowKeys
]
=
useState
<
string
[]
>
([])
const
[
orderProductselectRowRecord
,
setOrderProductSelectRowRecord
]
=
useState
<
{[
key
:
string
]:
any
}[]
>
([]);
/** 勾选的加工订单数据 */
const
[
processOrder
,
setProcessOrder
]
=
useState
<
GetOrderProcessingOrderListResponseDetail
[]
>
([])
/** ---- 加工订单end ------- */
/** 订单数据 */
const
[
fetchedOrderData
,
setFetchOrderData
]
=
useState
<
GetOrderProcessingOrderListResponseDetail
[]
>
([])
/**
* 获取加工企业
*/
...
...
@@ -349,9 +238,7 @@ const Create = () => {
const
handleBeforeProductChecked
=
useCallback
(
async
(
record
:
GetProductCommodityCommonGetCommodityListByBuyerResponseDetail
,
selected
:
boolean
,
list
:
GetProductCommodityCommonGetCommodityListByBuyerResponseDetail
[])
=>
{
const
postData
=
list
.
map
((
item
)
=>
{
return
{
/**
* 这里指的是skuid, 而接口getProductCommodityCommonGetCommodityListByBuyer 的主键id 就是skuid, 不是(commodityId)
*/
/** * 这里指的是skuid, 而接口getProductCommodityCommonGetCommodityListByBuyer 的主键id 就是skuid, 不是(commodityId)*/
productId
:
item
.
id
,
memberId
:
item
.
memberId
||
authInfo
.
memberId
,
memberRoleId
:
item
.
memberRoleId
||
authInfo
.
memberRoleId
,
...
...
@@ -360,7 +247,11 @@ const Create = () => {
type
:
5
,
}
})
const
{
code
,
data
,
...
rest
}
=
await
PublicApi
.
postOrderGetProcessEnum
({
list
:
postData
},
{
ctlType
:
'none'
});
return
await
checkProcessEnum
(
postData
);
},
[])
const
checkProcessEnum
=
async
(
list
:
{
productId
:
number
,
memberId
:
number
,
memberRoleId
:
number
,
shopId
:
number
,
type
:
number
}[])
=>
{
const
{
code
,
data
,
...
rest
}
=
await
PublicApi
.
postOrderGetProcessEnum
({
list
:
list
},
{
ctlType
:
'none'
});
if
(
code
!==
1000
)
{
message
.
error
(
rest
.
message
);
return
false
...
...
@@ -378,8 +269,9 @@ const Create = () => {
message
.
error
(
"当前所选商品配置的工作流不一致"
);
return
false
}
return
true
}
,
[])
}
/**
* 确认勾选加工商品
...
...
@@ -445,7 +337,6 @@ const Create = () => {
}
else
{
setProcessProduct
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
skuid
!==
target
.
skuid
));
formActions
.
setFieldValue
(
'detail.layout1.productList'
,
productList
)
}
}
...
...
@@ -532,15 +423,32 @@ const Create = () => {
/** ------- 加工订单相关 -------*/
const
onSelectChange
=
async
(
record
:
GetOrderProcessingOrderListResponseDetail
[
"productDateilss"
][
0
],
selected
:
boolean
,
selectedRows
)
=>
{
const
currentOrderData
=
fetchedOrderData
?.
filter
((
_item
)
=>
_item
.
id
===
record
.
orderId
)[
0
];
const
key
=
`
${
record
.
orderId
}
_
${
record
.
id
}
`
if
(
!
selected
)
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
(
_row
!==
key
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
!==
key
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
record
.
orderId
))
}
else
{
const
children
=
currentOrderData
.
productDateilss
;
const
tempData
=
orderProductselectRowRecord
.
concat
(
record
);
const
keysList
=
tempData
.
filter
((
_item
)
=>
_item
.
includes
(
record
.
orderId
.
toString
()));
// const formatData = tempData.map((_item) => {
// return {
// productId: _item.productId,
// memberId: _item.memberId || authInfo.memberId,
// memberRoleId: _item.memberRoleId || authInfo.memberRoleId,
// shopId: ENTERPRISE_MALL[authInfo.memberType],
// /** 1.订单交易流程2.售后换货流程3.售后退货流程4.售后维修流程, @todo 5是后端说的,具体不知道代表什么意思? */
// type: 5,
// }
// })
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
concat
(
key
))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
concat
(
record
))
setOrderProductSelectRowRecord
(
tempData
)
if
(
children
.
length
===
keysList
.
length
)
{
setProcessOrder
((
prev
)
=>
prev
.
concat
(
currentOrderData
))
}
}
};
const
orderProductRowSelection
=
{
...
...
@@ -553,6 +461,7 @@ const Create = () => {
const
handleFetchOrderList
=
useCallback
(
async
(
params
:
any
)
=>
{
const
{
data
,
code
}
=
await
PublicApi
.
getOrderProcessingOrderList
(
params
as
any
);
if
(
code
===
1000
)
{
setFetchOrderData
(
data
.
data
);
return
data
}
return
{
...
...
@@ -561,7 +470,7 @@ const Create = () => {
}
},
[])
/** @tofix 有bug */
const
handleBeforeOrderChecked
=
(
record
:
GetOrderProcessingOrderListResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderProcessingOrderListResponseDetail
[])
=>
{
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrderProcessingOrderListResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderProcessingOrderListResponseDetail
[])
=>
{
const
{
productDateilss
,
orderNo
,
id
}
=
record
;
const
keys
=
productDateilss
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
);
if
(
checked
)
{
...
...
@@ -574,15 +483,29 @@ const Create = () => {
}
})
)
setOrderProductSelectRowKeys
(
uniqueKeys
);
setOrderProductSelectRowRecord
(
uniqueList
)
setProcessOrder
((
prev
)
=>
prev
.
concat
(
record
))
const
formatData
=
uniqueList
.
map
((
_item
)
=>
{
return
{
productId
:
_item
.
productId
,
memberId
:
_item
.
memberId
||
authInfo
.
memberId
,
memberRoleId
:
_item
.
memberRoleId
||
authInfo
.
memberRoleId
,
shopId
:
ENTERPRISE_MALL
[
authInfo
.
memberType
],
/** 1.订单交易流程2.售后换货流程3.售后退货流程4.售后维修流程, @todo 5是后端说的,具体不知道代表什么意思? */
type
:
5
,
}
})
const
res
=
await
checkProcessEnum
(
formatData
);
if
(
res
)
{
setOrderProductSelectRowKeys
(
uniqueKeys
);
setOrderProductSelectRowRecord
(
uniqueList
)
setProcessOrder
((
prev
)
=>
prev
.
concat
(
record
))
return
true
}
return
false
}
else
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
_row
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
`
${
_row
.
orderId
}
_
${
_row
.
id
}
`
)))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
id
))
}
return
true
;
}
const
tiggerProcessOrderProductOk
=
()
=>
{
...
...
@@ -640,7 +563,7 @@ const Create = () => {
return
[]
},
[])
const
onSubmit
=
(
value
:
submitDataType
)
=>
{
const
onSubmit
=
async
(
value
:
submitDataType
)
=>
{
console
.
log
(
value
)
const
{
receivefullAddress
,
...
...
@@ -748,7 +671,9 @@ const Create = () => {
...
restData
}
console
.
info
(
postData
,
orderListFormated
);
// const service = pathname.includes("edit") ? PublicApi.postEnhanceSupplierToBeAddUpdate : PublicApi.postEnhanceSupplierToBeAddAdd
// const withId = pathname.includes("edit") ? { id: editInfo.id, ...postData}: postData;
// const { data, code } = await PublicApi.postEnhanceSupplierToBeAddAdd(postData)
}
return
(
...
...
src/pages/handling/assign/create/types.ts
0 → 100644
View file @
2b9b2be2
export
type
EnterpriceType
=
{
name
:
string
,
memberId
:
number
|
string
,
roleId
:
number
|
string
}
export
type
FileType
=
{
name
:
string
,
url
:
string
,
}
export
type
submitDataType
=
{
/** 物流地址id, 显示用,不提交 */
receivefullAddress
:
number
,
receiveAddress
:
string
receiveUserName
:
string
receiveUserTel
:
string
receiverAddressId
:
number
deliveryDate
:
string
,
/**配送方式 */
deliveryType
:
1
|
2
|
number
&
{},
/* 加工企业id */
processMemberId
:
number
,
processName
:
string
processRoleId
:
number
,
/** 来源 1 加工订单, 2 加工商品 */
source
:
1
|
2
|
number
&
{},
/** 通知单摘要 */
summary
:
string
,
orderList
?:
{
/** 品牌 */
brand
:
string
,
category
:
string
/** skuid */
commodityId
:
number
,
/** 附件 */
enclosure
:
FileType
[],
/** 订单商品,即下单的商品 唯一id */
id
:
string
,
/** 是否是 */
isHasTax
:
0
|
1
|
number
|
{},
/** 是否含税、税率,显示用 */
isHasTaxAndTaxRate
:
string
,
/** 商品图片 */
mainPic
:
string
,
/** 商品名 */
name
:
string
,
/** 订单id, 跟上面id 不一样 */
orderId
:
number
,
orderNo
:
string
,
/** 加工数量 */
processNum
:
string
,
/** 加工总价 = 加工数量 * 加工单价 */
processTotalPrice
:
string
,
/** 加工单价 */
processUnitPrice
:
string
,
/** 采购数量 或者叫订单数量 */
purchaseCount
:
number
/** 采购数量 跟 单位,只做显示用 */
purchaseCountAndUnit
:
string
,
/** skuid, 这里跟commodityId yizhi */
skuid
:
number
/** 加工剩余数量 */
surplusAndProcessNum
:
number
,
/** 税率 */
taxRate
:
string
,
/** 单位 */
unitName
:
string
,
/** 商品属性 */
productProps
:
{
name
:
string
,
value
:
string
,
}[]
}[],
/** 加工商品 */
productList
:
{
brand
:
string
,
category
:
string
,
/** 商品id */
commodityId
:
number
,
enclosure
:
FileType
[],
isHasTax
:
0
|
1
|
number
&
{}
isHasTaxAndTaxRate
:
string
,
mainPic
:
string
,
name
:
string
,
processNum
:
string
,
processTotalPrice
:
string
,
processUnitPrice
:
string
,
productProps
:
{
name
:
string
,
value
:
string
,
}[],
/** skuid */
skuid
:
number
,
taxRate
:
string
,
unitName
:
string
,
}[],
/** 其他说明 */
otherDesc
:
string
,
/** 包装说明 */
packingDesc
:
string
,
/** 付款说明 */
payDesc
:
string
,
/** 税费说明 */
taxDesc
:
string
,
/** 交付说明 */
deliveryDesc
:
string
,
/** 物资说明 */
materialDesc
:
string
,
enclosure
:
FileType
[]
}
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