The primary objective of this study is to accurately determine the abundances of Cu, Sr, Y, Zr, Ba, La, and Ce in selected solar-type stars. This will allow us to establish observational abundance--metallicity and abundance--age relations and to explore the reasons for the excess of Ba compared to other $s$-elements in younger solar-type stars. The chosen $s$-process elements are critical diagnostics for understanding the chemical evolution of our Galaxy. We analysed HARPS spectra with a high resolution ($R$ = 115\,000) and high signal-to-noise ratio (close to 100) of main-sequence solar-type FGK stars with metallicities from $-0.15$ to +0.35 dex and ages from 2 to 14 Gyr using one-dimensional (1D) local thermodynamic equilibrium (LTE) synthesis and MARCS atmospheric models. In the procedure of fitting synthetic to observed line profiles, the free parameters included abundance and microturbulent and macroturbulent velocity. The macroturbulent velocity can substantially compensate for non-local thermodynamic equilibrium (NLTE) effects in the line core. The resulting elemental abundance X/H increases with metallicity and age for solar-type stars. The ratio of the abundances of $s$-process elements s/Fe increases with decreasing metallicity and age, while the Cu/Fe ratio increases with both metallicity and age. These observed trends agree well with published observational data and with predictions from Galactic chemical evolution (GCE) models. A small Ba/Fe enhancement of 0.08 ± 0.08 dex has been detected in seven younger stars with an average age of $2.8 0.6$ Gyr. Compared to the abundances of other $s$-process elements Ba/Fe is 0.07 and 0.08 dex higher than La and Ce on average, respectively. Furthermore, we find that the Ba/Fe ratio increases with increasing chromospheric activity. The average Ba/Fe for the three most active stars is $0.15 0.10$ dex higher than that of the other stars. Chromospheric activity, characterised by stronger magnetic fields found in active regions such as pores, spots, plages, and networks, can significantly alter the physical conditions in the formation layers of the Ba lines. Our primary conclusion is that to account for the observed excess of Ba/Fe abundance in younger stars, it is essential to use more complex atmospheric models that incorporate magnetic structures.