Default [Q] Phone discharges when plugged in and doesnt charge

Phone discharges and does not charge when ON and plugged in.
The charger light glows even if it is jst connected to the phone and not to the power socket. Though the charging seems to work once the phone is switched off but jst charges upto 10% after which the animation turns blue and stops charging further. , also if trying to charge with USB via PC it says unrecognized device and the phone doesn't charge.
any solutions?
have tried different USB wires as have a cpl of more Androids at home but same issue with all wires.
I am using pure stock rom with no rooting or flashes done yet.
There was a solved thread in forum but for other rom.