I was thinking about this topic recently and found
this paper, which says that the end of Spanish control of American silver led to the reliably standard Spanish silver coinage being replaced by many lower-quality silver coins, which reduced its usefulness for China, which led to the trade imbalances motivating the opium trade. American traders, especially after the Napoleonic Wars started, sold European goods to Spanish America in exchange for silver coins which were then traded for Chinese goods. China then sold silver ingots to western traders such as the BEIC. Spanish silver coins continued to be used in trade with China in the decades after the Spanish colonies became independent, but supplies slowly dried up and inferior non-standard coinage spread. By the 1830s, Chinese traders began to refuse to accept new American silver coins due to their unreliability, which caused a currency crisis and a credit shortage, leading to unrest and conflict. The US apparently had a similar dependence on Spanish silver coins, but they had the state capacity to reform their currency market to avoid crisis.
So if Spain kept their colonies, you might end up delaying the mid-19th century crises Qing China faced (rebellions, Opium Wars, etc). I don't know if they could be delayed indefinitely, but if the Qing used the time to reform their currency system I imagine they would have an easier 19th century than OTL. I also wonder if there could be some impact on the US economy if Spanish silver coins continue to dominate rather than local currency.