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
0a497825
Commit
0a497825
authored
Sep 21, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:商品列表页码处理,渠道商品规格必选
parent
87846397
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
95 additions
and
22 deletions
+95
-22
index.ts
src/module/productModule/index.ts
+7
-0
index.tsx
src/pages/classAndProperty/propertyValue/index.tsx
+3
-1
setPrice.tsx
src/pages/commodity/products/addChannelItem/setPrice.tsx
+1
-1
addDirectChannel.tsx
src/pages/commodity/products/addDirectChannel.tsx
+6
-0
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+5
-5
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+1
-3
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+7
-1
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+0
-1
fastModifyPrice.tsx
src/pages/commodity/products/fastModifyPrice.tsx
+4
-3
index.tsx
src/pages/commodity/products/index.tsx
+50
-4
modifyDirectChannel.tsx
src/pages/commodity/products/modifyDirectChannel.tsx
+1
-1
addBrand.tsx
src/pages/trademark/addBrand.tsx
+3
-1
index.ts
src/store/product/index.ts
+7
-1
No files found.
src/module/productModule/index.ts
View file @
0a497825
...
...
@@ -47,6 +47,11 @@ export interface IDecsParams {
word
:
string
[];
}
export
interface
IPage
{
current
:
number
;
pageSize
:
number
;
}
export
interface
IProductModule
{
productInfoByEdit
:
GetProductCommodityGetCommodityResponse
;
attributeLists
:
any
[];
...
...
@@ -59,6 +64,7 @@ export interface IProductModule {
priceAttributeParams
:
any
[];
// 价格设置的传输数据
productAttributeAndImageParams
:
any
[];
//价格属性包含图片的传输数据
areaOption
:
any
[];
// 省市数据
currentPageInStore
:
IPage
;
setAttributeLists
(
lists
:
any
[]):
void
;
setProductName
(
name
:
string
):
void
;
...
...
@@ -72,4 +78,5 @@ export interface IProductModule {
setProductAttributeAndImageParams
(
datas
:
any
[]):
void
;
setAreaOption
(
datas
:
any
[]):
void
;
setProductInfoByEdit
(
data
:
GetProductCommodityGetCommodityResponse
):
void
;
setCurrentPageInStore
(
data
:
IPage
):
void
;
}
src/pages/classAndProperty/propertyValue/index.tsx
View file @
0a497825
...
...
@@ -32,6 +32,7 @@ const PropertyValue: React.FC<{}> = () => {
const
ref
=
useRef
<
any
>
({})
const
[
selectKey
,
setSelectKey
]
=
useState
(
undefined
)
const
[
selectNode
,
setSelectNode
]
=
useState
<
any
>
()
const
[
innerExpandKeys
,
setInnerExpandKeys
]
=
useState
<
any
[]
>
([])
const
{
treeStatus
,
...
...
@@ -55,8 +56,9 @@ const PropertyValue: React.FC<{}> = () => {
if
(
beforeKey
){
// 展开之前的选择项
setSelectKey
(
beforeKey
)
setInnerExpandKeys
([
`
${
prefix
}
_
${
beforeKey
}
`
])
treeActions
.
setExpandedKeys
([
`
${
prefix
}
_
${
beforeKey
}
`
])
// 拼接不正常的key
console
.
log
(
`
${
prefix
}
_
${
beforeKey
}
`
)
console
.
log
(
`
${
prefix
}
_
${
beforeKey
}
`
,
'展开的key'
)
}
},
[])
...
...
src/pages/commodity/products/addChannelItem/setPrice.tsx
View file @
0a497825
...
...
@@ -87,7 +87,7 @@ const SetPrice:React.FC<IProps> = (props) => {
// 获取商品规格列表
const
fetchSpecData
=
(
params
?:
any
)
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPrice
({
id
:
productSelectRowInStore
.
id
+
''
,
source
:
selectedSource
}).
then
(
res
=>
{
PublicApi
.
getProductChannelCommodityGetCommodityUnitPrice
({
id
:
productSelectRowInStore
.
id
+
''
,
source
:
selectedSource
+
''
}).
then
(
res
=>
{
const
{
data
}
=
res
setOriginTableData
(
data
)
if
(
data
.
length
>
0
)
...
...
src/pages/commodity/products/addDirectChannel.tsx
View file @
0a497825
...
...
@@ -58,6 +58,12 @@ const AddDirectChannel:React.FC<{}> = (props) => {
params
.
childMemberRoleName
=
selectedRole
?.
children
||
null
params
.
commodityMemberList
=
selectChannel
.
map
(
item
=>
({
memberId
:
item
.
memberId
,
memberName
:
item
.
name
}))
if
(
!
tableDataInSetPrice
.
length
){
message
.
error
(
'请选择商品规格!'
)
setIsDisabledSave
(
false
)
return
;
}
if
(
params
.
childMemberRoleName
)
PublicApi
.
postProductChannelCommoditySaveChannelCommodity
(
params
).
then
(
res
=>
{
setIsDisabledSave
(
false
)
...
...
src/pages/commodity/products/addProducts.tsx
View file @
0a497825
...
...
@@ -46,7 +46,7 @@ const AddProducts: React.FC<{}> = (props) => {
clearData
,
setProductInfoByEdit
,
isAllAttributePic
,
productInfoByEdit
productInfoByEdit
,
}
=
ProductStore
useEffect
(()
=>
{
...
...
@@ -256,15 +256,15 @@ const AddProducts: React.FC<{}> = (props) => {
PublicApi
.
postProductCommoditySaveOrUpdateCommodity
(
_params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
){
setIsEnableCheck
(
false
)
setIsDisableSaveBtn
(
false
)
//
setIsDisableSaveBtn(false)
setReponseId
(
res
.
data
)
}
})
}).
then
(
e
=>
{
setIsDisableSaveBtn
(
false
)
if
(
e
)
if
(
e
){
setIsDisableSaveBtn
(
fals
e
)
message
.
error
(
e
.
message
)
}
console
.
log
(
e
,
'e'
)
}).
catch
(
error
=>
{
setIsDisableSaveBtn
(
false
)
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
0a497825
...
...
@@ -128,7 +128,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_attributeValueArr
.
push
(
_tempArr
)
// 价格属性的属性值数组 用于SKU组合
_temp_attributeValObjArr
.
push
(
_tempObjArr
)
})
}
else
if
(
history
.
location
.
query
?.
id
){
// 此时没有属性并且处于编辑状态 取接口返回的数据 [0]?
*9.12*
}
else
if
(
history
.
location
.
query
?.
id
){
// 此时没有属性并且处于编辑状态 取接口返回的数据 [0]?
(也有可能编辑情况下切换到无规格的品类)
_attributeNameArr
=
productInfoByEdit
.
unitPriceAndPicList
[
0
]?.
attributeAndValueList
.
map
(
_
=>
_
.
customerAttribute
.
name
)
_attributeValueArr
=
[
productInfoByEdit
.
unitPriceAndPicList
.
map
(
item
=>
item
.
attributeAndValueList
.
map
(
_
=>
_
.
customerAttributeValue
.
value
))]
_temp_attributeObjArr
=
productInfoByEdit
.
unitPriceAndPicList
[
0
]?.
attributeAndValueList
.
map
(
item
=>
{
...
...
@@ -408,12 +408,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setPriceForm
.
resetFields
()
setLadderPrice
(
false
)
setPlanPrice
(
v
.
target
.
value
)
// console.log(v.target.value, 'v')
}
const
setPriceOk
=
()
=>
{
setPriceForm
.
validateFields
().
then
(
v
=>
{
// console.log(v, 'ladder')
setSetPriceModal
(
false
)
const
{
ladderPrice
,
ladderRange
}
=
v
let
_priceRange
=
{}
...
...
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
0a497825
...
...
@@ -40,7 +40,13 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
const
productAttributeFormRef
=
useRef
()
const
[
attributeForm
]
=
Form
.
useForm
()
const
{
ProductStore
}
=
store
const
{
attributeLists
,
setProductSelectAttribute
,
getProductAttributeFormParamsByEdit
,
productInfoByEdit
,
clearProductDetailsUnitPriceAndPicListInEdit
}
=
ProductStore
const
{
attributeLists
,
setProductSelectAttribute
,
getProductAttributeFormParamsByEdit
,
productInfoByEdit
,
clearProductDetailsUnitPriceAndPicListInEdit
}
=
ProductStore
useEffect
(()
=>
{
onRef
(
productAttributeFormRef
)
...
...
src/pages/commodity/products/directChannel.tsx
View file @
0a497825
...
...
@@ -226,7 +226,6 @@ const DirectChannel: React.FC<{}> = () => {
}
const
fetchData
=
(
params
:
any
)
=>
{
console
.
log
(
params
,
'params'
)
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductChannelCommodityGetChannelCommodityList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
...
...
src/pages/commodity/products/fastModifyPrice.tsx
View file @
0a497825
...
...
@@ -184,7 +184,6 @@ const FastModifyPrice: React.FC<{}> = () => {
];
const
fetchData
=
(
params
:
any
)
=>
{
console
.
log
(
params
,
filterParams
)
return
new
Promise
((
resolve
,
reject
)
=>
{
//@ts-ignore
PublicApi
.
getProductCommodityGetCommodityDetailList
({
...
filterParams
,
...
params
,
environment
:
1
}).
then
(
res
=>
{
...
...
@@ -297,8 +296,10 @@ const FastModifyPrice: React.FC<{}> = () => {
}
const
handleHightSearch
=
(
val
?:
string
)
=>
{
console
.
log
(
val
)
let
obj
=
val
?
{...
filterParams
,
name
:
val
}
:
{
...
filterParams
}
let
_params
:
any
=
{
...
filterParams
}
if
(
_params
.
priceType
)
_params
.
priceTypeList
=
[
_params
.
priceType
]
let
obj
=
val
?
{...
_params
,
name
:
val
}
:
{
...
_params
}
setFilterParams
(
obj
)
ref
.
current
.
reload
(
obj
)
}
...
...
src/pages/commodity/products/index.tsx
View file @
0a497825
...
...
@@ -20,6 +20,8 @@ import styles from "./index.less"
import
{
PublicApi
}
from
'@/services/api'
import
{
GetProductCommodityGetShopResponse
}
from
'@/services'
import
{
store
}
from
'@/store'
const
{
Option
}
=
Select
;
const
{
confirm
}
=
Modal
;
...
...
@@ -65,6 +67,14 @@ const Products: React.FC<{}> = () => {
const
[
checkedValues
,
setCheckedValues
]
=
useState
<
any
>
([])
const
[
currentOptionId
,
setCurrentOptionId
]
=
useState
()
const
[
isDisabledOKbtn
,
setIsDisabledOKbtn
]
=
useState
<
boolean
>
(
false
)
const
[
pageTotal
,
setPageTotal
]
=
useState
<
number
>
()
// 表格当前总数
const
{
ProductStore
}
=
store
const
{
currentPageInStore
,
setCurrentPageInStore
}
=
ProductStore
const
[
currentPage
,
setCurrentPage
]
=
useState
<
number
>
(
currentPageInStore
.
current
||
1
)
// 表格当前页
const
[
currentPageSize
,
setCurrentPageSize
]
=
useState
<
number
>
(
currentPageInStore
.
pageSize
||
10
)
let
[
isHighSearch
,
setIsHighSearch
]
=
useState
(
false
)
const
[
filterParams
,
setFilterParams
]
=
useState
<
paramItem
>
({
...
...
@@ -75,7 +85,7 @@ const Products: React.FC<{}> = () => {
min
:
null
,
max
:
null
,
brandId
:
0
,
customerCategoryId
:
0
,
customerCategoryId
:
0
,
status
:
null
,
statusList
:
null
,
})
...
...
@@ -249,10 +259,14 @@ const Products: React.FC<{}> = () => {
}
const
fetchData
=
(
params
:
any
)
=>
{
if
(
currentPageInStore
.
current
){
params
.
current
=
currentPageInStore
.
current
params
.
pageSize
=
currentPageInStore
.
pageSize
}
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getProductCommodityGetCommodityList
({
...
filterParams
,
...
params
}).
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
const
{
data
}
=
res
setPageTotal
(
data
.
totalCount
)
resolve
(
data
)
})
})
...
...
@@ -365,6 +379,11 @@ const Products: React.FC<{}> = () => {
const
[
time
,
setTime
]
=
useState
(
0
);
// timer
useEffect
(()
=>
{
clearInterval
(
timeChange
)
// 监听路由 清空页码数据
history
.
listen
((
location
,
action
)
=>
{
if
(
location
.
pathname
.
indexOf
(
'/commodity/products'
)
===
-
1
)
setCurrentPageInStore
({
current
:
null
,
pageSize
:
null
})
})
},
[])
useEffect
(()
=>
{
console
.
log
(
modalStep
)
...
...
@@ -428,7 +447,7 @@ const Products: React.FC<{}> = () => {
message
.
error
(
'您还还未创建店铺,请先创建店铺!'
)
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/shopAbility/infoManage'
)
},
3
000
)
},
1
000
)
}
})
}
...
...
@@ -608,6 +627,18 @@ const Products: React.FC<{}> = () => {
ref
.
current
.
reload
(
obj
)
}
const
onChangePage
=
(
page
,
pageSize
)
=>
{
setCurrentPageInStore
({
current
:
page
,
pageSize
:
pageSize
})
setCurrentPage
(
page
)
setCurrentPageSize
(
pageSize
)
}
const
onChangePageSize
=
(
current
,
size
)
=>
{
setCurrentPageInStore
({
current
:
1
,
pageSize
:
size
})
setCurrentPage
(
1
)
setCurrentPageSize
(
size
)
}
const
menuMore
=
(
<
Menu
onClick=
{
(
e
)
=>
handleMenuClick
(
e
)
}
>
<
Menu
.
Item
key=
"1"
icon=
{
<
DeleteOutlined
/>
}
>
...
...
@@ -619,6 +650,7 @@ const Products: React.FC<{}> = () => {
</
Menu
>
)
return
(
<
PageHeaderWrapper
>
<
Card
>
...
...
@@ -626,7 +658,21 @@ const Products: React.FC<{}> = () => {
columns=
{
columns
}
currentRef=
{
ref
}
rowSelection=
{
rowSelection
}
tableProps=
{
{
rowKey
:
'id'
}
}
tableProps=
{
{
rowKey
:
'id'
,
pagination
:
{
onChange
:
onChangePage
,
current
:
currentPage
,
total
:
pageTotal
,
showTotal
:
total
=>
`共 ${total} 条`
,
size
:
'small'
,
defaultPageSize
:
10
,
showSizeChanger
:
true
,
pageSize
:
currentPageSize
,
onShowSizeChange
:
onChangePageSize
,
showQuickJumper
:
true
}
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
<
Row
>
...
...
src/pages/commodity/products/modifyDirectChannel.tsx
View file @
0a497825
...
...
@@ -101,7 +101,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
// 构建规格弹框table 列columns
let
col
:
any
=
[]
let
temp
:
any
=
[]
data
[
0
].
attributeAndValueList
.
map
(
_item
=>
{
data
[
0
]
?
.
attributeAndValueList
.
map
(
_item
=>
{
temp
.
push
({
title
:
_item
.
customerAttribute
.
name
,
dataIndex
:
[
_item
.
customerAttribute
.
name
,
'value'
],
key
:
_item
.
customerAttribute
.
name
})
})
col
.
push
({
...
...
src/pages/trademark/addBrand.tsx
View file @
0a497825
...
...
@@ -65,6 +65,7 @@ const AddBrand: React.FC<{}> = () => {
const
[
responseId
,
setReponseId
]
=
useState
<
number
>
(
null
)
const
[
formValues
,
setFormValues
]
=
useState
<
any
>
({})
const
[
banSomeField
,
setBanSomeField
]
=
useState
<
boolean
>
(
false
)
const
[
isDisabledSave
,
setIsDisabledSave
]
=
useState
<
boolean
>
(
false
)
useEffect
(()
=>
{
const
{
id
}
=
history
.
location
.
query
...
...
@@ -138,6 +139,7 @@ const AddBrand: React.FC<{}> = () => {
delete
values
.
proveUrl
.
file
}
PublicApi
.
postProductBrandSaveOrUpdateBrand
(
values
).
then
(
res
=>
{
setIsDisabledSave
(
true
)
setIsEnableCheck
(
false
)
//@ts-ignore
setReponseId
(
res
.
data
)
...
...
@@ -178,7 +180,7 @@ const AddBrand: React.FC<{}> = () => {
title=
{
history
.
location
.
query
?.
id
?
'修改品牌'
:
'新建品牌'
}
extra=
{
[
<
Button
key=
"2"
disabled=
{
isEnableCheck
}
onClick=
{
handleApplyCheck
}
>
直接提交审核
</
Button
>,
<
Button
icon=
{
<
SaveOutlined
/>
}
key=
"1"
type=
"primary"
onClick=
{
handleSave
}
>
<
Button
icon=
{
<
SaveOutlined
/>
}
key=
"1"
type=
"primary"
onClick=
{
handleSave
}
disabled=
{
isDisabledSave
}
>
保存
</
Button
>,
]
}
...
...
src/store/product/index.ts
View file @
0a497825
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
IProductModule
,
IProductSelectAttribute
,
IBasicFormParam
,
IPriceAttributeParam
,
IOtherParam
,
IDecsParams
}
from
'@/module/productModule'
;
// mobx要用到的数据类型
import
{
IProductModule
,
IProductSelectAttribute
,
IBasicFormParam
,
IPriceAttributeParam
,
IOtherParam
,
IDecsParams
,
IPage
}
from
'@/module/productModule'
;
// mobx要用到的数据类型
class
ProductStore
implements
IProductModule
{
@
observable
public
attributeLists
:
any
[]
=
[];
...
...
@@ -15,6 +15,7 @@ class ProductStore implements IProductModule {
@
observable
public
productInfoByEdit
:
any
;
@
observable
public
productDescription
:
IDecsParams
;
@
observable
public
isAllAttributePic
:
boolean
=
true
;
// 是否所有属性共用
@
observable
public
currentPageInStore
:
IPage
=
{
current
:
null
,
pageSize
:
null
};
// 页码相关
/** 计算操作 **/
// 加工接口返回的数据,用户编辑回显数据
...
...
@@ -168,6 +169,11 @@ class ProductStore implements IProductModule {
this
.
isAllAttributePic
=
data
}
@
action
.
bound
public
setCurrentPageInStore
(
data
:
IPage
)
{
this
.
currentPageInStore
=
data
}
}
...
...
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