Single-variable realisation of the SU(1,1) spectrum generating algebra and discrete eigenvalue spectra of a class of potentials