diff --git a/packages/app-client/src/components/audit/AuditList.tsx b/packages/app-client/src/components/audit/AuditList.tsx index cf0a025..8067070 100644 --- a/packages/app-client/src/components/audit/AuditList.tsx +++ b/packages/app-client/src/components/audit/AuditList.tsx @@ -44,9 +44,19 @@ export default function AuditList(props: IAuditListProps) { const toolbar: ToolBar = { ...defaultToolbar, search: { - activeKey: "plate", - defaultActiveKey: "plate", + activeKey: "orderSn", + defaultActiveKey: "orderSn", items: [ + { + key: "orderSn", + name: "采购单号", + placeholder: "请输入采购单号", + }, + { + key: "vehicleNo", + name: "车次号", + placeholder: "请输入车次号", + }, { key: "plate", name: "车牌号", @@ -349,6 +359,7 @@ export default function AuditList(props: IAuditListProps) { Taro.navigateTo({ url: buildUrl(purchase.path[orderVO.type].create, { orderId: orderVO.orderId, + auditId: auditVO.auditId, }), }); e.stopPropagation(); diff --git a/packages/app-client/src/components/biz/PageList.tsx b/packages/app-client/src/components/biz/PageList.tsx index 2a6043f..215ba9f 100644 --- a/packages/app-client/src/components/biz/PageList.tsx +++ b/packages/app-client/src/components/biz/PageList.tsx @@ -210,8 +210,19 @@ export default ( } onClear={() => actionRef.current.reload()} onSearch={(val) => { + // 将所有 search items 的 key 设置为 undefined + const clearedSearchKeys = (toolbar?.search?.items || []).reduce( + (acc, item) => ({ + ...acc, + [item.key]: undefined, + }), + {}, + ); + + // 只保留当前搜索类型的值 setQuery({ ...query, + ...clearedSearchKeys, [searchType]: val == "" ? undefined : val, pageIndex: 1, }); @@ -399,6 +410,11 @@ export default ( ({ value: c.key, @@ -406,7 +422,7 @@ export default ( })) || [], ]} onConfirm={(value: any) => { - setSearchType(value[0].value); + setSearchType(value[0]?.value); }} onClose={() => setLightTheme(false)} /> diff --git a/packages/app-client/src/components/delivery/Step3Success.tsx b/packages/app-client/src/components/delivery/Step3Success.tsx index 8d22154..c6d49bf 100644 --- a/packages/app-client/src/components/delivery/Step3Success.tsx +++ b/packages/app-client/src/components/delivery/Step3Success.tsx @@ -10,6 +10,7 @@ import { ProfitTableTemplate, } from "@/utils"; import dayjs from "dayjs"; +import { ProfitCalculationService } from "@/utils/classes/calculators"; interface Step3SuccessProps { pdfUrl: string; @@ -60,7 +61,7 @@ export default function Step3Success(props: Step3SuccessProps) { for (const order of orderVOList) { // 如果还没有到达当前车次,继续 if (includeNext) { - const profitRow = calculateOrderProfit(order); + const profitRow = ProfitCalculationService.calculateOrderProfit(order); profitData.push(profitRow); // 如果是当前车次,停止添加 diff --git a/packages/app-client/src/components/order/OrderItem.tsx b/packages/app-client/src/components/order/OrderItem.tsx index 31c9a5d..e896563 100644 --- a/packages/app-client/src/components/order/OrderItem.tsx +++ b/packages/app-client/src/components/order/OrderItem.tsx @@ -375,17 +375,22 @@ export default function OrderItem(props: IOrderItemProps) { )} - {orderVO.state === "AUDITING" && ( - - )} + {/*{orderVO.state === "AUDITING" && (*/} + {/* {*/} + {/* Taro.navigateTo({*/} + {/* url: buildUrl(purchase.path[orderVO.type].result, {*/} + {/* orderId: orderVO.orderId,*/} + {/* }),*/} + {/* });*/} + {/* e.stopPropagation();*/} + {/* }}*/} + {/* >*/} + {/* 审核进度*/} + {/* */} + {/*)}*/} ); diff --git a/packages/app-client/src/components/order/OrderList.tsx b/packages/app-client/src/components/order/OrderList.tsx index 4cd8a85..c86a3ef 100644 --- a/packages/app-client/src/components/order/OrderList.tsx +++ b/packages/app-client/src/components/order/OrderList.tsx @@ -38,9 +38,19 @@ export default function OrderList(props: IOrderListProps) { const toolbar: ToolBar = { ...defaultToolbar, search: { - activeKey: "plate", - defaultActiveKey: "plate", + activeKey: "orderSn", + defaultActiveKey: "orderSn", items: [ + { + key: "orderSn", + name: "采购单号", + placeholder: "请输入采购单号", + }, + { + key: "vehicleNo", + name: "车次号", + placeholder: "请输入车次号", + }, { key: "plate", name: "车牌号", diff --git a/packages/app-client/src/components/order/section/BasicInfoSection.tsx b/packages/app-client/src/components/order/section/BasicInfoSection.tsx index 334834d..7f4a1b6 100644 --- a/packages/app-client/src/components/order/section/BasicInfoSection.tsx +++ b/packages/app-client/src/components/order/section/BasicInfoSection.tsx @@ -63,11 +63,6 @@ export default forwardRef< (cost) => cost.type === "LOGISTICS_TYPE" && cost.name === "短驳费", ); - // 草帘费 - const curtainCost = costList.find( - (cost) => cost.type === "LOGISTICS_TYPE" && cost.name === "草帘费", - ); - const formatter = (type: string, option: PickerOption) => { switch (type) { case "year": @@ -98,6 +93,8 @@ export default forwardRef< // 编辑值的状态(用于弹窗中的临时编辑) const [editValues, setEditValues] = useState({ + driver: orderVehicle?.driver || "", + dealerName: orderVehicle?.dealerName || "", vehicleNo: orderVehicle?.vehicleNo || "", origin: orderVehicle?.origin || "", destination: orderVehicle?.destination || "", @@ -177,6 +174,8 @@ export default forwardRef< const openBasicInfoPopup = () => { if (readOnly) return; setEditValues({ + driver: orderVehicle?.driver || "", + dealerName: orderVehicle?.dealerName || "", vehicleNo: orderVehicle?.vehicleNo || "", origin: orderVehicle?.origin || "", destination: orderVehicle?.destination || "", @@ -194,74 +193,50 @@ export default forwardRef< // 保存基础信息 const saveBasicInfo = () => { if (onChange) { - const newOrderCostList = orderVO.orderCostList.map((orderCost) => { - if (orderCost.type === "LOGISTICS_TYPE") { - if (editValues.priceType === "MAIN_FREIGHT" && mainCost) { - return { - ...orderCost, - costId: mainCost.costId, - name: mainCost.name, - belong: mainCost.belong, - price: Number(editValues.price), - unit: mainCost.unit || orderCost.unit || "元", - }; - } - if (editValues.priceType === "SHORT_TRANSPORT" && shortCost) { - return { - ...orderCost, - costId: shortCost.costId, - name: shortCost.name, - belong: shortCost.belong, - price: Number(editValues.price), - unit: shortCost.unit || orderCost.unit || "元", - }; - } - } - return orderCost; + const newOrderCostList = orderVO.orderCostList.filter((cost) => { + return cost.type !== "LOGISTICS_TYPE"; }); - if (editValues.strawCurtainPrice) { - if (curtainCost) { - const orderStrawCost = newOrderCostList.find( - (orderCost) => - orderCost.type === "LOGISTICS_TYPE" && - orderCost.name === "草帘费", - ); - if (orderStrawCost) { - newOrderCostList.map((orderCost) => { - if ( - orderCost.type === "LOGISTICS_TYPE" && - orderCost.name === "草帘费" - ) { - return { - ...orderCost, - costId: orderStrawCost.costId, - name: orderStrawCost.name, - belong: orderStrawCost.belong, - price: editValues.openStrawCurtain - ? editValues.strawCurtainPrice - : 0, - unit: orderStrawCost.unit || orderCost.unit || "元", - }; - } - }); - } else { - newOrderCostList.push({ - orderCostId: generateShortId(), - costId: curtainCost.costId || "", - name: curtainCost.name || "", - price: editValues.openStrawCurtain - ? editValues.strawCurtainPrice - : 0, - unit: curtainCost.unit || "元", - count: 1, - type: curtainCost.type, - costItemIds: [], - belong: curtainCost.belong, - selected: true, - }); - } - } + const orderVehicle = editValues; + const costName = + orderVehicle.priceType === "SHORT_TRANSPORT" ? "短驳费" : "主运费"; + const cost2 = costList?.find( + (cost) => cost.name === costName && cost.type === "LOGISTICS_TYPE", + ); + + // 加运费 + if (orderVehicle.price && cost2) { + newOrderCostList.push({ + orderCostId: generateShortId(), + costId: cost2.costId || "", + name: cost2.name || "", + price: orderVehicle.price, + unit: cost2.unit || "元", + count: 1, + type: "LOGISTICS_TYPE", + costItemIds: [], + belong: cost2.belong, + selected: true, + }); + } + + const cost3 = costList?.find( + (cost) => cost.name === "草帘费" && cost.type === "LOGISTICS_TYPE", + ); + // 加草帘 + if (orderVehicle.openStrawCurtain && cost3) { + newOrderCostList.push({ + orderCostId: generateShortId(), + costId: cost3.costId || "", + name: cost3.name || "", + price: orderVehicle.strawCurtainPrice!, + unit: cost3.unit || "元", + count: 1, + type: "LOGISTICS_TYPE", + costItemIds: [], + belong: cost3.belong, + selected: true, + }); } const updatedOrder = { diff --git a/packages/app-client/src/components/order/section/DeliveryFormSection.tsx b/packages/app-client/src/components/order/section/DeliveryFormSection.tsx index 7f36bc9..1e9c012 100644 --- a/packages/app-client/src/components/order/section/DeliveryFormSection.tsx +++ b/packages/app-client/src/components/order/section/DeliveryFormSection.tsx @@ -55,7 +55,7 @@ export default forwardRef< // 更新模板配置 const updateTemplateConfig = (template: any[], data: any) => { let templateList: any[] = []; - template.map(async (module: any) => { + template?.map(async (module: any) => { let newModule = { ...module }; if (data[module.type]) { newModule.config = { ...module.config, ...data[module.type] }; diff --git a/packages/app-client/src/constant/app.ts b/packages/app-client/src/constant/app.ts index 0491e9f..073e8d9 100644 --- a/packages/app-client/src/constant/app.ts +++ b/packages/app-client/src/constant/app.ts @@ -1,2 +1,2 @@ // App 相关常量 -export const APP_VERSION = "v0.0.76"; +export const APP_VERSION = "v0.0.77"; diff --git a/packages/app-client/src/pages/approval/audit.tsx b/packages/app-client/src/pages/approval/audit.tsx index a1fec51..0bef35c 100644 --- a/packages/app-client/src/pages/approval/audit.tsx +++ b/packages/app-client/src/pages/approval/audit.tsx @@ -90,7 +90,7 @@ export default hocAuth(function Page(props: CommonComponent) { const estimatedArrivalDate = orderVO.orderShipList[0].estimatedArrivalDate; - const personalProfit = calculator.getPersonalProfit(); + const personalProfit = calculator.getNetProfit(); return ( <> - 个人利润 + 利润 0, diff --git a/packages/app-client/src/pages/delivery/document.tsx b/packages/app-client/src/pages/delivery/document.tsx index 7f21385..83f40b6 100644 --- a/packages/app-client/src/pages/delivery/document.tsx +++ b/packages/app-client/src/pages/delivery/document.tsx @@ -143,7 +143,7 @@ export default hocAuth(function Page(props: CommonComponent) { orderVO: BusinessAPI.OrderVO, ) => { let templateList: any[] = []; - template.map(async (module: any) => { + template?.map(async (module: any) => { let newModule = { ...module }; if (data[module.type]) { newModule.config = { ...module.config, ...data[module.type] }; diff --git a/packages/app-client/src/pages/main/message/index.tsx b/packages/app-client/src/pages/main/message/index.tsx index 01f7c8b..340d1c6 100644 --- a/packages/app-client/src/pages/main/message/index.tsx +++ b/packages/app-client/src/pages/main/message/index.tsx @@ -101,127 +101,147 @@ export default hocAuth(function Page() { render={(messageReceiverVO: BusinessAPI.MessageReceiverVO, index) => { const { messageVO } = messageReceiverVO; return ( - - {/* 头部区域:标题 + 已读状态 */} - - - {/* 未读指示器 */} - {!messageReceiverVO.isRead && ( - - )} - - {messageVO?.title || "暂无标题"} - - - - + + {/* 头部区域:标题 + 已读状态 */} + + + {/* 未读指示器 */} + {!messageReceiverVO.isRead && ( + )} - > - {messageReceiverVO.isRead ? "已读" : "未读"} - - - - - {/* 详细信息区域 */} - - - 消息内容 - - {messageVO?.content || "暂无内容"} - - - - 接收时间 - - {messageReceiverVO.createdAt - ? dayjs(messageReceiverVO.createdAt).format( - "YYYY-MM-DD HH:mm", - ) - : "-"} - - - {messageReceiverVO.readAt && ( - - 已读时间 - - {dayjs(messageReceiverVO.readAt).format("YYYY-MM-DD HH:mm")} + + {messageVO?.title || "暂无标题"} - )} - + + + {messageReceiverVO.isRead ? "已读" : "未读"} + + + - {/* 操作按钮区域 */} - - {!messageReceiverVO.isRead && ( + {/* 详细信息区域 */} + + + 消息内容 + + {messageVO?.content || "暂无内容"} + + + + 接收时间 + + {messageReceiverVO.createdAt + ? dayjs(messageReceiverVO.createdAt).format( + "YYYY-MM-DD HH:mm", + ) + : "-"} + + + {messageReceiverVO.readAt && ( + + 已读时间 + + {dayjs(messageReceiverVO.readAt).format( + "YYYY-MM-DD HH:mm", + )} + + + )} + + + {/* 操作按钮区域 */} + + {!messageReceiverVO.isRead && ( + + )} + - )} - - + ); diff --git a/packages/app-client/src/pages/purchase/made/create.tsx b/packages/app-client/src/pages/purchase/made/create.tsx index 2ae3ff9..525fad8 100644 --- a/packages/app-client/src/pages/purchase/made/create.tsx +++ b/packages/app-client/src/pages/purchase/made/create.tsx @@ -84,6 +84,7 @@ export default hocAuth(function Page(props: CommonComponent) { const defaultActive = router.params.active as number; const defaultSupplierId = router.params.supplierId as string; const defaultOrderSupplierId = router.params.orderSupplierId as string; + const auditId = router.params.auditId as BusinessAPI.AuditVO["auditId"]; const orderOptionRef = useRef(null); const vehicleRef = useRef(null); @@ -99,6 +100,23 @@ export default hocAuth(function Page(props: CommonComponent) { const supplierPackageRefs = useRef([]); const [order, setOrder] = useState(); + const [auditVO, setAuditVO] = useState(); + + useEffect(() => { + if (auditId) { + business.audit + .showAudit({ + auditShowQry: { + auditId, + }, + }) + .then(({ data: { data: auditVO, success: auditSuccess } }) => { + if (auditSuccess && auditVO) { + setAuditVO(auditVO); + } + }); + } + }, [auditId]); const [step, setStep] = useState(); @@ -257,6 +275,17 @@ export default hocAuth(function Page(props: CommonComponent) { return ( <> + {auditVO?.state === "AUDIT_REJECTED" && ( + + + + 驳回原因 + + + {auditVO?.auditReason || "暂无驳回原因"} + + + )} {step.value < purchase.madeSteps.length && ( diff --git a/packages/app-client/src/pages/purchase/market/create.tsx b/packages/app-client/src/pages/purchase/market/create.tsx index c6e7c50..45e5d27 100644 --- a/packages/app-client/src/pages/purchase/market/create.tsx +++ b/packages/app-client/src/pages/purchase/market/create.tsx @@ -70,6 +70,7 @@ export default hocAuth(function Page(props: CommonComponent) { const defaultActive = router.params.active as number; const defaultSupplierId = router.params.supplierId as string; const defaultOrderSupplierId = router.params.orderSupplierId as string; + const auditId = router.params.auditId as BusinessAPI.AuditVO["auditId"]; const orderOptionRef = useRef(null); const vehicleRef = useRef(null); @@ -81,8 +82,23 @@ export default hocAuth(function Page(props: CommonComponent) { const stallPackageRefs = useRef([]); const [orderVO, setOrderVO] = useState(); + const [auditVO, setAuditVO] = useState(); - console.log("orderVO", orderVO); + useEffect(() => { + if (auditId) { + business.audit + .showAudit({ + auditShowQry: { + auditId, + }, + }) + .then(({ data: { data: auditVO, success: auditSuccess } }) => { + if (auditSuccess && auditVO) { + setAuditVO(auditVO); + } + }); + } + }, [auditId]); const [step, setStep] = useState(); @@ -243,6 +259,17 @@ export default hocAuth(function Page(props: CommonComponent) { return ( <> + {auditVO?.state === "AUDIT_REJECTED" && ( + + + + 驳回原因 + + + {auditVO?.auditReason || "暂无驳回原因"} + + + )} {step.value < purchase.marketSteps.length && ( diff --git a/packages/app-client/src/utils/classes/calculators/services/ProfitCalculationService.ts b/packages/app-client/src/utils/classes/calculators/services/ProfitCalculationService.ts index 335915e..5900767 100644 --- a/packages/app-client/src/utils/classes/calculators/services/ProfitCalculationService.ts +++ b/packages/app-client/src/utils/classes/calculators/services/ProfitCalculationService.ts @@ -21,7 +21,7 @@ export class ProfitCalculationService { // 报价金额 const quoteAmount = orderCalculator.getSalesAmount(); // 计算利润 - const profit = orderCalculator.getPersonalProfit(); + const profit = orderCalculator.getNetProfit(); return { vehicleNo,