Decays of $B_{s}^{0}$ and $overline{B}{}_{s}^{0}$ mesons into $J/psipi^+pi^-$ final states are studied in a data sample corresponding to 1.9 fb$^{-1}$ of integrated luminosity collected with the LHCb detector in 13 TeV $pp$ collisions. A time-dependent amplitude analysis is used to determine the final-state resonance contributions, the $CP$-violating phase $phi_s=-0.057pm 0.060pm 0.011$ rad, the decay-width difference between the heavier mass $B_{s}^{0}$ eigenstate and the $B^{0}$ meson of $-0.050pm 0.004pm 0.004$ ps$^{-1}$, and the $CP$-violating parameter $|lambda|=1.01_{-0.06}^{+0.08}pm0.03$, where the first uncertainty is statistical and the second systematic. These results are combined with previous LHCb measurements in the same decay channel using 7 TeV and 8 TeV $pp$ collisions obtaining $phi_s =0.002pm0.044pm0.012$ rad, and $|lambda| =0.949pm0.036pm0.019$.