  We study $S$-wave resonance contributions to the $B^0_{(s)}\to
J/\psi\pi^+\pi^-$ and $B_s\to\pi^+\pi^-\ell^+\ell^-$ decays in the perturbative
QCD (PQCD) framework by introducing two-hadron distribution amplitudes for
final states. The Breit-Wigner formula for the $f_0(500)$, $f_0(1500)$ and
$f_0(1790)$ resonances and the Flatt\'e model for the $f_0(980)$ resonance are
adopted to parameterize the time-like scalar form factors in the two-pion
distribution amplitudes, which include both resonant and nonresonant
contributions. The resultant branching fraction and differential branching
fraction in the pion-pair invariant mass for each resonance channel are
consistent with experimental data. The determined $S$-wave two-pion
distribution amplitudes, containing the information of both resonant and
nonresonant rescattering phases, can be employed to predict direct CP
asymmetries of other three-body hadronic $B$ meson decays in various localized
regions of two-pion phase space.
