1, it may be that the charger and socket are relatively loose, and then reinsert it to try, it may also be that the data cable is connected to the charger a little loose, reconnect it.
2, it may be that the data cable is broken, although it is the original genuine, but there may be quality problems.
3, if neither of the above is the case, then restart the phone.
4, if you still can't charge after the restart, it is estimated that the quality of the phone is a problem.