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
201d9923
Commit
201d9923
authored
Mar 28, 2023
by
baxibaba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新商品库
parent
184bb8b8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
16 deletions
+42
-16
common.less
src/pages/ServiceGoods/common.less
+9
-0
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+32
-16
index.jsx
src/pages/ServiceGoods/index.jsx
+1
-0
No files found.
src/pages/ServiceGoods/common.less
View file @
201d9923
...
...
@@ -245,6 +245,15 @@
.specsBetween {
display: flex;
flex-flow: row nowrap;
:global {
.ant-form-item-label{
overflow:inherit;
}
.ant-col-sm-3{
max-width: fit-content;
}
}
}
.specRepertory {
background-color: #319bfe;
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
201d9923
...
...
@@ -101,6 +101,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
takeawayCalc
=
takeawayData
=>
{
// 商品基本信息编辑商品名称
const
{
infoMation
:
name
,
infoMation
,
takeawayItem
}
=
takeawayData
;
console
.
log
(
'
infoMation========
'
,
infoMation
);
// weight 份量 specs规格 生成sku规则 weight * specs
const
{
specs
=
[],
...
...
@@ -120,9 +121,9 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
singleDelivery
,
saleTimeType
,
autoStock
=
0
,
categoryId
,
skuList
,
id
,
categoryId
,
}
=
takeawayItem
;
console
.
log
(
'
id
'
,
id
,
skuList
);
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
...
...
@@ -163,8 +164,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
salePrice
,
maxStock
,
quantity
,
// unit: (unit && unit?.length && unit?.splice(unit?.length - 1)[0]) || unit,
unit
,
unit
:
(
Array
.
isArray
(
unit
)
&&
unit
?.
length
&&
unit
?.
splice
(
unit
?.
length
-
1
)[
0
])
||
unit
,
productStock
,
specGroupName
:
'
份量
'
,
};
...
...
@@ -261,8 +261,10 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
// debugger
setMultiSpu(multiSpu);
}
console.log('categoryId', categoryId);
// +repertoryType === 1 单规格 2多规格
const intactDataTemp = {
...takeawayItem,
id,
type: 5, // 外卖类型
...infoMation,
...
...
@@ -277,7 +279,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
(
infoMation?.categoryId &&
infoMation?.categoryId?.slice(infoMation?.categoryId?.length - 1)
)?.toString() || categoryId,
)?.toString() ||
(Array.isArray(categoryId) && categoryId?.slice(categoryId?.length - 1)?.toString()),
};
setIntactData(intactDataTemp);
...
...
@@ -310,6 +313,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
// 设置库存
const modifiedInventory = (type, idx, values) => {
const { productStock, maxStock, autoStock } = values;
console.log('type', type);
if (type === 'multi') {
multiSpu.map(item => {
if (item.unique === idx) {
...
...
@@ -325,17 +329,29 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
setMultiSpu(temp);
}
if (type === 'all') {
if (intactData?.items.length) {
intactData?.items.forEach(item => {
multiSpu.map(item => {
item.serviceItem.productStock = productStock;
item.serviceItem.autoStock = autoStock;
item.serviceItem.maxStock = maxStock;
return item;
});
const temp = { ...intactData };
setIntactData(temp);
}
let temp = JSON.parse(JSON.stringify(multiSpu));
tempMultiSpu.push(...temp);
setTempMultiSpu(tempMultiSpu);
setMultiSpu(multiSpu);
// if (intactData?.items.length) {
// intactData?.items.forEach(item => {
// item.serviceItem.productStock = productStock;
// item.serviceItem.autoStock = autoStock;
// item.serviceItem.maxStock = maxStock;
// return item;
// });
// const temp = { ...intactData };
// setIntactData(temp);
// }
}
console.log('=========', multiSpu, tempMultiSpu);
getFormValues();
return false;
};
...
...
@@ -482,7 +498,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}
}, [customer.isEdit, editData]);
useEffect(() => {
//
setIntactData(intactData);
setIntactData(intactData);
}, [intactData]);
useEffect(() => {
init();
...
...
@@ -734,7 +750,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
</Form.Item>
<div className={styles.rowWarp}>
{singularSpu.length > 0 &&
takeawayData?.infoMation?.name
&&
(takeawayData?.infoMation?.name || takeawayData.takeawayItem.name)
&&
singularSpu.map((item, index) => (
<div className={styles.specsBetween}>
<Form.Item label={calcLabelName(intactData, item, 'singular')}>
...
...
src/pages/ServiceGoods/index.jsx
View file @
201d9923
...
...
@@ -207,6 +207,7 @@ const ServiceGoods = options => {
setPageLoading
(
true
);
const
sendAsyncHttpRequest
=
isEdit
?
merchantProductEdit
:
merchantProductAdd
;
const
addResponse
=
await
sendAsyncHttpRequest
(
sendData
);
debugger
;
if
(
addResponse
.
data
)
{
message
.
success
(
`
${
isEdit
?
'
修改
'
:
'
添加
'
}
成功!`
);
localStorage
.
remove
(
localAutoSaveKey
);
...
...
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