get_the_permalink($post, $leavename = true) is only returning https://localhost/apple/ without the page name.
So in your example “apple” is the parent page of the page you want a link to, “macintosh?
Did you pass a value for $post (ID or WP_Post object)? If so, you likely passed the wrong value. If nothing was passed, the global $post variable is apparently referring to the parent page instead of the child page you wish to have a link for. Without more context it’s difficult to speculate why this would be so.
get_the_permalink()
return is filterable, so one possibility is some other code is erroneously altering the return value for some reason. You could also filter “page_link” and force get_the_permalink() to return any link you want, but it’d be better to determine why it’s not returning the proper child page link and correct the problem.