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
26aa2b71
Commit
26aa2b71
authored
Oct 22, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品上架商城和归属地显示变更、商品卖点添加校验提示
parent
71fdf9ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
21 deletions
+92
-21
proxy.ts
config/proxy.ts
+1
-1
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+27
-9
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+64
-11
No files found.
config/proxy.ts
View file @
26aa2b71
export
default
{
'/api'
:
{
'target'
:
'http://10.0.0.
10
:8100/'
,
'target'
:
'http://10.0.0.
25
:8100/'
,
'changeOrigin'
:
true
,
'pathRewrite'
:
{
'^/api'
:
''
},
}
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
26aa2b71
...
...
@@ -182,6 +182,25 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
return
'积分兑换商品'
}
const
checkSellingPoint
=
(
rule
,
value
,
callback
)
=>
{
try
{
if
(
Array
.
isArray
(
value
)){
if
(
value
.
length
>
3
)
{
throw
new
Error
(
'商品卖点不能超过三个'
);
}
else
{
value
.
map
(
item
=>
{
if
(
item
.
length
>
8
){
throw
new
Error
(
'标签长度不超过八个字符'
);
}
})
callback
()
}
}
}
catch
(
err
)
{
callback
(
err
)
}
}
return
(<>
<
Form
{
...
layout
}
...
...
@@ -295,18 +314,17 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</
Tooltip
>
</
span
>
}
// rules={[
// {
// required: true,
// message: '请添加卖点标签',
// },
// ]}
rules=
{
[
{
validator
:
checkSellingPoint
},
]
}
>
<
Select
mode=
"tags"
placeholder=
"请输入
或
选择商品卖点"
maxTagCount=
{
3
}
maxTagTextLength=
{
8
}
placeholder=
"请输入
并
选择商品卖点"
//
maxTagCount={3}
//
maxTagTextLength={8}
tagRender=
{
tagRender
}
/>
</
Form
.
Item
>
...
...
src/pages/commodity/products/viewProducts.tsx
View file @
26aa2b71
...
...
@@ -5,7 +5,9 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'
import
{
QuestionCircleOutlined
,
FormOutlined
,
UserOutlined
UserOutlined
,
CaretDownOutlined
,
CaretUpOutlined
}
from
'@ant-design/icons'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
cx
from
'classnames'
...
...
@@ -45,6 +47,7 @@ const viewProducts: React.FC<{}> = () => {
const
[
logisticTemplateName
,
setLogisticTemplateName
]
=
useState
<
string
>
()
const
[
logisticResourceCompanyName
,
setLogisticResourceCompanyName
]
=
useState
<
string
>
()
const
[
logisticResourceSendAddress
,
setLogisticResourceSendAddress
]
=
useState
<
string
>
()
const
[
showMore
,
setShowMore
]
=
useState
<
any
>
({
areaShowMore
:
false
,
shopShowMore
:
false
})
useEffect
(()
=>
{
const
{
id
}
=
history
.
location
.
query
...
...
@@ -52,7 +55,7 @@ const viewProducts: React.FC<{}> = () => {
PublicApi
.
getProductCommodityGetCommodity
({
id
:
id
}).
then
(
res
=>
{
const
{
code
,
data
}
=
res
if
(
code
===
1000
){
console
.
log
(
data
,
'data'
)
//
console.log(data, 'data')
setPorductDetail
(
data
)
renderDataByTab
(
data
)
constructTableData
(
data
,
data
.
unitPriceAndPicList
)
...
...
@@ -155,7 +158,7 @@ const viewProducts: React.FC<{}> = () => {
let
dataByTab
=
groupBy
(
archiveByAttributeGroup
,
'groupName'
)
setDataByTab
(
Object
.
values
(
dataByTab
))
setDataByTabTitle
(
Object
.
keys
(
dataByTab
))
console
.
log
(
dataByTab
,
'dataByData'
)
//
console.log(dataByTab,'dataByData')
}
/* 按属性归类 */
...
...
@@ -207,14 +210,14 @@ const viewProducts: React.FC<{}> = () => {
<
Descriptions
colon=
{
true
}
style=
{
{
paddingLeft
:
128
}
}
>
<
Descriptions
.
Item
label=
"商品品牌"
>
{
productDetail
?.
brand
?.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"商品品类"
>
{
productDetail
?.
customerCategory
?.
fullName
}
</
Descriptions
.
Item
>
{
{
/* {
productDetail?.commodityShopList?.length>0 &&
<Descriptions.Item label="上架商城">
{
productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>)
}
</Descriptions.Item>
}
}
*/
}
{
renderStatus
(
productDetail
?.
status
,
1
)
&&
<
Descriptions
.
Item
label=
"审核状态"
>
{
renderStatus
(
productDetail
?.
status
,
1
)
}
</
Descriptions
.
Item
>
}
{
renderStatus
(
productDetail
?.
status
,
2
)
&&
<
Descriptions
.
Item
label=
"商品状态"
>
{
renderStatus
(
productDetail
?.
status
,
2
)
}
</
Descriptions
.
Item
>
}
<
Descriptions
.
Item
label=
"商品类型"
><
span
className=
"commonStatusValid"
></
span
>
{
renderCustomerCategoryType
(
productDetail
?.
customerCategory
?.
type
)
}
</
Descriptions
.
Item
>
...
...
@@ -242,7 +245,7 @@ const viewProducts: React.FC<{}> = () => {
/* 构建表格数据 */
const
constructTableData
=
(
product
:
any
,
unitPriceAndPicList
:
GetProductCommodityGetCommodityResponse
[
"unitPriceAndPicList"
])
=>
{
// 构建列
console
.
log
(
product
,
unitPriceAndPicList
,
'构建列'
)
//
console.log(product, unitPriceAndPicList, '构建列')
let
_col
=
[];
let
col_productName
=
{
title
:
'商品名称'
,
dataIndex
:
'商品名称'
,
key
:
'索引'
}
_col
.
push
(
col_productName
)
...
...
@@ -311,7 +314,7 @@ const viewProducts: React.FC<{}> = () => {
}
return
temp
})
console
.
log
(
_tableData
,
_attributeArrByImageRender
,
'_tableData'
)
//
console.log(_tableData, _attributeArrByImageRender, '_tableData')
setTableRenderDatas
(
_tableData
)
setAttributeArrByImageRender
(
_attributeArrByImageRender
)
setImageArrByImageRender
(
_imageArrByImageRender
)
...
...
@@ -321,6 +324,41 @@ const viewProducts: React.FC<{}> = () => {
history
.
push
(
`/memberCenter/commodityAbility/commodity/products/edit?id=
${
productDetail
.
id
}
`
)
}
const
toogleMore
=
(
str
:
string
)
=>
{
if
(
str
===
'area'
){
setShowMore
({
shopShowMore
:
showMore
.
shopShowMore
,
areaShowMore
:
!
showMore
.
areaShowMore
})
}
else
{
setShowMore
({
shopShowMore
:
!
showMore
.
shopShowMore
,
areaShowMore
:
showMore
.
areaShowMore
})
}
}
const
renderMoreList
=
(
data
,
str
)
=>
{
const
showDataSource
=
(
str
===
'area'
?
showMore
.
areaShowMore
:
showMore
.
shopShowMore
)
?
data
:
[...
data
].
splice
(
0
,
3
)
return
<>
<
p
>
{
str
===
'area'
?
showDataSource
.
map
((
_item
,
_i
)
=>
<
p
key=
{
_i
}
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>)
:
showDataSource
.
map
((
_item
,
_i
)
=>
<
p
key=
{
_i
}
>
{
_item
.
name
}
</
p
>)
}
</
p
>
{
data
.
length
>
3
&&
<
p
onClick=
{
()
=>
toogleMore
(
str
)
}
style=
{
{
cursor
:
'pointer'
}
}
className=
"commonPickColor"
>
展开
{
showMore
.
areaShowMore
?
<
CaretDownOutlined
/>
:
<
CaretUpOutlined
/>
}
</
p
>
}
</>
}
return
(
<
PageHeaderWrapper
title=
{
productDetail
?.
name
}
...
...
@@ -346,7 +384,7 @@ const viewProducts: React.FC<{}> = () => {
<
Space
direction=
"vertical"
style=
{
{
width
:
'100%'
}
}
>
<
Row
gutter=
{
[
26
,
0
]
}
>
<
Col
span=
{
8
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"基本信息"
style=
{
{
height
:
'
320px
'
}
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"基本信息"
style=
{
{
height
:
'
100%
'
}
}
>
{
productDetail
?.
slogan
&&
<
Row
>
<
Col
span=
{
4
}
>
...
...
@@ -374,15 +412,30 @@ const viewProducts: React.FC<{}> = () => {
<
Col
span=
{
20
}
>
<
p
>
{
productDetail
?.
commodityAreaList
.
length
>
0
?
productDetail
?.
commodityAreaList
.
map
(
_item
=>
<
p
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>
)
:
'全国'
productDetail
?.
commodityAreaList
.
length
>
0
?
renderMoreList
(
productDetail
?.
commodityAreaList
,
'area'
)
:
'全国'
}
</
p
>
</
Col
>
</
Row
>
{
productDetail
?.
commodityShopList
?.
length
>
0
&&
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
上架商城:
</
p
>
</
Col
>
<
Col
span=
{
20
}
>
<
p
>
{
renderMoreList
(
productDetail
.
commodityShopList
,
'shop'
)
}
</
p
>
</
Col
>
</
Row
>
}
</
Card
>
</
Col
>
<
Col
span=
{
8
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"物流信息"
style=
{
{
height
:
'
320px
'
}
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"物流信息"
style=
{
{
height
:
'
100%
'
}
}
>
{
renderDeliveryType
(
productDetail
?.
logistics
?.
deliveryType
)
&&
<
Row
>
...
...
@@ -452,7 +505,7 @@ const viewProducts: React.FC<{}> = () => {
</
Card
>
</
Col
>
<
Col
span=
{
8
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"其他信息"
style=
{
{
height
:
'
320px
'
}
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"其他信息"
style=
{
{
height
:
'
100%
'
}
}
>
<
Row
>
<
Col
span=
{
4
}
>
<
p
>
提供发票:
</
p
>
...
...
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