The space-air-ground integrated network (SAGIN) is formed by the fusion of ground and aircraft networks. It overcomes the limitations in communications that cannot cover the whole world, bringing new opportunities for network communication in remote areas. However, the existence of many heterogeneous devices in SAGIN poses significant challenges in terms of end-to-end resource management, and the limited regional heterogeneous resources also affect the quality of service (QoS) for users. In this context, this study proposes a hierarchical resource management structure for SAGIN, named SAGIN-MEC, based on a software-defined network (SDN), network function virtualization (NFV), and mobile edge computing (MEC), aiming to facilitate the systematic management of heterogeneous network resources. Furthermore, to minimize operator deployment costs while ensuring QoS, this study formulates a resource scheduling optimization model tailored for SAGIN scenarios to minimize energy consumption. Additionally, we propose a deployment algorithm named DRL-G, which is based on heuristics and deep reinforcement learning (DRL), aiming to allocate heterogeneous network resources within SAGIN effectively. Experimental results show that SAGIN-MEC can reduce the end-to-end delay by 6-15 ms compared to the terrestrial edge network. In addition, compared to other algorithms, DRL-G can improve the service request reception rate by up to 28%.