The Shanghai General Station of Immigration Inspection has provided a Interpretation of the 144-Hour Visa-Exemption Transit Policy (in reasonably good English).
When you first arrive at Tianjin, you must satisfy all the following conditions to be eligible for the 144-hour visa exemption (emphasis mine):
An eligible passenger can transfer via any of the following ports of entry including Beijing Capital International Airport, Tianjing Binhai International Airport, Tianjin International Cruise Home Port, Shijiazhuang Zhengding International Airport and Qinhuangdao Sea Port, and stay within the administrative precincts of Beijing Municipality, Tianjin Municipality and Hebei Province for 144 hours.
An applicant for 144-hour visa-exemption transit needs to possess a valid passport or other valid international travel documents and an onward air / vessel / train ticket to a third country (region) with confirmed date and seat within 144 hours upon arrival, fill out an arrival card for temporary entry foreigners, and be interviewed by the immigration inspection authority.
Since your next destination is Shanghai, which is still within the PRC, you do not meet the second condition, and hence require a visitor visa.
This case is apparently featured in this Independent article, with the catchy title:
CHINA VISA RULES: BEIJING AND SHANGHAI ISSUE FREE TRANSIT VISAS BUT CRUISE LINE TELLS BRITS THEY STILL HAVE TO PAY
As an aside, suppose your cruise trip goes to only one of Tianjin or Shanghai (but not both), then you are eligible for the 144-hour visa exemption as your next destination is Hong Kong, which is treated as a third region for the purpose of immigration.