We get very limited info on the wiring for RV after 2010, so this would be a bit of guessing but my thoughts would be that the wiring to the batteries is not good.
Think of them as being a place to store the energy which the power cord and generator supply to some form of converter. The converter turns the AC from those two into 12VDC used by the lights, etc. as well as storing the excess in the batteries.
So if something simple like the ground /negative battery cable is loose or corroded, I might see a situation where the 12VDC is made and available but not being stored or accessed from the battteries.
No wiring info online to check this, so a simple guess but maybe a place to start?
With a meter,first check the battery voltages to see if there is power there. Check the negative cables have good solid ground on them, then start the engine or generator and see if the voltage jumps up to indicate good contact there.
If nothing found at that point, there will be a solenoid and battery disconnect in a forward spot, I believe possibly under the passenger seat, where you can do more checking that the battery power is getting to the solenoid as well as the battery disconnect. There should be a round metal "can" looking solenoid with chassis battery cable on one side and coach battery on the other side. Both should have 12 VDC at all times and then be connected together when the engine alternator is providing power, so both voltages should jump up as the engine is revved a bit.
I believe your situation may be due to working when engine is working but that solenoid may be fooling us and you are seeing the engine alternator, rather than the coach battery voltage.
Best idea I have with limited info we have online.
When trying to sort which cable goes where, this chart may be helpfull as it should match tape at the cable ends for ID.
Extra point to check, we can assume the batteries have been getting water to avoid killing them?