With the booming development of door-to-door housekeeping service, the platform faces the problem of order assignment. Improving the matching mechanism between orders and housekeepers based on a dynamic programming (DP) algorithm can not only achieve flexible order allocation but can also improve the service efficiency and service quality. In this paper, a single objective nonlinear programming model is established, which takes the maximum total weight value as the objective function to study the order allocation problem under offline and online conditions. Under the offline condition, the number of housekeepers is taken as the decision variable. The status of order and housekeeper, order time, and action trajectory are taken as constraints. For online assignment, the order backlog status is treated as the decision variable. The reliability of the model was verified using real data from 20 groups of housekeepers and 50 groups of orders. Finally, the effect of order backlog on online allocation is discussed and the optimal threshold and maximum weight are found. The online order assignment model is compared with the nearest distance assignment model. The results show that the online assignment model with a total weighted score of 1045.14 is better than the nearest distance assignment model with a score of 810.25.