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
910a4dce
Commit
910a4dce
authored
Apr 07, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:更新暂存信息
parent
59619ce4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
18 deletions
+43
-18
index.jsx
src/pages/GoodsManage/index.jsx
+1
-1
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+26
-3
index.jsx
src/pages/ServiceGoods/index.jsx
+12
-10
utils.js
src/pages/ServiceGoods/utils.js
+4
-4
No files found.
src/pages/GoodsManage/index.jsx
View file @
910a4dce
...
@@ -62,7 +62,7 @@ class goodsManage extends Component {
...
@@ -62,7 +62,7 @@ class goodsManage extends Component {
auditRow
:
{},
// 查看审核信息使用
auditRow
:
{},
// 查看审核信息使用
isVisibleDraft
:
false
,
// 显示隐藏草稿箱
isVisibleDraft
:
false
,
// 显示隐藏草稿箱
isEditDraft
:
false
,
// 是否编辑草稿
isEditDraft
:
false
,
// 是否编辑草稿
productType
:
1
,
// 商品类型
productType
:
5
,
// 商品类型
takeAway
:
{},
// 弹窗外卖商品参数
takeAway
:
{},
// 弹窗外卖商品参数
searchValue
:
{},
// 搜索条件
searchValue
:
{},
// 搜索条件
refresh
:
''
,
// 外卖刷新
refresh
:
''
,
// 外卖刷新
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
910a4dce
...
@@ -319,8 +319,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -319,8 +319,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
props
.
onValuesChange
({
takeawayItem
:
JSON
.
parse
(
JSON
.
stringify
(
values
))
});
props
.
onValuesChange
({
takeawayItem
:
JSON
.
parse
(
JSON
.
stringify
(
values
))
});
const
takeawayData
=
customer
.
isEdit
const
takeawayData
=
customer
.
isEdit
?
{
takeawayItem
:
Object
.
assign
({},
editData
,
values
)
}
?
{
takeawayItem
:
Object
.
assign
({},
editData
,
values
)
}
:
{
takeawayItem
:
values
};
:
localStorage
.
get
(
localAutoSaveKey
)
||
{
};
// :
localStorage.get(localAutoSaveKey) || {
};
// :
{ takeawayItem: values
};
setTakeawayData
(
takeawayData
);
setTakeawayData
(
takeawayData
);
takeawayCalc
(
takeawayData
);
takeawayCalc
(
takeawayData
);
},
400
);
},
400
);
...
@@ -499,7 +499,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -499,7 +499,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
return false;
return false;
};
};
useEffect(() => {
useEffect(() => {
if (customer.isEdit
||
customer.isUseCache) {
if (customer.isEdit
&& !
customer.isUseCache) {
if (!editData) return;
if (!editData) return;
const {
const {
label,
label,
...
@@ -601,6 +601,29 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -601,6 +601,29 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
getFormValues();
getFormValues();
}
}
}
}
if (customer.isUseCache) {
onValuesChange(editData, !0);
let tempEdit = JSON.parse(JSON.stringify(editData));
tempEdit = Object.assign({}, editData, { ...tempEdit.takeawayItem });
console.log('tempEdit', tempEdit);
tempEdit.saleTimes = tempEdit?.saleTimes?.length
? tempEdit?.saleTimes?.map(item => [moment(item[0]), moment(item[1])])
: [];
if (tempEdit?.saleTimes && !(tempEdit?.weight)) {
setRepertoryType('1');
} else {
setRepertoryType('2');
form.setFieldsValue({ weight: tempEdit?.weight });
form.setFieldsValue(tempEdit);
form.setFieldsValue({ specs: tempEdit?.specs });
}
onCardSuccessImageList(tempEdit?.detailImageList);
if (tempEdit && tempEdit?.saleTimeType) {
setTimeType(tempEdit?.saleTimeType);
}
form.setFieldsValue(tempEdit);
// getFormValues();
}
}, [customer.isEdit, editData]);
}, [customer.isEdit, editData]);
useEffect(() => {
useEffect(() => {
setIntactData(intactData);
setIntactData(intactData);
...
...
src/pages/ServiceGoods/index.jsx
View file @
910a4dce
...
@@ -326,13 +326,18 @@ const ServiceGoods = options => {
...
@@ -326,13 +326,18 @@ const ServiceGoods = options => {
await
getAfterSalesAddrsPage
();
await
getAfterSalesAddrsPage
();
await
getMerchantSpecList
();
await
getMerchantSpecList
();
if
(
Object
.
keys
(
SourceData
).
length
)
{
if
(
Object
.
keys
(
SourceData
).
length
)
{
console
.
log
(
'
SourceData :>>
'
,
SourceData
);
console
.
log
(
'
SourceData :>>
'
,
SourceData
,
options
.
isDraft
);
// 从编辑草稿进入 执行以下代码
// 从编辑草稿进入 执行以下代码
if
(
options
.
isDraft
)
{
if
(
options
.
isDraft
)
{
setIsUseCache
(
true
);
setIsUseCache
(
true
);
setVisibleCacheEdit
(
false
);
setVisibleCacheEdit
(
false
);
onSetData
(
SourceData
);
onSetData
(
SourceData
);
onValuesChange
(
SourceData
,
!
0
);
onValuesChange
(
SourceData
,
!
0
);
// 外卖类型---
if
(
SourceData
&&
SourceData
?.
type
===
5
)
{
setTakeawayEditData
(
SourceData
);
setIsUseCache
(
true
);
}
}
else
{
}
else
{
setEditData
(
SourceData
);
setEditData
(
SourceData
);
setPageId
(
SourceData
.
id
);
setPageId
(
SourceData
.
id
);
...
@@ -418,12 +423,13 @@ const ServiceGoods = options => {
...
@@ -418,12 +423,13 @@ const ServiceGoods = options => {
console
.
log
(
'
newCategoryList :>>
'
,
newCategoryList
);
console
.
log
(
'
newCategoryList :>>
'
,
newCategoryList
);
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
const
info
=
localStorage
.
get
(
localAutoSaveKey
);
console
.
log
(
'
info
'
,
info
);
if
(
if
(
!
info
||
!
info
||
!
info
.
infoMation
||
!
info
.
infoMation
||
!
info
.
infoMation
.
name
||
!
info
.
infoMation
.
name
||
!
info
.
infoMation
.
categoryId
||
!
info
.
infoMation
.
categoryId
||
info
.
infoMation
.
categoryId
.
length
!==
3
(
info
.
infoMation
.
categoryId
.
length
!==
3
&&
info
.
type
!==
5
)
)
{
)
{
message
.
warning
(
'
请添加商品类目和名称
'
);
message
.
warning
(
'
请添加商品类目和名称
'
);
return
;
return
;
...
@@ -448,7 +454,7 @@ const ServiceGoods = options => {
...
@@ -448,7 +454,7 @@ const ServiceGoods = options => {
secondCategoryId
:
info
.
infoMation
.
categoryId
[
1
],
secondCategoryId
:
info
.
infoMation
.
categoryId
[
1
],
secondCategoryName
:
second
.
name
,
secondCategoryName
:
second
.
name
,
thirdCategoryId
:
info
.
infoMation
.
categoryId
[
2
],
thirdCategoryId
:
info
.
infoMation
.
categoryId
[
2
],
thirdCategoryName
:
third
.
name
,
thirdCategoryName
:
third
?
.
name
,
content
:
JSON
.
stringify
(
info
),
content
:
JSON
.
stringify
(
info
),
};
};
console
.
log
(
'
params :>>
'
,
params
);
console
.
log
(
'
params :>>
'
,
params
);
...
@@ -494,13 +500,9 @@ const ServiceGoods = options => {
...
@@ -494,13 +500,9 @@ const ServiceGoods = options => {
maskClosable=
{
false
}
maskClosable=
{
false
}
keyboard=
{
false
}
keyboard=
{
false
}
footer=
{
[
footer=
{
[
productType
===
5
?
(
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
''
保存草稿
)
:
(
</
Button
>,
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
保存草稿
</
Button
>
),
<
Button
key=
"submit"
type=
"primary"
loading=
{
pageLoading
}
onClick=
{
submitEvent
}
>
<
Button
key=
"submit"
type=
"primary"
loading=
{
pageLoading
}
onClick=
{
submitEvent
}
>
提交
提交
</
Button
>,
</
Button
>,
...
...
src/pages/ServiceGoods/utils.js
View file @
910a4dce
...
@@ -303,10 +303,10 @@ export const localAutoSaveKey = 'good-info-auto-save';
...
@@ -303,10 +303,10 @@ export const localAutoSaveKey = 'good-info-auto-save';
export const onAutoSaveValue = (e, isClear) => {
export const onAutoSaveValue = (e, isClear) => {
// 暂时去掉外卖类型
// 暂时去掉外卖类型
if (e && e.type === 5) {
//
if (e && e.type === 5) {
localStorage.remove(localAutoSaveKey);
//
localStorage.remove(localAutoSaveKey);
return;
//
return;
}
//
}
const keys = Object.keys(e);
const keys = Object.keys(e);
if (
if (
e &&
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