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
795ceb50
Commit
795ceb50
authored
Mar 30, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20230315_take_out_goods' into feature/20230327_public_takeaway
parents
78e861fe
68a1db9c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
17 deletions
+62
-17
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+2
-0
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+10
-3
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+32
-7
index.jsx
src/pages/ServiceGoods/index.jsx
+4
-4
utils.js
src/pages/ServiceGoods/utils.js
+14
-3
No files found.
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
795ceb50
...
@@ -117,6 +117,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -117,6 +117,7 @@ const AddRepertoryModal = (props, ref) => {
>
>
<
InputNumber
<
InputNumber
min=
{
0
}
min=
{
0
}
max=
{
999999999
}
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
style=
{
{
width
:
200
,
display
:
'
inline-block
'
}
}
placeholder=
"请输入"
placeholder=
"请输入"
/>
/>
...
@@ -135,6 +136,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -135,6 +136,7 @@ const AddRepertoryModal = (props, ref) => {
>
>
<
InputNumber
<
InputNumber
min=
{
0
}
min=
{
0
}
max=
{
999999999
}
style=
{
{
width
:
200
}
}
style=
{
{
width
:
200
}
}
placeholder=
"请输入"
placeholder=
"请输入"
onChange=
{
onChangeMaxStock
}
onChange=
{
onChangeMaxStock
}
...
...
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
795ceb50
...
@@ -124,6 +124,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -124,6 +124,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
if
(
e
)
{
if
(
e
)
{
setShopList
([]);
setShopList
([]);
queryShopList
({
shopId
:
e
});
queryShopList
({
shopId
:
e
});
form
.
setFieldsValue
({
storageRackIds
:
''
,
});
}
}
};
};
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
...
@@ -150,15 +153,19 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -150,15 +153,19 @@ const FormInformationBasic = forwardRef((props, ref) => {
onTakeawayImageList
(
editData
.
commonImageList
);
onTakeawayImageList
(
editData
.
commonImageList
);
},
[
customer
.
isEdit
,
editData
]);
},
[
customer
.
isEdit
,
editData
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setShopList
([]);
shopGetByProductType
(
5
);
const
{
shopId
=
''
,
groupId
=
''
}
=
groupShopData
const
{
shopId
=
''
,
groupId
=
''
}
=
groupShopData
if
(
shopId
)
{
if
(
shopId
)
{
queryShopList
({
shopId
});
queryShopList
({
shopId
});
}
}
const
temp
=
{
const
temp
=
{
productRefShopId
:
[
`
${
shopId
}
`
],
productRefShopId
:
shopId
?
[
`
${
shopId
}
`
]
:
[
],
storageRackIds
:
[
`
${
groupId
}
`
],
storageRackIds
:
groupId
?
[
+
groupId
]
:
[
],
}
}
setTimeout
(()
=>
{
form
.
setFieldsValue
(
temp
);
form
.
setFieldsValue
(
temp
);
},
[])
},
[
groupShopData
]);
},
[
groupShopData
]);
return
(
return
(
<
Form
<
Form
...
@@ -171,7 +178,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -171,7 +178,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
categoryId
:
[],
categoryId
:
[],
description
:
''
,
description
:
''
,
productRefShopId
:
[],
productRefShopId
:
[],
storageRackIds
:
[]
,
storageRackIds
:
null
,
}
}
}
}
scrollToFirstError
scrollToFirstError
onValuesChange=
{
getFormValues
}
onValuesChange=
{
getFormValues
}
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
795ceb50
...
@@ -47,7 +47,7 @@ const createInitValues = () => ({
...
@@ -47,7 +47,7 @@ const createInitValues = () => ({
saleTimeType
:
0
,
// 售卖时间
saleTimeType
:
0
,
// 售卖时间
singleDelivery
:
0
,
// 单点不送
singleDelivery
:
0
,
// 单点不送
list
:
1
,
// 列出商品
list
:
1
,
// 列出商品
label
:
''
,
label
:
[]
,
});
});
const
format
=
'
HH:mm
'
;
const
format
=
'
HH:mm
'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
...
@@ -77,6 +77,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -77,6 +77,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
const
[
tempMultiSpu
,
setTempMultiSpu
]
=
useState
([]);
const
[
tempMultiSpu
,
setTempMultiSpu
]
=
useState
([]);
const
[
tempWeight
,
setTempWeight
]
=
useState
([]);
const
[
tempWeight
,
setTempWeight
]
=
useState
([]);
const
[
tempSpecs
,
setTempSpecs
]
=
useState
([]);
const
[
tempSpecs
,
setTempSpecs
]
=
useState
([]);
const
[
weightUnits
,
setWeightUnits
]
=
useState
([]);
const
initialDealValue
=
[
const
initialDealValue
=
[
{
{
...
@@ -448,8 +449,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -448,8 +449,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
if (!unitsList.length) {
if (!unitsList.length) {
const res = await apiUnits();
const res = await apiUnits();
setUnitsList(res.data || []);
setUnitsList(res.data || []);
let temp = res.data.filter(item => item.name === '准确重量单位');
if (temp.length && temp[0]?.children) {
const tempWeightName = temp[0]?.children.map(item => item.name);
sessionStorage.setItem('weightUnits', JSON.stringify(tempWeightName || []));
}
}
}
setTempMultiSpu([]);
setTempMultiSpu([]);
return false;
return false;
};
};
...
@@ -495,6 +500,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -495,6 +500,17 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
} = editData?.skuList[0];
} = editData?.skuList[0];
let specList = editData?.specList;
let specList = editData?.specList;
let weight = specList.filter(item => item.specGroupName === '份量');
let weight = specList.filter(item => item.specGroupName === '份量');
const tempWeightName = JSON.parse(sessionStorage.getItem('weightUnits'));
weight.forEach(item => {
if (item?.specs?.length) {
item.specs.forEach(itm => {
if (tempWeightName.includes(itm.unit)) {
itm.quantity =
itm?.quantity.indexOf('约') > -1 ? itm?.quantity.slice(1) : itm?.quantity || '';
}
});
}
});
let specs = specList.filter(item => item.specGroupName !== '份量');
let specs = specList.filter(item => item.specGroupName !== '份量');
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.categoryId = [firstCategoryId, secondCategoryId, thirdCategoryId];
editData.saleTimeType = saleTimeType;
editData.saleTimeType = saleTimeType;
...
@@ -575,7 +591,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -575,7 +591,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="最少购买"
label="最少购买"
// rules={[{ required: true, message: '每日最低接待量' }]}
// rules={[{ required: true, message: '每日最低接待量' }]}
>
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入购买量" />
<InputNumber min={1}
max={999999999}
style={{ width: 200 }} placeholder="请输入购买量" />
</Form.Item>
</Form.Item>
<Form.Item
<Form.Item
name="saleTimeType"
name="saleTimeType"
...
@@ -712,7 +728,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -712,7 +728,12 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
}}
}}
rules={[{ required: true, message: '请输入分量' }]}
rules={[{ required: true, message: '请输入分量' }]}
>
>
<InputNumber min={1} style={{ width: 200 }} placeholder="请输入数字" />
<InputNumber
min={1}
max={999999999}
style={{ width: 200 }}
placeholder="请输入数字"
/>
</Form.Item>
</Form.Item>
<Form.Item
<Form.Item
name="unit"
name="unit"
...
@@ -738,7 +759,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -738,7 +759,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
label="销售价格"
label="销售价格"
rules={[{ required: true, message: '请输入销售价格' }]}
rules={[{ required: true, message: '请输入销售价格' }]}
>
>
<InputNumber min={0} style={{ width: 200 }} placeholder="元" />
<InputNumber min={0}
max={999999999}
style={{ width: 200 }} placeholder="元" />
</Form.Item>
</Form.Item>
<Form.Item className={styles.itemInline}>
<Form.Item className={styles.itemInline}>
<Form.Item
<Form.Item
...
@@ -752,6 +773,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -752,6 +773,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
>
<InputNumber
<InputNumber
min={0}
min={0}
max={999999999}
style={{ width: 200, display: 'inline-block' }}
style={{ width: 200, display: 'inline-block' }}
placeholder="请输入"
placeholder="请输入"
/>
/>
...
@@ -770,6 +792,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -770,6 +792,7 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
>
>
<InputNumber
<InputNumber
min={0}
min={0}
max={999999999}
style={{ width: 200 }}
style={{ width: 200 }}
placeholder="请输入"
placeholder="请输入"
onChange={onChangeMaxStock}
onChange={onChangeMaxStock}
...
@@ -989,6 +1012,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
...
@@ -989,6 +1012,8 @@ const TakeawayGoodsInfo = forwardRef((props, ref) => {
]}
]}
>
>
<InputNumber
<InputNumber
max={999999999}
min={0}
style={{ width: '200px' }}
style={{ width: '200px' }}
placeholder="加价名称金额(元)"
placeholder="加价名称金额(元)"
/>
/>
...
...
src/pages/ServiceGoods/index.jsx
View file @
795ceb50
...
@@ -487,7 +487,7 @@ const ServiceGoods = options => {
...
@@ -487,7 +487,7 @@ const ServiceGoods = options => {
maskClosable=
{
false
}
maskClosable=
{
false
}
keyboard=
{
false
}
keyboard=
{
false
}
footer=
{
[
footer=
{
[
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
productType
===
5
?
''
:
<
Button
key=
"draft"
type=
"primary"
ghost
loading=
{
pageLoading
}
onClick=
{
onSaveDraft
}
>
保存草稿
保存草稿
</
Button
>,
</
Button
>,
<
Button
key=
"submit"
type=
"primary"
loading=
{
pageLoading
}
onClick=
{
submitEvent
}
>
<
Button
key=
"submit"
type=
"primary"
loading=
{
pageLoading
}
onClick=
{
submitEvent
}
>
...
@@ -500,7 +500,7 @@ const ServiceGoods = options => {
...
@@ -500,7 +500,7 @@ const ServiceGoods = options => {
>
>
<
Spin
tip=
"正在加载..."
spinning=
{
pageLoading
}
delay=
{
100
}
>
<
Spin
tip=
"正在加载..."
spinning=
{
pageLoading
}
delay=
{
100
}
>
<
WrapperContainer
>
<
WrapperContainer
>
{
visibleCacheEdit
&&
(
{
visibleCacheEdit
&&
productType
!==
5
&&
(
<
div
className=
{
styles
.
draftBox
}
>
<
div
className=
{
styles
.
draftBox
}
>
有未保存内容。是否
有未保存内容。是否
<
span
className=
{
styles
.
conEdit
}
onClick=
{
onContinueEdit
}
>
<
span
className=
{
styles
.
conEdit
}
onClick=
{
onContinueEdit
}
>
...
...
src/pages/ServiceGoods/utils.js
View file @
795ceb50
...
@@ -111,11 +111,22 @@ const filterItems = (type, props) => {
...
@@ -111,11 +111,22 @@ const filterItems = (type, props) => {
export
const
filterSendData
=
(
type
,
params
)
=>
{
export
const
filterSendData
=
(
type
,
params
)
=>
{
// takeawayItem 外卖商品
// takeawayItem 外卖商品
const
{
infoMation
,
infoImageData
,
attributeApplyList
,
takeawayItem
}
=
params
;
const
{
infoMation
,
infoImageData
,
attributeApplyList
,
takeawayItem
}
=
params
;
console
.
log
(
'
infoMation
'
,
infoMation
,
takeawayItem
);
const
temp
=
Object
.
assign
({},
takeawayItem
?.
intactData
,
infoMation
)
temp
.
categoryId
=
(
Array
.
isArray
(
temp
.
categoryId
)
&&
temp
.
categoryId
?.
slice
(
temp
.
categoryId
?.
length
-
1
)?.
toString
())
// 外卖商品
// 外卖商品
if
(
type
===
5
)
{
if
(
type
===
5
)
{
const
temp
=
Object
.
assign
({},
takeawayItem
?.
intactData
,
infoMation
)
temp
.
categoryId
=
(
Array
.
isArray
(
temp
.
categoryId
)
&&
temp
.
categoryId
?.
slice
(
temp
.
categoryId
?.
length
-
1
)?.
toString
())
temp
.
productRefShopId
=
temp
.
productRefShopId
.
toString
()
const
tempWeightName
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'
weightUnits
'
))
console
.
log
(
tempWeightName
,
'
tempWeightName
'
);
temp
.
items
.
forEach
(
item
=>
{
if
(
item
?.
specs
?.
length
)
{
item
.
specs
.
forEach
(
itm
=>
{
if
(
tempWeightName
.
includes
(
itm
.
unit
))
{
itm
.
quantity
=
itm
.
quantity
.
indexOf
(
'
约
'
)
>
-
1
?
itm
.
quantity
:
`约
${
itm
.
quantity
}
`
}
})
}
})
return
temp
;
return
temp
;
}
}
const
items
=
filterItems
(
type
,
params
);
const
items
=
filterItems
(
type
,
params
);
...
...
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