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
e3c3c17b
Commit
e3c3c17b
authored
Apr 06, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新时间问题
parent
5d4359f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
91 deletions
+107
-91
common.less
src/pages/ServiceGoods/common.less
+5
-1
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+102
-90
No files found.
src/pages/ServiceGoods/common.less
View file @
e3c3c17b
...
...
@@ -215,8 +215,12 @@
.ant-form-item-control-input-content {
display: flex;
}
.ant-form-text {
display: flex;
justify-content: center;
align-items: center;
}
}
}
.itemInline {
:global {
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
e3c3c17b
...
...
@@ -195,94 +195,94 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
// 多规格
if
(
+
repertoryType
===
2
)
{
// if (name || editData.name) {
if
(
weight
.
length
)
{
let
tempSku
=
[];
multiSpecList
[
0
].
specs
=
weight
;
// 处理specList
if
(
specs
.
length
)
{
specs
.
forEach
((
specsItem
,
specsIndex
)
=>
{
if
(
specsItem
&&
!
specsItem
.
generateSku
)
{
specsItem
.
generateSku
=
1
;
}
if
(
specsItem
.
specGroupName
)
{
specsItem
?.
specs
?.
forEach
(
itm
=>
{
itm
.
specGroupName
=
specsItem
.
specGroupName
;
});
}
multiSpecList
.
push
(
specsItem
);
});
}
const
sepcx
=
specs
.
map
(
item
=>
item
.
specs
);
sepcx
.
map
(
item
=>
{
item
.
unit
=
''
;
return
item
});
// 生成 specs 规格sku
tempSku
=
[[...
weight
],
...
sepcx
].
reduce
(
(
x
,
y
)
=>
{
const
arr
=
[];
x
.
forEach
(
x
=>
y
.
forEach
(
y
=>
arr
.
push
(
x
.
concat
([
y
]))));
return
arr
;
},
[[]],
);
console
.
log
(
'
multiSpu1111
'
,
multiSpu
);
multiSpu
=
tempSku
.
map
((
item
,
index
)
=>
{
const
obj
=
{};
obj
.
salePrice
=
salePrice
;
obj
.
productStock
=
productStock
;
obj
.
list
=
list
;
obj
.
id
=
multiSpu
?.[
index
]?.
id
||
''
obj
.
serviceItem
=
{
...
temp
.
serviceItem
,
productStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
productStock
||
productStock
,
maxStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
maxStock
||
maxStock
,
autoStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
autoStock
||
autoStock
,
};
obj
.
unique
=
''
;
multiSpecList
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
[
idx
]
&&
!
item
[
idx
]?.
specGroupName
)
{
if
(
multiSpecList
[
idx
].
specGroupName
)
{
item
[
idx
].
specGroupName
=
multiSpecList
[
idx
].
specGroupName
;
}
}
});
obj
.
specs
=
[...
item
];
return
obj
;
if
(
weight
.
length
)
{
let
tempSku
=
[];
multiSpecList
[
0
].
specs
=
weight
;
// 处理specList
if
(
specs
.
length
)
{
specs
.
forEach
((
specsItem
,
specsIndex
)
=>
{
if
(
specsItem
&&
!
specsItem
.
generateSku
)
{
specsItem
.
generateSku
=
1
;
}
if
(
specsItem
.
specGroupName
)
{
specsItem
?.
specs
?.
forEach
(
itm
=>
{
itm
.
specGroupName
=
specsItem
.
specGroupName
;
});
}
multiSpecList
.
push
(
specsItem
);
});
}
multiSpu
.
map
(
item
=>
{
item
.
salePrice
=
0
;
item
.
unique
=
item
?.
specs
.
map
(
itm
=>
{
if
(
itm
?.
unit
)
{
itm
.
unit
=
itm
?.
unit
&&
(
Array
.
isArray
(
itm
?.
unit
)
?
itm
?.
unit
.
slice
(
itm
?.
unit
.
length
-
1
)[
0
]
:
itm
?.
unit
);
}
if
(
itm
?.
unit
&&
peopleUnits
.
includes
(
itm
.
unit
))
{
delete
itm
.
quantity
;
}
if
(
itm
?.
specName
)
{
return
itm
.
specName
;
const
sepcx
=
specs
.
map
(
item
=>
item
.
specs
);
sepcx
.
map
(
item
=>
{
item
.
unit
=
''
;
return
item
;
});
// 生成 specs 规格sku
tempSku
=
[[...
weight
],
...
sepcx
].
reduce
(
(
x
,
y
)
=>
{
const
arr
=
[];
x
.
forEach
(
x
=>
y
.
forEach
(
y
=>
arr
.
push
(
x
.
concat
([
y
]))));
return
arr
;
},
[[]],
);
console
.
log
(
'
multiSpu1111
'
,
multiSpu
);
multiSpu
=
tempSku
.
map
((
item
,
index
)
=>
{
const
obj
=
{};
obj
.
salePrice
=
salePrice
;
obj
.
productStock
=
productStock
;
obj
.
list
=
list
;
obj
.
id
=
multiSpu
?.[
index
]?.
id
||
''
;
obj
.
serviceItem
=
{
...
temp
.
serviceItem
,
productStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
productStock
||
productStock
,
maxStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
maxStock
||
maxStock
,
autoStock
:
multiSpu
?.[
index
]?.
serviceItem
?.
autoStock
||
autoStock
,
};
obj
.
unique
=
''
;
multiSpecList
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
[
idx
]
&&
!
item
[
idx
]?.
specGroupName
)
{
if
(
multiSpecList
[
idx
].
specGroupName
)
{
item
[
idx
].
specGroupName
=
multiSpecList
[
idx
].
specGroupName
;
}
})
.
toString
();
}
});
obj
.
specs
=
[...
item
];
return
obj
;
});
}
console
.
log
(
'
multiSpu
'
,
multiSpu
);
if
(
tempMultiSpu
.
length
)
{
multiSpu
.
forEach
((
item
,
index
)
=>
{
tempMultiSpu
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
.
unique
===
itm
.
unique
)
{
item
.
serviceItem
=
objectComparison
(
item
.
serviceItem
,
itm
);
}
});
multiSpu
.
map
(
item
=>
{
item
.
salePrice
=
0
;
item
.
unique
=
item
?.
specs
.
map
(
itm
=>
{
if
(
itm
?.
unit
)
{
itm
.
unit
=
itm
?.
unit
&&
(
Array
.
isArray
(
itm
?.
unit
)
?
itm
?.
unit
.
slice
(
itm
?.
unit
.
length
-
1
)[
0
]
:
itm
?.
unit
);
}
if
(
itm
?.
unit
&&
peopleUnits
.
includes
(
itm
.
unit
))
{
delete
itm
.
quantity
;
}
if
(
itm
?.
specName
)
{
return
itm
.
specName
;
}
})
.
toString
();
});
console
.
log
(
'
multiSpu
'
,
multiSpu
);
if
(
tempMultiSpu
.
length
)
{
multiSpu
.
forEach
((
item
,
index
)
=>
{
tempMultiSpu
.
forEach
((
itm
,
idx
)
=>
{
if
(
item
.
unique
===
itm
.
unique
)
{
item
.
serviceItem
=
objectComparison
(
item
.
serviceItem
,
itm
);
}
});
}
});
}
console
.
log
(
multiSpu
,
'
multiSpumultiSpu
'
);
setMultiSpu
(
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)));
console
.
log
(
multiSpu
,
'
multiSpumultiSpu
'
);
setMultiSpu
(
JSON
.
parse
(
JSON
.
stringify
(
multiSpu
)));
// }
}
// +repertoryType === 1 单规格 2多规格
...
...
@@ -730,15 +730,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
) : null}
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
新增售卖时段
</Button>
{fields.length < 5 ? (
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
新增售卖时段
</Button>
) : null}
</Form.Item>
</>
)}
...
...
@@ -787,12 +790,21 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
{repertoryType === '1' && (
<>
<Form.Item label="份量" className={styles.required}>
{form.getFieldValue(['unit']) &&
Array.isArray(form.getFieldValue(['unit'])) &&
weightUnits.includes(
form
.getFieldValue(['unit'])
.slice(1)
.toString(),
) && <span className="ant-form-text"> 约</span>}
<Form.Item
// noStyle
shouldUpdate={(prevValues, curValues) => false}
>
{form => {
let unit = form.getFieldValue('unit') || '';
console.log('unit', unit);
unit =
(unit && (Array.isArray(unit) && unit?.length && unit?.slice(1).toString())) ||
unit;
...
...
@@ -1222,7 +1234,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}}
shape="round"
>
统一设置
置
库存
统一设置库存
</Button>
<div className={styles.rowWarp}>
{multiSpu.length > 0 &&
...
...
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