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
864f156f
Commit
864f156f
authored
Jan 11, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加有效期类型
parent
d50542cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
8 deletions
+38
-8
env.config.js
config/env.config.js
+1
-1
FormRuleSetting.jsx
src/pages/ServiceGoods/components/FormRuleSetting.jsx
+37
-7
No files found.
config/env.config.js
View file @
864f156f
const
isProduction
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
isPre
=
process
.
env
.
PRE_ENV
===
'
pre
'
;
const
environment
=
'
sc1
'
;
const
environment
=
'
xyqb
'
;
const
envAPi
=
{
api
:
`https://security-
${
environment
}
.liangkebang.net`
,
//'https://security-xyqb.liangkebang.net',
kdspOpApi
:
`https://sc-merchant-api-
${
environment
}
.liangkebang.net`
,
...
...
src/pages/ServiceGoods/components/FormRuleSetting.jsx
View file @
864f156f
import
{
Form
,
Input
,
Select
,
Checkbox
,
DatePicker
}
from
'
antd
'
;
import
React
,
{
useEffect
,
forwardRef
,
useImperativeHandle
,
useContext
}
from
'
react
'
;
import
{
Form
,
Input
,
Select
,
Checkbox
,
DatePicker
,
Radio
,
InputNumber
}
from
'
antd
'
;
import
React
,
{
useEffect
,
forwardRef
,
useImperativeHandle
,
useContext
,
useState
}
from
'
react
'
;
import
moment
from
'
moment
'
;
import
{
WeeksList
,
formItemLayout
}
from
'
../config
'
;
import
{
ServiceContext
}
from
'
../context
'
;
...
...
@@ -23,6 +23,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
const
{
editData
,
supplierIdList
}
=
props
;
const
[
form
]
=
Form
.
useForm
();
const
customer
=
useContext
(
ServiceContext
);
const
[
dateType
,
setDateType
]
=
useState
(
1
);
// 判断是否有禁用的店铺 禁用店铺不显示
const
getIsInShops
=
arr
=>
{
...
...
@@ -41,6 +42,9 @@ const FormRuleSetting = forwardRef((props, ref) => {
const
shopIds
=
getIsInShops
(
editData
.
shopIds
);
goodInfo
.
shopIds
=
shopIds
;
}
if
(
goodInfo
.
validityPeriodType
)
{
setDateType
(
+
goodInfo
.
validityPeriodType
);
}
form
.
setFieldsValue
(
goodInfo
);
}
},
[
customer
.
isEdit
,
customer
.
isUseCache
,
editData
]);
...
...
@@ -62,6 +66,11 @@ const FormRuleSetting = forwardRef((props, ref) => {
}
};
const
onChangeDateType
=
e
=>
{
const
v
=
+
e
.
target
.
value
;
setDateType
(
v
);
};
const
getFormValues
=
debounce
(()
=>
{
const
values
=
form
.
getFieldsValue
();
props
.
onValuesChange
({
serviceItem
:
values
});
...
...
@@ -82,6 +91,7 @@ const FormRuleSetting = forwardRef((props, ref) => {
name=
"register"
initialValues=
{
{
useTime
:
[],
// 使用开始时间
dateType
:
'
1
'
,
// 有效期类型
// useEndTime: '', // 使用结束时间
purchaseTime
:
[],
// 购买开始时间
// purchaseEndTime: '2022-07-27 06', // 购买结束时间
...
...
@@ -102,12 +112,32 @@ const FormRuleSetting = forwardRef((props, ref) => {
defaultPickerValue=
{
[
nowDateTime
,
nowDateTimeEnd
]
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"validityPeriodType"
label=
"有效期类型"
rules=
{
[{
required
:
true
,
message
:
'
请选择有效期类型!
'
}]
}
>
<
Radio
.
Group
onChange=
{
onChangeDateType
}
>
<
Radio
value=
"1"
>
固定日期
</
Radio
>
<
Radio
value=
"2"
>
指定范围
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
{
dateType
===
1
?
(
<
Form
.
Item
name=
"useTime"
label=
"有效期"
{
...
rangeConfig
}
>
<
RangePicker
format=
"YYYY-MM-DD HH:mm:ss"
defaultPickerValue=
{
[
nowDateTime
,
nowDateTimeEnd
]
}
/>
</
Form
.
Item
>
)
:
(
<
Form
.
Item
name=
"validityPeriodDays"
label=
"有效期天数"
rules=
{
[{
required
:
true
,
message
:
'
请输入有效期天数!
'
}]
}
>
<
InputNumber
min=
{
1
}
max=
{
36000
}
/>
</
Form
.
Item
>
)
}
<
Form
.
Item
name=
"shopIds"
label=
"适用门店"
...
...
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