Switchable bipartite and genuine tripartite entanglement via an optoelectromechanical interface