A method for simultaneously measuring polarization and phase of arbitrarily polarized beams based on Pancharatnam-Berry phase