Online food delivery (OFD) is one of the top industries in the Online-to-offline (O2O) commerce sector. Deliverymen need to complete a large number of delivery orders in limited default time every day, which cause high working stress to them. Therefore, a high level of traffic violations and crashes by deliverymen and corresponding negative impact on public safety are observed. To reduce traffic violations by deliverymen and resulting crashes, a hierarchical online food delivery framework is proposed, which is based on data from questionnaire surveys conducted in Xi'an City, China. The study includes the analysis of the root cause correlated with traffic violations during online food delivery as part of an empirical study on the priority delivery fee by applying a conditional price sensitivity measurement (PSM) model. The feasibility and rationality of the framework are further investigated by using cross analysis of urban dwellers' occupation, income, and commuting cost. The results identify that, through rationally shunting the demand of online food delivery, prolonging the default delivery duration, and providing diversified delivery services, the proposed hierarchical online food delivery mechanism is able to relieve the stress of deliverymen during peak hours of food requests. This reduces the willingness of deliverymen to engage in traffic violations, and other risky behaviors during food delivery trips. All of which facilitate high-quality and timely online food delivery service while enabling improved safety of deliverymen and others as part of enhanced public safety and health.