Commit 76787ee6ff6de1f73d1994e37020d5281d6f1db8
1 parent
3c810fc9
fix: 修改预警数接口
Showing
2 changed files
with
34 additions
and
27 deletions
src/pages/Order/Order/index.tsx
... | ... | @@ -131,6 +131,7 @@ import './index.less'; |
131 | 131 | import { OrderListItemType, OrderType } from './type.d'; |
132 | 132 | // import { useNavigate } from 'react-router-dom'; |
133 | 133 | import { history } from '@umijs/max'; |
134 | +import { format } from 'fecha'; | |
134 | 135 | |
135 | 136 | const OrderPage = () => { |
136 | 137 | const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); |
... | ... | @@ -4587,7 +4588,14 @@ const OrderPage = () => { |
4587 | 4588 | |
4588 | 4589 | return toolBtns; |
4589 | 4590 | } |
4590 | - | |
4591 | + function setOriginTime(value) { | |
4592 | + const currentDate = new Date(); | |
4593 | + // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 | |
4594 | + const newDate = new Date(currentDate); | |
4595 | + newDate.setDate(currentDate.getDate() - value); | |
4596 | + const formattedDate = format(newDate, 'yyyy-MM-dd HH:mm:ss'); | |
4597 | + return formattedDate; | |
4598 | + } | |
4591 | 4599 | const [invoiceWarningNum, setInvoiceWarningNum] = useState(0); |
4592 | 4600 | const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(0); |
4593 | 4601 | const [waitConfirmPayment, setWaitConfirmPayment] = useState(0); |
... | ... | @@ -4597,7 +4605,13 @@ const OrderPage = () => { |
4597 | 4605 | |
4598 | 4606 | async function getInvoiceWarningNum() { |
4599 | 4607 | const res = await postServiceOrderWarningOrderStatistics({ |
4600 | - data: {}, | |
4608 | + data: { | |
4609 | + salesCode: userInfo.username, | |
4610 | + waitConfirmReiceptStatusDateTimeLe: setOriginTime(7), | |
4611 | + waitFeedbackStatusDateTimeLe: setOriginTime(20), | |
4612 | + waitConfirmInvoiceStatusDateTimeLe: setOriginTime(5), | |
4613 | + waitConfirmPaymentStatusDateTimeLe: setOriginTime(30), | |
4614 | + }, | |
4601 | 4615 | }); |
4602 | 4616 | if ( |
4603 | 4617 | (res.data.waitConfirmInvoice !== 0 || | ... | ... |
src/pages/Order/OrderWarning/index.tsx
... | ... | @@ -4143,8 +4143,8 @@ const OrderPage = () => { |
4143 | 4143 | value: 5, |
4144 | 4144 | }, |
4145 | 4145 | { |
4146 | - label: '超过10天', | |
4147 | - value: 10, | |
4146 | + label: '超过15天', | |
4147 | + value: 15, | |
4148 | 4148 | }, |
4149 | 4149 | ]; |
4150 | 4150 | const options4 = [ |
... | ... | @@ -4177,6 +4177,14 @@ const OrderPage = () => { |
4177 | 4177 | setCalDate(formattedDate); |
4178 | 4178 | setValue1(value); |
4179 | 4179 | }; |
4180 | + function setOriginTime(value) { | |
4181 | + const currentDate = new Date(); | |
4182 | + // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 | |
4183 | + const newDate = new Date(currentDate); | |
4184 | + newDate.setDate(currentDate.getDate() - value); | |
4185 | + const formattedDate = format(newDate, 'yyyy-MM-dd HH:mm:ss'); | |
4186 | + return formattedDate; | |
4187 | + } | |
4180 | 4188 | const [invoiceWarningNum, setInvoiceWarningNum] = useState(0); |
4181 | 4189 | const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(0); |
4182 | 4190 | const [waitConfirmPayment, setWaitConfirmPayment] = useState(0); |
... | ... | @@ -4205,6 +4213,10 @@ const OrderPage = () => { |
4205 | 4213 | const res = await postServiceOrderWarningOrderStatistics({ |
4206 | 4214 | data: { |
4207 | 4215 | salesCode: staticSalesCode, |
4216 | + waitConfirmReiceptStatusDateTimeLe: setOriginTime(options1[0].value), | |
4217 | + waitFeedbackStatusDateTimeLe: setOriginTime(options2[0].value), | |
4218 | + waitConfirmInvoiceStatusDateTimeLe: setOriginTime(options3[0].value), | |
4219 | + waitConfirmPaymentStatusDateTimeLe: setOriginTime(options4[0].value), | |
4208 | 4220 | }, |
4209 | 4221 | }); |
4210 | 4222 | setInvoiceWarningNum(res.data.waitConfirmInvoice); |
... | ... | @@ -4243,25 +4255,6 @@ const OrderPage = () => { |
4243 | 4255 | // }, [value1]); // 添加了 value1 作为依赖 |
4244 | 4256 | |
4245 | 4257 | useEffect(() => { |
4246 | - // 根据 activeTabKey 设置默认值 | |
4247 | - // getValue1(); | |
4248 | - // switch (activeTabKey) { | |
4249 | - // case 1: | |
4250 | - // setValue1(options1[0]?.value || 0); // 使用选项组1的第一个value | |
4251 | - // break; | |
4252 | - // case 2: | |
4253 | - // setValue1(options2[0]?.value || 0); // 使用选项组2的第一个value | |
4254 | - // break; | |
4255 | - // case 3: | |
4256 | - // setValue1(options3[0]?.value || 0); // 使用选项组3的第一个value | |
4257 | - // break; | |
4258 | - // case 4: | |
4259 | - // setValue1(options4[0]?.value || 0); // 使用选项组4的第一个value | |
4260 | - // break; | |
4261 | - // default: | |
4262 | - // setValue1(0); // 默认值为空 | |
4263 | - // break; | |
4264 | - // } | |
4265 | 4258 | // 根据 activeTabKey 设置 value1 为当前选项组的第一个 value |
4266 | 4259 | let options; |
4267 | 4260 | switch (activeTabKey) { |
... | ... | @@ -4530,7 +4523,7 @@ const OrderPage = () => { |
4530 | 4523 | // params.paymentMethod = 'UNPAID'; |
4531 | 4524 | finalParams = { |
4532 | 4525 | ...params, |
4533 | - waitConfirmReiceptStatusDateTimeLe: calDate, | |
4526 | + statusDatetimeLe: calDate, | |
4534 | 4527 | }; |
4535 | 4528 | } else if (activeTabKey === 2) { |
4536 | 4529 | // // 第一段代码 |
... | ... | @@ -4549,7 +4542,7 @@ const OrderPage = () => { |
4549 | 4542 | // params.paymentMethod = 'UNPAID'; |
4550 | 4543 | finalParams = { |
4551 | 4544 | ...params, |
4552 | - waitFeedbackStatusDateTimeLe: calDate, | |
4545 | + confirmReceiptDatetimeLe: calDate, | |
4553 | 4546 | }; |
4554 | 4547 | } else if (activeTabKey === 3) { |
4555 | 4548 | // 第一段代码 |
... | ... | @@ -4568,7 +4561,7 @@ const OrderPage = () => { |
4568 | 4561 | // params.paymentMethod = 'UNPAID'; |
4569 | 4562 | finalParams = { |
4570 | 4563 | ...params, |
4571 | - waitConfirmInvoiceStatusDateTimeLe: calDate, | |
4564 | + invoicingEndTime: calDate, | |
4572 | 4565 | }; |
4573 | 4566 | } else if (activeTabKey === 4) { |
4574 | 4567 | params.warningStatus = 'paymentReceiptStatusWarning'; // 用于回款预警 |
... | ... | @@ -4580,7 +4573,7 @@ const OrderPage = () => { |
4580 | 4573 | params.paymentNotReceipt = true; // 在回款预警中标记未支付订单 |
4581 | 4574 | finalParams = { |
4582 | 4575 | ...params, |
4583 | - waitConfirmPaymentStatusDateTimeLe: calDate, | |
4576 | + applyTimeLe: calDate, | |
4584 | 4577 | }; |
4585 | 4578 | } |
4586 | 4579 | //保存这个搜索条件 | ... | ... |