ASCA observations of deep ROSAT fields -- II. The 2-10-keV AGN luminosity function