diff --git a/src/pages/Invoice/InvoiceRecord/index.tsx b/src/pages/Invoice/InvoiceRecord/index.tsx index 8a18b54..23c8a28 100644 --- a/src/pages/Invoice/InvoiceRecord/index.tsx +++ b/src/pages/Invoice/InvoiceRecord/index.tsx @@ -375,7 +375,7 @@ const InvoiceRecord = () => { )} </>, <> - {!record.invoice?.invoiceConfirmStatusDatetime && ( + {record.paths?.includes('INVOICE_CONFIRM') && ( <ButtonConfirm key="delete" className="p-0" diff --git a/src/pages/Invoice/constant.tsx b/src/pages/Invoice/constant.tsx index e75c725..c7f05fd 100644 --- a/src/pages/Invoice/constant.tsx +++ b/src/pages/Invoice/constant.tsx @@ -45,6 +45,13 @@ export const INVOICE_COLUMNS = [ width: 100, }, { + dataIndex: 'mainOrderId', + title: '主订单id', + valueType: 'text', + width: 160, + hideInTable: true, + }, + { dataIndex: 'invoiceStatus', title: '发票类型', valueType: 'select', diff --git a/src/pages/Order/Order/components/InvoicingDrawerForm.tsx b/src/pages/Order/Order/components/InvoicingDrawerForm.tsx index 32c1b8c..fc53a97 100644 --- a/src/pages/Order/Order/components/InvoicingDrawerForm.tsx +++ b/src/pages/Order/Order/components/InvoicingDrawerForm.tsx @@ -10,7 +10,13 @@ import { postServiceInvoiceQueryCompanyInfo, postServiceInvoiceWaitReissueInvoices, } from '@/services'; -import { FloatAdd, FloatSub, enum2ReverseSelect, enumToSelect } from '@/utils'; +import { + FloatAdd, + FloatMul, + FloatSub, + enum2ReverseSelect, + enumToSelect, +} from '@/utils'; import { convertCurrency } from '@/utils/numberUtil'; import { DrawerForm, @@ -93,7 +99,22 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { document.body.removeChild(textarea); } } - + // 定义一个计算总金额的函数 + const calculateTotalPrice = (index: number) => { + const invoiceDetails = form.getFieldValue('invoiceDetails'); + if (invoiceDetails && invoiceDetails[index]) { + const quantity = invoiceDetails[index].quantity || 0; + const price = invoiceDetails[index].price || 0; + const totalPrice = FloatMul(quantity, price); + const newInvoiceDetails = [...invoiceDetails]; + newInvoiceDetails[index] = { ...newInvoiceDetails[index], totalPrice }; + form.setFieldsValue({ invoiceDetails: newInvoiceDetails }); + } + const totalPrice = invoiceDetails.reduce((accumulator, currentValue) => { + return FloatAdd(accumulator, currentValue.quantity * currentValue.price); + }, 0); + form.setFieldValue('price', totalPrice); + }; useEffect(() => {}, []); return ( <DrawerForm @@ -539,7 +560,9 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { }, }, ]} + onChange={() => calculateTotalPrice(listMeta.index)} /> + <ProFormDigit key={'price' + listMeta.index} label="单价" @@ -554,23 +577,13 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { }, }, ]} + onChange={() => calculateTotalPrice(listMeta.index)} /> + <ProFormMoney key={'totalPrice' + listMeta.index} label="金额" name="totalPrice" - onChange={() => { - const invoiceDetails = form.getFieldValue('invoiceDetails'); - console.log('invoiceDetails', invoiceDetails); - const totalPrice = invoiceDetails.reduce( - (accumulator, currentValue) => { - return FloatAdd(accumulator, currentValue.totalPrice); - }, - 0, - ); - console.log('totalPrice', totalPrice); - form.setFieldValue('price', totalPrice); - }} rules={[ { validator: (_, value) => { @@ -581,6 +594,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { }, }, ]} + readonly={true} locale="zh-CN" /> </ProCard> diff --git a/src/pages/Order/Order/index.tsx b/src/pages/Order/Order/index.tsx index 0d33a02..53ade4a 100644 --- a/src/pages/Order/Order/index.tsx +++ b/src/pages/Order/Order/index.tsx @@ -131,6 +131,7 @@ import './index.less'; import { OrderListItemType, OrderType } from './type.d'; // import { useNavigate } from 'react-router-dom'; import { history } from '@umijs/max'; +// import { format } from 'fecha'; const OrderPage = () => { const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); @@ -4587,7 +4588,23 @@ const OrderPage = () => { return toolBtns; } - + function setOriginTime(value) { + const currentDate = new Date(); + + // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 + const newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() - value); + // 检查日期是否有效,并格式化输出 + function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需加1 + const day = String(date.getDate()).padStart(2, '0'); // 确保是两位数 + return `${year}-${month}-${day} ${date.toTimeString().split(' ')[0]}`; // 获取时间部分 + } + const formattedDate = formatDate(newDate); + // const formattedDate = format(newDate, 'YYYY-MM-dd HH:mm:ss'); + return formattedDate; + } const [invoiceWarningNum, setInvoiceWarningNum] = useState(0); const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(0); const [waitConfirmPayment, setWaitConfirmPayment] = useState(0); @@ -4597,7 +4614,13 @@ const OrderPage = () => { async function getInvoiceWarningNum() { const res = await postServiceOrderWarningOrderStatistics({ - data: {}, + data: { + salesCode: userInfo.username, + waitConfirmReiceptStatusDateTimeLe: setOriginTime(7), + waitFeedbackStatusDateTimeLe: setOriginTime(20), + waitConfirmInvoiceStatusDateTimeLe: setOriginTime(5), + waitConfirmPaymentStatusDateTimeLe: setOriginTime(30), + }, }); if ( (res.data.waitConfirmInvoice !== 0 || @@ -4631,375 +4654,283 @@ const OrderPage = () => { <div className="order-page-container"> <div id="resizeDiv"></div> <div id="resizeDiv"></div> - <Modal - title="订单预警提醒" - open={open} - width={800} - closable={false} - footer={[ - <Button - key="confirm" - size="large" - type="primary" - onClick={navigateToWarning} - > - 去处理 - </Button>, - ]} - > - {/* <Row - gutter={16} - justify="space-between" // Aligns Cols to the start and end - align="middle" // Vertically center contents - > - <Col span={12}> - <div - style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', - }} + {roleCode === 'SALES_REPRESENTATIVE' && ( + <Modal + title="订单预警提醒" + open={open} + width={800} + closable={false} + footer={[ + <Button + key="confirm" + size="large" + type="primary" + onClick={navigateToWarning} > - <Card - bordered={true} + 去处理 + </Button>, + ]} + > + <Row + gutter={16} + justify="space-between" // Aligns Cols to the start and end + align="middle" // Vertically center contents + > + {/* 新增卡片1: 待确认收货订单 */} + <Col span={6}> + {' '} + {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} + <div style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 display: 'flex', - alignItems: 'center', justifyContent: 'center', + marginTop: '20px', }} > - <div + <Card + bordered={true} style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '20px', // 字体大小 + backgroundColor: '#f0f0f0', // 背景颜色 + width: '200px', // 卡片宽度 + height: '200px', // 卡片高度 + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }} > <div style={{ fontWeight: 'bold', // 字体加粗 color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', + fontSize: '18px', // 字体大小 }} > - {invoiceWarningNum} + <div + style={{ + fontWeight: 'bold', // 字体加粗 + color: 'black', // 字体颜色 + fontSize: '40px', // 字体大小 + justifyContent: 'center', + display: 'flex', + alignItems: 'center', + marginBottom: '20px', + }} + > + {invoiceRefundWarningNum} + </div> + 待确认收货订单 </div> - 发票待确认订单 - </div> - </Card> - </div> - </Col> - <Col span={12}> - <div - style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', - }} - > - <Card - bordered={true} + </Card> + </div> + </Col> + + {/* 新增卡片2: 待回访登记订单 */} + <Col span={6}> + {' '} + {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} + <div style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 display: 'flex', - alignItems: 'center', justifyContent: 'center', + marginTop: '20px', }} > - <div + <Card + bordered={true} style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '20px', // 字体大小 + backgroundColor: '#f0f0f0', // 背景颜色 + width: '200px', // 卡片宽度 + height: '200px', // 卡片高度 + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }} > <div style={{ fontWeight: 'bold', // 字体加粗 color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', + fontSize: '18px', // 字体大小 }} > - {invoiceRefundWarningNum} + <div + style={{ + fontWeight: 'bold', // 字体加粗 + color: 'black', // 字体颜色 + fontSize: '40px', // 字体大小 + justifyContent: 'center', + display: 'flex', + alignItems: 'center', + marginBottom: '20px', + }} + > + {waitFeedback} + </div> + 待回访登记订单 </div> - 回款待确认订单 - </div> - </Card> - </div> - </Col> - </Row> */} - <Row - gutter={16} - justify="space-between" // Aligns Cols to the start and end - align="middle" // Vertically center contents - > - {/* 新增卡片1: 待确认收货订单 */} - <Col span={6}> - {' '} - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} - <div - style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', - }} - > - <Card - bordered={true} + </Card> + </div> + </Col> + + {/* 现有卡片: 发票待确认订单 */} + <Col span={6}> + {' '} + {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} + <div style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 display: 'flex', - alignItems: 'center', justifyContent: 'center', + marginTop: '20px', }} > - <div + <Card + bordered={true} style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '18px', // 字体大小 + backgroundColor: '#f0f0f0', // 背景颜色 + width: '200px', // 卡片宽度 + height: '200px', // 卡片高度 + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }} > <div style={{ fontWeight: 'bold', // 字体加粗 color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', + fontSize: '18px', // 字体大小 }} > - {invoiceRefundWarningNum} + <div + style={{ + fontWeight: 'bold', // 字体加粗 + color: 'black', // 字体颜色 + fontSize: '40px', // 字体大小 + justifyContent: 'center', + display: 'flex', + alignItems: 'center', + marginBottom: '20px', + }} + > + {invoiceWarningNum} + </div> + 待确认发票订单 </div> - 待确认收货订单 - </div> - </Card> - </div> - </Col> + </Card> + </div> + </Col> - {/* 新增卡片2: 待回访登记订单 */} - <Col span={6}> - {' '} - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} - <div - style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', - }} - > - <Card - bordered={true} + {/* 现有卡片: 回款待确认订单 */} + <Col span={6}> + {' '} + {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} + <div style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 display: 'flex', - alignItems: 'center', justifyContent: 'center', + marginTop: '20px', }} > - <div + <Card + bordered={true} style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '18px', // 字体大小 + backgroundColor: '#f0f0f0', // 背景颜色 + width: '200px', // 卡片宽度 + height: '200px', // 卡片高度 + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }} > <div style={{ fontWeight: 'bold', // 字体加粗 color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', + fontSize: '18px', // 字体大小 }} > - {waitFeedback} + <div + style={{ + fontWeight: 'bold', // 字体加粗 + color: 'black', // 字体颜色 + fontSize: '40px', // 字体大小 + justifyContent: 'center', + display: 'flex', + alignItems: 'center', + marginBottom: '20px', + }} + > + {waitConfirmPayment} + </div> + 待回款订单 </div> - 待回访登记订单 - </div> - </Card> - </div> - </Col> + </Card> + </div> + </Col> + </Row> - {/* 现有卡片: 发票待确认订单 */} - <Col span={6}> - {' '} - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} + <div> + <p + style={{ + color: 'red', + paddingLeft: '20px', + paddingRight: '20px', + marginTop: '10px', + }} + > + 预警说明: + </p> <div style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', + marginLeft: '20px', + marginRight: '20px', + marginBottom: '20px', }} > - <Card - bordered={true} - style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - }} - > - <div - style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '18px', // 字体大小 - }} - > - <div - style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', - }} - > - {invoiceWarningNum} - </div> - 待确认发票订单 - </div> - </Card> + <span style={{ color: 'red' }}>确认收货预警:</span> + <span> + 从发货之日起计算,国内超过7天(海外30天)未【确认收货】,将进行确认收货预警提醒,超过10天(海外60天)未确认收货将锁单,并且每次登录都会提醒 + </span> </div> - </Col> - - {/* 现有卡片: 回款待确认订单 */} - <Col span={6}> - {' '} - {/* 修改位置:将 span 改为 6,以保证一行四个卡片 */} <div style={{ - display: 'flex', - justifyContent: 'center', - marginTop: '20px', + marginLeft: '20px', + marginRight: '20px', + marginBottom: '20px', }} > - <Card - bordered={true} - style={{ - backgroundColor: '#f0f0f0', // 背景颜色 - width: '200px', // 卡片宽度 - height: '200px', // 卡片高度 - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - }} - > - <div - style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '18px', // 字体大小 - }} - > - <div - style={{ - fontWeight: 'bold', // 字体加粗 - color: 'black', // 字体颜色 - fontSize: '40px', // 字体大小 - justifyContent: 'center', - display: 'flex', - alignItems: 'center', - marginBottom: '20px', - }} - > - {waitConfirmPayment} - </div> - 待回款订单 - </div> - </Card> + <span style={{ color: 'red' }}>回访登记预警:</span> + <span> + 从【确认收货】之日起计算,国内超过20天(海外30天)未【回访登记】,将进行回访登记预警提醒,超过45天(海外60天)未回访登记将锁单,并且每次登录都会提醒 + </span> + </div> + <div + style={{ + marginLeft: '20px', + marginRight: '20px', + marginBottom: '20px', + }} + > + <span style={{ color: 'red' }}>确认发票预警:</span> + <span> + 从发票开出之日起,超过5天未和客户确认发票(不开票的订单除外)的订单将会进行第一次提醒;超过15天未和客户确认发票(不开票的订单除外)的订单将会每天进行一次提醒,并限制下单功能 + </span> + </div> + <div + style={{ + marginLeft: '20px', + marginRight: '20px', + marginBottom: '20px', + }} + > + <span style={{ color: 'red' }}>回款预警:</span> + <span> + 从【发票确认】之日起,超过30天未确认回款的订单将会每周提醒,超过90天未确认回款的订单将会每天进行一次提醒,并限制下单功能 + </span> </div> - </Col> - </Row> - - <div> - <p - style={{ - color: 'red', - paddingLeft: '20px', - paddingRight: '20px', - marginTop: '10px', - }} - > - 预警说明: - </p> - <div - style={{ - marginLeft: '20px', - marginRight: '20px', - marginBottom: '20px', - }} - > - <span style={{ color: 'red' }}>确认收货预警:</span> - <span> - 从发货之日起计算,国内超过7天(海外30天)未【确认收货】,将进行确认收货预警提醒,超过10天(海外60天)未确认收货将锁单,并且每次登录都会提醒 - </span> - </div> - <div - style={{ - marginLeft: '20px', - marginRight: '20px', - marginBottom: '20px', - }} - > - <span style={{ color: 'red' }}>回访登记预警:</span> - <span> - 从【确认收货】之日起计算,国内超过20天(海外30天)未【回访登记】,将进行回访登记预警提醒,超过45天(海外60天)未回访登记将锁单,并且每次登录都会提醒 - </span> - </div> - <div - style={{ - marginLeft: '20px', - marginRight: '20px', - marginBottom: '20px', - }} - > - <span style={{ color: 'red' }}>确认发票预警:</span> - <span> - 从发票开出之日起,超过5天未和客户确认发票(不开票的订单除外)的订单将会进行第一次提醒;超过15天未和客户确认发票(不开票的订单除外)的订单将会每天进行一次提醒,并限制下单功能 - </span> - </div> - <div - style={{ - marginLeft: '20px', - marginRight: '20px', - marginBottom: '20px', - }} - > - <span style={{ color: 'red' }}>回款预警:</span> - <span> - 从【发票确认】之日起,超过30天未确认回款的订单将会每周提醒,超过90天未确认回款的订单将会每天进行一次提醒,并限制下单功能 - </span> </div> - </div> - </Modal> + </Modal> + )} <ProTable id="main-table" // tableStyle={{backgroundColor:'red'}} diff --git a/src/pages/Order/OrderWarning/index.tsx b/src/pages/Order/OrderWarning/index.tsx index 048d40d..46a9827 100644 --- a/src/pages/Order/OrderWarning/index.tsx +++ b/src/pages/Order/OrderWarning/index.tsx @@ -4143,8 +4143,8 @@ const OrderPage = () => { value: 5, }, { - label: '超过10天', - value: 10, + label: '超过15天', + value: 15, }, ]; const options4 = [ @@ -4177,6 +4177,14 @@ const OrderPage = () => { setCalDate(formattedDate); setValue1(value); }; + function setOriginTime(value) { + const currentDate = new Date(); + // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 + const newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() - value); + const formattedDate = format(newDate, 'yyyy-MM-dd HH:mm:ss'); + return formattedDate; + } const [invoiceWarningNum, setInvoiceWarningNum] = useState(0); const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(0); const [waitConfirmPayment, setWaitConfirmPayment] = useState(0); @@ -4205,6 +4213,10 @@ const OrderPage = () => { const res = await postServiceOrderWarningOrderStatistics({ data: { salesCode: staticSalesCode, + waitConfirmReiceptStatusDateTimeLe: setOriginTime(options1[0].value), + waitFeedbackStatusDateTimeLe: setOriginTime(options2[0].value), + waitConfirmInvoiceStatusDateTimeLe: setOriginTime(options3[0].value), + waitConfirmPaymentStatusDateTimeLe: setOriginTime(options4[0].value), }, }); setInvoiceWarningNum(res.data.waitConfirmInvoice); @@ -4243,25 +4255,6 @@ const OrderPage = () => { // }, [value1]); // 添加了 value1 作为依赖 useEffect(() => { - // 根据 activeTabKey 设置默认值 - // getValue1(); - // switch (activeTabKey) { - // case 1: - // setValue1(options1[0]?.value || 0); // 使用选项组1的第一个value - // break; - // case 2: - // setValue1(options2[0]?.value || 0); // 使用选项组2的第一个value - // break; - // case 3: - // setValue1(options3[0]?.value || 0); // 使用选项组3的第一个value - // break; - // case 4: - // setValue1(options4[0]?.value || 0); // 使用选项组4的第一个value - // break; - // default: - // setValue1(0); // 默认值为空 - // break; - // } // 根据 activeTabKey 设置 value1 为当前选项组的第一个 value let options; switch (activeTabKey) { @@ -4524,13 +4517,14 @@ const OrderPage = () => { params.orderStatus = 'SHIPPED'; // 发票确认预警 params.isDeleteQueryOrder = false; // 强制查询非作废订单 params.salesCode = userInfo.username; + params.warningStatus = 'waitConfirmReicept'; if (salesCodeSelect !== undefined && salesCodeSelect !== null) { params.salesCode = salesCodeSelect; } // params.paymentMethod = 'UNPAID'; finalParams = { ...params, - waitConfirmReiceptStatusDateTimeLe: calDate, + statusDatetimeLe: calDate, }; } else if (activeTabKey === 2) { // // 第一段代码 @@ -4549,7 +4543,7 @@ const OrderPage = () => { // params.paymentMethod = 'UNPAID'; finalParams = { ...params, - waitFeedbackStatusDateTimeLe: calDate, + confirmReceiptDatetimeLe: calDate, }; } else if (activeTabKey === 3) { // 第一段代码 @@ -4568,7 +4562,7 @@ const OrderPage = () => { // params.paymentMethod = 'UNPAID'; finalParams = { ...params, - waitConfirmInvoiceStatusDateTimeLe: calDate, + invoicingEndTime: calDate, }; } else if (activeTabKey === 4) { params.warningStatus = 'paymentReceiptStatusWarning'; // 用于回款预警 @@ -4580,7 +4574,7 @@ const OrderPage = () => { params.paymentNotReceipt = true; // 在回款预警中标记未支付订单 finalParams = { ...params, - waitConfirmPaymentStatusDateTimeLe: calDate, + applyTimeLe: calDate, }; } //保存这个搜索条件