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
ede9b518
Commit
ede9b518
authored
Dec 23, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加回显基本信息
parent
3ef322b9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
33 deletions
+84
-33
index.jsx
src/pages/GoodsManage/index.jsx
+1
-1
common.less
src/pages/ServiceGoods/common.less
+7
-0
EditFormTable.jsx
src/pages/ServiceGoods/components/EditFormTable.jsx
+1
-1
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+3
-5
FormPriceOrStock.jsx
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
+16
-15
FormRuleSetting.jsx
src/pages/ServiceGoods/components/FormRuleSetting.jsx
+1
-1
FormRuleVPictures.jsx
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
+1
-1
FormSettlementOthers.jsx
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
+1
-1
index.jsx
src/pages/ServiceGoods/index.jsx
+48
-4
utils.js
src/pages/ServiceGoods/utils.js
+5
-4
No files found.
src/pages/GoodsManage/index.jsx
View file @
ede9b518
...
@@ -53,7 +53,7 @@ class goodsManage extends Component {
...
@@ -53,7 +53,7 @@ class goodsManage extends Component {
stockSkuIds
:
[],
stockSkuIds
:
[],
isType
:
''
,
isType
:
''
,
serviceVisble
:
fals
e
,
serviceVisble
:
tru
e
,
serviceData
:
{},
serviceData
:
{},
visibleAuditModal
:
false
,
visibleAuditModal
:
false
,
auditRow
:
{},
// 查看审核信息使用
auditRow
:
{},
// 查看审核信息使用
...
...
src/pages/ServiceGoods/common.less
View file @
ede9b518
...
@@ -179,3 +179,10 @@
...
@@ -179,3 +179,10 @@
.btnMore {
.btnMore {
text-align: center;
text-align: center;
}
}
.draftBox {
margin-bottom: 5px;
}
.conEdit {
color: #0e75fd;
cursor: pointer;
}
src/pages/ServiceGoods/components/EditFormTable.jsx
View file @
ede9b518
...
@@ -97,7 +97,7 @@ const EditFormTable = forwardRef((props, ref) => {
...
@@ -97,7 +97,7 @@ const EditFormTable = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
props
.
onValuesChange
(
{
skuList
:
values
.
tableList
}
);
},
400
);
},
400
);
const
rowOnClickEvent
=
row
=>
{
const
rowOnClickEvent
=
row
=>
{
...
...
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
ede9b518
...
@@ -56,7 +56,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -56,7 +56,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
props
.
onValuesChange
(
{
infoMation
:
values
}
);
},
400
);
},
400
);
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
...
@@ -70,10 +70,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -70,10 +70,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
},
[
brandList
]);
},
[
brandList
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
customer
.
isEdit
)
{
if
(
!
editData
)
return
;
if
(
!
editData
)
return
;
form
.
setFieldsValue
(
editData
);
form
.
setFieldsValue
(
editData
);
}
},
[
customer
.
isEdit
,
editData
]);
},
[
customer
.
isEdit
,
editData
]);
return
(
return
(
...
...
src/pages/ServiceGoods/components/FormPriceOrStock.jsx
View file @
ede9b518
...
@@ -295,11 +295,6 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -295,11 +295,6 @@ const FormPriceOrStock = forwardRef((props, ref) => {
}
}
};
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
},
400
);
const
CreateColumnsEvent
=
specData
=>
{
const
CreateColumnsEvent
=
specData
=>
{
const
columsData
=
[];
const
columsData
=
[];
if
(
specData
.
firstSpec
&&
specData
.
firstSpecValue
.
length
)
{
if
(
specData
.
firstSpec
&&
specData
.
firstSpecValue
.
length
)
{
...
@@ -369,7 +364,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -369,7 +364,7 @@ const FormPriceOrStock = forwardRef((props, ref) => {
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
const
{
batchItem
,
bacthFirst
,
bacthSecon
}
=
values
;
const
{
batchItem
,
bacthFirst
,
bacthSecon
}
=
values
;
const
resetObject
=
batchTableSourceData
({
batchItem
,
tableData
,
bacthSecon
,
bacthFirst
});
const
resetObject
=
batchTableSourceData
({
batchItem
,
tableData
,
bacthSecon
,
bacthFirst
});
props
.
onValuesChange
({
table
List
:
resetObject
});
props
.
onValuesChange
({
sku
List
:
resetObject
});
setTableData
(
resetObject
);
setTableData
(
resetObject
);
};
};
...
@@ -395,6 +390,11 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -395,6 +390,11 @@ const FormPriceOrStock = forwardRef((props, ref) => {
return
null
;
return
null
;
};
};
const
getFormValues
=
debounce
(
async
()
=>
{
const
cleanValues
=
await
onSpecificationEvent
();
props
.
onValuesChange
({
infoSpecData
:
cleanValues
});
},
400
);
const
firstOnChangeEvent
=
async
()
=>
{
const
firstOnChangeEvent
=
async
()
=>
{
const
cleanValues
=
await
onSpecificationEvent
();
const
cleanValues
=
await
onSpecificationEvent
();
if
(
cleanValues
)
{
if
(
cleanValues
)
{
...
@@ -423,15 +423,16 @@ const FormPriceOrStock = forwardRef((props, ref) => {
...
@@ -423,15 +423,16 @@ const FormPriceOrStock = forwardRef((props, ref) => {
}));
}));
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
customer
.
isEdit
)
{
// if (customer.isEdit) {
if
(
!
editData
)
return
;
if
(
!
editData
)
return
;
form
.
setFieldsValue
(
editData
);
// 设置规格数据
form
.
setFieldsValue
(
editData
);
// 设置规格数据
firstOnChangeEvent
();
// 触发成底部动态表格数据
firstOnChangeEvent
();
// 触发成底部动态表格数据
setSpecInitValue
(
editData
);
// 缓存规格数据
setSpecInitValue
(
editData
);
// 缓存规格数据
CreateColumnsEvent
(
editData
);
CreateColumnsEvent
(
editData
);
setMergeTable
(
Boolean
(
editData
.
secondSpecValue
.
length
));
setMergeTable
(
Boolean
(
editData
.
secondSpecValue
.
length
));
setTableData
(
fliterSkuListSortData
(
skuList
));
console
.
log
(
'
skuList :>>
'
,
skuList
);
}
setTableData
(
fliterSkuListSortData
(
skuList
));
// }
},
[
customer
.
isEdit
,
editData
]);
},
[
customer
.
isEdit
,
editData
]);
return
(
return
(
...
...
src/pages/ServiceGoods/components/FormRuleSetting.jsx
View file @
ede9b518
...
@@ -64,7 +64,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
...
@@ -64,7 +64,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
props
.
onValuesChange
(
{
serviceItem
:
values
}
);
},
400
);
},
400
);
const
nowDateTime
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 00:00:00
'
));
const
nowDateTime
=
moment
(
moment
().
format
(
'
YYYY-MM-DD 00:00:00
'
));
...
...
src/pages/ServiceGoods/components/FormRuleVPictures.jsx
View file @
ede9b518
...
@@ -70,7 +70,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
...
@@ -70,7 +70,7 @@ const FormRuleVPictures = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
props
.
onValuesChange
(
{
infoImageData
:
values
}
);
},
400
);
},
400
);
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
...
...
src/pages/ServiceGoods/components/FormSettlementOthers.jsx
View file @
ede9b518
...
@@ -38,7 +38,7 @@ const FormSettlementOthers = forwardRef((props, ref) => {
...
@@ -38,7 +38,7 @@ const FormSettlementOthers = forwardRef((props, ref) => {
const
getFormValues
=
debounce
(()
=>
{
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
(
values
);
props
.
onValuesChange
(
{
settlementItem
:
values
}
);
},
400
);
},
400
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/pages/ServiceGoods/index.jsx
View file @
ede9b518
...
@@ -19,9 +19,10 @@ import {
...
@@ -19,9 +19,10 @@ import {
merchantProductEdit
,
merchantProductEdit
,
getByProductType
,
getByProductType
,
}
from
'
./service
'
;
}
from
'
./service
'
;
import
{
isUrl
,
filterSendData
,
clearCurrent
,
onAutoSaveValue
}
from
'
./utils
'
;
import
{
isUrl
,
filterSendData
,
clearCurrent
,
onAutoSaveValue
,
localAutoSaveKey
}
from
'
./utils
'
;
import
{
ServiceContext
}
from
'
./context
'
;
import
{
ServiceContext
}
from
'
./context
'
;
import
{
GOOD_MANAGE
}
from
'
@/../config/permission.config
'
;
import
{
GOOD_MANAGE
}
from
'
@/../config/permission.config
'
;
import
styles
from
'
./common.less
'
;
/**
/**
* 服务商品改造-商品模块
* 服务商品改造-商品模块
...
@@ -52,6 +53,7 @@ const ServiceGoods = options => {
...
@@ -52,6 +53,7 @@ const ServiceGoods = options => {
const
[
specList
,
setSpecList
]
=
useState
([]);
// 规格列表
const
[
specList
,
setSpecList
]
=
useState
([]);
// 规格列表
const
[
editData
,
setEditData
]
=
useState
({});
// 编辑保存数据
const
[
editData
,
setEditData
]
=
useState
({});
// 编辑保存数据
const
[
newCategoryList
,
setNewCategoryList
]
=
useState
({});
const
[
newCategoryList
,
setNewCategoryList
]
=
useState
({});
const
[
visibleCacheEdit
,
setVisibleCacheEdit
]
=
useState
(
false
);
// 显示有缓存未保存提示
const
[
checkFormList
]
=
useState
([
const
[
checkFormList
]
=
useState
([
basicRef
,
basicRef
,
attrRef
,
attrRef
,
...
@@ -67,6 +69,16 @@ const ServiceGoods = options => {
...
@@ -67,6 +69,16 @@ const ServiceGoods = options => {
const
onValuesChange
=
e
=>
{
const
onValuesChange
=
e
=>
{
if
(
!
isEdit
)
{
if
(
!
isEdit
)
{
if
(
visibleCacheEdit
)
{
setVisibleCacheEdit
(
false
);
localStorage
.
remove
(
localAutoSaveKey
);
onAutoSaveValue
(
{
type
:
productType
,
},
!
0
,
);
}
onAutoSaveValue
(
e
);
onAutoSaveValue
(
e
);
}
}
};
};
...
@@ -75,6 +87,7 @@ const ServiceGoods = options => {
...
@@ -75,6 +87,7 @@ const ServiceGoods = options => {
setProductType
(
task
.
type
);
setProductType
(
task
.
type
);
setPageLoading
(
true
);
setPageLoading
(
true
);
setCategoryIds
([]);
setCategoryIds
([]);
setVisibleCacheEdit
(
false
);
const
timer
=
setTimeout
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
setPageLoading
(
false
);
setPageLoading
(
false
);
resetForm
();
resetForm
();
...
@@ -216,6 +229,17 @@ const ServiceGoods = options => {
...
@@ -216,6 +229,17 @@ const ServiceGoods = options => {
}
}
},
[
productType
,
options
.
visible
]);
},
[
productType
,
options
.
visible
]);
useEffect
(()
=>
{
if
(
options
.
visible
&&
!
isEdit
)
{
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
if
(
info
)
{
setVisibleCacheEdit
(
true
);
return
;
}
}
setVisibleCacheEdit
(
false
);
},
[
isEdit
,
options
.
visible
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setProductType
(
canAddNormal
?
1
:
4
);
setProductType
(
canAddNormal
?
1
:
4
);
},
[
canAddNormal
]);
},
[
canAddNormal
]);
...
@@ -252,10 +276,22 @@ const ServiceGoods = options => {
...
@@ -252,10 +276,22 @@ const ServiceGoods = options => {
};
};
// 保存草稿
// 保存草稿
const
onSaveDraft
=
()
=>
{
const
onSaveDraft
=
()
=>
{
const
localkey
=
'
good-info-auto-save
'
;
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
const
info
=
localStorage
.
get
(
localkey
);
if
(
info
)
{
if
(
info
)
{
localStorage
.
remove
(
localkey
);
localStorage
.
remove
(
localAutoSaveKey
);
}
};
// 继续编辑
const
onContinueEdit
=
()
=>
{
setVisibleCacheEdit
(
false
);
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
if
(
info
)
{
console
.
log
(
'
info :>>
'
,
info
);
setProductType
(
info
.
type
);
setEditData
(
info
);
if
(
info
.
infoMation
.
categoryId
&&
info
.
infoMation
.
categoryId
.
length
)
{
setCategoryIds
(
info
.
infoMation
.
categoryId
);
}
}
}
};
};
...
@@ -297,6 +333,14 @@ const ServiceGoods = options => {
...
@@ -297,6 +333,14 @@ const ServiceGoods = options => {
>
>
<
Spin
tip=
"正在加载..."
spinning=
{
pageLoading
}
delay=
{
100
}
>
<
Spin
tip=
"正在加载..."
spinning=
{
pageLoading
}
delay=
{
100
}
>
<
WrapperContainer
>
<
WrapperContainer
>
{
visibleCacheEdit
&&
(
<
div
className=
{
styles
.
draftBox
}
>
有未保存内容。是否
<
span
className=
{
styles
.
conEdit
}
onClick=
{
onContinueEdit
}
>
继续编辑
</
span
>
</
div
>
)
}
<
ServiceContext
.
Provider
value=
{
providerValue
}
>
<
ServiceContext
.
Provider
value=
{
providerValue
}
>
<
Title
title=
"商品类型"
/>
<
Title
title=
"商品类型"
/>
<
TaskTypeSelect
productType=
{
productType
}
onChange=
{
productChange
}
/>
<
TaskTypeSelect
productType=
{
productType
}
onChange=
{
productChange
}
/>
...
...
src/pages/ServiceGoods/utils.js
View file @
ede9b518
...
@@ -255,13 +255,14 @@ export const createProductData = (props, isEdit, skuList) => {
...
@@ -255,13 +255,14 @@ export const createProductData = (props, isEdit, skuList) => {
return
list
;
return
list
;
};
};
export
const
localAutoSaveKey
=
'
good-info-auto-save
'
;
export
const
onAutoSaveValue
=
(
e
,
isClear
)
=>
{
export
const
onAutoSaveValue
=
(
e
,
isClear
)
=>
{
const
localkey
=
'
good-info-auto-save
'
;
if
(
isClear
)
{
if
(
isClear
)
{
localStorage
.
set
(
local
k
ey
,
Object
.
assign
({},
e
));
localStorage
.
set
(
local
AutoSaveK
ey
,
Object
.
assign
({},
e
));
}
else
{
}
else
{
const
info
=
localStorage
.
get
(
local
k
ey
)
||
{};
const
info
=
localStorage
.
get
(
local
AutoSaveK
ey
)
||
{};
localStorage
.
set
(
local
k
ey
,
Object
.
assign
({},
info
,
e
));
localStorage
.
set
(
local
AutoSaveK
ey
,
Object
.
assign
({},
info
,
e
));
}
}
};
};
...
...
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