Why does the verse say that he fought many days?
Rashi, citing Tanchuma: It is a criticism. He intended to delay the conquest, in order to extend his life 1 , for it says "you will make them inherit" (1:10).
Malbim: This teaches that verse 12 does not mean that he conquered all the cities at once, like regarding the five kings.
Malbim (19): Hashem arranged this. This is why no city (except for the Giv'onim) made Shalom with Yisrael (verse 19). Had Yehoshua fought the cities immediately after defeating the Klal (the kings of the north who joined together), they would have requested Shalom, and we would have been forced to accept them (if they accept their seven Mitzvos, taxes and servitude). Since Yehoshua fought many days, their hearts hardened (verse 20), and they did not make Shalom.
Here it says that he fought many days. Above (10:42), it says "Pa'am Achas", i.e. the war did not stretch out. He conquered all of them at once!
Radak: The kings mentioned there, he conquered at once. After that, he returned to Gilgal, and fought many days with the other kings until he took everything.