In recent years, with the accelerated progress of pure electric buses in my country, the charging scheduling and operation plan of pure electric buses urgently needs to be rationalized and scientific. This study takes the charging scheduling operation in the daily operation of pure electric buses as the starting point, and effectively describes the battery loss cost function by analyzing the optimal fluctuation range of the state of charge of the power battery of pure electric buses. Combined with the analysis of the characteristics of peak and valley time-of-use electricity prices during the charging period, the problem is refined into a pure electric bus charging scheduling decision with controllable operation completion, and the parallel machine scheduling theory is used to characterize and solve the mathematical optimization model, with the aim of minimizing the operating cost of bus companies. At the same time, an immune optimization algorithm based on random key encoding and a greedy algorithm based on the idea of avoiding peaks and filling valleys are developed to solve large-scale problems. In addition, the effectiveness of the algorithm and the applicability of the method are verified through the real bus network in Shanghai.