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

bug调整

parent 3916ef2f
import React, { useState, useRef } from 'react';
import { Button } from 'antd';
import { Button, notification } from 'antd';
import ProTable from '@ant-design/pro-table';
// import { searchList, auditInfoApi, orderDetail } from './service';
import { searchList, orderDetail } from './service';
......@@ -13,8 +13,59 @@ 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 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],
......
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