The low earth orbit (LEO) satellite deployed with the multi-access edge computing (MEC) server is a prospective approach to providing intelligent service in the future intelligent network. However, since the relative location of the LEO satellite to the sun changes in real-time, the available satellite energy endures periodic fluctuation, which limits its capability of providing service. In this paper, we propose the joint task offloading and resource allocation strategy within the satellite cooperative offloading structure to optimize satellite energy consumption. The cooperative structure utilizes the stable intra-orbit inter-satellite links for inter-satellite cooperation and the satellite-terrestrial links for cloud-edge cooperation. Considering the fluctuation of energy harvested by satellite, the energy used for computing is limited to ensure sufficient energy for the satellite to fly out of the shaded area. Then we formulate the task offloading and resource allocation as a mixed-integer nonlinear programming problem with the target of minimizing the satellite energy consumption for computing while satisfying the delay requirement of the task. The problem is solved by the improved non-dominated sorting genetic algorithm II, where the constraint comparator is proposed to make feasible solutions satisfy trade-off constraints. The simulation results show that the proposed algorithm effectively reduces the energy consumption on satellites compared with random offloading algorithm and poll offloading algorithm.