Commit fd1b0d52 authored by 王苓芝's avatar 王苓芝

已审核问题修改

parent f8eba718
import React, { useState, useRef, useEffect } from 'react';
import { Button } from 'antd';
import { Button, notification } from 'antd';
import ProTable from '@ant-design/pro-table';
import { searchList, orderDetail } from './service';
import { column } from './data';
import DetailTable from './components/detailTable';
import { dateDiff } from './common';
export default () => {
const table = useRef();
......@@ -23,6 +24,38 @@ export default () => {
};
const query = async (params, type) => {
if (params.orderId) {
params.orderId = `${params.orderId}`.replace(/\s/g, '');
}
if (params.receiverPhone) {
const reg = /^1[3456789]\d{9}$/;
if (!reg.test(params.receiverPhone)) {
notification.warning({
message: '您输入的手机号有误,请重新输入!',
});
return false;
}
}
if (params.orderTime && params.orderTime.length) {
const startTime = params.orderTime[0];
const endTime = params.orderTime[1];
if (dateDiff(startTime, endTime)) {
notification.warning({
message: '您输入的订单创建时间超过3个月啦!',
});
return false;
}
}
if (params.applyTime && params.applyTime.length) {
const startTime = params.applyTime[0];
const endTime = params.applyTime[1];
if (dateDiff(startTime, endTime)) {
notification.warning({
message: '您输入的订单提交时间超过3个月啦!',
});
return false;
}
}
const tempParams = {
...params,
applyTimeStartAt: params.applyTime?.[0],
......
......@@ -6,6 +6,7 @@ import { searchList, orderDetail } from './service';
import { column } from './data';
import AuditModal from './components/auditModal';
import DetailTable from './components/detailTable';
import { dateDiff } from './common';
export default () => {
const table = useRef();
......@@ -13,25 +14,25 @@ export default () => {
const [detailVisible, setDetailVisible] = useState(false);
const [detailInfo, setDetailInfo] = useState([]);
const [auditInfo, setAuditInfo] = useState({});
const dateDiff = (startTime, endTime) => {
const startY = startTime.substr(0, 4);
const startM = startTime.substr(5, 2);
const startD = startTime.substr(8, 2);
const endY = endTime.substr(0, 4);
const endM = endTime.substr(5, 2);
const endD = endTime.substr(8, 2);
if (endY - startY > 0) {
if (
(endY - startY) * (12 - startM) + endM > 3 ||
((endY - startY) * (12 - startM) + endM === 3 && endD > startD)
) {
return true;
}
} else if (endM - startM > 3 || (endM - startM === 3 && endD > startD)) {
return true;
}
return false;
};
// const dateDiff = (startTime, endTime) => {
// const startY = startTime.substr(0, 4);
// const startM = startTime.substr(5, 2);
// const startD = startTime.substr(8, 2);
// const endY = endTime.substr(0, 4);
// const endM = endTime.substr(5, 2);
// const endD = endTime.substr(8, 2);
// if (endY - startY > 0) {
// if (
// (endY - startY) * (12 - startM) + endM > 3 ||
// ((endY - startY) * (12 - startM) + endM === 3 && endD > startD)
// ) {
// return true;
// }
// } else if (endM - startM > 3 || (endM - startM === 3 && endD > startD)) {
// return true;
// }
// return false;
// };
const query = async (params, type) => {
if (params.orderId) {
......
export const dateDiff = (startTime, endTime) => {
const startY = startTime.substr(0, 4);
const startM = startTime.substr(5, 2);
const startD = startTime.substr(8, 2);
const endY = endTime.substr(0, 4);
const endM = endTime.substr(5, 2);
const endD = endTime.substr(8, 2);
if (endY - startY > 0) {
if (
(endY - startY) * (12 - startM) + endM > 3 ||
((endY - startY) * (12 - startM) + endM === 3 && endD > startD)
) {
return true;
}
} else if (endM - startM > 3 || (endM - startM === 3 && endD > startD)) {
return true;
}
return false;
};
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