In this paper, we study an electric vehicle routing problem while considering the constraints on battery life and battery swapping stations. We first introduce a comprehensive model consisting of speed, load and distance to measure the energy consumption and carbon emissions of electric vehicles. Second, we propose a mixed integer programming model to minimize the total costs related to electric vehicle energy consumption and travel time. To solve this model efficiently, we develop an adaptive genetic algorithm based on hill climbing optimization and neighborhood search. The crossover and mutation probabilities are designed to adaptively adjust with the change of population fitness. The hill climbing search is used to enhance the local search ability of the algorithm. In order to satisfy the constraints of battery life and battery swapping stations, the neighborhood search strategy is applied to obtain the final optimal feasible solution. Finally, we conduct numerical experiments to test the performance of the algorithm. Computational results illustrate that a routing arrangement that accounts for power consumption and travel time can reduce carbon emissions and total logistics delivery costs. Moreover, we demonstrate the effect of adaptive crossover and mutation probabilities on the optimal solution.