Commit d96e6859 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修改营销活动新增

parent 42706953
......@@ -249,7 +249,7 @@ export default {
'marketingAbility.qingshuruhuodongxiangouzongshuliang':'Please enter the total purchase limit of the activity',
'marketingAbility.bixudayu0qiedayugerenxiangoushuliang':'Must be greater than 0 and greater than the personal purchase limit',
'marketingAbility.shifoushanchu?':'Do you want to delete?',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu':'The discount must be greater than 0 and less than 100, with a maximum of 3 as a decimal',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu':'The discount must be greater than 0 and less than 100, with a maximum of 1 as a decimal',
'marketingAbility.zhekouweishangpinjiagedezhekou, shurushuzi, ru85zhe, shuru85, 9zheshuru90':
'Discount is the discount of the commodity price, enter a number, such as 15% off, enter 85, 10% off, enter 90',
'marketingAbility.shezhihuangoushangpin':'Set up redemption products',
......
......@@ -267,5 +267,7 @@ export default {
"selfManagement.fold": "fold",
"selfManagement.play": "Play",
"selfManagement.sureYouWantToDelete?": "Are you sure you want to delete?",
'selfManagement.qingshuruId':'Please enter id'
'selfManagement.qingshuruId':'Please enter id',
"selfManagement.bixudayu0zuiduobaoliu3wei": "Keep a maximum of 3 decimal places, which is greater than 0 and cannot be empty",
"selfManagement.rejectmin1":"Keep a maximum of 1 decimal place, greater than 0 and less than 100, and cannot be empty",
}
......@@ -249,7 +249,7 @@ export default {
'marketingAbility.qingshuruhuodongxiangouzongshuliang': '이벤트 구매 제한 총 수량을 입력하세요',
'marketingAbility.bixudayu0qiedayugerenxiangoushuliang': '0보다 크고 개인 구매 제한 수량보다 커야 합니다',
'marketingAbility.shifoushanchu?': '삭제하시겠습니까?',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu': '할인은 0보다 크고 100보다 작아야 하며 최대 3은 소수점',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu': '할인은 0보다 크고 100보다 작아야 하며 최대 1은 소수점',
'marketingAbility.zhekouweishangpinjiagedezhekou,shurushuzi,ru85zhe,shuru85,9zheshuru90':
'할인은 상품 가격의 할인으로 숫자를 입력한다. 예를 들어 85% 할인, 85% 할인, 9% 할인 90을 입력한다.',
'marketingAbility.shezhihuangoushangpin': '교환 상품을 설치하다.',
......
......@@ -233,7 +233,7 @@ export default {
'marketingAbility.shangjia': '上架',
'marketingAbility.xiajia': '下架',
'marketingAbility.mai': '买',
'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu': '必须大于0最多保留2位小数',
'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu': '最多保留2位小数,大于0,不可为空',
'marketingAbility.bixudayu0': '必须大于0',
'marketingAbility.tijiao': '提交',
'marketingAbility.qingshuruyuanyin': '请输入原因',
......@@ -249,7 +249,7 @@ export default {
'marketingAbility.qingshuruhuodongxiangouzongshuliang': '请输入活动限购总数量',
'marketingAbility.bixudayu0qiedayugerenxiangoushuliang': '必须大于0且大于个人限购数量',
'marketingAbility.shifoushanchu?': '是否删除?',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu': '折扣必须大于0且小于100最多保留3为小数',
'marketingAbility.zhekoubixudayu0qiexiaoyu100zuiduobaoliu3weixiaoshu': '折扣必须大于0且小于100最多保留1位小数',
'marketingAbility.zhekouweishangpinjiagedezhekou,shurushuzi,ru85zhe,shuru85,9zheshuru90':
'折扣为商品价格的折扣,输入数字,如85折,输入85,9折输入90',
'marketingAbility.shezhihuangoushangpin': '设置换购商品',
......
......@@ -267,5 +267,7 @@ export default {
"selfManagement.fold": "折",
"selfManagement.play": "打",
"selfManagement.sureYouWantToDelete?": "确定要删除吗?",
'selfManagement.qingshuruId': '请输入id'
'selfManagement.qingshuruId': '请输入id',
"selfManagement.bixudayu0zuiduobaoliu3wei": "最多保留3位小数,大于0,不可为空",
"selfManagement.rejectmin1":"最多保留1位小数,大于0且小于100,不可为空",
}
......@@ -87,11 +87,15 @@ const ProductLayout: React.FC<ProductLayoutProps> = (props: any) => {
label={remind.label[1]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;;
const pattern = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;
const pattern1 = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
if (!value) {
return Promise.reject(new Error(remind.message[4]));
}
if (!pattern.test(value)) {
if (!pattern.test(value) && remind.label[2] !== '元') {
return Promise.reject(new Error(remind.label[1] + `${intl.formatMessage({ id: 'selfManagement.bixudayu0zuiduobaoliu3wei'})}`));
}
if (!pattern1.test(value) && remind.label[2] === '元') {
return Promise.reject(new Error(remind.label[1] + `${intl.formatMessage({ id: 'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu'})}`));
}
return Promise.resolve();
......
......@@ -79,11 +79,16 @@ const ProductLayout: React.FC<ProductLayoutProps> = (props: any) => {
label={remind.label[1]}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^-?[1-9]\d*(\.\d{1,2})?$/;
const pattern = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;
const pattern1 = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
console.log(remind, 'remind')
if (!value) {
return Promise.reject(new Error(remind.message[4]));
}
if (!pattern.test(value)) {
if (!pattern.test(value) && remind.label[2] !== '元') {
return Promise.reject(new Error(remind.label[1] + `${intl.formatMessage({ id: 'selfManagement.bixudayu0zuiduobaoliu3wei'})}`));
}
if (!pattern1.test(value) && remind.label[2] === '元') {
return Promise.reject(new Error(remind.label[1] + `${intl.formatMessage({ id: 'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu'})}`));
}
return Promise.resolve();
......@@ -108,12 +113,12 @@ const ProductLayout: React.FC<ProductLayoutProps> = (props: any) => {
name={`swapPrice_${index}_${_index}`}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;;
const pattern = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;
if (!value) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'marketingAbility.qingshuruhuangoudanjia'})}`));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'marketingAbility.huangoudanjiabixudayu0zuiduobaoliu3weixiaoshu'})}`));
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.bixudayu0zuiduobaoliu3wei'})}`));
}
return Promise.resolve();
}
......@@ -150,12 +155,12 @@ const ProductLayout: React.FC<ProductLayoutProps> = (props: any) => {
initialValue={1}
rules={[{
required: true, validator: (_rule, value) => {
const pattern = /^[1-9]\d*$/;
const pattern = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;
if (!value) {
return Promise.reject(new Error(remind.message[5]));
}
if (!pattern.test(value)) {
return Promise.reject(new Error(remind.label[4] + `${intl.formatMessage({ id: 'marketingAbility.bixudayu0'})}`));
return Promise.reject(new Error(remind.label[4] + `${intl.formatMessage({ id: 'selfManagement.bixudayu0zuiduobaoliu3wei'})}`));
}
return Promise.resolve();
}
......
import { useIntl } from 'umi';
import React, { Fragment, useCallback, useMemo, useState } from 'react';
import { Badge, Button, Tag } from 'antd';
import { Badge, Button, Tag, Typography, Image } from 'antd';
import { history } from 'umi';
import { Context } from '@/pages/transaction/components/detailLayout/components/context';
import PeripheralLayout from '@/pages/transaction/components/detailLayout';
......@@ -231,6 +231,11 @@ const DetialLayout = () => {
}
}, [value])
const isHasTax = (tax: number) => {
const taxText = tax === 1 ? '是' : '否';
return taxText
}
const tableModalColumns: ColumnType<any>[] = [
{
title: '单据号',
......@@ -261,7 +266,8 @@ const DetialLayout = () => {
{
title: '单据时间',
key: 'orderTime',
dataIndex: 'orderTime'
dataIndex: 'orderTime',
render: (text) => format(text)
},
{
title: '单据状态',
......@@ -271,7 +277,8 @@ const DetialLayout = () => {
{
title: '含税/税率',
key: 'isHasTax',
dataIndex: 'isHasTax'
dataIndex: 'isHasTax',
render: (text, record) => `${isHasTax(text)} / ${record.taxRate}%`
},
{
title: '购买数量',
......@@ -281,17 +288,20 @@ const DetialLayout = () => {
{
title: '应付金额',
key: 'skuPrice',
dataIndex: 'skuPrice'
dataIndex: 'skuPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '实付金额',
key: 'amount',
dataIndex: 'amount'
dataIndex: 'amount',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '优惠金额',
key: 'discountPrice',
dataIndex: 'discountPrice'
dataIndex: 'discountPrice',
render: (_text, record) => `¥${(record.skuPrice - record.amount).toFixed(2)}`
},
]
......
......@@ -353,6 +353,8 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
required: true, validator: (_rule, value) => {
const pattern1 = /(^[1-9](\d+)?(\.\d{1,3})?$)|(^\d\.\d{1,3}$)/;
const pattern2 = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
const valueKey = form.getFieldValue(`activityDefined`)['ladderList'][fieldKey]['value'];
console.log(valueKey)
if (!value && int === ACTIVITY_TYPE_4) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.pleaseEnterTheNumberOf' })}`));
}
......@@ -363,11 +365,14 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.pleaseEnterTheNumber' })}`));
}
if (!pattern1.test(value) && (int === ACTIVITY_TYPE_4 || int === ACTIVITY_TYPE_7)) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.mustBeGreaterThanZero' })}`));
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.bixudayu0zuiduobaoliu3wei' })}`));
}
if (!pattern2.test(value) && int === ACTIVITY_TYPE_5) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu' })}`));
}
if (!pattern2.test(value) && int === ACTIVITY_TYPE_5 && Number(valueKey) >= Number(value)) {
return Promise.reject(new Error('最多保留2位小数,大于0且大于满额减金额'))
}
return Promise.resolve();
}
}]}
......@@ -386,18 +391,22 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
const pattern2 = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
const pattern3 = /^(?!0+(?:\.0+)?$)\d?\d(?:\.\d{1,1}?)?$/;
const pattern4 = /^(?!0+(?:\.0+)?$)\d?\d(?:\.\d{1,1}?)?$/;
const valueKey = form.getFieldValue(`activityDefined`)['ladderList'][fieldKey]['key'];
if (!value) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.pleaseEnterThe' })}`));
}
if (!pattern1.test(value) && (int === ACTIVITY_TYPE_4 || int === ACTIVITY_TYPE_7)) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.mustBeGreaterThanZero' })}`));
if (!pattern1.test(value) && (int === ACTIVITY_TYPE_4 || int === ACTIVITY_TYPE_7) && type === 1) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu' })}`));
}
if (!pattern3.test(value) && (int === ACTIVITY_TYPE_4 || int === ACTIVITY_TYPE_7) && type === 2) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.mustBeGreaterThanZero' })}`));
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.rejectmin1' })}`));
}
if (!pattern2.test(value) && int === ACTIVITY_TYPE_5) {
if (!pattern2.test(value) && int === ACTIVITY_TYPE_5 && type === 1) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'marketingAbility.bixudayu0zuiduobaoliu2weixiaoshu' })}`));
}
if (int === ACTIVITY_TYPE_5 && type === 1 && Number(valueKey) <= Number(value)) {
return Promise.reject(new Error('最多保留2位小数,大于0且小于优惠门槛'))
}
if (!pattern4.test(value) && int === ACTIVITY_TYPE_5 && type === 2) {
return Promise.reject(new Error(`${intl.formatMessage({ id: 'selfManagement.greaterDecimalPlaces' })}`));
}
......
......@@ -229,6 +229,11 @@ const DetialLayout = () => {
}
}, [value])
const isHasTax = (tax: number) => {
const taxText = tax === 1 ? '是' : '否';
return taxText
}
const tableModalColumns: ColumnType<any>[] = [
{
title: '单据号',
......@@ -259,7 +264,8 @@ const DetialLayout = () => {
{
title: '单据时间',
key: 'orderTime',
dataIndex: 'orderTime'
dataIndex: 'orderTime',
render: (text) => format(text)
},
{
title: '单据状态',
......@@ -269,7 +275,8 @@ const DetialLayout = () => {
{
title: '含税/税率',
key: 'isHasTax',
dataIndex: 'isHasTax'
dataIndex: 'isHasTax',
render: (text, record) => `${isHasTax(text)} / ${record.taxRate}%`
},
{
title: '购买数量',
......@@ -279,17 +286,20 @@ const DetialLayout = () => {
{
title: '应付金额',
key: 'skuPrice',
dataIndex: 'skuPrice'
dataIndex: 'skuPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '实付金额',
key: 'amount',
dataIndex: 'amount'
dataIndex: 'amount',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '优惠金额',
key: 'discountPrice',
dataIndex: 'discountPrice'
dataIndex: 'discountPrice',
render: (_text, record) => `¥${(record.skuPrice - record.amount).toFixed(2)}`
},
]
......
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