Potential energy and spontaneous-fission half-lives for heavy and superheavy nuclei