With the electrical working sporadically I would suspect a bad wire connection or corroded wire. Check all grounds. From battery to engine, bat to fender, bat to starter, engine to firewall, computer ground to body.
Google " voltage drop test" and check your connections.
A good battery will...