If all the electrical dies when this happens its likely an issue with the positive or negative cables and or their associated connection. Look at both battery connections ( also actual battery posts. One may be loose), negative to engine and chassis etc...