Incomplete tumor resection is the direct cause of the tumor recurrence and metastasis after surgery. Intraoperative accurate detection and elimination of microscopic residual cancer improve surgery outcomes. In this study, a powerful D1-π-A-D2-R type phototheranostic based on aggregation-induced emission (AIE)-active the second near-infrared window (NIR-II) fluorophore is designed and constructed. The prepared theranostic agent, A1 nanoparticles (NPs), simultaneously shows high absolute quantum yield (1.23%), excellent photothermal conversion efficiency (55.3%), high molar absorption coefficient and moderate singlet oxygen generation performance. In vivo experiments indicate that NIR-II fluorescence imaging of A1 NPs precisely detect microscopic residual tumor (2 mm in diameter) in the tumor bed and metastatic lymph nodes. More notably, a novel integrated strategy that achieves complete tumor eradication (no local recurrence and metastasis after surgery) is proposed. In summary, A1 NPs possess superior imaging and treatment performance, and can detect and eliminate residual tumor lesions intraoperatively. This work provides a promising technique for future clinical applications achieving improved surgical outcomes.