Phonon surface loss function of ionic-crystal films: A comparison between microscopic and macroscopic approaches