  Metasurfaces have appeared as a versatile platform for miniaturized
functional nonlinear optics due to their design freedom in tailoring
wavefronts. The key factor that limits its application in functional devices is
the low conversion efficiency. Recently, dielectric metasurfaces governed by
either high-quality factor modes (quasi-bound states in the continuum) or Mie
modes, enabling strong light-matter interaction, have become a prolific route
to achieve high nonlinear efficiency. Here, we demonstrate both numerically and
experimentally an effective way of spatial nonlinear phase control by using the
Pancharatnam-Berry phase principle with a high third harmonic conversion
efficiency of $10^{-4}$ $1/W^2$. We find that the magnetic Mie resonance
appears to be the main contributor to the third harmonic response, while the
contribution from the quasi-bound states in the continuum is negligible. This
is confirmed by a phenomenological model based on coupled anharmonic
oscillators. Besides, our metasurface provides experimentally a high
diffraction efficiency (80-90%) in both polarization channels. We show a
functional application of our approach by experimentally reconstructing an
encoded polarization-multiplexed vortex beam array with different topological
charges at the third harmonic frequency with high fidelity. Our approach has
the potential viability for future on-chip nonlinear signal processing and
wavefront control.
