The war in Ukraine would end if all NATO countries stopped buying oil from Russia, Donald Trump has said.