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
b83bb669
Commit
b83bb669
authored
Aug 21, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品图片设置方式,商品价格批量设置,优化输入搜索
parent
a0ab05f7
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
219 additions
and
279 deletions
+219
-279
index.tsx
src/pages/commodity/goods/index.tsx
+12
-22
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+20
-12
basicInfoForm.tsx
...ages/commodity/products/addProductsItem/basicInfoForm.tsx
+8
-12
logisticsForm.tsx
...ages/commodity/products/addProductsItem/logisticsForm.tsx
+2
-4
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+29
-24
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+1
-1
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+28
-24
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+47
-92
fastModifyPrice.tsx
src/pages/commodity/products/fastModifyPrice.tsx
+37
-54
index.tsx
src/pages/commodity/products/index.tsx
+21
-27
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+5
-4
index.ts
src/store/product/index.ts
+9
-3
No files found.
src/pages/commodity/goods/index.tsx
View file @
b83bb669
...
...
@@ -337,42 +337,30 @@ const Goods: React.FC<{}> = () => {
setFilterParams
(
obj
)
}
const
handleBrandSearch
=
(
value
:
any
)
=>
{
// end value
console
.
log
(
value
,
'handleBrandSearch'
)
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
else
{
setBrandData
([])
}
const
handleBrandSearch
=
(
value
?:
any
)
=>
{
// end value
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
const
handleBrandChange
=
(
value
:
any
)
=>
{
setBrandValue
(
value
)
console
.
log
(
value
,
'handleBrandChange'
)
let
obj
=
{
...
filterParams
,
brandId
:
value
}
setFilterParams
(
obj
)
}
const
handleClassSearch
=
(
value
:
any
)
=>
{
console
.
log
(
value
,
'handleClassSearch'
)
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
else
{
setClassData
([])
}
const
handleClassSearch
=
(
value
?:
any
)
=>
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
const
handleClassChange
=
(
value
:
any
)
=>
{
setClassValue
(
value
)
let
obj
=
{
...
filterParams
,
customerCategoryId
:
value
}
setFilterParams
(
obj
)
console
.
log
(
value
,
'handleClassChange'
)
}
const
controllerBtns
=
(
...
...
@@ -472,6 +460,7 @@ const Goods: React.FC<{}> = () => {
filterOption=
{
false
}
onSearch=
{
handleBrandSearch
}
onChange=
{
handleBrandChange
}
onFocus=
{
()
=>
handleBrandSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
>
...
...
@@ -488,6 +477,7 @@ const Goods: React.FC<{}> = () => {
filterOption=
{
false
}
onSearch=
{
handleClassSearch
}
onChange=
{
handleClassChange
}
onFocus=
{
()
=>
handleClassSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
>
...
...
src/pages/commodity/products/addProducts.tsx
View file @
b83bb669
...
...
@@ -79,7 +79,7 @@ const AddProducts: React.FC<{}> = (props) => {
})
try
{
if
(
productAttributeAndImageParams
.
length
>
0
){
console
.
log
(
productAttributeAndImageParams
,
'____'
)
console
.
log
(
productAttributeAndImageParams
,
'____'
)
// 所有属性共用的情况下 item只有第一项有图片
productAttributeAndImageParams
.
map
(
_item
=>
{
if
(
_item
.
goodsCustomerAttributeList
.
length
>
0
){
_item
.
goodsCustomerAttributeList
.
map
(
__item
=>
{
...
...
@@ -88,11 +88,13 @@ const AddProducts: React.FC<{}> = (props) => {
})
}
if
(
_item
.
commodityPic
.
length
>
0
){
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
{
return
__item
?.
response
?.
data
||
__item
?.
url
// 编辑情况下兼顾手动添加图片列表属性
})
// 编辑情况下兼顾手动添加图片列表属性
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
)
}
else
{
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
if
(
isAllAttributePic
&&
productAttributeAndImageParams
[
0
].
commodityPic
.
length
>
0
)
//处理所有属性共用
_item
.
commodityPic
=
productAttributeAndImageParams
[
0
].
commodityPic
else
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
}
})
}
...
...
@@ -114,12 +116,10 @@ const AddProducts: React.FC<{}> = (props) => {
commodityRemark
:
productDescription
,
isAllAttributePic
:
isAllAttributePic
,
}
_params
.
minOrder
=
Number
(
_params
.
minOrder
)
_params
.
logistics
.
weight
=
Number
(
_params
.
logistics
.
weight
)
// 处理地址
let
_commodityAreaList
:
any
=
[]
_params
.
commodityAreaList
.
length
>
0
&&
_params
.
commodityAreaList
.
map
(
_itme
=>
{
if
(
_itme
){
_params
.
commodityAreaList
.
length
>
0
&&
areaOption
.
length
>
0
&&
_params
.
commodityAreaList
.
map
(
_itme
=>
{
if
(
_itme
&&
_itme
.
length
>
0
){
let
_temp
:
any
=
{}
let
pobj
=
areaOption
.
filter
(
_
=>
_
.
code
===
_itme
[
0
])[
0
]
let
cobj
=
pobj
.
areaResponses
.
filter
(
__
=>
__
.
code
===
_itme
[
1
])[
0
]
...
...
@@ -134,8 +134,13 @@ const AddProducts: React.FC<{}> = (props) => {
}
})
// 增加不限区域字段
_commodityAreaList
.
length
>
0
?
_params
.
isAllArea
=
false
:
_params
.
isAllArea
=
true
_params
.
commodityAreaList
=
_commodityAreaList
if
(
_commodityAreaList
.
length
>
0
){
_params
.
isAllArea
=
false
_params
.
commodityAreaList
=
_commodityAreaList
}
else
{
_params
.
isAllArea
=
true
delete
_params
.
commodityAreaList
}
const
{
id
}
=
history
.
location
.
query
_params
.
id
=
id
?
id
:
null
console
.
log
(
_params
,
'_params'
)
...
...
@@ -152,7 +157,10 @@ const AddProducts: React.FC<{}> = (props) => {
message
.
error
(
e
.
message
)
}).
catch
(
error
=>
{
console
.
log
(
error
,
'_error'
)
message
.
error
(
error
.
message
)
if
(
error
.
messge
)
message
.
error
(
error
.
message
)
else
message
.
error
(
error
.
errorFields
[
0
].
errors
.
toString
())
})
}
catch
(
e
){
message
.
error
(
e
.
message
)
...
...
src/pages/commodity/products/addProductsItem/basicInfoForm.tsx
View file @
b83bb669
...
...
@@ -106,16 +106,11 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
console
.
log
(
values
,
'原values'
)
}
const
handleBrandSearch
=
(
value
:
any
)
=>
{
// end value
console
.
log
(
value
,
'handleBrandSearch'
)
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
else
{
setBrandData
([])
}
const
handleBrandSearch
=
(
value
?:
any
)
=>
{
// end value
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
const
handleBrandChange
=
(
value
:
any
)
=>
{
...
...
@@ -210,13 +205,14 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<
Select
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"请
选择
品牌"
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
>)
}
...
...
@@ -279,7 +275,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
>
<
Select
mode=
"tags"
placeholder=
"请
选择或输入
商品卖点"
placeholder=
"请
输入或选择
商品卖点"
maxTagCount=
{
3
}
tagRender=
{
tagRender
}
/>
...
...
src/pages/commodity/products/addProductsItem/logisticsForm.tsx
View file @
b83bb669
...
...
@@ -74,7 +74,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
labelAlign=
"left"
ref=
{
logisticsFormRef
}
colon=
{
false
}
initialValues=
{
history
.
location
.
query
?.
id
?
productInfoByEdit
.
logistics
:
{}
}
initialValues=
{
history
.
location
.
query
?.
id
?
productInfoByEdit
.
logistics
:
{
deliveryType
:
1
,
carriageType
:
1
}
}
autoComplete=
"off"
>
<
Form
.
Item
...
...
@@ -86,7 +86,6 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
message
:
'请选择配送方式'
},
]
}
initialValue=
{
1
}
>
<
Radio
.
Group
onChange=
{
changeDeliveryType
}
>
<
Radio
value=
{
1
}
>
物流(默认)
</
Radio
>
...
...
@@ -104,7 +103,6 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
message
:
'请选择运费方式'
},
]
}
initialValue=
{
1
}
>
<
Radio
.
Group
onChange=
{
(
e
)
=>
setCarriageType
(
e
.
target
.
value
)
}
>
<
Radio
value=
{
1
}
>
卖家承担运费(默认)
</
Radio
>
...
...
@@ -112,7 +110,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"重量"
label=
{
<>
重量
<
i
style=
{
{
color
:
'red'
}
}
>
*
</
i
></>
}
style=
{
{
position
:
'relative'
}
}
>
<
Form
.
Item
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
b83bb669
...
...
@@ -80,17 +80,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
constructedCallback
()
console
.
log
(
'重新构造'
)
},[
productName
,
selectedGoods
,
productSelectAttribute
,
planPrice
])
/* 构建表格列和data */
const
constructedCallback
=
()
=>
{
console
.
log
(
productName
,
'name'
)
let
_col
=
[];
let
col_productName
=
{
title
:
'商品名称'
,
dataIndex
:
'商品名称'
,
key
:
'商品名称'
}
_col
.
push
(
col_productName
)
let
_priceAttribute
=
productSelectAttribute
.
filter
(
_item
=>
_item
.
isPrice
)
let
len
=
_priceAttribute
.
length
console
.
log
(
productName
,
_priceAttribute
,
len
,
productSelectAttribute
,
_tableDataSource
,
'---construct---'
)
let
_temp_attributeObjArr
=
[]
// 取id备用
let
_temp_attributeValObjArr
=
[]
// 取id备用
let
_attributeNameArr
=
[]
...
...
@@ -109,7 +109,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_temp_attributeValObjArr
.
push
(
_tempObjArr
)
})
}
console
.
log
(
_priceAttribute
,
_attributeNameArr
,
_attributeValueArr
,
_temp_attributeObjArr
,
_temp_attributeValObjArr
,
'
>>>>>'
)
// .....
..............................
console
.
log
(
_priceAttribute
,
_attributeNameArr
,
_attributeValueArr
,
_temp_attributeObjArr
,
_temp_attributeValObjArr
,
'
---constructimg---'
)
//
..............................
if
(
selectedGoods
.
length
>
0
){
_col
.
push
({
title
:
'对应货品'
,
...
...
@@ -163,6 +163,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
)
}
})
setColumns
(
_col
)
// 生成表格data
...
...
@@ -173,7 +174,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
console
.
log
(
combineArray
,
'combine'
)
let
_tableData
:
any
[]
=
[]
if
(
combineArray
?.
length
>
0
){
// length存在 表示表格的行数
if
(
combineArray
?.
length
>
0
){
// length存在 表示表格的行数
(有价格属性组合)
combineArray
.
map
((
_rowArr
:
any
[],
i
:
any
)
=>
{
// _rowArr 属性值数组
let
_tempObj
:
any
=
{
索引
:
i
,
商品名称
:
productName
}
Array
.
isArray
(
_rowArr
)
?
_rowArr
.
map
((
__rowArr
,
index
)
=>
{
...
...
@@ -193,16 +194,16 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableData
.
push
(
_tempObj
)
})
}
else
{
// length不存在,默认只有商品名称一行
}
else
{
// length不存在,默认只有商品名称一行
(无价格属性组合)只有一行的情况下单价可能有,可能阶梯价,也可能没有
let
_tempObj
:
any
=
{
索引
:
0
,
商品名称
:
productName
}
_tempObj
[
'对应货品'
]
=
selectedGoods
.
length
>
0
?
selectedGoods
[
0
].
id
:
0
// 编辑情况下 对应货品id和单价 特殊处理
_tempObj
[
'单价'
]
=
{}
_tempObj
[
'单价'
]
=
productInfoByEdit
?.
unitPriceAndPicList
[
0
]?.
unitPrice
||
{}
_tableData
.
push
(
_tempObj
)
}
console
.
log
(
_tableData
,
'_tableData'
)
// 只有一项 变动情况下表格数据的key获取不到
console
.
log
(
_tableData
,
'_tableData'
)
// 只有一项 变动情况下表格数据的key获取不到
//..............Bug:再进来这里依旧有数据..................
_tableDataSource
=
_tableData
setTableDataSource
(
_tableDataSource
)
setTableDataSource
(
productName
?
_tableDataSource
:
[])
// 通过商品名称来判断是否显示表格数据
constructedPrarams
()
}
...
...
@@ -302,10 +303,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let
_row
=
{
...
curretSetPriceRow
,
单价
:
_priceRange
}
let
newTabeData
=
[...
_tableDataSource
]
newTabeData
[
curretSetPriceRow
[
'索引'
]]
=
_row
console
.
log
(
newTabeData
,
'newTableData'
)
if
(
isBatchSetting
){
// 判断是否批量设置价格
_tableDataSource
.
map
(
_item
=>
_item
[
'单价'
]
=
_priceRange
)
}
else
{
newTabeData
[
curretSetPriceRow
[
'索引'
]]
=
_row
}
_tableDataSource
=
newTabeData
setTableDataSource
(
_tableDataSource
)
// console.log(_tableDataSource, curretSetPriceRow, v,
'setPriceOk')
console
.
log
(
_tableDataSource
,
curretSetPriceRow
,
v
,
isBatchSetting
,
'setPriceOk'
)
})
}
...
...
@@ -315,6 +321,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
const
clickSetPrice
=
(
record
:
any
)
=>
{
setIsBatchSetting
(
false
)
// 点击行操作批量置为false
setCurrentSetPriceRow
(
record
)
setSetPriceModal
(
true
)
console
.
log
(
record
,
'record'
)
// 通过判断key字符串'0-0' 是否是阶梯价格 注:空对象时候{}为新建状态
...
...
@@ -352,19 +359,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
}
const
handleUnitSearch
=
(
value
:
any
)
=>
{
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectCnUnit
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setUnitData
(
res
.
data
)
})
}
else
{
setUnitData
([])
}
const
handleUnitSearch
=
(
value
?:
any
)
=>
{
PublicApi
.
getProductSelectGetSelectCnUnit
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setUnitData
(
res
.
data
)
})
}
const
handleUnitChange
=
(
value
:
any
,
option
:
any
)
=>
{
console
.
log
(
value
,
option
,
'change value'
)
setUnitValue
(
value
)
priceForm
.
setFieldsValue
({
unitName
:
option
.
children
})
}
...
...
@@ -394,7 +396,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const
clickBatchSetPrice
=
()
=>
{
console
.
log
(
'批量设置价格'
)
setIsBatchSetting
(
!
isBatchSetting
)
setPriceForm
.
resetFields
()
// 先清空
setIsBatchSetting
(
true
)
// 点击置为true
setSetPriceModal
(
true
)
}
...
...
@@ -429,12 +432,13 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
<
Select
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"请输入单位"
placeholder=
"请输入
或选择
单位"
value=
{
unitValue
}
defaultActiveFirstOption=
{
false
}
filterOption=
{
false
}
onSearch=
{
handleUnitSearch
}
onChange=
{
(
value
,
option
)
=>
handleUnitChange
(
value
,
option
)
}
onFocus=
{
()
=>
handleUnitSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
>
...
...
@@ -506,13 +510,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</
Form
>
{
/* 批量设置按钮 */
}
{
planPrice
!=
2
&&
<
Button
type=
"text"
style=
{
{
float
:
'right'
}
}
onClick=
{
clickBatchSetPrice
}
><
SettingOutlined
/>
{
planPrice
===
3
?
'批量设置积分'
:
'批量设置价格'
}
</
Button
>
planPrice
!=
2
&&
productName
&&
<
Button
type=
"text"
style=
{
{
float
:
'right'
}
}
onClick=
{
clickBatchSetPrice
}
><
SettingOutlined
/>
{
planPrice
===
3
?
'批量设置积分'
:
'批量设置价格'
}
</
Button
>
}
<
Table
rowKey=
"索引"
dataSource=
{
tableDataSource
}
columns=
{
planPrice
===
2
?
colums
.
slice
(
0
,
colums
.
length
-
2
)
:
colums
}
pagination=
{
false
}
locale=
{
{
emptyText
:<>
暂无数据
<
br
/>
请先完善商品基本信息项!
</>}
}
style=
{
{
clear
:
'both'
}
}
/>
{
/* 设置价格 */
}
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
b83bb669
...
...
@@ -210,7 +210,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
</Button>
</Form.Item> */
}
</
Form
>
{
attributesData
?.
length
===
0
&&
"请先
选择基本信息中商品品类
项!"
}
{
attributesData
?.
length
===
0
&&
"请先
完善商品基本信息
项!"
}
</>)
}
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
b83bb669
...
...
@@ -52,7 +52,9 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
useEffect
(()
=>
{
let
_priceAttributeParams
:
any
=
[]
if
(
productInfoByEdit
?.
id
){
// id判断是否新增还是编辑
setSetImageType
(
productInfoByEdit
.
isAllAttributePic
||
true
)
console
.
log
(
123456789
)
setSetImageType
(
productInfoByEdit
.
isAllAttributePic
)
setIsAllAttributePic
(
productInfoByEdit
.
isAllAttributePic
)
let
_commodityPicList
=
productInfoByEdit
.
unitPriceAndPicList
.
map
(
_
=>
_
.
commodityPic
)
_priceAttributeParams
=
priceAttributeParams
.
map
((
_item
,
_index
)
=>
{
// 为图片字符串数组手动添加 uid 和 status
...
...
@@ -75,12 +77,13 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
})
}
// console.log('???', _priceAttributeParams)
if
(
_priceAttributeParams
?.
length
>
0
&&
_priceAttributeParams
[
0
]?.
goodsCustomerAttributeList
?.
length
!=
0
){
//
if(_priceAttributeParams?.length>0 && _priceAttributeParams[0]?.goodsCustomerAttributeList?.length!=0){
setDefaultChecked
(
0
)
}
else
{
setDefaultChecked
(
-
1
)
}
clickItemTab
(
-
1
)
clickItemTab
(
0
)
// }else{
// setDefaultChecked(-1)
// clickItemTab(-1)
// }
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
setProductAttributeAndImageParams
(
_priceAttributeParams
)
console
.
log
(
_priceAttributeParams
,
'_p'
)
...
...
@@ -158,7 +161,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
const
handleChange
=
({
file
,
fileList
},
index
)
=>
{
let
_priceAttributeParams
=
[...
priceAttributeParamsByRender
]
console
.
log
(
_priceAttributeParams
,
'图片更改初始数据'
)
console
.
log
(
_priceAttributeParams
,
index
,
'图片更改初始数据'
)
// if(index===-1){ // -1表示所有属性共用 也表示表格只有默认的一行 // 无需判断 不管是共用还是不共用都需要逐条写入fileList
setCommonImageList
(
fileList
)
// _priceAttributeParams[0].commodityPic = fileList
...
...
@@ -167,14 +170,15 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
// }
if
(
!
file
?.
status
&&
file
?.
status
!==
'done'
){
// 不符合要求的 移除没有'done'状态的图片
if
(
index
===
-
1
){
let
ttt
=
_priceAttributeParams
[
0
].
commodityPic
.
filter
(
_
=>
_
.
status
===
'done'
)
setCommonImageList
(
ttt
)
_priceAttributeParams
[
0
].
commodityPic
=
ttt
}
else
{
//
if(index === -1){
//
let ttt = _priceAttributeParams[0].commodityPic.filter(_ => _.status === 'done')
//
setCommonImageList(ttt)
//
_priceAttributeParams[0].commodityPic = ttt
//
}else{
let
ttt
=
_priceAttributeParams
[
index
].
commodityPic
.
filter
(
_
=>
_
.
status
===
'done'
)
_priceAttributeParams
[
index
].
commodityPic
=
ttt
}
setCommonImageList
(
ttt
)
// }
}
console
.
log
(
_priceAttributeParams
,
'图片更改之后数据'
)
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
...
...
@@ -184,9 +188,9 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
const
onChangeSetImageType
=
(
e
)
=>
{
setSetImageType
(
e
.
target
.
value
)
setIsAllAttributePic
(
e
.
target
.
value
)
if
(
e
.
target
.
value
)
clickItemTab
(
-
1
)
else
//
if(e.target.value)
//
clickItemTab(-1)
//
else
clickItemTab
(
0
)
// 切换 清空图片数组
let
_priceAttributeParams
=
[...
priceAttributeParamsByRender
]
...
...
@@ -211,7 +215,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
<
ul
>
{
!
setImageType
?
<
span
className=
{
styles
.
tipTitle
}
>
按特定属性添加图片
</
span
>
:
<
li
className=
{
defaultChecked
==
-
1
?
styles
.
activedLi
:
""
}
onClick=
{
()
=>
clickItemTab
(
-
1
)
}
>
:
<
li
className=
{
defaultChecked
==
0
?
styles
.
activedLi
:
""
}
onClick=
{
()
=>
clickItemTab
(
0
)
}
>
{
/* -1 */
}
<
span
>
所有属性共用
</
span
>
</
li
>
}
...
...
@@ -233,8 +237,8 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
</
Col
>
<
Col
span=
{
20
}
style=
{
{
padding
:
24
}
}
>
{
!
setImageType
&&
priceAttributeParamsByRender
?.
length
>
0
&&
priceAttributeParamsByRender
[
0
]?.
goodsCustomerAttributeList
?.
length
!=
0
?
priceAttributeParamsByRender
.
map
((
item
,
index
)
=>
!
setImageType
?
(
priceAttributeParamsByRender
?.
length
>
0
&&
priceAttributeParamsByRender
[
0
]?.
goodsCustomerAttributeList
?.
length
!=
0
?
priceAttributeParamsByRender
.
map
((
item
,
index
)
=>
<
div
key=
{
index
+
100
}
style=
{
defaultChecked
==
index
?
{
display
:
'block'
}
:
{
display
:
'none'
}
}
>
<
div
className=
{
styles
.
pictureCardBox
}
>
<
div
className=
"clearfix"
>
...
...
@@ -256,14 +260,14 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner
showIcon=
{
false
}
message=
""
description=
{
<>
1. 一次可以选择 6 张图片
<
br
/>
2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式
<
br
/>
3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图
</>
}
description=
{
<>
1.
(按属性设置)
一次可以选择 6 张图片
<
br
/>
2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式
<
br
/>
3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图
</>
}
type=
"info"
closable
style=
{
{
backgroundColor
:
'#F0F8FF'
,
color
:
'#1B9AEE'
}
}
/>
</
div
>
)
:
<
div
style=
{
defaultChecked
==
-
1
?
{
display
:
'block'
}
:
{
display
:
'none'
}
}
>
)
:
null
)
:
<
div
style=
{
defaultChecked
==
0
?
{
display
:
'block'
}
:
{
display
:
'none'
}
}
>
{
/* -1 */
}
<
div
className=
{
styles
.
pictureCardBox
}
>
<
div
className=
"clearfix"
>
<
Upload
...
...
@@ -273,7 +277,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
fileList=
{
commonImageList
}
beforeUpload=
{
beforeUpload
}
onPreview=
{
handlePreview
}
onChange=
{
(
files
)
=>
handleChange
(
files
,
-
1
)
}
onChange=
{
(
files
)
=>
handleChange
(
files
,
0
)
}
//-1
data=
{
{
fileType
:
UPLOAD_TYPE
}
}
>
{
commonImageList
.
length
>=
6
?
null
:
uploadButton
}
...
...
@@ -284,7 +288,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner
showIcon=
{
false
}
message=
""
description=
{
<>
1. 一次可以选择 6 张图片
<
br
/>
2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式
<
br
/>
3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图
</>
}
description=
{
<>
1.
(所有属性共用)
一次可以选择 6 张图片
<
br
/>
2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式
<
br
/>
3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图
</>
}
type=
"info"
closable
style=
{
{
backgroundColor
:
'#F0F8FF'
,
color
:
'#1B9AEE'
}
}
...
...
src/pages/commodity/products/directChannel.tsx
View file @
b83bb669
...
...
@@ -4,7 +4,6 @@ import { Button, Form, Card, Modal, Select, Row, Col, Dropdown, Input, Menu, Spa
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
EyeOutlined
,
DownOutlined
,
CaretUpOutlined
,
CaretDownOutlined
,
...
...
@@ -24,6 +23,7 @@ import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
import
{
PublicApi
}
from
'@/services/api'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
searchBrandOptionEffect
,
searchCustomerCategoryOptionEffect
}
from
'./effect'
import
EyePreview
from
'@/components/EyePreview'
// 定义选择的行数据的类型
interface
Item
{
...
...
@@ -38,59 +38,6 @@ interface Item {
status
:
string
;
}
const
data
=
[
{
id
:
'1'
,
role
:
'百达翡丽'
,
type
:
'小羊皮'
,
brand
:
'YSL'
,
unit
:
'寸'
,
price
:
'¥400 ~ ¥500'
,
channelName
:
'经销商'
,
origin
:
'江南皮革厂'
,
batch
:
'2015-15-26 12:12:76'
,
status
:
'0'
},
{
id
:
'2'
,
role
:
'万宝卡'
,
type
:
'小瓜皮'
,
brand
:
'MAC'
,
unit
:
'克'
,
price
:
'¥400 ~ ¥500'
,
channelName
:
'经销商'
,
origin
:
'江南皮革厂'
,
batch
:
'2015-15-26 12:12:76'
,
status
:
'1'
},
{
id
:
'3'
,
role
:
'小宝SOD蜜'
,
type
:
'洗护一体'
,
brand
:
'AOC'
,
unit
:
'吨'
,
price
:
'¥186 ~ ¥536'
,
channelName
:
'经销商'
,
origin
:
'江南皮革厂'
,
batch
:
'2015-15-26 12:12:76'
,
status
:
'2'
}
]
// 模拟请求
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
queryResult
=
data
.
find
(
v
=>
v
.
id
===
params
.
keywords
)
setTimeout
(()
=>
{
resolve
({
code
:
200
,
message
:
''
,
data
:
queryResult
?
[
queryResult
]
:
data
})
},
1000
)
})
}
const
formActions
=
createFormActions
();
const
DirectChannel
:
React
.
FC
<
{}
>
=
()
=>
{
...
...
@@ -101,56 +48,64 @@ const DirectChannel: React.FC<{}> = () => {
const
[
isUp
,
setIsUp
]
=
useState
(
1
)
// 1上0下架状态
const
[
upDownModal
,
setUpDownModal
]
=
useState
(
false
)
// brand: {id: 33, name: "沙县",…}
// code: "P00002M"
// customerCategory: {id: 49, name: "男装"}
// id: 85
// name: "沙县沙滩裤"
// parentMemberId: null
// parentMemberName: null
// priceType: 1
// source: null
// status: 5
// unitName: "件"
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'role'
,
align
:
'center'
,
key
:
'role'
,
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
span
className=
"commonPickColor"
onClick=
{
()
=>
handleSee
(
record
)
}
>
{
text
}
<
EyeOutlined
/></
span
>
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/viewDirectChannel?id=${record.key}`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'品类'
,
dataIndex
:
'type'
,
align
:
'center'
,
key
:
'type'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
key
:
'id'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brand'
,
align
:
'center'
,
key
:
'brand'
,
dataIndex
:
[
'brand'
,
'name'
],
key
:
'id'
,
},
{
title
:
'单位'
,
dataIndex
:
'unit'
,
align
:
'center'
,
key
:
'unit'
,
dataIndex
:
'unitName'
,
key
:
'unitName'
,
},
{
title
:
'价格'
,
dataIndex
:
'price'
,
align
:
'center'
,
key
:
'price'
,
},
{
title
:
'渠道会员名称'
,
dataIndex
:
'channelName'
,
align
:
'center'
,
key
:
'chanelName'
,
dataIndex
:
'parentMemberName'
,
key
:
'parentMemberName'
,
},
{
title
:
'商品来源'
,
dataIndex
:
'origin'
,
align
:
'center'
,
key
:
'origin'
,
dataIndex
:
'source'
,
key
:
'source'
,
},
{
title
:
'操作时间'
,
...
...
@@ -165,12 +120,12 @@ const DirectChannel: React.FC<{}> = () => {
key
:
'status'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
if
(
record
.
status
===
'1'
)
if
(
record
.
status
===
5
)
component
=
(<
span
style=
{
{
color
:
'#00B37A'
,
padding
:
'2px 5px'
,
background
:
'rgba(235,247,242,1)'
,
borderRadius
:
'4px'
}
}
>
已上架
</
span
>)
else
if
(
record
.
status
===
'2'
)
else
if
(
record
.
status
===
6
)
component
=
(<
span
style=
{
{
padding
:
'2px 5px'
,
background
:
'rgba(244,245,247,1)'
,
borderRadius
:
'4px'
}
}
>
已下架
</
span
>)
else
if
(
record
.
status
===
'0'
)
component
=
(<
span
style=
{
{
color
:
'#E63F3B'
,
padding
:
'2px 5px'
,
background
:
'rgba(255,235,230,1)'
,
borderRadius
:
'4px'
}
}
>
未上架
</
span
>)
else
if
(
record
.
status
===
4
)
component
=
(<
span
style=
{
{
color
:
'#E63F3B'
,
padding
:
'2px 5px'
,
background
:
'rgba(255,235,230,1)'
,
borderRadius
:
'4px'
}
}
>
审核通过
</
span
>)
return
component
}
},
...
...
@@ -181,8 +136,8 @@ const DirectChannel: React.FC<{}> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
{
(
record
.
status
===
'0'
||
record
.
status
===
'2'
)?<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
1
)
}
>
上架
</
Button
>:
''
}
{
record
.
status
===
'1'
?<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
0
)
}
>
下架
</
Button
>:
''
}
{
(
record
.
status
===
6
)?<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
1
)
}
>
上架
</
Button
>:
''
}
{
record
.
status
===
5
?<
Button
type=
'link'
onClick=
{
()
=>
clickUp
(
0
)
}
>
下架
</
Button
>:
''
}
<
Button
type=
'link'
>
修改
</
Button
>
<
Button
type=
'link'
>
删除
</
Button
>
</>
...
...
@@ -191,6 +146,17 @@ const DirectChannel: React.FC<{}> = () => {
}
];
const
fetchData
=
(
params
:
any
)
=>
{
console
.
log
(
params
,
'params'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
console
.
log
(
data
,
'data'
)
resolve
(
data
)
})
})
}
const
handleBatchUp
=
()
=>
{
console
.
log
(
'批量上架'
)
setUpDownModal
(
true
)
...
...
@@ -208,11 +174,6 @@ const DirectChannel: React.FC<{}> = () => {
console
.
log
(
'删除'
)
}
const
handleSee
=
(
record
:
any
)
=>
{
console
.
log
(
'see'
)
history
.
push
(
`/memberCenter/commodityAbility/commodity/products/viewDirectChannel?id=
${
record
.
key
}
`
)
}
const
confirm
=
()
=>
{
console
.
log
(
'confirm'
)
}
...
...
@@ -270,12 +231,6 @@ const DirectChannel: React.FC<{}> = () => {
}
}
// const fetchSelectBrand = async (params) => {
// const { data } = await PublicApi.getProductSelectGetSelectBrand({ name: params })
// console.log(params, data)
// return data
// }
const
menuMore
=
(
<
Menu
onClick=
{
(
param
)
=>
handleMenuClick
(
param
)
}
>
<
Menu
.
Item
key=
"2"
icon=
{
<
VerticalAlignTopOutlined
/>
}
>
...
...
src/pages/commodity/products/fastModifyPrice.tsx
View file @
b83bb669
...
...
@@ -4,7 +4,6 @@ import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox,
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
EyeOutlined
,
MinusOutlined
,
CaretUpOutlined
,
CaretDownOutlined
...
...
@@ -14,6 +13,7 @@ import { ColumnType } from 'antd/lib/table/interface'
import
moment
from
'moment'
import
styles
from
"./index.less"
import
{
PublicApi
}
from
'@/services/api'
import
EyePreview
from
'@/components/EyePreview'
const
{
Option
}
=
Select
;
const
{
Item
}:
any
=
Form
...
...
@@ -41,8 +41,6 @@ interface paramItem {
status
:
number
;
}
let
timeChange
:
any
;
const
FastModifyPrice
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
[
setForm
]
=
Form
.
useForm
()
...
...
@@ -57,16 +55,17 @@ const FastModifyPrice: React.FC<{}> = () => {
wrapperCol
:
{
span
:
24
},
};
const
[
filterParams
,
setFilterParams
]
=
useState
<
paramItem
>
({
name
:
''
,
code
:
''
,
priceType
:
null
,
min
:
null
,
max
:
null
,
brandId
:
0
,
customerCategoryId
:
0
,
status
:
null
,
})
// const [filterParams, setFilterParams] = useState<paramItem>({
// name: '',
// code: '',
// priceType: null,
// min: null,
// max: null,
// brandId: 0,
// customerCategoryId: 0,
// status: null,
// })
const
[
filterParams
,
setFilterParams
]
=
useState
<
any
>
({})
const
[
brandData
,
setBrandData
]
=
useState
<
any
>
([])
const
[
brandValue
,
setBrandValue
]
=
useState
(
undefined
)
const
[
classData
,
setClassData
]
=
useState
<
any
>
([])
...
...
@@ -84,7 +83,11 @@ const FastModifyPrice: React.FC<{}> = () => {
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
span
className=
"commonPickColor"
onClick=
{
()
=>
handleSee
(
record
)
}
>
{
text
}
<
EyeOutlined
/></
span
>
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.commodityId}`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'品类'
,
...
...
@@ -186,11 +189,6 @@ const FastModifyPrice: React.FC<{}> = () => {
})
}
const
handleSee
=
(
record
:
any
)
=>
{
console
.
log
(
'see'
)
history
.
push
(
`/memberCenter/commodityAbility/commodity/products/viewProducts?id=
${
record
.
commodityId
}
`
)
}
const
handleModify
=
(
record
:
any
)
=>
{
console
.
log
(
'点击修改价格'
,
record
)
const
{
id
,
unitPrice
,
priceType
}
=
record
...
...
@@ -221,53 +219,39 @@ const FastModifyPrice: React.FC<{}> = () => {
const
handleReset
=
()
=>
{
let
restObj
=
{
name
:
''
,
code
:
''
,
max
:
null
,
min
:
null
,
priceType
:
null
,
brandId
:
0
,
customerCategoryId
:
0
,
status
:
null
}
setFilterParams
(
restObj
)
setFilterParams
({})
setBrandValue
(
undefined
)
setClassValue
(
undefined
)
ref
.
current
.
reload
(
restObj
)
ref
.
current
.
reload
(
{}
)
}
const
handleBrandSearch
=
(
value
:
any
)
=>
{
// end value
// console.log(value, 'handleBrandSearch')
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
else
{
setBrandData
([])
}
const
handleBrandSearch
=
(
value
?:
any
)
=>
{
// end value
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
const
handleBrandChange
=
(
value
:
any
)
=>
{
setBrandValue
(
value
)
// console.log(value, 'handleBrandChange')
let
obj
=
{
...
filterParams
,
brandId
:
value
}
setFilterParams
(
obj
)
}
const
handleClassSearch
=
(
value
:
any
)
=>
{
// console.log(value, 'handleClassSearch')
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
else
{
setClassData
([])
}
const
handleClassSearch
=
(
value
?:
any
)
=>
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
const
handleClassChange
=
(
value
:
any
)
=>
{
setClassValue
(
value
)
let
obj
=
{
...
filterParams
,
customerCategoryId
:
value
}
setFilterParams
(
obj
)
// console.log(value, 'handleClassChange')
}
const
handleSearch
=
(
val
:
string
)
=>
{
console
.
log
(
val
)
let
obj
=
{
...
filterParams
,
name
:
val
}
setFilterParams
(
obj
)
ref
.
current
.
reload
(
obj
)
...
...
@@ -276,14 +260,11 @@ const FastModifyPrice: React.FC<{}> = () => {
const
handleOk
=
()
=>
{
setForm
.
validateFields
().
then
(
v
=>
{
setModifyModal
(
false
)
// console.log(v,'value')
})
// console.log('handleOk')
}
const
handleCancel
=
()
=>
{
setModifyModal
(
false
)
// console.log('handleCancel')
}
const
changeLadderPrice
=
(
e
:
any
)
=>
{
...
...
@@ -369,32 +350,34 @@ const FastModifyPrice: React.FC<{}> = () => {
</
Col
>
<
Col
span=
{
4
}
>
<
Select
showSearch
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"商品品牌"
value=
{
brandValue
}
defaultActiveFirstOption=
{
false
}
showArrow=
{
false
}
filterOption=
{
false
}
onSearch=
{
handleBrandSearch
}
onChange=
{
handleBrandChange
}
onFocus=
{
()
=>
handleBrandSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
>
{
brandData
.
map
(
d
=>
<
Option
value=
{
d
.
id
}
key=
{
d
.
id
}
>
{
d
.
name
}
</
Option
>)
}
</
Select
>
</
Col
>
<
Col
span=
{
4
}
>
<
Select
showSearch
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"商品品类"
value=
{
classValue
}
defaultActiveFirstOption=
{
false
}
showArrow=
{
false
}
filterOption=
{
false
}
onSearch=
{
handleClassSearch
}
onChange=
{
handleClassChange
}
onFocus=
{
()
=>
handleClassSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
>
{
classData
.
map
(
d
=>
<
Option
value=
{
d
.
id
}
key=
{
d
.
id
}
>
{
d
.
name
}
</
Option
>)
}
</
Select
>
...
...
src/pages/commodity/products/index.tsx
View file @
b83bb669
...
...
@@ -460,8 +460,10 @@ const Products: React.FC<{}> = () => {
console
.
log
(
'复制商品'
)
const
{
id
}
=
record
;
if
(
id
){
PublicApi
.
postProductCommodityCopyCommodity
({
id
:
id
})
ref
.
current
.
reload
()
PublicApi
.
postProductCommodityCopyCommodity
({
id
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
}
}
...
...
@@ -469,8 +471,10 @@ const Products: React.FC<{}> = () => {
console
.
log
(
'提交审核'
)
const
{
id
}
=
record
;
if
(
id
)
PublicApi
.
postProductCommodityApplyCheckCommodity
({
id
:
id
})
ref
.
current
.
reload
()
PublicApi
.
postProductCommodityApplyCheckCommodity
({
id
:
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
}
const
handleMenuClick
=
(
e
:
any
)
=>
{
...
...
@@ -501,42 +505,30 @@ const Products: React.FC<{}> = () => {
ref
.
current
.
reload
(
restObj
)
}
const
handleBrandSearch
=
(
value
:
any
)
=>
{
// end value
console
.
log
(
value
,
'handleBrandSearch'
)
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
else
{
setBrandData
([])
}
const
handleBrandSearch
=
(
value
?:
any
)
=>
{
// end value
PublicApi
.
getProductSelectGetSelectBrand
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setBrandData
(
res
.
data
)
})
}
const
handleBrandChange
=
(
value
:
any
)
=>
{
setBrandValue
(
value
)
console
.
log
(
value
,
'handleBrandChange'
)
let
obj
=
{...
filterParams
,
brandId
:
value
}
setFilterParams
(
obj
)
}
const
handleClassSearch
=
(
value
:
any
)
=>
{
console
.
log
(
value
,
'handleClassSearch'
)
if
(
value
)
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
else
{
setClassData
([])
}
const
handleClassSearch
=
(
value
?:
any
)
=>
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
({
name
:
value
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
setClassData
(
res
.
data
)
})
}
const
handleClassChange
=
(
value
:
any
)
=>
{
setClassValue
(
value
)
let
obj
=
{...
filterParams
,
customerCategoryId
:
value
}
setFilterParams
(
obj
)
console
.
log
(
value
,
'handleClassChange'
)
}
const
handleSearch
=
(
val
?:
string
)
=>
{
...
...
@@ -627,7 +619,8 @@ const Products: React.FC<{}> = () => {
defaultActiveFirstOption=
{
false
}
filterOption=
{
false
}
onSearch=
{
handleBrandSearch
}
onChange=
{
handleBrandChange
}
onChange=
{
handleBrandChange
}
onFocus=
{
()
=>
handleBrandSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
>
...
...
@@ -644,6 +637,7 @@ const Products: React.FC<{}> = () => {
filterOption=
{
false
}
onSearch=
{
handleClassSearch
}
onChange=
{
handleClassChange
}
onFocus=
{
()
=>
handleClassSearch
(
null
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'100%'
}
}
>
...
...
src/pages/commodity/products/viewProducts.tsx
View file @
b83bb669
...
...
@@ -318,7 +318,7 @@ const viewProducts: React.FC<{}> = () => {
backIcon=
{
<
ReutrnEle
logoSrc=
{
productDetail
?.
unitPriceAndPicList
[
0
]?.
commodityPic
[
0
]
}
/>
}
content=
{
content
}
extra=
{
[
<
Button
icon=
{
<
FormOutlined
/>
}
key=
"1"
type=
"primary"
disabled=
{
productDetail
?.
status
!==
3
}
onClick=
{
clickModify
}
>
<
Button
icon=
{
<
FormOutlined
/>
}
key=
"1"
type=
"primary"
disabled=
{
productDetail
?.
status
!==
3
&&
productDetail
?.
status
!==
1
}
onClick=
{
clickModify
}
>
修改
</
Button
>,
]
}
...
...
@@ -360,7 +360,7 @@ const viewProducts: React.FC<{}> = () => {
<
Col
span=
{
20
}
>
<
p
>
{
productDetail
?.
commodityAreaList
.
map
(
_item
=>
<
p
>
{
_item
.
provinceName
+
'/'
+
_item
.
cityName
}
</
p
>)
productDetail
?.
commodityAreaList
.
map
(
_item
=>
<
p
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>)
}
</
p
>
</
Col
>
...
...
@@ -529,7 +529,8 @@ const viewProducts: React.FC<{}> = () => {
<
Space
direction=
"vertical"
style=
{
{
width
:
'100%'
}
}
>
<
Card
headStyle=
{
{
borderBottom
:
'none'
}
}
title=
"商品图片"
>
{
productDetail
?.
unitPriceAndPicList
[
0
].
attributeAndValueList
.
length
===
0
?
<>
// productDetail?.unitPriceAndPicList[0].attributeAndValueList.length === 0 ? <>
productDetail
?.
isAllAttributePic
?
<>
<
Row
>
<
Col
span=
{
3
}
>
<
p
>
设置方式:
</
p
>
...
...
@@ -599,7 +600,7 @@ const viewProducts: React.FC<{}> = () => {
{
/* 图片区块 */
}
<
div
className=
{
styles
.
descriptionBox
}
>
{
productDetail
?.
commodityRemark
?.
image
.
length
>
0
?
productDetail
?.
commodityRemark
?.
image
.
map
((
_item
,
_index
)
=>
<
div
key=
{
_index
}
className=
{
styles
.
imgItem
}
>
productDetail
?.
commodityRemark
?.
image
?
.
length
>
0
?
productDetail
?.
commodityRemark
?.
image
.
map
((
_item
,
_index
)
=>
<
div
key=
{
_index
}
className=
{
styles
.
imgItem
}
>
<
img
src=
{
_item
}
/>
</
div
>)
:
<
p
>
暂无数据
</
p
>
}
...
...
src/store/product/index.ts
View file @
b83bb669
...
...
@@ -13,7 +13,7 @@ class ProductStore implements IProductModule {
@
observable
public
areaOption
:
any
[]
=
[];
@
observable
public
productInfoByEdit
:
GetProductCommodityGetCommodityResponse
;
@
observable
public
productDescription
:
IDecsParams
;
@
observable
public
isAllAttributePic
:
boolean
=
null
;
// 是否所有属性共用
@
observable
public
isAllAttributePic
:
boolean
=
true
;
// 是否所有属性共用
/** 计算操作 **/
// 加工接口返回的数据,用户编辑回显数据
...
...
@@ -89,6 +89,7 @@ class ProductStore implements IProductModule {
@
action
.
bound
public
setProductSelectAttribute
(
list
:
any
[])
{
console
.
log
(
list
,
'mobx'
)
this
.
productSelectAttribute
=
list
;
}
...
...
@@ -103,8 +104,13 @@ class ProductStore implements IProductModule {
}
@
action
.
bound
public
clearData
(
data
:
any
[])
{
this
.
tableDataSource
=
data
;
public
clearData
(
data
?:
any
[])
{
this
.
tableDataSource
=
data
||
[];
//productName, selectedGoods, productSelectAttribute, productInfoByEdit
this
.
productName
=
null
;
this
.
selectedGoods
=
[];
this
.
productSelectAttribute
=
[];
this
.
productInfoByEdit
=
null
;
}
@
action
.
bound
...
...
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