We built a portable microchip electrophoresis heavy metal ion detection system and proposed a pH-mediated field amplified sample stacking (pH-mediated FASS) online preconcentration method. The pH-mediated FASS focuses and stacks heavy metal cations by controlling electrophoretic mobilities with a pH change between the analyte and the background electrolyte (BGE) in solution to improve the detection sensitivity of the system. We optimized and adjusted sample matrix solution (SMS) ratios and pH to create concentration and pH gradients for SMS and BGE. Furthermore, we optimize the microchannel width to improve the preconcentration effect further. The system and method analyzed soil leachates polluted with heavy metals and separated Pb2+ and Cd2+ within 90s, obtaining their levels at 58.01mg/L and 4.91mg/L with sensitivity enhancement factors (SEF) of 26.40 and 43.73. Compared with inductively coupled plasma atomic emission spectrometry (ICP-AES), the detection error of the system was less than 8.80%.