How to change the order of Jquery in the footer of my theme?

Understand wp_enqueue’s dependencies parameter

You need to ensure the other script depends on jQuery being ready before it loads. Checking the wp_enqueue usage example:

<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>

It is $deps (dependencies) that we can utilise for this purpose.

Properly enqueue the second script, and leverage that parameter

Secondly you should use the enqueue function to conditionally load the second script:

if ( is_page_template( array('template-name.php'))){
 wp_register_script('xxx', '/path/to/script/xxx.js', array('jquery'),'1.0',true);
 wp_enqueue_script('xxx');
}

Notice the array('jquery') which stops this script loading before jQuery is ready.