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
139bafe6
Commit
139bafe6
authored
Mar 20, 2023
by
陈万宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增份量表单
parent
16e5208e
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
735 additions
and
264 deletions
+735
-264
common.less
src/pages/ServiceGoods/common.less
+50
-20
AddMenusModal.jsx
src/pages/ServiceGoods/components/AddMenusModal.jsx
+45
-33
AddRepertoryModal.jsx
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
+1
-1
AddSellTimeModal.jsx
src/pages/ServiceGoods/components/AddSellTimeModal.jsx
+37
-36
FormInformationBasic.jsx
src/pages/ServiceGoods/components/FormInformationBasic.jsx
+12
-13
FormTakeaway.jsx
src/pages/ServiceGoods/components/FormTakeaway.jsx
+509
-103
config.js
src/pages/ServiceGoods/config.js
+8
-10
index.jsx
src/pages/ServiceGoods/index.jsx
+55
-48
service.js
src/pages/ServiceGoods/service.js
+18
-0
No files found.
src/pages/ServiceGoods/common.less
View file @
139bafe6
...
@@ -28,7 +28,17 @@
...
@@ -28,7 +28,17 @@
content: '';
content: '';
}
}
}
}
.week {
background: #f0f0f0;
}
.weekCon {
display: flex;
flex-flow: row nowrap;
color: #319bfe;
}
.weekText {
margin-right: 10px;
}
.prodcutContent {
.prodcutContent {
display: flex;
display: flex;
padding-bottom: 10px;
padding-bottom: 10px;
...
@@ -188,33 +198,44 @@
...
@@ -188,33 +198,44 @@
}
}
.required {
.required {
:global {
:global {
.ant-form-item-label > {
.ant-form-item-label > {
::before {
::before {
display: inline-block;
display: inline-block;
margin-right: 4px;
margin-right: 4px;
color: #ff4d4f;
color: #ff4d4f;
font-size: 14px;
font-size: 14px;
font-family: SimSun, sans-serif;
font-family: SimSun, sans-serif;
line-height: 1;
line-height: 1;
content: '*';
content: '*';
}
}
.ant-form-item {
margin-bottom: 0;
}
}
}
.ant-form-item {
margin-bottom: 0;
}
}
}
}
}
.itemInline {
.itemInline {
:global {
:global {
.ant-form-item-control-input-content {
.ant-form-item-control-input-content {
display: flex;
display: flex;
}
}
.ant-form-item {
.ant-form-item {
margin-bottom: 0;
margin-bottom: 0;
margin-left: 40px;
}
}
}
}
}
}
.textStyle{
.itemInlineModal {
:global {
.ant-form-item-control-input-content {
display: flex;
}
.ant-form-item {
margin-bottom: 0;
}
}
}
.textStyle {
color: red;
color: red;
}
}
.multiSpecification {
.multiSpecification {
...
@@ -233,19 +254,28 @@
...
@@ -233,19 +254,28 @@
.deal {
.deal {
:global {
:global {
.ant-form-item-control-input-content {
.ant-form-item-control-input-content {
display: flex;
display: flex;
align-items: center;
align-items: center;
}
}
.ant-form-item {
.ant-form-item {
margin-bottom: 0;
margin-bottom: 0;
}
}
}
}
}
}
.dealInput {
:global {
.ant-form-item-control-input-content {
.ant-input {
margin-bottom: 8px;
}
}
}
}
.nameWidth {
.nameWidth {
width: 300px;
width: 300px;
}
}
.colRow {
.colRow {
display: flex;
display: flex;
flex: none;
flex: none;
max-width:none;
max-width: none;
}
}
\ No newline at end of file
src/pages/ServiceGoods/components/AddMenusModal.jsx
View file @
139bafe6
import
React
,
{
useState
,
useEffect
,
forwardRef
,
useRef
,
useImperativeHandle
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
forwardRef
,
useRef
,
useImperativeHandle
}
from
'
react
'
;
import
{
Button
,
Modal
,
Form
,
Switch
,
Input
}
from
'
antd
'
;
import
{
Button
,
Modal
,
Form
,
Switch
,
Input
,
Select
}
from
'
antd
'
;
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
import
{
apiCreateShop
}
from
'
../service
'
import
{
apiCreateShop
}
from
'
../service
'
;
const
AddMenusModal
=
(
props
,
ref
)
=>
{
const
AddMenusModal
=
(
props
,
ref
)
=>
{
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
formProject
]
=
Form
.
useForm
();
const
[
formProject
]
=
Form
.
useForm
();
const
[
menusSwitch
,
setMenusSwitch
]
=
useState
(
0
)
// 分组开启状态
const
[
menusSwitch
,
setMenusSwitch
]
=
useState
(
0
)
;
// 分组开启状态
// const {
// const {
// queryShopList,
// queryShopList,
...
@@ -20,27 +20,27 @@ const AddMenusModal = (props, ref) => {
...
@@ -20,27 +20,27 @@ const AddMenusModal = (props, ref) => {
}));
}));
const
handleOk
=
()
=>
{
const
handleOk
=
()
=>
{
formProject
formProject
.
validateFields
()
.
validateFields
()
.
then
(
async
values
=>
{
.
then
(
async
values
=>
{
console
.
log
(
'
valuse
'
,
values
,
menusSwitch
);
console
.
log
(
'
valuse
'
,
values
,
menusSwitch
);
const
params
=
{
const
params
=
{
name
:
values
?.
name
,
name
:
values
?.
name
,
necessary
:
menusSwitch
,
necessary
:
menusSwitch
,
}
};
const
data
=
await
apiCreateShop
(
params
);
const
data
=
await
apiCreateShop
(
params
);
if
(
data
.
code
===
'
0000
'
)
{
if
(
data
.
code
===
'
0000
'
)
{
formProject
.
resetFields
();
// 表单清除历史
formProject
.
resetFields
();
// 表单清除历史
setConfirmLoading
(
true
);
setConfirmLoading
(
true
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
setOpen
(
false
);
setOpen
(
false
);
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
},
2000
);
},
2000
);
}
}
})
})
.
catch
(
info
=>
{
.
catch
(
info
=>
{
// queryShopList()
// queryShopList()
console
.
log
(
'
保存异常
'
,
info
);
console
.
log
(
'
保存异常
'
,
info
);
});
});
};
};
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
...
@@ -49,12 +49,12 @@ const AddMenusModal = (props, ref) => {
...
@@ -49,12 +49,12 @@ const AddMenusModal = (props, ref) => {
};
};
const
onChange
=
()
=>
{
const
onChange
=
()
=>
{
if
(
menusSwitch
===
0
)
{
if
(
menusSwitch
===
0
)
{
setMenusSwitch
(
1
)
setMenusSwitch
(
1
)
;
return
false
return
false
;
}
}
setMenusSwitch
(
0
)
setMenusSwitch
(
0
)
;
return
false
return
false
;
}
}
;
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
open
'
,
open
);
console
.
log
(
'
open
'
,
open
);
},
[
open
]);
},
[
open
]);
...
@@ -72,14 +72,26 @@ const AddMenusModal = (props, ref) => {
...
@@ -72,14 +72,26 @@ const AddMenusModal = (props, ref) => {
onCancel=
{
handleCancel
}
onCancel=
{
handleCancel
}
>
>
<
Form
form=
{
formProject
}
>
<
Form
form=
{
formProject
}
>
<
Form
.
Item
label=
"Select"
>
<
Select
>
<
Select
.
Option
value=
"shopId"
>
Demo
</
Select
.
Option
>
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
"分组名称"
name=
"name"
rules=
{
[{
required
:
true
}]
}
>
<
Form
.
Item
label=
"分组名称"
name=
"name"
rules=
{
[{
required
:
true
}]
}
>
<
Input
/>
<
Input
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
"下单必选分组"
name=
"necessary"
valuePropName=
{
menusSwitch
}
>
<
Form
.
Item
label=
"下单必选分组"
name=
"necessary"
valuePropName=
{
menusSwitch
}
>
<
Switch
defaultChecked=
{
menusSwitch
}
checkedChildren=
"开启"
unCheckedChildren=
"关闭"
onChange=
{
onChange
}
/>
<
Switch
<
div
className=
{
styles
.
textStyle
}
>
选中后,顾客下单需至少选择1个 “下单必须分组” 商品
</
div
>
defaultChecked=
{
menusSwitch
}
<
div
className=
{
styles
.
textStyle
}
>
每店仅可设置1个必点分组
</
div
>
checkedChildren=
"开启"
</
Form
.
Item
>
unCheckedChildren=
"关闭"
onChange=
{
onChange
}
/>
<
div
className=
{
styles
.
textStyle
}
>
选中后,顾客下单需至少选择1个 “下单必须分组” 商品
</
div
>
<
div
className=
{
styles
.
textStyle
}
>
每店仅可设置1个必点分组
</
div
>
</
Form
.
Item
>
</
Form
>
</
Form
>
</
Modal
>
</
Modal
>
)
}
)
}
...
...
src/pages/ServiceGoods/components/AddRepertoryModal.jsx
View file @
139bafe6
...
@@ -47,7 +47,7 @@ const AddRepertoryModal = (props, ref) => {
...
@@ -47,7 +47,7 @@ const AddRepertoryModal = (props, ref) => {
onCancel=
{
handleCancel
}
onCancel=
{
handleCancel
}
>
>
<
Form
>
<
Form
>
<
Form
.
Item
className=
{
styles
.
itemInline
}
>
<
Form
.
Item
className=
{
styles
.
itemInline
Modal
}
>
<
Form
.
Item
<
Form
.
Item
name=
"receptionVolume"
name=
"receptionVolume"
label=
"剩余库存"
label=
"剩余库存"
...
...
src/pages/ServiceGoods/components/AddSellTimeModal.jsx
View file @
139bafe6
...
@@ -2,19 +2,19 @@ import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } f
...
@@ -2,19 +2,19 @@ import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle } f
import
{
Button
,
Modal
,
Form
,
Checkbox
,
Row
,
Col
,
time
,
DatePicker
}
from
'
antd
'
;
import
{
Button
,
Modal
,
Form
,
Checkbox
,
Row
,
Col
,
time
,
DatePicker
}
from
'
antd
'
;
import
{
map
}
from
'
lodash
'
;
import
{
map
}
from
'
lodash
'
;
import
{
MinusCircleOutlined
,
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
{
MinusCircleOutlined
,
PlusOutlined
}
from
'
@ant-design/icons
'
;
import
moment
from
'
moment
'
;
import
{
ENUM_WEEK
}
from
'
../config
'
;
import
{
ENUM_WEEK
}
from
'
../config
'
;
import
styles
from
'
../common.less
'
;
import
styles
from
'
../common.less
'
;
const
format
=
'
HH:mm
'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
const
AddSellTimeModal
=
(
props
,
ref
)
=>
{
const
AddSellTimeModal
=
(
props
,
ref
)
=>
{
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
modalText
,
setModalText
]
=
useState
(
'
Content of the modal
'
);
const
[
modalText
,
setModalText
]
=
useState
(
'
Content of the modal
'
);
const
[
formProject
]
=
Form
.
useForm
();
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
open
,
setOpen
]
=
useState
(
false
);
// const {
const
{
saleDates
,
setSaleDates
}
=
props
;
// open,
// setOpen,
// } = props;
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
// changeVal 就是暴露给父组件的方法
// changeVal 就是暴露给父组件的方法
setOpen
:
newVal
=>
{
setOpen
:
newVal
=>
{
...
@@ -22,12 +22,15 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -22,12 +22,15 @@ const AddSellTimeModal = (props, ref) => {
},
},
}));
}));
const
handleOk
=
()
=>
{
const
handleOk
=
()
=>
{
setModalText
(
'
The modal will be closed after two seconds
'
);
formProject
.
validateFields
().
then
(
async
values
=>
{
setConfirmLoading
(
true
);
console
.
log
(
'
valuse
'
,
values
);
setTimeout
(()
=>
{
setConfirmLoading
(
true
);
setOpen
(
false
);
setSaleDates
(
values
);
setConfirmLoading
(
false
);
setTimeout
(()
=>
{
},
2000
);
setOpen
(
false
);
setConfirmLoading
(
false
);
},
1000
);
});
};
};
const
handleCancel
=
()
=>
{
const
handleCancel
=
()
=>
{
...
@@ -36,6 +39,8 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -36,6 +39,8 @@ const AddSellTimeModal = (props, ref) => {
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'
open
'
,
open
);
console
.
log
(
'
open
'
,
open
);
console
.
log
(
'
sss/
'
,
formProject
);
// formProject.setFieldsValue({ saleTimes: [['12:00', '13:00']] })
},
[
open
]);
},
[
open
]);
const
onChange
=
()
=>
{};
const
onChange
=
()
=>
{};
return
(
return
(
...
@@ -50,16 +55,13 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -50,16 +55,13 @@ const AddSellTimeModal = (props, ref) => {
width=
{
1050
}
width=
{
1050
}
>
>
<
Form
<
Form
name=
"validate_other"
name=
"sellTime"
form=
{
formProject
}
//
{
...
formItemLayout
}
//
{
...
formItemLayout
}
// onFinish=
{
onFinish
}
// onFinish=
{
onFinish
}
initialValues=
{
{
initialValues=
{
saleDates
}
'
input-number
'
:
3
,
'
checkbox-group
'
:
[
'
A
'
,
'
B
'
],
rate
:
3.5
,
}
}
>
>
<
Form
.
Item
name=
"
chec
"
label=
"售卖时期(可多选)"
>
<
Form
.
Item
name=
"
unavailableDate
"
label=
"售卖时期(可多选)"
>
<
Checkbox
.
Group
>
<
Checkbox
.
Group
>
<
Row
>
<
Row
>
<
Col
className=
{
styles
.
colRow
}
span=
{
8
}
>
<
Col
className=
{
styles
.
colRow
}
span=
{
8
}
>
...
@@ -71,20 +73,21 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -71,20 +73,21 @@ const AddSellTimeModal = (props, ref) => {
</
Checkbox
.
Group
>
</
Checkbox
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
name=
"rate"
label=
"售卖时段"
>
<
Form
.
Item
label=
"售卖时段"
>
<
Form
.
List
<
Form
.
List
name=
"names"
name=
"saleTimes"
rules=
{
[
initialValue=
{
[[]]
}
{
// rules=
{[
validator
:
async
(
_
,
names
)
=>
{
//
{
if
(
!
names
||
names
.
length
<
2
)
{
// validator: async (_, times) =>
{
return
Promise
.
reject
(
new
Error
(
'
At least 2 passengers
'
));
// if (!times || times.length < 2)
{
}
// return Promise.reject(new Error('At least 2 passengers'));
},
//
}
},
//
},
]
}
//
},
// ]
}
>
>
{
(
fields
,
{
add
,
remove
}
,
{
errors
}
)
=>
(
{
(
fields
,
{
add
,
remove
})
=>
(
<>
<>
{
fields
.
map
((
field
,
index
)
=>
(
{
fields
.
map
((
field
,
index
)
=>
(
<
Form
.
Item
<
Form
.
Item
...
@@ -92,21 +95,19 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -92,21 +95,19 @@ const AddSellTimeModal = (props, ref) => {
required=
{
false
}
required=
{
false
}
key=
{
field
.
key
}
key=
{
field
.
key
}
className=
{
styles
.
deal
}
className=
{
styles
.
deal
}
>
>
<
Form
.
Item
<
Form
.
Item
className=
{
styles
.
deal
}
className=
{
styles
.
deal
}
{
...
field
}
{
...
field
}
validateTrigger=
{
[
'
onChange
'
,
'
onBlur
'
]
}
//
validateTrigger=
{['
onChange
',
'
onBlur
']}
rules=
{
[
rules=
{
[
{
{
required
:
true
,
required
:
true
,
whitespace
:
true
,
message
:
'
请输入售卖时间
'
,
message
:
"
Please input passenger's name or delete this field.
"
,
},
},
]
}
]
}
>
>
<
RangePicker
picker=
"time"
onChange=
{
onChange
}
/>
<
RangePicker
picker=
"time"
format=
{
format
}
onChange=
{
onChange
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
{
fields
.
length
>
1
?
(
{
fields
.
length
>
1
?
(
<
MinusCircleOutlined
<
MinusCircleOutlined
...
@@ -123,7 +124,7 @@ const AddSellTimeModal = (props, ref) => {
...
@@ -123,7 +124,7 @@ const AddSellTimeModal = (props, ref) => {
style=
{
{
width
:
'
60%
'
}
}
style=
{
{
width
:
'
60%
'
}
}
icon=
{
<
PlusOutlined
/>
}
icon=
{
<
PlusOutlined
/>
}
>
>
新增时段
新增时段
</
Button
>
</
Button
>
</
Form
.
Item
>
</
Form
.
Item
>
</>
</>
...
...
src/pages/ServiceGoods/components/FormInformationBasic.jsx
View file @
139bafe6
...
@@ -43,7 +43,6 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -43,7 +43,6 @@ const FormInformationBasic = forwardRef((props, ref) => {
const
childAddMenusModalRef
=
useRef
(
null
);
const
childAddMenusModalRef
=
useRef
(
null
);
const
[
takeawayImageList
,
setTakeawayImageList
]
=
useState
([]);
const
[
takeawayImageList
,
setTakeawayImageList
]
=
useState
([]);
const
onCheck
=
async
()
=>
{
const
onCheck
=
async
()
=>
{
try
{
try
{
const
values
=
await
form
.
validateFields
();
const
values
=
await
form
.
validateFields
();
...
@@ -66,7 +65,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -66,7 +65,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
return
null
;
return
null
;
}
}
};
};
// 自定义加入菜单
// 自定义加入菜单
const
showModal
=
()
=>
{
const
showModal
=
()
=>
{
childAddMenusModalRef
.
current
.
setOpen
(
true
);
childAddMenusModalRef
.
current
.
setOpen
(
true
);
};
};
...
@@ -143,7 +142,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -143,7 +142,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
name=
"name"
name=
"name"
label=
"商品名称"
label=
"商品名称"
rules=
{
[
rules=
{
[
{
required
:
true
,
min
:
2
,
message
:
'
请输入最少两个字符的商品名称
!
'
,
whitespace
:
true
},
{
required
:
true
,
min
:
2
,
message
:
'
请输入最少两个字符的商品名称
'
,
whitespace
:
true
},
]
}
]
}
>
>
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
}
/>
<
Input
placeholder=
"请输入商品名称"
disabled=
{
customer
.
isDisabled
}
/>
...
@@ -155,28 +154,28 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -155,28 +154,28 @@ const FormInformationBasic = forwardRef((props, ref) => {
<
Form
.
Item
<
Form
.
Item
name=
"categoryId"
name=
"categoryId"
label=
"菜单分组"
label=
"菜单分组"
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入菜单分组
!
'
}]
}
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入菜单分组
'
}]
}
>
>
<
Cascader
<
Cascader
placeholder=
"请选择菜单分组
!
"
placeholder=
"请选择菜单分组"
disabled=
{
customer
.
isEdit
&&
customer
.
isNormal
}
disabled=
{
customer
.
isEdit
&&
customer
.
isNormal
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
onChange=
{
props
.
onCategoryChange
}
onChange=
{
props
.
onCategoryChange
}
options=
{
shopList
}
options=
{
shopList
}
//
dropdownRender=
{
dropdownRender
}
dropdownRender=
{
dropdownRender
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
)
}
)
}
{
/* 新增菜单分组弹框 */
}
{
/* 新增菜单分组弹框 */
}
{
/* <AddMenusModal ref={childAddMenusModalRef} queryShopList={queryShopList} /> */
}
<
AddMenusModal
ref=
{
childAddMenusModalRef
}
queryShopList=
{
queryShopList
}
/>
<
Form
.
Item
<
Form
.
Item
name=
"storageRackIds"
name=
"storageRackIds"
label=
"商品类目"
label=
"商品类目"
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目
!
'
}]
}
rules=
{
[{
type
:
'
array
'
,
required
:
true
,
message
:
'
请输入商品类目
'
}]
}
>
>
<
Cascader
<
Cascader
placeholder=
"请选择商品类目
!
"
placeholder=
"请选择商品类目"
disabled=
{
customer
.
isEdit
&&
customer
.
isNormal
}
disabled=
{
customer
.
isEdit
&&
customer
.
isNormal
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
showSearch=
{
{
filter
:
filterCategoryOptions
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
fieldNames=
{
{
label
:
'
name
'
,
value
:
'
id
'
,
children
:
'
children
'
}
}
...
@@ -194,7 +193,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -194,7 +193,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
{
{
required
:
true
,
required
:
true
,
type
:
'
array
'
,
type
:
'
array
'
,
message
:
'
请上传商品图片
!
'
,
message
:
'
请上传商品图片
'
,
},
},
]
}
]
}
>
>
...
@@ -212,7 +211,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -212,7 +211,7 @@ const FormInformationBasic = forwardRef((props, ref) => {
<
Form
.
Item
<
Form
.
Item
name=
"brandId"
name=
"brandId"
label=
"商品品牌"
label=
"商品品牌"
rules=
{
[{
required
:
true
,
message
:
'
请选择商品品牌
!
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'
请选择商品品牌
'
}]
}
extra=
"若需新增品牌请联系业务员"
extra=
"若需新增品牌请联系业务员"
>
>
<
Select
<
Select
...
@@ -276,9 +275,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
...
@@ -276,9 +275,9 @@ const FormInformationBasic = forwardRef((props, ref) => {
key=
"description"
key=
"description"
name=
"description"
name=
"description"
label=
"描述"
label=
"描述"
rules=
{
[{
required
:
true
,
message
:
'
请输入描述,100字以内
!
'
}]
}
rules=
{
[{
required
:
true
,
message
:
'
请输入描述,100字以内
'
}]
}
>
>
<
Input
.
TextArea
showCount
maxLength=
{
100
}
placeholder=
"请输入描述, 100字以内
!
"
/>
<
Input
.
TextArea
showCount
maxLength=
{
100
}
placeholder=
"请输入描述, 100字以内"
/>
</
Form
.
Item
>
</
Form
.
Item
>
)
:
null
}
)
:
null
}
</
Form
>
</
Form
>
...
...
src/pages/ServiceGoods/components/FormTakeaway.jsx
View file @
139bafe6
This diff is collapsed.
Click to expand it.
src/pages/ServiceGoods/config.js
View file @
139bafe6
...
@@ -323,20 +323,18 @@ export const StaticColumns = customer => [
...
@@ -323,20 +323,18 @@ export const StaticColumns = customer => [
disabeldRender
:
()
=>
customer
.
isDisabled
,
disabeldRender
:
()
=>
customer
.
isDisabled
,
},
},
];
];
export
const
ENUM_REPERTORY
=
[
export
const
ENUM_REPERTORY
=
[{
label
:
'
单规格
'
,
value
:
'
1
'
},
{
label
:
'
多规格
'
,
value
:
'
2
'
}];
{
label
:
'
单规格
'
,
value
:
'
单规格
'
},
{
label
:
'
多规格
'
,
value
:
'
多规格
'
},
]
export
const
ENUM_SET_REPERTORY
=
[
export
const
ENUM_SET_REPERTORY
=
[
{
label
:
'
清零
'
,
value
:
'
清零
'
},
{
label
:
'
清零
'
,
value
:
'
清零
'
},
{
label
:
'
最大
'
,
value
:
'
最大
'
},
{
label
:
'
最大
'
,
value
:
'
最大
'
},
]
]
;
export
const
ENUM_WEEK
=
[
export
const
ENUM_WEEK
=
[
{
value
:
1
,
label
:
'
周一
'
},
{
value
:
1
,
label
:
'
周一
'
},
{
value
:
2
,
label
:
'
周二
'
},
{
value
:
2
,
label
:
'
周二
'
},
{
value
:
3
,
label
:
'
周三
'
},
{
value
:
3
,
label
:
'
周三
'
},
{
value
:
1
,
label
:
'
周四
'
},
{
value
:
4
,
label
:
'
周四
'
},
{
value
:
1
,
label
:
'
周五
'
},
{
value
:
5
,
label
:
'
周五
'
},
{
value
:
1
,
label
:
'
周六
'
},
{
value
:
6
,
label
:
'
周六
'
},
{
value
:
1
,
label
:
'
周日
'
},
{
value
:
7
,
label
:
'
周日
'
},
]
{
value
:
8
,
label
:
'
法定假日
'
},
];
src/pages/ServiceGoods/index.jsx
View file @
139bafe6
...
@@ -62,10 +62,7 @@ const ServiceGoods = options => {
...
@@ -62,10 +62,7 @@ const ServiceGoods = options => {
const
[
specList
,
setSpecList
]
=
useState
([]);
// 规格列表
const
[
specList
,
setSpecList
]
=
useState
([]);
// 规格列表
const
[
editData
,
setEditData
]
=
useState
({});
// 编辑保存数据
const
[
editData
,
setEditData
]
=
useState
({});
// 编辑保存数据
const
[
newCategoryList
,
setNewCategoryList
]
=
useState
({});
const
[
newCategoryList
,
setNewCategoryList
]
=
useState
({});
const
[
shopList
,
setShopList
]
=
useState
([
const
[
shopList
,
setShopList
]
=
useState
([{
id
:
1
,
name
:
'
分组1
'
},
{
id
:
2
,
name
:
'
分组2
'
}]);
{
id
:
1
,
name
:
'
分组1
'
},
{
id
:
2
,
name
:
'
分组2
'
},
]);
const
[
visibleCacheEdit
,
setVisibleCacheEdit
]
=
useState
(
false
);
// 显示有缓存未保存提示
const
[
visibleCacheEdit
,
setVisibleCacheEdit
]
=
useState
(
false
);
// 显示有缓存未保存提示
const
[
checkFormList
]
=
useState
([
const
[
checkFormList
]
=
useState
([
...
@@ -75,6 +72,7 @@ const ServiceGoods = options => {
...
@@ -75,6 +72,7 @@ const ServiceGoods = options => {
settingRef
,
settingRef
,
settleOtrRef
,
settleOtrRef
,
picturesRef
,
picturesRef
,
takeawayRef
,
]);
]);
const
[
specKeyList
,
setSpecKeyList
]
=
useState
([]);
// 记录一级规格key字段
const
[
specKeyList
,
setSpecKeyList
]
=
useState
([]);
// 记录一级规格key字段
...
@@ -82,6 +80,7 @@ const ServiceGoods = options => {
...
@@ -82,6 +80,7 @@ const ServiceGoods = options => {
const
resetForm
=
()
=>
clearCurrent
(
checkFormList
).
forEach
(({
current
})
=>
current
.
reset
());
const
resetForm
=
()
=>
clearCurrent
(
checkFormList
).
forEach
(({
current
})
=>
current
.
reset
());
const
onValuesChange
=
e
=>
{
const
onValuesChange
=
e
=>
{
console
.
log
(
'
e======
'
,
e
);
if
(
!
isEdit
)
{
if
(
!
isEdit
)
{
if
(
visibleCacheEdit
)
{
if
(
visibleCacheEdit
)
{
setVisibleCacheEdit
(
false
);
setVisibleCacheEdit
(
false
);
...
@@ -157,12 +156,12 @@ const ServiceGoods = options => {
...
@@ -157,12 +156,12 @@ const ServiceGoods = options => {
}
}
};
};
// 查询分组列表
// 查询分组列表
const
queryShopList
=
async
()
=>
{
const
queryShopList
=
async
()
=>
{
if
(
!
shopList
.
length
)
{
if
(
!
shopList
.
length
)
{
const
result
=
await
apiQueryShopList
()
const
result
=
await
apiQueryShopList
();
setShopList
(
result
.
data
||
[]);
setShopList
(
result
.
data
||
[]);
}
}
}
};
const
getAfterSalesAddrsPage
=
async
()
=>
{
const
getAfterSalesAddrsPage
=
async
()
=>
{
if
(
!
afterAddressList
.
length
)
{
if
(
!
afterAddressList
.
length
)
{
const
result
=
await
afterSalesAddrsPage
();
const
result
=
await
afterSalesAddrsPage
();
...
@@ -208,6 +207,7 @@ const queryShopList = async () => {
...
@@ -208,6 +207,7 @@ const queryShopList = async () => {
// 保存商品
// 保存商品
const
submitEvent
=
async
()
=>
{
const
submitEvent
=
async
()
=>
{
const
checkPromiseList
=
clearCurrent
(
checkFormList
).
map
(({
current
})
=>
current
.
onCheck
());
const
checkPromiseList
=
clearCurrent
(
checkFormList
).
map
(({
current
})
=>
current
.
onCheck
());
console
.
log
(
'
333333333333
'
,
checkFormList
);
const
resuslt
=
await
Promise
.
all
(
checkPromiseList
);
const
resuslt
=
await
Promise
.
all
(
checkPromiseList
);
console
.
log
(
'
resuslt :>>
'
,
resuslt
);
console
.
log
(
'
resuslt :>>
'
,
resuslt
);
if
(
!
resuslt
.
includes
(
null
))
{
if
(
!
resuslt
.
includes
(
null
))
{
...
@@ -492,36 +492,42 @@ const queryShopList = async () => {
...
@@ -492,36 +492,42 @@ const queryShopList = async () => {
onValuesChange=
{
onValuesChange
}
onValuesChange=
{
onValuesChange
}
/>,
/>,
]
}
]
}
{
productType
!==
5
&&
<>
{
productType
!==
5
&&
(
<
Title
title=
"价格与库存"
/>
<>
<
FormPriceOrStock
<
Title
title=
"价格与库存"
/>
ref=
{
stockRef
}
<
FormPriceOrStock
specList=
{
specList
}
ref=
{
stockRef
}
onSpecChange=
{
onSpecCommonImgEvent
}
specList=
{
specList
}
editData=
{
editData
.
infoSpecData
}
onSpecChange=
{
onSpecCommonImgEvent
}
skuList=
{
editData
.
skuList
}
editData=
{
editData
.
infoSpecData
}
onValuesChange=
{
onValuesChange
}
skuList=
{
editData
.
skuList
}
/>
onValuesChange=
{
onValuesChange
}
</>
}
/>
{
productType
!==
5
&&
<>
</>
<
Title
title=
"规则设置"
/>
)
}
{
productType
===
4
&&
(
{
productType
!==
5
&&
(
<
FormRuleSetting
<>
ref=
{
settingRef
}
<
Title
title=
"规则设置"
/>
editData=
{
editData
.
serviceItem
}
{
productType
===
4
&&
(
supplierIdList=
{
supplierIdList
}
<
FormRuleSetting
onValuesChange=
{
onValuesChange
}
ref=
{
settingRef
}
/>
editData=
{
editData
.
serviceItem
}
supplierIdList=
{
supplierIdList
}
onValuesChange=
{
onValuesChange
}
/>
)
}
</>
)
}
{
productType
!==
5
&&
(
<>
<
FormRuleVPictures
ref=
{
picturesRef
}
specKeyItem=
{
specKeyList
}
editData=
{
editData
.
infoImageData
}
onValuesChange=
{
onValuesChange
}
/>
</>
)
}
)
}
</>
}
{
productType
!==
5
&&
<>
<
FormRuleVPictures
ref=
{
picturesRef
}
specKeyItem=
{
specKeyList
}
editData=
{
editData
.
infoImageData
}
onValuesChange=
{
onValuesChange
}
/>
</>
}
{
productType
===
4
&&
(
{
productType
===
4
&&
(
<
FormSettlementOthers
<
FormSettlementOthers
...
@@ -530,15 +536,16 @@ const queryShopList = async () => {
...
@@ -530,15 +536,16 @@ const queryShopList = async () => {
onValuesChange=
{
onValuesChange
}
onValuesChange=
{
onValuesChange
}
/>
/>
)
}
)
}
{
productType
===
5
&&
<>
{
productType
===
5
&&
(
<
FormTakeaway
<>
ref=
{
takeawayRef
}
<
FormTakeaway
editData=
{
editData
.
serviceItem
}
ref=
{
takeawayRef
}
supplierIdList=
{
supplierIdList
}
editData=
{
editData
.
serviceItem
}
onValuesChange=
{
onValuesChange
}
supplierIdList=
{
supplierIdList
}
/>
onValuesChange=
{
onValuesChange
}
</>
}
/>
</>
)
}
</
ServiceContext
.
Provider
>
</
ServiceContext
.
Provider
>
</
WrapperContainer
>
</
WrapperContainer
>
</
Spin
>
</
Spin
>
...
...
src/pages/ServiceGoods/service.js
View file @
139bafe6
...
@@ -130,3 +130,21 @@ export const apiCreateShop = data =>
...
@@ -130,3 +130,21 @@ export const apiCreateShop = data =>
prefix
:
goodsApi
,
prefix
:
goodsApi
,
data
,
data
,
});
});
// 新增外卖商品 http://yapi.quantgroups.com/project/389/interface/api/57324
export
const
apiAddGoods
=
data
=>
request
.
post
(
'
/v1/channels/products/add
'
,
{
prefix
:
goodsApi
,
data
,
});
// 商品标签列表 http://yapi.quantgroups.com/project/389/interface/api/57979
export
const
apiTagList
=
data
=>
request
.
post
(
'
/v1/channels/products/tag/getAll
'
,
{
prefix
:
goodsApi
,
data
,
});
// 单位列表 http://yapi.quantgroups.com/project/389/interface/api/57179
export
const
apiUnits
=
data
=>
request
.
get
(
'
/api/consoles/products/units
'
,
{
prefix
:
goodsApi
,
data
,
});
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