I will not replace the lenses of the sunglasses with optical lenses because the prescription lenses can't fit for the frame of my sunglasses. The lenses will deform in order to fit for the frame of the sunglasses. And the vision will distort in the end. So I will not suggest you to do that.
You can buy a pair of that kind of glasses. They are made by sunglasses frame and optical lenses? You can place an order on Firmoo. And then they will make that kind of glasses for you. Hope this helped!
If you have the frame of the sunglasses at hand, you can take them to some optical shops. Some opticians may do that for you. But it will take a longer time. Besides, you must take the prescription with you too because they need to make the lenses according to your prescription. But if the opticians told you that the lenses will not totally fit for your frames and the glasses will be a little ugly in the end, you'd better give up that idea and buy a pair of new glasses. Good luck!