The first thing that I noticed with your code, which may or may not be a problem, is that you are missing the data parameter for your jQuery on event. You are also going to want to apply your event to document.body rather than document.
$(document.body/*changed*/).on('click', '.icon-layer-up', {}/*added*/, function() {
Next, you are always setting currentIndex to auto and then to 0, rather than checking to see if it equals auto.
if ( currentIndex ==/*fixed*/ "auto" ) {
Furthermore, you are originally setting currentIndex as a string, which will only convert the string to a number, when trying to increment it, the way you are. You must first attempt to convert it to a Number, check to make sure it was a Number, and then increment it.
So altogether the fixed code should be:
$(document.body).on('click', '.icon-layer-up', {}, function() {
console.log($(this).parent(".ui-wrapper").css("z-index"));
var currentIndex = Number($(this).parent(".ui-wrapper").css("z-index"));
if ( isNaN(currentIndex) ) { // if is not a number, set it to 0
currentIndex = 0;
}
var num = currentIndex++;
$(this).parent(".ui-wrapper").css("z-index", num );
});
Next, make sure you read about z-index, and understand how it works. z-index will not be applied to elements of a default position of static. Try setting your elements to position: relative;, to which you are trying to apply z-index.
References for z-index:
Understanding CSS z-index
Adding z-index