Commit 03bc128c authored by XieZhiXiong's avatar XieZhiXiong
parents 6ee1b9df cbd3b5fa
......@@ -4,194 +4,194 @@ const marketingRoutes = {
routes: [
{
/** 平台营销活动查询 - marketingSearch */
path: '/marketing/marketingSearch',
path: '/marketingManage/marketing/marketingSearch',
name: '平台营销活动查询',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/marketingSearch',
component: '@/pages/marketingManage/marketingManage/marketing/marketingSearch',
},
{
/** 平台营销活动查询详情 - preview */
path: '/marketing/marketingSearch/preview',
path: '/marketingManage/marketing/marketingSearch/preview',
name: '平台营销活动查询详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待新增平台营销活动 - waitAddedMarketing */
path: '/marketing/waitAddedMarketing',
path: '/marketingManage/marketing/waitAddedMarketing',
name: '待新增平台营销活动',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitAddedMarketing',
component: '@/pages/marketingManage/marketingManage/marketing/waitAddedMarketing',
},
{
/** 待新增平台营销活动 - preview */
path: '/marketing/waitAddedMarketing/preview',
path: '/marketingManage/marketing/waitAddedMarketing/preview',
name: '待新增平台营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 新增平台营销活动 - add */
path: '/marketing/waitAddedMarketing/add',
path: '/marketingManage/marketing/waitAddedMarketing/add',
name: '新增平台营销活动',
hidePageHeader: true,
hideInMenu: true,
component: '@/pages/marketingManage/marketing/waitAddedMarketing/add',
component: '@/pages/marketingManage/marketingManage/marketing/waitAddedMarketing/add',
},
{
/** 编辑平台营销活动 - edit */
path: '/marketing/waitAddedMarketing/edit',
path: '/marketingManage/marketing/waitAddedMarketing/edit',
name: '编辑平台营销活动',
hidePageHeader: true,
hideInMenu: true,
component: '@/pages/marketingManage/marketing/waitAddedMarketing/add',
component: '@/pages/marketingManage/marketingManage/marketing/waitAddedMarketing/add',
},
{
/** 待审核报名 - waitAuditApply */
path: '/marketing/waitAuditApply',
path: '/marketingManage/marketing/waitAuditApply',
name: '待审核报名',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitAuditApply',
component: '@/pages/marketingManage/marketingManage/marketing/waitAuditApply',
},
{
/** 待审核报名 - preview */
path: '/marketing/waitAuditApply/preview',
path: '/marketingManage/marketing/waitAuditApply/preview',
name: '待审核报名详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待审核报名 - detail */
path: '/marketing/waitAuditApply/detail',
path: '/marketingManage/marketing/waitAuditApply/detail',
name: '待审核报名详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待提交审核平台营销活动 - waitSubmitMarketing */
path: '/marketing/waitSubmitMarketing',
path: '/marketingManage/marketing/waitSubmitMarketing',
name: '待提交审核平台营销活动',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitSubmitMarketing',
component: '@/pages/marketingManage/marketingManage/marketing/waitSubmitMarketing',
},
{
/** 待提交审核平台营销活动 - preview */
path: '/marketing/waitSubmitMarketing/preview',
path: '/marketingManage/marketing/waitSubmitMarketing/preview',
name: '待提交审核平台营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待审核平台营销活动(一级) - waitAuditMarketingOne */
path: '/marketing/waitAuditMarketingOne',
path: '/marketingManage/marketing/waitAuditMarketingOne',
name: '待审核平台营销活动(一级)',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitAuditMarketingOne',
component: '@/pages/marketingManage/marketingManage/marketing/waitAuditMarketingOne',
},
{
/** 待审核平台营销活动(一级) - preview */
path: '/marketing/waitAuditMarketingOne/preview',
path: '/marketingManage/marketing/waitAuditMarketingOne/preview',
name: '待审核平台营销活动(一级)详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待审核平台营销活动(一级) - detail */
path: '/marketing/waitAuditMarketingOne/detail',
path: '/marketingManage/marketing/waitAuditMarketingOne/detail',
name: '待审核平台营销活动(一级)详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待审核平台营销活动(二级) - waitAuditMarketingTwo */
path: '/marketing/waitAuditMarketingTwo',
path: '/marketingManage/marketing/waitAuditMarketingTwo',
name: '待审核平台营销活动(二级)',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitAuditMarketingTwo',
component: '@/pages/marketingManage/marketingManage/marketing/waitAuditMarketingTwo',
},
{
/** 待审核平台营销活动(二级) - preview */
path: '/marketing/waitAuditMarketingTwo/preview',
path: '/marketingManage/marketing/waitAuditMarketingTwo/preview',
name: '待审核平台营销活动(二级)详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待审核平台营销活动(二级) - detail */
path: '/marketing/waitAuditMarketingTwo/detail',
path: '/marketingManage/marketing/waitAuditMarketingTwo/detail',
name: '待审核平台营销活动(二级)详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 待上线平台营销活动 - waitLineMarketing */
path: '/marketing/waitLineMarketing',
path: '/marketingManage/marketing/waitLineMarketing',
name: '待上线平台营销活动',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/waitLineMarketing',
component: '@/pages/marketingManage/marketingManage/marketing/waitLineMarketing',
},
{
/** 待上线平台营销活动 - preview */
path: '/marketing/waitLineMarketing/preview',
path: '/marketingManage/marketing/waitLineMarketing/preview',
name: '待上线平台营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/marketingManage/marketing/detail',
component: '@/pages/marketingManage/marketingManage/marketing/detail',
},
{
/** 平台营销活动页管理 - activePage */
path: '/marketing/activitiesManagement',
path: '/marketingManage/marketing/activitiesManagement',
name: '平台营销活动页管理',
component: '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage'
component: '@/pages/marketingManage/marketingManage/marketing/marketingActivitiesManagement/activePage'
},
{
path: '/marketing/activitiesManagement/add',
path: '/marketingManage/marketing/activitiesManagement/add',
name: '新增平台营销活动页管理',
component: '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
component: '@/pages/marketingManage/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
hidePageHeader: true,
noMargin: true,
hideInMenu: true,
},
{
path: '/marketing/activitiesManagement/edit',
path: '/marketingManage/marketing/activitiesManagement/edit',
name: '修改平台营销活动页管理',
component: '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
component: '@/pages/marketingManage/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
hidePageHeader: true,
noMargin: true,
hideInMenu: true,
},
{
path: '/marketing/activitiesManagement/view',
path: '/marketingManage/marketing/activitiesManagement/view',
name: '查看平台营销活动页管理',
component: '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
component: '@/pages/marketingManage/marketingManage/marketing/marketingActivitiesManagement/activePage/add/index',
hidePageHeader: true,
noMargin: true,
hideInMenu: true,
},
/** 装修营销活动页 */
{
path: '/marketing/activitiesManagement/fixtures',
path: '/marketingManage/marketing/activitiesManagement/fixtures',
name: '营销活动页管理装修',
component: '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/index',
component: '@/pages/marketingManage/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/index',
hidePageHeader: true,
noMargin: true,
noLayout: true,
......@@ -199,17 +199,17 @@ const marketingRoutes = {
},
{
/** 平台营销活动执行 - marketingExecute */
path: '/marketing/marketingExecute',
path: '/marketingManage/marketing/marketingExecute',
name: '平台营销活动执行',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/marketingExecute',
component: '@/pages/marketingManage/marketingManage/marketing/marketingExecute',
},
{
/** 平台营销活动监控 - marketingMonitor */
path: '/marketing/marketingMonitor',
path: '/marketingManage/marketing/marketingMonitor',
name: '平台营销活动监控',
hidePageHeader: true,
component: '@/pages/marketingManage/marketing/marketingMonitor',
component: '@/pages/marketingManage/marketingManage/marketing/marketingMonitor',
},
]
};
......
......@@ -4,44 +4,44 @@ const merchantMarketing = {
routes: [
{
/** 商家营销活动查询 - merchantMarketingSearch */
path: '/merchantMarketing/merchantMarketingSearch',
path: '/marketingManage/merchantMarketing/merchantMarketingSearch',
name: '商家营销活动查询',
hidePageHeader: true,
component: '@/pages/merchantMarketing/merchantMarketingSearch',
component: '@/pages/marketingManage/merchantMarketing/merchantMarketingSearch',
},
{
/** 商家营销活动查询详情 - preview */
path: '/merchantMarketing/merchantMarketingSearch/preview',
path: '/marketingManage/merchantMarketing/merchantMarketingSearch/preview',
name: '商家营销活动查询详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/merchantMarketing/detail',
component: '@/pages/marketingManage/merchantMarketing/detail',
},
{
/** 待审核商家营销活动 - waitAuditMerchantMarketing */
path: '/merchantMarketing/waitAuditMerchantMarketing',
path: '/marketingManage/merchantMarketing/waitAuditMerchantMarketing',
name: '待审核商家营销活动',
hidePageHeader: true,
component: '@/pages/merchantMarketing/waitAuditMerchantMarketing',
component: '@/pages/marketingManage/merchantMarketing/waitAuditMerchantMarketing',
},
{
/** 待审核商家营销活动详情 - preview */
path: '/merchantMarketing/waitAuditMerchantMarketing/preview',
path: '/marketingManage/merchantMarketing/waitAuditMerchantMarketing/preview',
name: '待审核商家营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/merchantMarketing/detail',
component: '@/pages/marketingManage/merchantMarketing/detail',
},
{
/** 待审核商家营销活动详情 - detail */
path: '/merchantMarketing/waitAuditMerchantMarketing/detail',
path: '/marketingManage/merchantMarketing/waitAuditMerchantMarketing/detail',
name: '待审核商家营销活动详情',
hidePageHeader: true,
hideInMenu: true,
noMargin: true,
component: '@/pages/merchantMarketing/detail',
component: '@/pages/marketingManage/merchantMarketing/detail',
},
]
}
......
......@@ -28,7 +28,6 @@ const DateModalLayout: React.FC<DateModalProps> = (props: any) => {
time: moment(res.time).format('x'),
reason: res.reason,
}
console.log(params, fieldApi)
setLoading(true)
fieldApi(params).then(res => {
if (res.code !== 1000) {
......@@ -36,6 +35,8 @@ const DateModalLayout: React.FC<DateModalProps> = (props: any) => {
return
}
onSubmit();
form.resetFields()
setLoading(false)
}).catch(err => {
setLoading(false)
})
......
......@@ -248,7 +248,7 @@ const AddedMarketing = (props: any) => {
roleType: item.roleId,
roleTypeName: item.roleName,
level: item.level,
levelTyp: item.levelTyp,
levelTyp: item.levelType,
levelTypeName: item.levelTypeName,
levelTag: item.levelTag,
}
......
......@@ -282,6 +282,7 @@ const ApplyMemberLayout: React.FC<ApplyMemberLayoutProps> = (props: any) => {
}
}
}}
value={dataSource}
/>
</CardLayout>
)
......
......@@ -65,6 +65,13 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
focus$.emit(option);
}
useEffect(() => {
if (isEdit) {
setActivitySignUpType(1);
form.setFieldsValue({ 'activitySignUpType': 1 })
}
}, [isEdit])
return (
<CardLayout
id="basicInfoLayout"
......@@ -136,6 +143,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => startTimeDisabled(current, 'endTime')}
/>
......@@ -173,6 +181,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => endTimeDisabled(current, 'startTime')}
/>
......@@ -215,6 +224,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => startTimeDisabled(current, 'signUpEndTime')}
/>
......@@ -249,6 +259,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => endTimeDisabled(current, 'signUpStartTime')}
/>
......
......@@ -56,7 +56,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
name={['activityDefined', 'allowActivity']}
tooltip="允许叠加活动类型表明在同一时间内允许同一个商品可以叠加的活动类型"
label="叠加活动类型"
rules={[{ required: true, message: '请选择叠加活动类型' }]}
rules={[{ required: false, message: '请选择叠加活动类型' }]}
className={style.rulesLayout}
>
<Checkbox.Group>
......@@ -181,7 +181,22 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'randomStartPrice']}
rules={[{ required: true, message: '请输入' }]}
dependencies={[['activityDefined', 'randomEndPrice']]}
rules={[
({ getFieldValue }) => ({
validator: (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,2})?$/;
const randomEndPrice = getFieldValue('activityDefined')['randomEndPrice'];
if (!value) {
return Promise.reject(new Error('请输入最小随机金额'));
}
if (!pattern.test(value) || !(Number(value) < Number(randomEndPrice))) {
return Promise.reject(new Error('必须大于0且小于最大随机金额'));
}
return Promise.resolve();
},
})
]}
>
<Input style={{ width: '160px' }} addonAfter="元" />
</Form.Item>
......@@ -189,7 +204,22 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'randomEndPrice']}
rules={[{ required: true, message: '请输入' }]}
dependencies={[['activityDefined', 'randomStartPrice']]}
rules={[
({ getFieldValue }) => ({
validator: (_rule, value) => {
const pattern = /^(\-)?\d+(\.\d{1,2})?$/;
const randomStartPrice = getFieldValue('activityDefined')['randomStartPrice'];
if (!value) {
return Promise.reject(new Error('请输入最大随机金额'));
}
if (!pattern.test(value) || !(Number(value) > Number(randomStartPrice))) {
return Promise.reject(new Error('必须大于0且大于最小随机金额'));
}
return Promise.resolve();
},
})
]}
>
<Input style={{ width: '160px' }} addonAfter="元" />
</Form.Item>
......@@ -200,7 +230,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'restrictPrice']}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入每次砍价金额'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`每次砍价金额必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '160px' }} addonAfter="元" />
</Form.Item>
......@@ -248,7 +289,28 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
style={{ margin: 0 }}
name={[name, `${int === 7 ? 'num' : 'key'}`]}
fieldKey={[fieldKey, `${int === 7 ? 'num' : 'key'}`]}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern1 = /^-?[1-9]\d*$/;
const pattern2 = /^-?[1-9]\d*(\.\d{1,2})?$/;
if (!value && int === 4) {
return Promise.reject(new Error('请输入数量'));
}
if (!value && int === 5) {
return Promise.reject(new Error('请输入金额'));
}
if (!value && int === 7) {
return Promise.reject(new Error('请输入件数'));
}
if (!pattern1.test(value) && (int === 4 || int === 7)) {
return Promise.reject(new Error(`必须大于0`));
}
if (!pattern2.test(value) && int === 5 ) {
return Promise.reject(new Error(`必须大于0最多保留2位小数`));
}
return Promise.resolve();
}
}]}
>
<Input addonAfter={LADDERBOLIST(int, type)?.addon} />
</Form.Item>
......@@ -258,7 +320,22 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
style={{ margin: 0 }}
name={[name, `${int === 7 ? 'discount' : 'value'}`]}
fieldKey={[fieldKey, `${int === 7 ? 'discount' : 'value'}`]}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern1 = /^-?[1-9]\d*(\.\d{1,1})?$/;
const pattern2 = /^-?[1-9]\d*(\.\d{1,2})?$/;
if (!value) {
return Promise.reject(new Error('请输入'));
}
if (!pattern1.test(value) && (int === 4 || int === 7)) {
return Promise.reject(new Error(`必须大于0最多保留1位小数`));
}
if (!pattern2.test(value) && int === 5 ) {
return Promise.reject(new Error(`必须大于0最多保留2位小数`));
}
return Promise.resolve();
}
}]}
>
<Input addonAfter={LADDERBOLIST(int, type)?.addonBefore} />
</Form.Item>
......@@ -285,7 +362,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'num']}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入件数'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input addonAfter="件" />
</Form.Item>
......@@ -293,7 +381,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'price']}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*(\.\d{1,2})?$/;
if (!value) {
return Promise.reject(new Error('请输入金额'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`金额必须大于0最多保留2位小数`));
}
return Promise.resolve();
}
}]}
>
<Input addonAfter="元" />
</Form.Item>
......@@ -360,7 +459,19 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'restrictNum']}
rules={[{ required: true, message: '请输入' }]}
initialValue={1}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入限制次数'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`限制次数必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '160px' }} addonAfter="次" />
</Form.Item>
......@@ -379,7 +490,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
tooltip="要求成团必须达到的人数,如只有参加团购的人数满足成团人数设置要求,团购才成立"
label="成团人数"
name={['activityDefined', 'assembleNum']}
required
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入成团人数'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`成团人数必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '359px' }} addonAfter="人" />
</Form.Item>
......@@ -426,6 +548,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
const _startTime = form.getFieldValue('startTime');
......@@ -466,7 +589,19 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'joinAssembleNum']}
rules={[{ required: true, message: '请选择' }]}
initialValue={1}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入参团限制次数'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`参团限制次数必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '191px' }} addonAfter="次" />
</Form.Item>
......@@ -541,6 +676,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
style={{ width: '168px' }}
allowClear
disabledDate={(current) => {
......@@ -556,6 +692,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
style={{ width: '168px' }}
allowClear
disabledDate={(current) => {
......@@ -601,7 +738,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'orderPrice']}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*(\.\d{1,2})?$/;
if (!value) {
return Promise.reject(new Error('请输入订单金额'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`订单金额必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '160px' }} addonAfter="元" />
</Form.Item>
......@@ -613,7 +761,18 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'integral']}
rules={[{ required: true, message: '请输入' }]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入消耗积分'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`消耗积分必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '160px' }} addonAfter="积分" />
</Form.Item>
......@@ -659,7 +818,19 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<Form.Item
style={{ margin: 0 }}
name={['activityDefined', 'lotteryNum']}
rules={[{ required: true, message: '请输入抽奖次数' }]}
initialValue={1}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*$/;
if (!value) {
return Promise.reject(new Error('请输入抽奖次数'));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`抽奖次数必须大于0`));
}
return Promise.resolve();
}
}]}
>
<Input style={{ width: '160px' }} addonAfter="次" />
</Form.Item>
......@@ -701,6 +872,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
return current && current < moment().startOf('day');
......@@ -729,6 +901,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
return current && current < moment().startOf('day');
......@@ -763,6 +936,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
return current && current < moment().startOf('day');
......@@ -791,6 +965,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
return current && current < moment().startOf('day');
......@@ -821,6 +996,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
>
<DatePicker
showTime
showNow={false}
allowClear
disabledDate={(current) => {
return current && current < moment().startOf('day');
......@@ -836,7 +1012,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
<CardLayout
id="rulesLayout"
weight
title={`活动规则-${!isEmpty(option) ? option.children : '特价促销'}`}
title={`活动规则-${!isEmpty(option) ? option?.children : '特价促销'}`}
>
{secondKill(option?.value)}
{type(option?.value)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment