s4 turns off when on battery
First, you might want to see about the battery. See if you can go to your service provider and see if they can swap out your battery for a newer one 
If step #1 doesn't work, you might want to power it on the way you been using it and go to your battery usage and see what's currently using you battery, then stop or force stop those apps. After that, backup all of your things you want and save them to a microSD Card, anything you prefer is just alright. Then do factory reset then set it back up
If steps #1 &amp; #2 didn't work, go to a cell phone shop that you can trust or your cellular provider and see if they can fix it for you. Otherwise, visit amazon.com and look up Galaxy's S4 charger port kits and make sure you pick the right one for your phone and fix it yourself.