With the rapid development of e-commerce, the logistics industry also presents new features such as multi-level, integrated upstream-downstream operations, increasingly perfect service quality and low logistics costs. The exponential growth in online transactions and consumer expectations for faster, more reliable deliveries intensifies the pressure on logistics systems. The last-mile service network refers to the logistics nodes that have direct contact with consumers, and its geographical location and quantity will directly affect the service level, cost and customer service mode of the distribution network. However, with the rapid growth in the number of online shoppers and their imbalance on the Internet, these factors have gradually become an important basis for influencing the layout of terminal outlets. This imbalance, coupled with dynamic urban traffic conditions, renders traditional distribution planning methods inadequate. Therefore, in the e-commerce environment, how to fully explore the new features and effectively optimize the allocation of logistics according to its characteristics is a problem worth studying and urgently needs to be solved. Therefore, this paper investigates the site selection-path optimisation of multilevel logistics and distribution networks in the context of e-commerce. On this basis, an e-commerce distribution route optimisation method based on ant colony algorithm is proposed. The method incorporates enhancements to address the complexities of real-world e-commerce logistics, including dynamic constraints. The experiment proves that the method introduced in this paper can effectively reduce the distribution time, reduce the transport distance, increase the vehicle utilisation rate, improve the customer satisfaction and other issues, and has a good application prospect in enhancing the efficiency and sustainability of modern e-commerce logistics operations.