Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
e21f8016
Commit
e21f8016
authored
Aug 08, 2022
by
beisir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新的分类接口
parent
52e2e6cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+2
-1
index.jsx
src/pages/ServiceGoods/index.jsx
+21
-0
service.js
src/pages/ServiceGoods/service.js
+5
-0
No files found.
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
e21f8016
...
...
@@ -18,6 +18,7 @@ const filterCategoryOptions = (inputValue, path) =>
const
FormInformationBasic
=
forwardRef
((
props
,
ref
)
=>
{
const
{
editData
,
newCategoryList
,
categoryList
,
virtualCategoryList
,
brandList
,
...
...
@@ -95,7 +96,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
placeholder=
"请选择商品类目!"
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
options=
{
customer
.
productType
===
2
?
virtualCategoryList
:
categoryList
}
options=
{
newCategoryList
[
customer
.
productType
]
}
/>
</
Form
.
Item
>
{
!
customer
.
isCard
&&
(
...
...
src/pages/ServiceGoods/index.jsx
View file @
e21f8016
...
...
@@ -17,6 +17,7 @@ import {
shopGetBySupplierId
,
merchantProductAdd
,
merchantProductEdit
,
getByProductType
,
}
from
'
./service
'
;
import
{
isUrl
,
filterSendData
,
clearCurrent
}
from
'
./utils
'
;
import
{
ServiceContext
}
from
'
./context
'
;
...
...
@@ -45,6 +46,7 @@ const ServiceGoods = options => {
const
[
brandList
,
setBrandList
]
=
useState
([]);
// 获取商品牌
const
[
specList
,
setSpecList
]
=
useState
([]);
// 规格列表
const
[
editData
,
setEditData
]
=
useState
({});
// 编辑保存数据
const
[
newCategoryList
,
setNewCategoryList
]
=
useState
({});
// const [shopList, setShopList] = useState([]); // 供应商列表
const
[
checkFormList
]
=
useState
([
basicRef
,
stockRef
,
settingRef
,
settleOtrRef
,
picturesRef
]);
...
...
@@ -122,6 +124,18 @@ const ServiceGoods = options => {
}
};
const
shopGetByProductType
=
async
type
=>
{
console
.
log
(
newCategoryList
[
type
]);
if
(
!
newCategoryList
[
type
]?.
length
)
{
const
result
=
await
getByProductType
(
type
);
setNewCategoryList
({
...
newCategoryList
,
[
type
]:
result
.
data
||
[],
});
}
// console.log(result);
};
const
submitEvent
=
async
()
=>
{
const
checkPromiseList
=
clearCurrent
(
checkFormList
).
map
(({
current
})
=>
current
.
onCheck
());
const
resuslt
=
await
Promise
.
all
(
checkPromiseList
);
...
...
@@ -179,6 +193,12 @@ const ServiceGoods = options => {
})();
},
[
SourceData
]);
useEffect
(()
=>
{
if
(
options
.
visible
)
{
shopGetByProductType
(
productType
);
}
},
[
productType
,
options
.
visible
]);
const
onSpecCommonImgEvent
=
useCallback
(
keys
=>
{
setSpecKeyList
(
keys
);
...
...
@@ -243,6 +263,7 @@ const ServiceGoods = options => {
<
FormInformationBasic
ref=
{
basicRef
}
editData=
{
editData
.
infoMation
}
newCategoryList=
{
newCategoryList
}
categoryList=
{
categoryList
}
virtualCategoryList=
{
virtualCategoryList
}
brandList=
{
brandList
}
...
...
src/pages/ServiceGoods/service.js
View file @
e21f8016
...
...
@@ -92,3 +92,8 @@ export const shopGetBySupplierId = (state = 1, supplierId = 0) =>
prefix
:
goodsApi
,
headers
,
});
export
const
getByProductType
=
type
=>
request
.
get
(
`/product/category/getByProductType/
${
type
}
`
,
{
prefix
:
goodsApi
,
headers
,
});
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