Dogs have a simple mind. It will think everything through. I suggest you stop hitting him and don't be angry with her. Dogs get scared.
When you feel that it is no longer afraid of you avoiding you, play with her patiently, and let him feel that you really won't hit him again, and it will slowly contact you. Then I know that his fear of you has gradually disappeared. You can gently comfort her when she wets the bed and slowly tell the dog that he is wrong (note: it must be soft! Otherwise, the dog will think you are going to do something to it again! Then your previous efforts will be in vain! ), the dog will try to make you happy and not wet the bed. Dogs don't want to love their owners and feel sad, and will try their best to correct what makes them unhappy. When he makes progress, give him some rewards, but not too much. Some dogs are greedy and must be given food.
Finally, the dog entered your circle step by step. You just need to tell her where to pee. If you don't know what to do, the dog will get well soon! He will never wet the bed again!