In the present work, we use optical theorem to calculate the next-to-leading order corrections to the QCD spectral densities directly in the QCD sum rules for the pseudoscalar and scalar $B_c$ mesons. We take the experimental data as guides to perform updated analysis, and obtain the masses and decay constants, especially the decay constants, which are the fundamental input parameters in the high energy physics, therefore the pure leptonic decay widths, which can be confronted to the experimental data in the future. Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. Article funded by SCOAP3 and published under licence by Chinese Physical Society and the Institute of High Energy Physics of the Chinese Academy of Science and the Institute of Modern Physics of the Chinese Academy of Sciences and IOP Publishing Ltd.