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
7f01a4a5
Commit
7f01a4a5
authored
Sep 02, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 对上游导入商品品类品牌无法关联特殊处理,处理修改询价报价订单异常问题
parent
fb3e7b16
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
127 additions
and
72 deletions
+127
-72
index.ts
src/module/productModule/index.ts
+1
-0
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+7
-0
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+70
-1
index.tsx
src/pages/commodity/products/constant/index.tsx
+10
-0
index.tsx
src/pages/commodity/products/index.tsx
+2
-1
useOrderDetail.tsx
...ages/transaction/_public/order/effects/useOrderDetail.tsx
+5
-1
index.tsx
src/pages/transaction/components/addressPop/index.tsx
+1
-1
useProductTable.tsx
...ion/components/orderHandDeleved/model/useProductTable.tsx
+2
-1
index.tsx
src/pages/transaction/components/orderPayTabs/index.tsx
+8
-6
index.tsx
...er/orderCollectB2b/components/productModalTable/index.tsx
+2
-2
index.tsx
...nsaction/purchaseOrder/orderCollectB2b/constant/index.tsx
+3
-3
index.ts
...ransaction/purchaseOrder/orderCollectB2b/effects/index.ts
+3
-3
useProductTable.tsx
...n/purchaseOrder/orderCollectB2b/model/useProductTable.tsx
+3
-43
index.ts
...transaction/purchaseOrder/orderCollectB2b/schema/index.ts
+8
-8
index.ts
src/store/product/index.ts
+2
-2
No files found.
src/module/productModule/index.ts
View file @
7f01a4a5
...
...
@@ -5,6 +5,7 @@ export interface IBasicFormParam {
brandName
:
string
;
commodityAreaList
:
string
[][];
customerCategoryId
:
string
[];
customerCategoryName
:
string
;
name
:
string
;
sellingPoint
:
string
[];
slogan
:
string
;
...
...
src/pages/commodity/products/addProducts.tsx
View file @
7f01a4a5
...
...
@@ -18,6 +18,7 @@ import ProductDescFormCloud from './addProductsItem/productDescFormCloud'
import
{
useLocalStore
,
observer
}
from
'mobx-react'
import
{
store
}
from
'@/store'
import
{
PublicApi
}
from
'@/services/api'
import
{
CommodityType
}
from
'./constant'
;
const
{
TabPane
}
=
Tabs
...
...
@@ -90,6 +91,7 @@ const AddProducts: React.FC<{}> = (props) => {
title
:
data
.
title
,
keywords
:
data
.
keywords
,
description
:
data
.
description
,
type
:
data
.
type
,
})
setProductName
(
data
?.
name
)
setProductPriceType
(
data
?.
priceType
)
...
...
@@ -169,6 +171,11 @@ const AddProducts: React.FC<{}> = (props) => {
}
}
}
if
(
productInfoByEdit
?.
type
===
CommodityType
.
UPPER_SUPPORTER_COMMODITY
)
{
// @ 上游商品 直接去原信息中的品类品牌id
_bacsicForm
.
customerCategoryId
=
productInfoByEdit
?.
customerCategory
.
fullId
.
split
(
'.'
).
map
(
item
=>
Number
(
item
)
+
''
)
_bacsicForm
.
brandId
=
productInfoByEdit
?.
brand
.
id
}
_bacsicForm
.
customerCategoryId
=
_bacsicForm
.
customerCategoryId
[
_bacsicForm
.
customerCategoryId
.
length
-
1
]
// 移除描述中的空数组[]
let
_productDescription
=
{
...
productDescription
}
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
7f01a4a5
...
...
@@ -13,7 +13,7 @@ import { store } from '@/store'
import
{
validatorByte
}
from
'@/utils/regExp'
;
import
{
GetProductCustomerGetCustomerCategoryTreeResponse
}
from
'@/services/ProductApi'
;
import
{
GetManageAreaAllResponse
}
from
'@/services/PassApi'
;
import
{
customerCategoryTypeLabel
}
from
'../constant'
;
import
{
CommodityType
,
customerCategoryTypeLabel
}
from
'../constant'
;
const
{
Option
}
=
Select
const
layout
=
{
...
...
@@ -198,6 +198,23 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
ref=
{
basicFormRef
}
autoComplete=
"off"
>
{
/* 对来自于上游的商品 品类品牌仅做显示处理 */
}
{
productInfoByEdit
?.
type
===
CommodityType
.
UPPER_SUPPORTER_COMMODITY
?
<
Form
.
Item
name=
"customerCategoryName"
label=
"商品品类"
rules=
{
[
{
required
:
true
,
message
:
'请选择商品品类'
},
]
}
>
<
Input
placeholder=
"请选择品类"
disabled=
{
history
.
location
.
query
?.
id
}
defaultValue=
{
productInfoByEdit
.
customerCategory
.
fullName
}
/>
</
Form
.
Item
>
:
<
Form
.
Item
name=
"customerCategoryId"
label=
"商品品类"
...
...
@@ -217,6 +234,17 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
placeholder=
"请选择品类"
/>
</
Form
.
Item
>
}
{
productInfoByEdit
?.
type
===
CommodityType
.
UPPER_SUPPORTER_COMMODITY
?
<
Form
.
Item
name=
"brandName"
label=
"商品品牌"
>
<
Input
placeholder=
"请选择商品品牌"
disabled=
{
!
isUpdateAttribute
}
defaultValue=
{
productInfoByEdit
.
brand
.
name
}
/>
</
Form
.
Item
>
:
<
Form
.
Item
name=
"brandId"
label=
"商品品牌"
...
...
@@ -238,6 +266,47 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
{
brandData
.
map
(
d
=>
<
Option
value=
{
d
.
id
}
key=
{
d
.
id
}
>
{
d
.
name
}
</
Option
>)
}
</
Select
>
</
Form
.
Item
>
}
{
/* <Form.Item
name="customerCategoryId"
label="商品品类"
rules={[
{
required: true,
message: '请选择商品品类'
},
]}
>
<Cascader
allowClear={false}
disabled={history.location.query?.id}
options={customerCategoryTree}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
onChange={onCustomerCategoryChange}
placeholder="请选择品类"
/>
</Form.Item>
<Form.Item
name="brandId"
label="商品品牌"
>
<Select
disabled={!isUpdateAttribute}
showSearch={true}
showArrow={true}
placeholder="请输入或选择商品品牌"
allowClear
value={brandValue}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={handleBrandSearch}
onChange={handleBrandChange}
onFocus={()=>handleBrandSearch(null)}
style={{ width: '100%' }}
>
{brandData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
</Form.Item> */
}
<
Form
.
Item
name=
"name"
label=
{
...
...
src/pages/commodity/products/constant/index.tsx
View file @
7f01a4a5
...
...
@@ -52,6 +52,16 @@ export const carriageTypeLabel = [
'买家承担运费'
,
]
/** 商品类型枚举 */
export
enum
CommodityType
{
/** 自营商品 */
SELF_SUPPORT_COMMODITY
=
1
,
/** 上游商品 */
UPPER_SUPPORTER_COMMODITY
=
2
,
/** 代销商品 */
AGENT_SALE_COMMODITY
=
3
,
}
/** 查看商品 审核历史列 */
export
const
columns
:
ColumnType
<
any
>
[]
=
[
{
...
...
src/pages/commodity/products/index.tsx
View file @
7f01a4a5
...
...
@@ -130,7 +130,8 @@ const Products: React.FC<{}> = () => {
{
title
:
'供应会员'
,
dataIndex
:
'upperMemberName'
,
key
:
'upperMemberName'
key
:
'upperMemberName'
,
render
:
t
=>
t
?
t
:
'—'
},
{
title
:
'价格'
,
...
...
src/pages/transaction/_public/order/effects/useOrderDetail.tsx
View file @
7f01a4a5
...
...
@@ -26,7 +26,11 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
const
{
orderNo
}
=
history
.
location
.
query
const
{
type
}
=
options
const
dataRef
=
useRef
<
any
>
([
{
label
:
'对应报价单号'
,
name
:
'quoteNo'
,
span
:
8
,
render
:
text
=>
<
Link
to=
{
'/'
}
>
{
text
}
</
Link
>
},
{
label
:
'对应报价单号'
,
name
:
'quoteNo'
,
span
:
8
,
render
:
(
text
,
record
)
=>
<
Link
to=
{
type
[
0
]
===
's'
?
`/memberCenter/tranactionAbility/inquiryOffer/offerSearch/offer/preview?id=${record?.quoteId}`
:
`/memberCenter/tranactionAbility/confirmOffer/offerSearch/offer/preview?id=${record?.quoteId}`
}
>
{
text
}
</
Link
>
},
{
label
:
'订单摘要'
,
name
:
'digest'
,
span
:
8
},
{
label
:
type
[
0
]
===
's'
?
'采购会员'
:
'供应会员'
,
name
:
type
[
0
]
===
's'
?
'buyerMemberName'
:
'vendorMemberName'
,
span
:
8
},
{
label
:
'下单模式'
,
name
:
'orderModeName'
,
span
:
8
},
...
...
src/pages/transaction/components/addressPop/index.tsx
View file @
7f01a4a5
...
...
@@ -4,7 +4,7 @@ import { Popover, Row, Space } from 'antd'
export
const
AddressPop
=
(
props
)
=>
{
const
{
pickInfo
=
null
,
children
}
=
props
return
pickInfo
&&
pickInfo
.
deliverType
===
2
?
<
Space
>
return
pickInfo
&&
pickInfo
.
deliver
y
Type
===
2
?
<
Space
>
<
EnvironmentOutlined
style=
{
{
marginRight
:
8
}
}
/>
<
Popover
content=
{
<
Row
>
...
...
src/pages/transaction/components/orderHandDeleved/model/useProductTable.tsx
View file @
7f01a4a5
...
...
@@ -18,7 +18,8 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const
handleSave
=
row
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'products'
)];
const
index
=
newData
.
findIndex
(
item
=>
row
.
productId
===
item
.
productId
);
// srm订单已productId为唯一key b2b订单以skuId为唯一
const
index
=
newData
.
findIndex
(
item
=>
row
.
skuId
?
row
.
skuId
===
item
.
skuId
:
row
.
productId
===
item
.
productId
);
const
item
=
newData
[
index
];
newData
.
splice
(
index
,
1
,
{
...
item
,
...
...
src/pages/transaction/components/orderPayTabs/index.tsx
View file @
7f01a4a5
...
...
@@ -24,12 +24,14 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
// 简单流程为24
const
processEnum
=
data
.
processEnum
const
payments
=
data
.
payments
.
sort
((
a
,
b
)
=>
a
.
batchNo
-
b
.
batchNo
)
useEffect
(()
=>
{
// 过滤支付信息 取第一个待支付或者未到账的id
if
(
data
?.
payments
?.
length
)
{
let
payments
=
data
.
payments
.
sort
((
a
,
b
)
=>
a
.
batchNo
-
b
.
batchNo
).
filter
(
item
=>
item
.
showPayment
)
if
(
payments
.
length
)
{
ctl
.
setPayId
(
payments
[
0
].
paymentId
)
let
payment
=
payments
.
filter
(
item
=>
item
.
showPayment
)
if
(
payment
.
length
)
{
ctl
.
setPayId
(
payment
[
0
].
paymentId
)
}
}
},
[])
...
...
@@ -61,7 +63,7 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
// const canCtlData = data.payments.find(v => v.showView) || {} //@todo 需后端提供showView字段支持
const
canCtlData
=
data
.
payments
.
find
(
v
=>
v
.
vouchers
.
length
)
||
{}
const
canCtlData
=
payments
.
find
(
v
=>
v
.
vouchers
.
length
)
||
{}
const
urlsDatas
=
canCtlData
.
vouchers
||
[]
return
(
...
...
@@ -71,9 +73,9 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = () => {
<
MellowCard
bordered=
{
false
}
fullHeight
>
<
Tabs
defaultActiveKey=
'1'
>
{
data
.
payments
.
length
payments
.
length
?
data
.
payments
.
map
(
v
=>
<
TabPane
key=
{
v
.
paymentId
}
tab=
{
<
TabHeader
dataSource=
{
v
}
/>
}
>
payments
.
map
(
v
=>
<
TabPane
key=
{
v
.
paymentId
}
tab=
{
<
TabHeader
dataSource=
{
v
}
/>
}
>
<
Row
>
<
Col
className=
{
style
.
fontGray
}
span=
{
4
}
>
支付环节:
</
Col
>
<
Col
>
{
v
.
payNode
}
</
Col
>
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/components/productModalTable/index.tsx
View file @
7f01a4a5
...
...
@@ -87,13 +87,13 @@ export const filterProductDataById = (data, targetData) => {
const
{
code
,
data
}
=
await
PublicApi
.
getLogisticsShipperAddressGet
({
id
:
logistics
.
sendAddress
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
logistics
.
render
=
{...
data
,
deliverType
:
logistics
.
deliveryType
}
logistics
.
render
=
{...
data
,
deliver
y
Type
:
logistics
.
deliveryType
}
}
else
{
logistics
.
render
=
DELIVERY_TYPE
[
logistics
.
deliveryType
]
}
// 配送方式外置, 用于接口字段冗余
next
.
deliverType
=
logistics
.
deliveryType
next
.
deliver
y
Type
=
logistics
.
deliveryType
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const
findResult
=
data
.
find
(
v
=>
v
.
id
===
next
.
id
)
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/constant/index.tsx
View file @
7f01a4a5
...
...
@@ -59,6 +59,7 @@ export const procurementRenderField = (data) => {
productId
:
item
.
skuId
,
productName
:
item
.
name
,
logistics
:
item
.
deliverType
,
deliveryType
:
item
.
deliverType
,
unitPrice
:
item
.
price
,
purchaseCount
:
item
.
quantity
,
taxInclusive
:
item
.
tax
,
...
...
@@ -351,11 +352,10 @@ export const productInfoColumns: any[] = [
// 接口调用
{
title
:
'配送方式'
,
dataIndex
:
'deliverType'
,
dataIndex
:
'deliver
y
Type'
,
align
:
'center'
,
key
:
'deliverType'
,
key
:
'deliver
y
Type'
,
render
:
(
t
,
r
)
=>
{
console
.
log
(
r
,
'rr'
)
if
(
t
===
1
)
return
"物流(默认)"
else
if
(
t
===
2
)
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/effects/index.ts
View file @
7f01a4a5
...
...
@@ -81,9 +81,9 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
if
(
value
&&
value
.
length
>
0
&&
!
state
.
loading
){
// 添加loading判断避免二次调用
// 请求一次并复制给支付信息
const
productItem
=
value
[
0
]
//
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
// 编辑下 支付信息联动实现
//
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
}
else
if
(
pageStatus
===
PageStatus
.
ADD
)
{
// 新增下 需要支付信息生成支付次数
const
shopId
=
ctx
.
getFieldValue
(
'shopId'
)
const
products
=
value
.
map
(
item
=>
({
productId
:
item
.
commodityId
,
skuId
:
item
.
productId
}))
if
(
shopId
&&
products
?.
length
)
{
...
...
@@ -108,7 +108,7 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
})
}
//
}
}
}
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/model/useProductTable.tsx
View file @
7f01a4a5
...
...
@@ -23,46 +23,7 @@ export const sortByKey = (params) => {
export
const
getUnitPriceTotal
=
(
record
)
=>
{
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
))
}
return
Number
((
record
.
price
*
purchaseCount
).
toFixed
(
2
))
}
/**
...
...
@@ -150,11 +111,10 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
newData
=
[...
ctx
.
getFieldValue
(
'products'
)];
const
index
=
newData
.
findIndex
(
item
=>
row
.
id
===
item
.
id
);
console
.
log
(
newData
,
row
)
const
index
=
newData
.
findIndex
(
item
=>
row
.
productId
===
item
.
productId
);
const
item
=
newData
[
index
];
row
[
'money'
]
=
getUnitPriceTotal
(
row
)
// 通过下单模式判断 是否是手工或者渠道手工下单
let
addModel
=
ctx
.
getFieldValue
(
"orderMode"
)
row
[
'productId'
]
=
row
.
productId
newData
.
splice
(
index
,
1
,
{
...
item
,
...
...
src/pages/transaction/purchaseOrder/orderCollectB2b/schema/index.ts
View file @
7f01a4a5
...
...
@@ -231,7 +231,6 @@ export const payInfo: ISchema = {
}
}
// 交付信息
const
submitInfo
:
ISchema
=
{
"x-index"
:
1
,
...
...
@@ -249,7 +248,7 @@ const submitInfo: ISchema = {
labelAlign
:
'left'
,
grid
:
true
,
columns
:
2
,
full
:
true
//
full: true
},
properties
:
{
FLEX_LAYOUT_LEFT
:
{
...
...
@@ -264,7 +263,8 @@ const submitInfo: ISchema = {
"x-component-props"
:
{
disabledDate
:
current
=>
{
return
current
&&
current
<
moment
().
startOf
(
'day'
)
}
},
style
:
{
width
:
400
}
}
},
}
...
...
@@ -272,11 +272,11 @@ const submitInfo: ISchema = {
deliveryAddresId
:
{
type
:
'string'
,
"x-component"
:
'SelectAddress'
,
"x-mega-props"
:
{
style
:
{
full
:
true
}
},
//
"x-mega-props": {
//
style: {
//
full: true
//
}
//
},
"x-component-props"
:
{
dataSource
:
[],
times
:
0
,
...
...
src/store/product/index.ts
View file @
7f01a4a5
...
...
@@ -43,8 +43,8 @@ class ProductStore implements IProductModule {
slogan
:
this
.
productInfoByEdit
?.
slogan
,
sellingPoint
:
this
.
productInfoByEdit
?.
sellingPoint
,
commodityAreaList
:
this
.
productInfoByEdit
?.
commodityAreaList
.
map
(
item
=>
[
item
.
provinceCode
,
item
.
cityCode
]),
customerCategoryId
:
this
.
productInfoByEdit
?.
customerCategory
.
fullId
.
split
(
'.'
).
map
(
item
=>
Number
(
item
)
+
''
)
// customerCategoryId: this.productInfoByEdit?.customerCategory.parentId ? [this.productInfoByEdit?.customerCategory.parentId + '', this.productInfoByEdit?.customerCategory.id + ''] : [this.productInfoByEdit?.customerCategory.id + '']
customerCategoryId
:
this
.
productInfoByEdit
?.
customerCategory
.
fullId
.
split
(
'.'
).
map
(
item
=>
Number
(
item
)
+
''
)
,
customerCategoryName
:
this
.
productInfoByEdit
?.
customerCategory
.
fullName
}
}
...
...
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