Receiving text alerts on Macbook but not iPhone
This is normal.  Messages notices you were sent the alert on your Mac so it doesn't alert again for the same message on your iPhone.

You mentioned that when you do get Messages alerts on your iPhone when your computer is locked or has the lid closed.  Messages is designed to not 'over alert' you when it believes you've already seen the alert.