With the rapid development of Internet of Vehicles, computing-intensive and delay-sensitive applications are widely used. Faced with the shortcomings of less computing resources and limited power supply of vehicle mobile terminals, mobile edge technology came into being. Firstly, a multi-terminal single-edge vehicle network model is established to alleviate the terminal pressure by accessing Multi-Access Edge Computing ( MEC ) servers. Aiming at the heterogeneous computing network, this paper constructs a joint optimization problem of task offloading and resource allocation under the constraints of delay and energy consumption. Aiming at the problem that the resources in the offloading decision process exceed the load, the modified chromosome and the improved elite selection strategy are used to optimize the genetic algorithm. The dynamic parameter adjustment strategy is used to optimize the particle swarm optimization algorithm to prevent premature convergence. A two-stage joint optimization algorithm is proposed to solve the problem. It can be seen from the results that the optimized algorithm can find the appropriate optimal solution and effectively reduce the cost compared with GAVECOS and Partial algorithm.