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
5da7897d
Commit
5da7897d
authored
Mar 29, 2023
by
baxibaba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新商品库
parent
cae5a4dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
31 deletions
+24
-31
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+2
-1
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+19
-29
index.jsx
src/pages/ServiceGoods/index.jsx
+3
-1
No files found.
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
5da7897d
...
...
@@ -102,6 +102,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
console
.
log
(
'
infoMation
'
,
values
);
props
.
onValuesChange
({
infoMation
:
values
});
},
400
);
// 查询shopIds
...
...
@@ -173,7 +174,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
{
required
:
true
,
min
:
2
,
message
:
'
请输入最少两个字符的商品名称
'
,
whitespace
:
true
},
]
}
>
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
||
isEditTakeaway
}
/>
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
}
/>
</
Form
.
Item
>
</
Popover
>
{
customer
.
isTakeawayService
&&
(
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
5da7897d
...
...
@@ -128,7 +128,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
id
,
categoryId
,
}
=
takeawayItem
;
console
.
log
(
'
skuList====
'
,
skuList
);
console
.
log
(
'
skuList====
'
,
infoMation
,
takeawayItem
,
skuList
);
const
singularSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 单规格
const
multiSpecList
=
[{
specGroupName
:
'
份量
'
,
generateSku
:
1
,
specs
:
[]
}];
// 多规格
// const multiSpu = customer.isEdit ? skuList:[]; // 多库存spu、
...
...
@@ -178,7 +178,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
singularSpu
=
[{
...
temp
,
specs
:
[
specs
]
}];
setSingularSpu
(
singularSpu
);
}
console
.
log
(
'
weight
'
,
weight
);
// 多规格
if
(
+
repertoryType
===
2
)
{
if
(
name
||
editData
.
name
)
{
...
...
@@ -253,23 +252,18 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
});
}
}
if (tempMultiSpu.length) {
multiSpu.forEach((item, index) => {
tempMultiSpu.forEach((itm, idx) => {
console.log("itm",itm);
if (item.unique === itm.unique) {
item.serviceItem = objectComparison(item.serviceItem, itm);
item.id = itm.id
item.id = itm.id
;
}
});
});
}
console.log('multiSpu=====11', tempMultiSpu);
console.log('multiSpu=====22', multiSpu);
// debugger
console.log('multiSpu', multiSpu);
// debugger;
console.log(multiSpu, tempMultiSpu, 'multiSpumultiSpu');
setMultiSpu(multiSpu);
}
// +repertoryType === 1 单规格 2多规格
...
...
@@ -302,16 +296,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
let {
serviceItem: { maxStock, autoStock, productStock },
} = itm;
let params = { maxStock, autoStock, productStock };
let params = { maxStock, autoStock, productStock
: productStock || itm.productStock
};
let temp = { ...item, ...params };
return temp;
};
const onChange = () => {};
const onDealFinish = values => {
console.log('Received values of form:', values);
};
const getFormValues = debounce(() => {
const values = form.getFieldsValue();
console.log('values', values);
props.onValuesChange({ takeawayItem: JSON.parse(JSON.stringify(values)) });
const takeawayData = customer.isEdit
? { takeawayItem: Object.assign({}, editData, values) }
...
...
@@ -397,10 +389,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
);
// 切换库存
const onChangeRepertory = e => {
if (e) {
setRepertoryType(`
$
{
e
.
target
.
value
}
`);
}
setRepertoryType(2);
setRepertoryType(`
$
{
e
.
target
.
value
}
`);
};
// 勾选库存设置
const onChangeSetRepertory = e => {
...
...
@@ -452,7 +441,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const tempUnit = `
$
{
item
.
specs
[
0
]?.
unit
||
''
})
`;
const tempSecondSpecName = `
$
{
item
.
specs
[
1
]?.
specName
||
''
}
`;
const isShow = tempQuantity && tempUnit && '+';
return `
$
{
tempName
}
$
{
tempSpecName
}
$
{
tempQuantity
}
$
{
isShow
}
$
{
tempUnit
}
$
{
tempSecondSpecName
}
`;
return `
$
{
tempName
}
$
{
tempSpecName
}
$
{
tempQuantity
}
$
{
isShow
}
$
{
tempUnit
}
$
{
tempSecondSpecName
}
`;
};
const init = async () => {
if (!tagList.length) {
...
...
@@ -471,7 +460,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (customer.isEdit || customer.isUseCache) {
if (!editData) return;
let { label, firstCategoryId, secondCategoryId, thirdCategoryId, id } = editData;
editData.label =
+label
;
editData.label =
label.split(',')
;
if (editData?.skuList.length) {
editData.minPurchaseNum = editData?.skuList[0]?.serviceItem.minPurchaseNum;
// 单规格
...
...
@@ -531,15 +520,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const tempMultiSpu = editData?.skuList.map(item => {
if (item) {
let weightIdx = item.specs.findIndex(itm => itm.specGroupName === '份量');
console.log(
"weightIdx",
weightIdx);
console.log(
'weightIdx',
weightIdx);
let specsIdx = item.specs.findIndex(itm => itm.specGroupName !== '份量');
console.log(
"specsIdx",
specsIdx);
console.log(
'specsIdx',
specsIdx);
item.unique = `
$
{
item
.
specs
[
weightIdx
]?.
specName
}
-
$
{
item
.
specs
[
specsIdx
]?.
specGroupName
}
-
$
{
item
.
specs
[
specsIdx
]?.
specName
}
`;
}
return item;
});
setTempMultiSpu(tempMultiSpu || []);
debugger
}
form.setFieldsValue({ productRefShopId: editData.shopId });
...
...
@@ -937,12 +925,14 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
<div>添加规格(如加料、甜度、辣度等)</div>
<Form.List
name="specs"
initialValue={[
{
specGroupName: '1',
specs: [],
},
]}
initialValue={
[
// {
// specGroupName: '',
// specs: [],
// },
]
}
>
{(specsFields, { add, remove }) => (
<>
...
...
src/pages/ServiceGoods/index.jsx
View file @
5da7897d
...
...
@@ -86,7 +86,7 @@ const ServiceGoods = options => {
const
resetForm
=
()
=>
clearCurrent
(
checkFormList
).
forEach
(({
current
})
=>
current
.
reset
());
const
onValuesChange
=
e
=>
{
//
console.log('e======', e, !isEdit, visibleCacheEdit);
console
.
log
(
'
e======
'
,
e
,
!
isEdit
,
visibleCacheEdit
);
if
(
!
isEdit
)
{
if
(
visibleCacheEdit
)
{
setVisibleCacheEdit
(
false
);
...
...
@@ -207,6 +207,8 @@ 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