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
bd968b1f
Commit
bd968b1f
authored
Mar 30, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修改库存
parent
ab9dde94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
22 deletions
+47
-22
GroupInfo.jsx
src/pages/GoodsManage/Takeaway/components/GroupInfo.jsx
+0
-1
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+28
-10
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+19
-11
No files found.
src/pages/GoodsManage/Takeaway/components/GroupInfo.jsx
View file @
bd968b1f
...
...
@@ -70,7 +70,6 @@ const GroupInfo = options => {
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"下单必选分组"
name=
"necessary"
extra=
{
extra
}
>
<
Switch
checkedChildren=
"开启"
...
...
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
bd968b1f
...
...
@@ -6,13 +6,14 @@ import React, {
useImperativeHandle
,
useRef
,
}
from
'
react
'
;
import
{
Cascader
,
Form
,
Input
,
Select
,
Popover
,
Button
,
Checkbox
,
Divider
,
Modal
}
from
'
antd
'
;
import
{
Cascader
,
Form
,
Input
,
Select
,
Popover
,
Button
,
Checkbox
,
Divider
,
Modal
,
notification
}
from
'
antd
'
;
import
{
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
import
AddMenusModal
from
'
./AddMenusModal
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
{
apiShopIds
,
apiQueryShopList
,
getByProductType
}
from
'
../service
'
;
import
GroupInfo
from
'
../../GoodsManage/Takeaway/components/GroupInfo
'
;
const
CreateSelectOption
=
optionList
=>
optionList
.
map
(
brandItem
=>
(
...
...
@@ -45,6 +46,8 @@ const FormInformationBasic = forwardRef((props, ref) => {
const
[
shopIds
,
setShopIds
]
=
useState
([]);
const
[
shopList
,
setShopList
]
=
useState
([]);
const
[
isEditTakeaway
,
setIsEditTakeaway
]
=
useState
(
false
);
const
[
isModalOpen
,
setIsModalOpen
]
=
useState
(
false
);
const
[
shopIdSource
,
setShopIdSource
]
=
useState
(
''
);
const
onCheck
=
async
()
=>
{
try
{
...
...
@@ -71,7 +74,11 @@ const FormInformationBasic = forwardRef((props, ref) => {
// 自定义加入菜单
const
showModal
=
()
=>
{
childAddMenusModalRef
.
current
.
setOpen
(
true
);
if
(
shopIdSource
)
{
setIsModalOpen
(
true
);
}
else
{
notification
.
error
({
message
:
'
请先选择名店在进行操作!
'
});
}
};
// 自定义菜单下拉
const
dropdownRender
=
menus
=>
(
...
...
@@ -115,15 +122,19 @@ const FormInformationBasic = forwardRef((props, ref) => {
};
// 查询分组列表
const
queryShopList
=
async
params
=>
{
if
(
!
shopList
.
length
)
{
const
result
=
await
apiQueryShopList
(
params
);
setShopList
(
result
.
data
||
[]);
let
result
=
[];
if
(
params
)
{
result
=
await
apiQueryShopList
(
params
);
}
else
{
result
=
await
apiQueryShopList
({
shopId
:
shopIdSource
});
}
setShopList
(
result
.
data
||
[]);
};
const
onChangeShopId
=
async
e
=>
{
if
(
e
)
{
setShopList
([]);
queryShopList
({
shopId
:
e
});
setShopIdSource
(
e
)
form
.
setFieldsValue
({
storageRackIds
:
''
,
});
...
...
@@ -147,6 +158,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
if
(
editData
.
productType
===
5
&&
editData
.
name
)
{
shopGetByProductType
(
5
);
queryShopList
({
shopId
:
editData
.
productRefShopId
});
setShopIdSource
(
editData
.
productRefShopId
);
setIsEditTakeaway
(
true
);
}
form
.
setFieldsValue
(
editData
);
...
...
@@ -155,17 +167,18 @@ const FormInformationBasic = forwardRef((props, ref) => {
useEffect
(()
=>
{
setShopList
([]);
shopGetByProductType
(
5
);
const
{
shopId
=
''
,
groupId
=
''
}
=
groupShopData
const
{
shopId
=
''
,
groupId
=
''
}
=
groupShopData
;
if
(
shopId
)
{
setShopIdSource
(
shopId
);
queryShopList
({
shopId
});
}
const
temp
=
{
productRefShopId
:
shopId
?
[
`
${
shopId
}
`
]
:
[],
storageRackIds
:
groupId
?
[
+
groupId
]
:
[],
}
}
;
setTimeout
(()
=>
{
form
.
setFieldsValue
(
temp
);
},
[])
},
[])
;
},
[
groupShopData
]);
return
(
<
Form
...
...
@@ -222,14 +235,13 @@ const FormInformationBasic = forwardRef((props, ref) => {
disabled=
{
customer
.
isEdit
&&
customer
.
isNormal
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
// onChange=
{
props
.
onCategoryChange
}
options=
{
shopList
}
dropdownRender=
{
dropdownRender
}
/>
</
Form
.
Item
>
)
}
{
/* 新增菜单分组弹框 */
}
<
AddMenusModal
ref=
{
childAddMenusModalRef
}
queryShopList=
{
queryShopList
}
/>
{
/* <AddMenusModal ref={childAddMenusModalRef} queryShopList={queryShopList} /> */
}
<
Form
.
Item
name=
"categoryId"
label=
"商品类目"
...
...
@@ -341,6 +353,12 @@ const FormInformationBasic = forwardRef((props, ref) => {
<
Input
.
TextArea
showCount
maxLength=
{
100
}
placeholder=
"请输入描述, 100字以内"
/>
</
Form
.
Item
>
)
:
null
}
<
GroupInfo
isModalOpen=
{
isModalOpen
}
shopId=
{
shopIdSource
}
search=
{
queryShopList
}
handleClose=
{
setIsModalOpen
}
/>
</
Form
>
);
});
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
bd968b1f
...
...
@@ -32,7 +32,7 @@ import { formItemLayout, ENUM_REPERTORY, ENUM_SET_REPERTORY, ENUM_WEEK } from '.
import
{
ServiceContext
}
from
'
../context
'
;
import
{
debounce
}
from
'
@/utils/utils
'
;
import
UploadImage
from
'
./UploadImage
'
;
import
AddSellTimeModal
from
'
./AddSellTimeModal
'
;
//
import AddSellTimeModal from './AddSellTimeModal';
import
styles
from
'
../common.less
'
;
import
AddRepertoryModal
from
'
./AddRepertoryModal
'
;
import
AddMultiSpecModal
from
'
./AddMultiSpecModal
'
;
...
...
@@ -79,12 +79,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
[
tempSpecs
,
setTempSpecs
]
=
useState
([]);
const
[
weightUnits
,
setWeightUnits
]
=
useState
([]);
const
initialDealValue
=
[
{
specGroupName
:
''
,
},
];
// 自定义加入菜单
const
showModal
=
()
=>
{
addSellTimeRef
.
current
.
setOpen
(
true
);
...
...
@@ -105,7 +99,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
takeawayCalc
=
takeawayData
=>
{
// 商品基本信息编辑商品名称
const
{
infoMation
:
name
,
infoMation
,
takeawayItem
}
=
takeawayData
;
console
.
log
(
'
i========
'
,
infoMation
,
takeawayItem
,
repertoryType
);
// weight 份量 specs规格 生成sku规则 weight * specs
const
{
specs
=
tempSpecs
,
...
...
@@ -386,7 +379,22 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
);
// 切换库存
const onChangeRepertory = e => {
setRepertoryType(`
$
{
e
.
target
.
value
}
`);
const value = e.target.value
setRepertoryType(`
$
{
value
}
`);
if(+value ===1 ){
form.setFieldsValue({weight:[]})
form.setFieldsValue({specs:[]})
} else {
const params = {
quantity:'',
unit:[],
salePrice:'',
productStock:'',
maxStock:'',
autoStock:false
}
form.setFieldsValue(params)
}
};
// 勾选库存设置
const onChangeSetRepertory = e => {
...
...
@@ -471,7 +479,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
productStock,
shopId,
specs,
serviceItem: { maxStock, saleTimeType, saleDates, saleTimes, id },
serviceItem: { maxStock, saleTimeType, saleDates, saleTimes, id
,autoStock
},
} = editData?.skuList[0];
let { quantity, unit, salePrice } = specs[0];
editData.productStock = productStock;
...
...
@@ -482,6 +490,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.saleTimeType = saleTimeType;
editData.saleDates = saleDates;
editData.autoStock = +autoStock === 1 ? true :false
editData.saleTimes = saleTimes.length
? saleTimes.map(item => {
return [moment(item?.startTime, format), moment(item?.endTime, format)];
...
...
@@ -542,7 +551,6 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
form.setFieldsValue({ productRefShopId: editData.shopId });
onCardSuccessImageList(editData?.detailImageList);
getFormValues();
// setInitValue({ ...editData });
}
}
}, [customer.isEdit, editData]);
...
...
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