It is not OK for you to go tanning right now with a black eye. It will be bad for the eyes. If you have to go, you could wear the pair of sunglasses to help your eyes prevent from the uv and other bad lights. However, the black eyes need the time to cure automatically. If it is in the strong sun light, the black eyes may get serious.
Although our skin tend to be more charming and healthy by tanning, however, it seems that your eyes are not in good conditions. And generally speaking, a black eye could be worsened if not properly taken care of, just because the sunshine or tanning lights are harmful to your eyes. So I suggest that you take adequate time to recover. After that, get a pair of sunglasses to protect your eyes.
Well, generally speaking, you are not supposed to go tanning with a black eye. As we know that when blood and other fluids collect in the space around the eye, a black eye can occur. And if you go tanning, it can make your symptom worse. So you should leave the tanning for a couple of days until swelling goes down. To speed up the recovery, you can put ice packs on the swelling. And then, butter on the bruising will be good too. By the way, warm compress will also be effective for your black eyes, for they can make your blood flow smoothly. So you can just put a warm cloth on your eyes. anyway, just wait for a few days until the symptom disappear.