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
2a8e6517
Commit
2a8e6517
authored
Jan 11, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into v2
parents
b45af8db
35a9c063
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
124 additions
and
273 deletions
+124
-273
index.ts
src/components/ModalTable/schema/index.ts
+2
-29
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+2
-2
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+3
-3
productDescFormCloud.tsx
...mmodity/products/addProductsItem/productDescFormCloud.tsx
+4
-1
productDescFormDefault.tsx
...odity/products/addProductsItem/productDescFormDefault.tsx
+3
-0
productDescFormYang.tsx
...ommodity/products/addProductsItem/productDescFormYang.tsx
+5
-2
index.tsx
src/pages/transaction/effect/index.tsx
+44
-1
index.ts
...ransaction/purchaseOrder/orderCollectB2b/effects/index.ts
+11
-2
index.tsx
...pages/transaction/purchaseOrder/orderCollectB2b/index.tsx
+1
-1
index.ts
...ges/transaction/saleOrder/addLogisticsOrder/apis/index.ts
+3
-3
index.tsx
.../addLogisticsOrder/components/productModalTable/index.tsx
+20
-71
index.tsx
...ransaction/saleOrder/addLogisticsOrder/constant/index.tsx
+2
-1
index.ts
.../transaction/saleOrder/addLogisticsOrder/effects/index.ts
+2
-43
index.tsx
src/pages/transaction/saleOrder/addLogisticsOrder/index.tsx
+6
-20
useProductTable.tsx
...ion/saleOrder/addLogisticsOrder/model/useProductTable.tsx
+14
-92
index.ts
...nsaction/saleOrder/readyAddLogisticsOrder/schema/index.ts
+2
-2
No files found.
src/components/ModalTable/schema/index.ts
View file @
2a8e6517
...
...
@@ -178,45 +178,18 @@ export const addOrderModalSchema: ISchema = {
},
},
properties
:
{
c
ustomerCategoryId
:
{
c
ategory
:
{
type
:
'string'
,
'x-component'
:
'CustomCategorySearch'
,
'x-component-props'
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'components.shangpinpinlei'
}),
showSearch
:
true
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
},
dataoption
:
[],
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
},
},
brand
Id
:
{
brand
:
{
type
:
'string'
,
'x-component'
:
'CustomInputSearch'
,
'x-component-props'
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'components.shangpinpinpai'
}),
showSearch
:
true
,
showArrow
:
true
,
defaultActiveFirstOption
:
false
,
filterOption
:
false
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
},
searchValue
:
null
,
dataoption
:
[],
},
},
// brandId: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// placeholder: '请选择品牌',
// fetchSearch: getProductSelectGetMemberBrand,
// style: {
// width: 160
// },
// queryParams: {},
// }
// },
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
...
...
src/pages/commodity/products/addProducts.tsx
View file @
2a8e6517
...
...
@@ -145,9 +145,9 @@ const AddProducts: React.FC<{}> = (props) => {
// 切换模板
const
renderTemplate
=
()
=>
{
// if(currentTemplateName === 'science')
// return <ProductDescFormDefualt />
//
return <ProductDescFormDefualt />
// else if(currentTemplateName === 'cloud')
// return <ProductDescFormCloud />
//
return <ProductDescFormCloud />
return
<
ProductDescFormYang
/>
}
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
2a8e6517
...
...
@@ -318,7 +318,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 生成表格dataSource
let
combineArray
=
SKUCombine
(
_attributeValueArr
)
console
.
log
(
combineArray
,
'combineArray'
)
//
console.log(combineArray, 'combineArray')
setCombineAttributeArray
(
combineArray
)
setAttributeObjArr
(
_temp_attributeObjArr
)
setAttributeValObjArr
(
_temp_attributeValObjArr
)
...
...
@@ -412,7 +412,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableDataSource
.
map
(
item
=>
item
[
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.unitPrice'
})]
=
{})
}
}
console
.
log
(
_tableDataSource
,
'_tableDataSource'
)
//
console.log(_tableDataSource, '_tableDataSource')
setTableDataSource
(
productName
?
_tableDataSource
:
[])
// 通过商品名称来判断是否显示表格数据
constructedPrarams
()
...
...
@@ -478,7 +478,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id
:
_tableDataSource
[
0
]
&&
_tableDataSource
[
0
][
intl
.
formatMessage
({
id
:
'commodity.products.addProductsItem.priceAttributeForm.id'
})],
})
/*带上货品id 带上单价*/
/* code1 end */
setPriceAttributeParams
(
_paramsArray
)
console
.
log
(
_paramsArray
,
'_paramsArray'
)
//
console.log(_paramsArray, '_paramsArray')
}
/**
...
...
src/pages/commodity/products/addProductsItem/productDescFormCloud.tsx
View file @
2a8e6517
...
...
@@ -25,7 +25,10 @@ const ISalePlaceholder = [
getIntl
().
formatMessage
({
id
:
'commodity.products.addProductsItem.productDescFormCloud.ISalePlaceholder.5'
}),
]
const
ProductDescFormCloud
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
/**
* YunXianCai式商品模板
*/
const
ProductDescFormCloud
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
();
const
{
token
}
=
getAuth
()
||
{}
// 初始商品特色4个input值和3*4个image值
...
...
src/pages/commodity/products/addProductsItem/productDescFormDefault.tsx
View file @
2a8e6517
...
...
@@ -19,6 +19,9 @@ import { postContractContractSignSaleSignContractCreate } from '@/services/Contr
const
schemaActions
=
createFormActions
()
/**
* 商品 默认模板
*/
const
ProductDescFormDefualt
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
();
const
[
fileImageList
,
setFileImageList
]
=
useState
<
any
>
([])
...
...
src/pages/commodity/products/addProductsItem/productDescFormYang.tsx
View file @
2a8e6517
...
...
@@ -22,7 +22,10 @@ const schemaActions = createFormActions()
const
imagesTypeKeyValue
=
[
''
,
'descriptionImages'
,
'certificationImages'
,
'reportImages'
]
const
ProductDescFormDefualt
:
React
.
FC
<
{}
>
=
()
=>
{
/**
* YangLian式商品模板
*/
const
ProductDescFormYang
:
React
.
FC
<
{}
>
=
()
=>
{
const
intl
=
useIntl
();
const
[
fileImageList
,
setFileImageList
]
=
useState
<
any
>
({
descriptionImages
:
[],
// 商品描述
...
...
@@ -430,4 +433,4 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
</
div
>)
}
export
default
observer
(
ProductDescForm
Defualt
)
export
default
observer
(
ProductDescForm
Yang
)
src/pages/transaction/effect/index.tsx
View file @
2a8e6517
import
{
getOrderBuyerCreatePageItems
,
getOrderBuyerPageItems
,
GetOrderBuyerPageItemsResponse
,
getOrderBuyerTakePageItems
,
getOrderBuyerValidatePageItems
,
getOrderVendorPageItems
,
getOrderVendorTakePageItems
,
getOrderVendorValidatePageItems
}
from
'@/services/OrderNewV2Api'
import
{
getOrderBuyerCreatePageItems
,
getOrderBuyerPageItems
,
GetOrderBuyerPageItemsResponse
,
getOrderBuyerTakePageItems
,
getOrderBuyerValidatePageItems
,
getOrderVendorPageItems
,
getOrderVendorTakePageItems
,
getOrderVendorValidatePageItems
,
getOrderVendorOrderTypeAll
,
getOrderBuyerOrderTypeAll
}
from
'@/services/OrderNewV2Api'
import
{
getProductSelectGetSelectCategory
}
from
'@/services/ProductV2Api'
import
{
getPurchaseRequisitionFindInnerStatusEnum
}
from
'@/services/PurchaseV2Api'
import
{
useEffect
,
useState
}
from
'react'
...
...
@@ -151,3 +162,35 @@ export const getSaleOrderReadyDistributionPageSelectOption = () => {
return
state
}
/** 销售订单 通用 订单类型下拉框列表 */
export
const
getSaleOrderPublicUsePageSelectOption
=
()
=>
{
const
[
state
,
setstate
]
=
useState
<
any
>
([])
useEffect
(()
=>
{
getOrderVendorOrderTypeAll
({}).
then
(
res
=>
{
const
{
code
,
data
}
=
res
if
(
code
===
1000
)
{
setstate
(
data
)
}
})
},
[])
return
state
}
/** 采购订单 通用 订单类型下拉框列表 */
export
const
getPurchaseOrderPublicUsePageSelectOption
=
()
=>
{
const
[
state
,
setstate
]
=
useState
<
any
>
([])
useEffect
(()
=>
{
getOrderBuyerOrderTypeAll
({}).
then
(
res
=>
{
const
{
code
,
data
}
=
res
if
(
code
===
1000
)
{
setstate
(
data
)
}
})
},
[])
return
state
}
src/pages/transaction/purchaseOrder/orderCollectB2b/effects/index.ts
View file @
2a8e6517
...
...
@@ -113,9 +113,18 @@ export interface JumpFormValueType {
}
// 异步处理发货 预约时间 时间段配置
export
const
useOrderDeliverTimeEffect
=
async
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
shopId
,
jumpFormValue
?:
JumpFormValueType
)
=>
{
export
const
useOrderDeliverTimeEffect
=
async
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
shopId
,
jumpFormValue
:
JumpFormValueType
)
=>
{
const
{
pageStatus
}
=
usePageStatus
()
if
(
shopId
)
{
const
{
vendorMemberId
,
vendorRoleId
}
=
jumpFormValue
let
vendorMemberId
,
vendorRoleId
;
if
(
pageStatus
===
PageStatus
.
ADD
)
{
vendorMemberId
=
ctx
.
getFieldValue
(
'vendorMemberId'
)
vendorRoleId
=
ctx
.
getFieldValue
(
'vendorRoleId'
)
}
else
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
vendorMemberId
=
jumpFormValue
.
vendorMemberId
vendorRoleId
=
jumpFormValue
.
vendorRoleId
}
console
.
log
(
vendorMemberId
,
vendorRoleId
,
'jumpFormValue'
)
const
{
code
,
data
}
=
await
getOrderBuyerFindDeliveryDate
({
shopId
,
vendorMemberId
,
vendorRoleId
})
if
(
code
!==
1000
)
{
return
false
;
}
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/index.tsx
View file @
2a8e6517
...
...
@@ -432,7 +432,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = () => {
return
(<
div
style=
{
{
margin
:
-
24
}
}
>
<
FormDetailContext
.
Provider
value=
{
providerValue
}
>
<
FormDetailHeader
title=
{
id
?
intl
.
formatMessage
({
id
:
'purchaseOrder.
add'
}):
intl
.
formatMessage
({
id
:
'purchaseOrder.edit
'
})
}
title=
{
id
?
intl
.
formatMessage
({
id
:
'purchaseOrder.
edit'
}):
intl
.
formatMessage
({
id
:
'purchaseOrder.add
'
})
}
schema=
{
orderAddSchema
}
extraRight=
{
[
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
loading=
{
btnLoading
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/apis/index.ts
View file @
2a8e6517
import
{
get
ProductCommodityCommonGetCommodityListByBuyer
}
from
"@/services/Product
V2Api"
import
{
get
OrderVendorLogisticsProductPage
}
from
"@/services/OrderNew
V2Api"
export
const
fetchOrderApi
=
{
/** 弹窗获取
商品列表
*/
/** 弹窗获取
发货单 商品明细
*/
async
getProductList
(
params
)
{
const
{
data
}
=
await
get
ProductCommodityCommonGetCommodityListByBuyer
(
params
,
{
useCache
:
true
,
ttl
:
10
*
1000
})
const
{
data
}
=
await
get
OrderVendorLogisticsProductPage
(
params
,
{
useCache
:
true
,
ttl
:
10
*
1000
})
return
data
},
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/components/productModalTable/index.tsx
View file @
2a8e6517
import
React
,
{
useEffect
}
from
'react'
import
ModalTable
,
{
ModalTableProps
}
from
'@/components/ModalTable'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
FormEffectHooks
,
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
DELIVERY_TYPE
,
OrderModalType
}
from
'@/constants/order'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
addOrderModalSchema
}
from
'@/components/ModalTable/schema'
...
...
@@ -10,11 +9,9 @@ import Search from '@/components/NiceForm/components/Search'
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
;
import
Submit
from
'@/components/NiceForm/components/Submit'
;
import
DateSelect
from
'@/components/NiceForm/components/DateSelect'
;
import
{
searchBrandOptionEffect
,
searchCustomerCategoryOptionEffect
}
from
'../../effects'
import
CustomCategorySearch
from
'@/components/NiceForm/components/CustomCategorySearch'
import
CustomInputSearch
from
'@/components/NiceForm/components/CustomInputSearch'
import
{
getLogisticsShipperAddressGet
}
from
'@/services/LogisticsV2Api'
import
{
getIntl
}
from
'umi'
import
{
getIntl
,
history
}
from
'umi'
export
interface
ProductModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
...
...
@@ -27,9 +24,9 @@ export interface ProductModalTableProps extends ModalTableProps {
export
const
productColumns
:
any
[]
=
[
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.id'
}),
dataIndex
:
'
i
d'
,
dataIndex
:
'
productI
d'
,
align
:
'center'
,
key
:
'
i
d'
,
key
:
'
productI
d'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.name'
}),
...
...
@@ -39,62 +36,33 @@ export const productColumns: any[] = [
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.customerCategoryName'
}),
dataIndex
:
'c
ustomerCategoryName
'
,
dataIndex
:
'c
ategory
'
,
align
:
'center'
,
key
:
'c
ustomerCategoryName
'
,
key
:
'c
ategory
'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.brandName'
}),
dataIndex
:
'brand
Name
'
,
dataIndex
:
'brand'
,
align
:
'center'
,
key
:
'brandName'
,
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.unitName'
}),
dataIndex
:
'unitName'
,
align
:
'center'
,
key
:
'unitName'
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.stockCount'
}),
dataIndex
:
'stockCount'
,
align
:
'center'
,
key
:
'stockCount'
key
:
'brand'
,
},
]
// 下单类型->商城类型映射
const
orderProductShopTypeMaps
=
{
[
OrderModalType
.
PURCHASE_ORDER
]:
1
,
[
OrderModalType
.
CHANNEL_DIRECT_PURCHASE_ORDER
]:
3
,
[
OrderModalType
.
CHANNEL_EXISTING_PURCHASE_ORDER
]:
4
}
export
const
filterProductDataById
=
(
data
,
targetData
)
=>
{
return
targetData
.
reduce
(
async
(
prev
:
any
[],
next
)
=>
{
const
{
logistics
}
=
next
// 由于自选商品和进货单商品字段不一致,需手动同步
// 由于自选发货单商品和物流单单商品字段不一致,需手动同步
next
.
id
=
next
.
id
||
next
.
productId
next
.
productId
=
next
.
id
||
next
.
productId
next
.
brand
=
next
.
brand
||
next
.
brandName
next
.
category
=
next
.
category
||
next
.
customerCategoryName
next
.
unit
=
next
.
unit
||
next
.
unitName
next
.
productName
=
next
.
productName
||
next
.
name
next
.
deliverType
=
next
.
logistics
.
sendAddress
// 保证和详情编辑字段一致
if
(
logistics
.
deliveryType
===
2
&&
logistics
.
sendAddress
)
{
const
{
code
,
data
}
=
await
getLogisticsShipperAddressGet
({
id
:
logistics
.
sendAddress
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
logistics
.
render
=
{...
data
,
deliveryType
:
logistics
.
deliveryType
}
}
else
{
logistics
.
render
=
DELIVERY_TYPE
[
logistics
.
deliveryType
]
}
// 配送方式外置, 用于接口字段冗余
next
.
deliveryType
=
logistics
.
deliveryType
next
.
amount
=
next
.
quantity
||
next
.
amount
next
.
weight
=
next
.
weight
||
null
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const
findResult
=
data
.
find
(
v
=>
v
.
id
===
next
.
i
d
)
const
findResult
=
data
.
find
(
v
=>
v
.
productId
===
next
.
productI
d
)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if
(
!
Array
.
isArray
(
prev
))
{
...
...
@@ -126,29 +94,16 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
},
[])
const
handleConfirmProduct
=
async
()
=>
{
const
newData
=
rowSelectionCtl
.
selectRow
.
map
(
v
=>
{
v
.
orderMode
=
schemaAction
.
getFieldValue
(
'orderMode'
)
v
.
shopId
=
schemaAction
.
getFieldValue
(
'shopId'
)
v
.
buyerMemberId
=
schemaAction
.
getFieldValue
(
'buyerMemberId'
)
v
.
buyerRoleId
=
schemaAction
.
getFieldValue
(
'buyerRoleId'
)
return
v
})
schemaAction
.
setFieldValue
(
'products'
,
await
filterProductDataById
([],
newData
))
const
newData
=
[...
rowSelectionCtl
.
selectRow
]
schemaAction
.
setFieldValue
(
'detailList'
,
await
filterProductDataById
([],
newData
))
confirmModal
&&
confirmModal
()
setVisible
(
false
)
}
const
fetchProductList
=
(
values
)
=>
{
const
modelType
=
schemaAction
.
getFieldValue
(
'orderMode'
)
const
buyerMembersId
=
schemaAction
.
getFieldValue
(
'buyerMemberId'
)
const
shopId
=
schemaAction
.
getFieldValue
(
'shopId'
)
const
params
=
{
...
values
,
shopType
:
orderProductShopTypeMaps
[
modelType
],
environment
:
1
,
memberId
:
buyerMembersId
,
priceTypeList
:
[
1
],
shopId
:
schemaAction
.
getFieldValue
(
'shopId'
)
orderId
:
history
.
location
.
query
.
id
}
return
fetchOrderApi
.
getProductList
(
params
)
}
...
...
@@ -156,7 +111,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
return
(
<
ModalTable
modalTitle=
{
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.title'
})
}
modalTitle=
{
getIntl
().
formatMessage
({
id
:
'purchaseOrder.orderCollect.productModalTable.title'
})
}
width=
{
900
}
columns=
{
productColumns
}
visible=
{
visible
}
...
...
@@ -167,11 +122,11 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
modalType=
'none'
tableProps=
{
{
rowKey
:
'
i
d'
,
rowKey
:
'
productI
d'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
rowSelectionCtl
.
appendSelectRow
(
record
);
rowSelectionCtl
.
appendSelectRowKeys
(
record
.
i
d
);
rowSelectionCtl
.
appendSelectRowKeys
(
record
.
productI
d
);
},
})
}
}
...
...
@@ -186,12 +141,6 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
'name'
,
FORM_FILTER_PATH
,
);
FormEffectHooks
.
onFieldChange$
(
'customerCategoryId'
).
subscribe
(()
=>
{
searchCustomerCategoryOptionEffect
(
schemaAction
,
actions
,
'customerCategoryId'
)
})
FormEffectHooks
.
onFieldChange$
(
'brandId'
).
subscribe
(()
=>
{
searchBrandOptionEffect
(
schemaAction
,
actions
,
'brandId'
)
})
}
}
}
}
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/constant/index.tsx
View file @
2a8e6517
...
...
@@ -22,7 +22,8 @@ export const PriceComp = (props) => {
/**新增物流单 初始值转换 */
export
const
procurmentRenderInit
=
(
initValue
:
any
)
=>
{
return
{
shipmentOrderId
:
initValue
.
deliveryNo
,
// shipmentOrderId: initValue.deliveryNo,
shipmentOrderCode
:
initValue
.
deliveryNo
,
relevanceOrderId
:
initValue
.
orderId
,
relevanceOrderCode
:
initValue
.
orderNo
,
memberName
:
initValue
.
buyerMemberName
,
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/effects/index.ts
View file @
2a8e6517
import
{
FormEffectHooks
,
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
getProductCustomerGetMemberCustomerCategoryTree
,
getProductSelectGetMemberBrand
}
from
'@/services/ProductV2Api'
;
export
const
use
Materia
lTableChangeForAmount
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
update
)
=>
{
FormEffectHooks
.
onFieldValueChange$
(
'detailList'
).
subscribe
(
state
=>
{
export
const
use
Detai
lTableChangeForAmount
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
update
)
=>
{
FormEffectHooks
.
onFieldValueChange$
(
'detailList'
).
subscribe
(
()
=>
{
// 强制渲染一次, 用于统计总数
update
()
})
}
/**
* 高级筛选schema中用于获取供应商 商品品类Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export
const
searchCustomerCategoryOptionEffect
=
(
ctx
:
any
,
mctx
:
any
,
fieldName
:
string
)
=>
{
const
params
:
any
=
{}
params
[
'memberId'
]
=
ctx
.
getFieldValue
(
'vendorMemberId'
)
params
[
'memberRoleId'
]
=
ctx
.
getFieldValue
(
'vendorRoleId'
)
mctx
.
getFieldState
(
fieldName
,
state
=>
{
// params['name'] = state.props['x-component-props'].searchValue
getProductCustomerGetMemberCustomerCategoryTree
(
params
).
then
(
res
=>
{
mctx
.
setFieldState
(
fieldName
,
state
=>
{
state
.
props
[
'x-component-props'
].
dataoption
=
res
.
data
})
})
})
}
/**
* 高级筛选schema中用于获取供应商 商品品牌Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export
const
searchBrandOptionEffect
=
(
ctx
:
any
,
mctx
:
any
,
fieldName
:
string
)
=>
{
const
params
:
any
=
{}
params
[
'memberId'
]
=
ctx
.
getFieldValue
(
'vendorMemberId'
)
params
[
'memberRoleId'
]
=
ctx
.
getFieldValue
(
'vendorRoleId'
)
mctx
.
getFieldState
(
fieldName
,
state
=>
{
params
[
'name'
]
=
state
.
props
[
'x-component-props'
].
searchValue
getProductSelectGetMemberBrand
(
params
).
then
(
res
=>
{
mctx
.
setFieldState
(
fieldName
,
state
=>
{
state
.
props
[
'x-component-props'
].
dataoption
=
res
.
data
})
})
})
}
src/pages/transaction/saleOrder/addLogisticsOrder/index.tsx
View file @
2a8e6517
...
...
@@ -6,8 +6,8 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
NiceForm
from
'@/components/NiceForm'
import
{
increaseSchema
}
from
'./schema'
import
{
use
Materia
lTableChangeForAmount
}
from
'./effects'
import
{
procurementProcessField
,
procur
ementRenderField
,
procur
mentRenderInit
}
from
'./constant'
import
{
use
Detai
lTableChangeForAmount
}
from
'./effects'
import
{
procurementProcessField
,
procurmentRenderInit
}
from
'./constant'
import
{
useUpdate
}
from
'@umijs/hooks'
import
{
help
}
from
'../../common'
import
styled
from
'styled-components'
...
...
@@ -17,7 +17,7 @@ import { FormDetailContext } from '@/formSchema/context'
import
{
useProductTable
}
from
'./model/useProductTable'
import
{
useFormDetail
}
from
'@/formSchema/effects/useFormDetail'
import
ProductModalTable
from
'./components/productModalTable'
import
{
getOrderVendorCreateLogisticsDetail
,
getOrderVendorSellDeliveryDetail
}
from
'@/services/OrderNewV2Api'
import
{
getOrderVendorCreateLogisticsDetail
}
from
'@/services/OrderNewV2Api'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
getLogisticsCompanyPage
,
getLogisticsShipperAddressPage
,
postLogisticsOrderWaitSubmitAdd
}
from
'@/services/LogisticsV2Api'
import
addressText
from
'../../components/addressText'
...
...
@@ -42,7 +42,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const
intl
=
useIntl
()
const
{
form
}
=
useFormSpy
({
selector
:
[[
'onFieldValueChange'
,
'detailList'
]],
reducer
:
v
=>
v
})
const
data
=
form
.
getFieldValue
(
'detailList'
)
console
.
log
(
data
,
'data'
)
const
totalCarton
=
data
.
reduce
((
prev
,
next
)
=>
(
prev
*
1000
+
(
next
.
carton
||
0
)
*
1000
)
/
1000
,
0
)
const
totalWeight
=
data
.
reduce
((
prev
,
next
)
=>
(
prev
*
1000
+
(
next
.
weight
||
0
)
*
1000
)
/
1000
,
0
)
const
totalVolume
=
data
.
reduce
((
prev
,
next
)
=>
(
prev
*
1000
+
(
next
.
volume
||
0
)
*
1000
)
/
1000
,
0
)
...
...
@@ -77,13 +77,9 @@ const AddLogisticsOrder:React.FC<{}> = () => {
useEffect
(()
=>
{
if
(
id
)
{
setFormLoading
(
true
)
getOrderVendorCreateLogisticsDetail
({
orderId
:
'5870'
}).
then
(
res
=>
{
getOrderVendorCreateLogisticsDetail
({
orderId
:
id
}).
then
(
res
=>
{
const
{
data
}
=
res
setInitFormValue
(()
=>
procurmentRenderInit
(
data
))
// const _orderProductRequests = procurementRenderField(data)
// setTimeout(() => {
// addSchemaAction.setFieldValue('detailList', _orderProductRequests)
// }, 1000)
setFormLoading
(
false
)
})
getSettleAccountsPlatformConfigGetSettlementWay
({
memberId
:
memberId
+
''
,
roleId
:
memberRoleId
+
''
}).
then
(
res
=>
{
...
...
@@ -97,7 +93,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
const
handleSubmit
=
async
(
value
)
=>
{
try
{
// let fnResult = null
// 新增物流单/编辑物流单
const
params
=
{
...
value
}
console
.
log
(
value
)
...
...
@@ -107,11 +102,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
setBtnLoading
(
true
)
const
_params
=
procurementProcessField
(
params
)
// if(id) {
// fnResult = await postPurchaseRequisitionUpdate({..._params, id})
// } else {
// fnResult = await postPurchaseRequisitionCreate(_params)
// }
const
fnResult
=
await
postLogisticsOrderWaitSubmitAdd
(
_params
)
if
(
fnResult
.
code
===
1000
)
{
setTimeout
(()
=>
{
...
...
@@ -145,10 +135,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
}
const
renderTitle
=
()
=>
{
// intl.formatMessage({ id: 'saleOrder.xiugaiwuliudan', defaultMessage: '修改物流单' })
// if(preview) {
// return intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
// }
return
intl
.
formatMessage
({
id
:
'saleOrder.xinzengwuliudan'
,
defaultMessage
:
'新增物流单'
})
}
...
...
@@ -176,7 +162,7 @@ const AddLogisticsOrder:React.FC<{}> = () => {
effects=
{
(
$
,
ctx
)
=>
{
$
(
'onFormMount'
).
subscribe
(()
=>
{
})
// 物流明细信息的改动 渲染总额
use
Materia
lTableChangeForAmount
(
ctx
,
update
)
use
Detai
lTableChangeForAmount
(
ctx
,
update
)
// 注入表单完成进度
formContext
.
useAttachmentChangeForContext
(
ctx
)
...
...
src/pages/transaction/saleOrder/addLogisticsOrder/model/useProductTable.tsx
View file @
2a8e6517
import
{
useRef
,
useState
}
from
'react'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
;
import
{
Button
,
message
}
from
'antd'
;
import
{
Button
}
from
'antd'
;
import
{
PriceComp
,
productInfoColumns
}
from
'../constant'
;
import
ProductTableCell
,
{
ProductEditableRow
}
from
'../components/productTableCell'
;
import
{
useModalTable
}
from
'./useModalTable'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
useIntl
}
from
'umi'
;
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export
const
sortByKey
=
(
params
)
=>
{
let
keys
=
Object
.
keys
(
params
).
sort
((
x
,
y
)
=>
parseInt
(
x
)
-
parseInt
(
y
));
let
newParams
=
{};
keys
.
forEach
((
key
)
=>
{
newParams
[
key
]
=
params
[
key
];
});
return
newParams
;
}
export
const
getUnitPriceTotal
=
(
record
)
=>
{
const
{
pageStatus
}
=
usePageStatus
()
const
purchaseCount
=
Number
(
record
[
'purchaseCount'
])
||
0
// fix 当没有传递unitPrice字段时 自动容错, 单价显示为0
// fix 编辑订单取price
record
.
unitPrice
=
pageStatus
===
PageStatus
.
EDIT
?
record
.
price
:
record
.
unitPrice
||
record
.
price
||
0
if
(
typeof
record
.
unitPrice
===
'number'
)
{
return
record
.
isMemberPrice
?
Number
((
record
.
unitPrice
*
purchaseCount
*
record
.
memberPrice
).
toFixed
(
2
))
:
Number
((
record
.
unitPrice
*
purchaseCount
).
toFixed
(
2
))
}
if
(
record
.
unitPrice
)
{
record
.
unitPrice
=
sortByKey
(
record
.
unitPrice
)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if
(
record
.
price
&&
JSON
.
stringify
(
record
.
unitPrice
)
===
"{}"
)
{
record
.
unitPrice
=
{
'0-0'
:
record
.
price
}
}
// fix 当有unitPrice字段时 没有price字段时 补全price字段
if
(
!
record
?.
price
&&
JSON
.
stringify
(
record
.
unitPrice
)
!==
"{}"
)
{
if
(
Object
.
keys
(
record
.
unitPrice
)[
0
]
===
'0-0'
)
record
.
price
=
record
.
unitPrice
[
'0-0'
]
}
let
unitPrice
=
0
Object
.
entries
(
record
.
unitPrice
).
forEach
(([
key
,
value
])
=>
{
const
[
min
,
max
]
=
key
.
split
(
'-'
).
map
(
v
=>
Number
(
v
))
if
(
min
===
0
&&
max
===
0
)
{
unitPrice
=
Number
(
value
)
return
false
}
if
((
purchaseCount
>=
min
&&
purchaseCount
<=
max
)
||
(
purchaseCount
>
max
))
{
// 处于该区间或者大于该区间
unitPrice
=
Number
(
value
)
return
false
}
})
// 考虑会员折扣
let
memberPrice
=
record
.
memberPrice
if
(
record
.
isMemberPrice
)
{
return
Number
((
unitPrice
*
purchaseCount
*
memberPrice
).
toFixed
(
2
))
}
else
{
return
Number
((
unitPrice
*
purchaseCount
).
toFixed
(
2
))
}
}
/**
* @param ctx schemaAction
*/
export
const
useProductTable
=
(
ctx
:
ISchemaFormActions
|
ISchemaFormAsyncActions
)
=>
{
const
{
pageStatus
,
preview
=
null
}
=
usePageStatus
()
const
productRef
=
useRef
<
any
>
({})
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
useModalTable
({
type
:
'checkbox'
})
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
useModalTable
({
type
:
'checkbox'
,
customKey
:
'productId'
})
const
intl
=
useIntl
()
const
handleDelete
=
(
record
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'detailList'
)]
// 删除formvalue
...
...
@@ -82,47 +27,26 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
rowSelectionCtl
.
setSelectedRowKeys
(
newData
.
map
(
v
=>
v
.
id
))
ctx
.
setFieldValue
(
'detailList'
,
newData
)
// 商品行数变动 清空之前的支付信息
if
(
pageStatus
===
PageStatus
.
ADD
)
{
ctx
.
setFieldValue
(
'payments'
,
[])
}
}
const
[
productColumns
,
setProductColumns
]
=
useState
(()
=>
{
// if (pageStatus === PageStatus.ADD) {
// 渲染操作
productInfoColumns
[
productInfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'saleOrder.delete'
})
}
</
Button
>
// 渲染单价
productInfoColumns
[
5
].
render
=
(
t
,
r
)
=>
{
return
r
.
price
?
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
r
.
price
}
</
span
>
:
<
PriceComp
priceSection=
{
r
.
unitPrice
}
/>
}
// 渲染商品ID
productInfoColumns
[
0
].
render
=
(
t
,
r
)
=>
{
return
r
.
id
}
// 渲染操作
productInfoColumns
[
productInfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
{
intl
.
formatMessage
({
id
:
'saleOrder.delete'
})
}
</
Button
>
// } else {
// // 渲染单价
// productInfoColumns[5].render = (t, r) => <span style={{color: 'red'}}>¥ {r.price}</span>
// // 渲染商品ID
// productInfoColumns[0].render = (t, r) => r.productId
// return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
// }
// 渲染单价
productInfoColumns
[
5
].
render
=
(
t
,
r
)
=>
{
return
r
.
price
?
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
r
.
price
}
</
span
>
:
<
PriceComp
priceSection=
{
r
.
unitPrice
}
/>
}
// 渲染商品ID
productInfoColumns
[
0
].
render
=
(
t
,
r
)
=>
{
return
r
.
id
}
return
productInfoColumns
})
const
handleShowProduct
=
()
=>
{
const
buyerMemberId
=
ctx
.
getFieldValue
(
'buyerMemberId'
)
const
shopId
=
ctx
.
getFieldValue
(
'shopId'
)
if
(
buyerMemberId
&&
shopId
)
{
productRef
.
current
.
setVisible
(
true
)
}
else
{
message
.
error
(
intl
.
formatMessage
({
id
:
'purchaseOrder.orderCollect.model.message'
}))
}
productRef
.
current
.
setVisible
(
true
)
}
const
productAddButton
=
!
preview
&&
<
Button
onClick=
{
handleShowProduct
}
block
type=
'default'
style=
{
{
margin
:
'24px auto'
}
}
>
{
intl
.
formatMessage
({
id
:
'saleOrder.xuanzeshangpin'
,
defaultMessage
:
'选择商品'
})
}
</
Button
>
...
...
@@ -144,8 +68,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const
newData
=
[...
ctx
.
getFieldValue
(
'detailList'
)];
const
index
=
newData
.
findIndex
(
item
=>
row
.
id
===
item
.
id
);
const
item
=
newData
[
index
];
row
[
'money'
]
=
getUnitPriceTotal
(
row
)
row
[
'productId'
]
=
row
.
commodityId
newData
.
splice
(
index
,
1
,
{
...
item
,
...
row
,
...
...
src/pages/transaction/saleOrder/readyAddLogisticsOrder/schema/index.ts
View file @
2a8e6517
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
getSaleOrder
ReadyDistribution
PageSelectOption
}
from
'@/pages/transaction/effect'
;
import
{
getSaleOrder
PublicUse
PageSelectOption
}
from
'@/pages/transaction/effect'
;
import
{
useIntl
}
from
'umi'
;
export
const
tableListSchema
:
any
=
()
=>
{
const
intl
=
useIntl
()
const
data
=
getSaleOrder
ReadyDistribution
PageSelectOption
()
const
data
=
getSaleOrder
PublicUse
PageSelectOption
()
if
(
data
)
{
return
{
...
...
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